akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {

	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
			
		String s = sc.nextLine();
		String a = s.split(" ")[0];
		String b = s.split(" ")[1];
		
		int a_ = sc.nextInt();
		int b_ = sc.nextInt();
		
		String key = sc.next();
		
		if(a.equals(key)) {
			System.out.println(a_ - 1 + " " + b_);
		} else {
			System.out.println(a_ + " " + String.valueOf(--b_));
		}
		
		
//		int n = sc.nextInt();
//		
//		
//		Set<Integer> s = new HashSet<Integer>();
//		for(int i=0;i<n;i++) {
//			int a = sc.nextInt();
//			if(s.contains(a)) {
//				System.out.println("No");
//			}
//			s.add(a);
//		}
//		
//		System.out.println("Yes");
		
		
	}
	


}

 

Measured memory_bytes: 21716
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;

    vl p(n);
    rep(i, n) {
        cin >> p[i];
        p[i]--;
    }

    vl id(n);
    rep(i, n) {
        id[p[i]] = i;
    }

    set<ll> st;
    ll ans = 0;
    rep(x, n) {
        ll i = id[x];
        st.insert(i);
        ll L;
        auto it1 = st.find(i);
        if(it1 == st.begin()) {
            L = -1;
        }
        else {
            it1--;
            L = *it1;
        }
        ll R;
        auto it2 = st.find(i);
        it2++;
        if(it2 == st.end()) {
            R = n;
        }
        else {
            R = *it2;
        }
        ans += (x + 1)*(i - L)*(R - i);
    }

    out(ans);
    re0;
}

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

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;


void solve() {
	int n;
	cin >> n;
	string ans;
	while (n) {
		ans += (char)((((n % 26) + 25) % 26) + 'a');
		n = (n - 1) / 26;
	}

	for (int i = ans.length() - 1; i >= 0; i--) cout << ans[i];

}

int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
//	cin >> t_c;
	while (t_c--)
		solve();
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

const int MAX_M = 10^5 + 10;
ll dp[ MAX_M ] = {};

int main(){
	int n,m;
	cin >> n >> m;
	priority_queue<int> q;
	vector<pair<int,int>> v;
	rep(i,0,n){
		int a,b;
		cin >> a >> b;
		a = m - a;
		v.push_back( make_pair(a,b) );
	}

	vsort(v);
	reverse( v.begin() , v.end() );

	/*
	cout << endl;
	rep(i,0,n)
		cout << v[i].first << " " << v[i].second << endl;
	*/

	int idx = 0;
	ll ans = 0;
	for( int i = m ; i >= 0 ; i-- ){
		//printf("idx:%d fir:%d sec:%d i:%d q_size:%lu\n" , idx ,   v[idx].first , v[idx].second  , i , q.size() );
		while( idx < v.size() && v[idx].first == i ) {
			q.push( v[idx].second );
			idx++;
		}
		if( q.size() > 0 ){
			ans += q.top();
			//cout << q.top() << endl;
			q.pop();
		}
	}

	cout << ans << endl;


	ret 0;
}

Measured memory_bytes: 1908
n = int(input())
l = len(str(n))
 
i = 0
c = 0
while i < l:
  if i == 0:
    if n < 10:
      c = n
      break
    else:
      c = 9
      i = i + 1
  elif i%2 == 1:
    i = i + 1
    continue
  elif i == (l-1):
    c = c + (n-((10**i)-1))
    i = i + 1
  else:
    c = c + ((10**(i+1))-(10**i))
    i = i + 1
 
print(c)

Measured memory_bytes: 3060
from fractions import gcd
import math
def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft



def main():
    n=int(input())
    s=input()
    t=input()
    for i in range(n):
        for j in range(n-i):
            if s[i+j] != t[j]:
                break
        else:
            print(n+i)
            return
    print(2*n)
main()


Measured memory_bytes: 5076
#include<stdio.h>
int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a-2*b<=0){
    printf("0\n");
  }
  if(a-2*b>0){
    printf("%d\n",a-2*b);
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
#define fs first
#define se second

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<ld, ld> pdd;

const llong inf = 1e18;
llong get(llong S, int h, int w) {
    if (h == 1) return inf;
    llong A = (llong)(h >> 1) * w;
    llong B = (llong)(h + 1 >> 1) * w;
    return max({ A, B, S }) - min({ A, B, S });
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int h, w;
    cin >> h >> w;
    llong ans = inf;
    for (int i = 1; i < h; ++i) {
        llong S = (llong)(h - i) * w;
        ans = min(ans, get(S, i, w));
        ans = min(ans, get(S, w, i));
    }
    for (int i = 1; i < w; ++i) {
        llong S = (llong)h * (w - i);
        ans = min(ans, get(S, h, i));
        ans = min(ans, get(S, i, h));
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)

	n, _ := strconv.Atoi(s)
	y := n/100
	m := n%100
	if y >= 1 && y <= 12 && m >= 1 && m <= 12 {
		fmt.Println("AMBIGUOUS")
	} else if y >= 1 && y <= 12 && (m == 0 || m >= 13) {
		fmt.Println("MMYY")
	} else if m >= 1 && m <= 12 && (y == 0 || y >= 13) {
		fmt.Println("YYMM")
	} else {
		fmt.Println("NA")
	}
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10**9)
INF = float('inf')

def main():
    n, m, p = map(int,input().split())
    es = []
    for _ in range(m):
        e = list(map(int,input().split()))
        es.append([e[0]-1,e[1]-1,- e[2] + p])

    v_cost = [INF]*n
    v_cost[0] = 0
    for v in range(n*2):
        for e in es:
            frm = e[0]
            to = e[1]
            if v_cost[to] > v_cost[frm]+e[2]:
                v_cost[to] = v_cost[frm]+e[2]
                if v >= n:
                    v_cost[to] = -INF
            if v == n-1:
                prev = v_cost[-1]
                
    if prev != v_cost[-1]:
        return -1

    return max(0,-v_cost[-1])
   

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


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

int main(){
  int n;
  cin >> n;
  int a[100][2];
  for(int i = 0; i < n; i++){
    cin >> a[i][0] >> a[i][1];
  }
  
  for(int i = 0; i < n - 2; i++){
    if(a[i][0] == a[i][1] && a[i + 1][0] == a[i + 1][1] && a[i + 2][0] == a[i + 2][1]){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

#define rep(i, n) FOR(i, 0, n)
#define FOR(i, x, n) for (int i = (x); i < (n); ++i)
#define all(v) (v).begin(), (v).end()

using ll = long long;

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

ll a[100001];

int main() {
    int n, t, q, b, c;
    ll ans = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> t;
        a[t]++;
        ans += t;
    }
    cin >> q;
    while (q--) {
        cin >> b >> c;
        ans -= b * a[b];
        ans += c * a[b];
        a[c] += a[b];
        a[b] = 0;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 4380
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

const ll INF = (ll)1e18;
const int N = 300100;
ll a[N];
ll b[N];
ll c[N][3];
int n;
ll dp[2][N];
ll L;

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%lld", &n, &L);
	for (int i = 1; i <= n; i++)
		scanf("%lld", &a[i]);
	for (int i = 1; i <= n; i++)
		scanf("%lld", &b[i]);
	a[n + 1] = L;
	for (int i = 1; i <= n; i++) {
		c[i][0] = c[i][1] = c[i][2] = INF;
		
		ll x = a[i] + b[i];
		if (x % (2 * L) > a[i]) x += 2 * L;
		x += a[i] - (x % (2 * L));
		x -= a[i];
		c[i][1] = min(c[i][1], x);

		x = a[i] + b[i];
		if (x % (2 * L) > 2 * L - a[i]) x += 2 * L;
		x += 2 * L - a[i] - (x % (2 * L));
		x -= a[i];
		c[i][0] = min(c[i][0], x);

		x = 2 * L - a[i] + b[i];
		if (x % (2 * L) > a[i]) x += 2 * L;
		x += a[i] - (x % (2 * L));
		x -= 2 * L - a[i];
		c[i][2] = min(c[i][2], x);

		x = 2 * L - a[i] + b[i];
		if (x % (2 * L) > 2 * L - a[i]) x += 2 * L;
		x += 2 * L - a[i] - (x % (2 * L));
		x -= 2 * L - a[i];
		c[i][1] = min(c[i][1], x);
	}

	int m = min(n, (int)2e8 / n);

	for (int i = 0; i <= m; i++)
		dp[0][i] = INF;
	dp[0][1] = 0;

	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= m; j++)
			dp[0][j] = min(INF, dp[0][j] + 2 * j * (a[i] - a[i - 1]));
		for (int j = 0; j <= m; j++)
			dp[1][j] = INF;
		for (int j = 1; j <= m; j++) {
			for (int x = 0; x < 3; x++)
				dp[1][j + x - 1] = min(dp[1][j + x - 1], dp[0][j] + c[i][x]);
		}
		for (int j = 0; j <= m; j++)
			dp[0][j] = dp[1][j];
	}

	ll ans = INF;
	for (int i = 0; i <= m; i++)
		ans = min(ans, dp[0][i] + 2 * i * (a[n + 1] - a[n]));
	printf("%lld\n", ans);

	return 0;
}


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

int main(){
	int a[5];
	int minn=10;
	for(int i=0; i<5; ++i){
		scanf("%d", &a[i]);
		if(minn>a[i]%10 && a[i]%10!=0){
			minn = a[i]%10;
		}
	}

	int ans=0;
	for(int i=0; i<5; ++i)
		ans += ((a[i]/10)+(a[i]%10>0))*10;

	ans+=minn-10;
	printf("%d\n", ans);

    return 0;
}



Measured memory_bytes: 256
N, A = [int(_) for _ in input().split()]
x = sorted([int(_) for _ in input().split()])

dp = [[0] * (sum(x)+1) for j in range(N+1)]

dp[0][0] = 1
for i in range(1, N+1):
    for j in list(range(1, N+1))[::-1]:
        for k in list(range(x[i-1], sum(x[:i])+1))[::-1]:
            dp[j][k] += dp[j-1][k - x[i-1]]

print(sum([dp[i][i*A] for i in range(1, N+1) if i*A <= sum(x)]))


Measured memory_bytes: 4208
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	ll out=0;
	sort(all(in));
	rep(i,n-3)if(in[i]==in[i+1]&&in[i]==in[i+2]&&in[i]==in[i+3])out=max(out,in[i]*in[i]);
	for(int i=n-1;i>0;i--)if(in[i]==in[i-1]){
		for(int j=i-2;j>0;j--)if(in[j]==in[j-1]){
			out=max(out,in[i]*in[j]);
			break;
		}
	}
	cout<<out<<endl;
}









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

using namespace std;

#define pb push_back
#define mp make_pair
constexpr int INF = 1 << 29;
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;

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


int main() {
	int n;
	cin >> n;

	string s;
	cin >> s;

	int now = 0;

	int countl = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == ')') {
			if (now == 0) {
				countl++;
			} else {
				now--;
			}
		} else if (s[i] == '(') {
			now++;
		}
	}
	now = 0;
	int countr = 0;
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == '(') {
			if (now == 0) {
				countr++;
			} else {
				now--;
			}
		} else if (s[i] == ')') {
			now++;
		}
	}

	cout << string(countl, '(') << s << string(countr, ')') << endl;

	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#整数の入力
X = int(input())

flg = 0

for n in range(1, 1000):
    if 100*n <= X <= 100*n + 5*n:
        flg = 1
    else:
        pass

if flg == 1:
    print(1)
else:
    print(0)






Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
	int Q,H,S,D,N;
	scanf("%d%d%d%d%d",&Q,&H,&S,&D,&N);
	S=min(S,min(H*2,Q*4));
	D=min(S*2,D);
	printf("%lld",1ll*(N/2)*D+1ll*(N%2)*S);
}

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

int main(){
  string s;
  cin >> s;
  int a,b;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'A'){
      a = i;
      break;
    }
  }
  for(int j=0; j < s.size(); j++){
    if(s[s.size()-1-j] == 'Z'){
      b = s.size()-1-j;
      break;
    }
  }
  cout << b-a+1 << endl;
}  

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int m[101][101];
int main(){
  int n,u,k,v;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--; //
    for(int j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      m[u][v]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j) printf(" ");
      printf("%d",m[i][j]);
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 3208
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>

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

using namespace std;
typedef long long ll;

int H,W,K;
char G[10][10];

int main(){
  cin >> H >> W >> K;

  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> G[i][j];
    }
  }

  int ans = 0;
  for(int bith=0; bith<(1<<H); bith++){
    for(int bitw=0; bitw<(1<<W); bitw++){
      vector<int> sh, sw;
      for(int i = 0; i<H; i++){
	if(bith & (1<<i)) sh.push_back(i);
      }
      for(int i = 0; i<W; i++){
	if(bitw & (1<<i)) sw.push_back(i);	
      }
      int cnt = 0;
      for(int k = 0; k<H; k++){
	for(int l = 0; l<W; l++){
	  bool notokh = false, notokw = false;
	  rep(m,sh.size()){
	    if(sh[m] == k) notokh = true;
	  }	  
	  rep(m,sw.size()){
	    if(sw[m] == l) notokw = true;
	  }
	  if(notokw || notokh) continue;
	  if(G[k][l] == '#') cnt++;
	}
      }
      if(cnt == K) ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main() {
	
	int m=1,n;
	cin>>n;
	if(n<13){
		for(int i=1;i<=n;i++)m=m*i;
		cout<<m<<endl;
	}
	if(n==13)cout<<"6227020800"<<endl;
	if(n==14)cout<<"87178291200"<<endl;
	if(n==15)cout<<"1307674368000"<<endl;
	if(n==16)cout<<"20922789888000"<<endl;
	if(n==17)cout<<"355687428096000"<<endl;
	if(n==18)cout<<"6402373705728000"<<endl;
	if(n==19)cout<<"121645100408832000"<<endl;
	if(n==20)cout<<"2432902008176640000"<<endl;
	return 0;
}

Measured memory_bytes: 0
// F.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;
typedef long long LL;

int main(int argc, char* argv[]) {
	cout.precision(20);
#ifdef _MSC_VER
	while (true)
#endif
	{
		LL n = -1, ans = -1;
		cin >> n;
		if (n < 0) return 0;
		vector<LL> a(n);
		for (LL i = 0; i < n; ++i) {
			cin >> a[i];
		}
		vector<LL> dp[3];
		for (int i = 0; i < 3; ++i) {
			dp[i] = vector<LL>(n + 8);
		}
		for (LL i = 0; i < n; ++i) {
			dp[0][i + 4]= dp[0][i + 2] + a[i];
			dp[1][i + 4] = max(dp[0][i + 1], dp[1][i + 2]) + a[i];
			dp[2][i + 4] = max({ dp[0][i], dp[1][i + 1], dp[2][i + 2] }) + a[i];
		}
		ans = max({ dp[0][n - 3 + 4], dp[1][n - 2 + 4], dp[2][n - 1 + 4] });
		if ((n % 2) == 0) {
			ans = max({ dp[0][n - 2 + 4], dp[1][n - 1 + 4] });
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 9540
import java.util.*;
class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] dam = new int[N];
        int[] yama = new int[N];
        for(int i=0;i<N;i++){
            dam[i] = sc.nextInt();
        }
        for(int i=0;i<N;i++){
            if(i%2==0){
                yama[0] += dam[i];
            }
            else{
                yama[0] -= dam[i];
            }
        }
        for(int i=1;i<N;i++){
            yama[i] = 2*dam[i-1] - yama[i-1];
        }
        for(int i=0;i<N;i++){
            System.out.print(yama[i] + " ");
        }
    }
}

Measured memory_bytes: 66796
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>

#define rep2(i, b, n) for(int i=b; i < n; ++i)
#define repm(i, b, n) for(int i=b; i > n; --i)
#define rep(i, n) rep2(i, 0, n)
#define sz(v) v.size()
#define mp(x, y) make_pair(x, y)
#define fst first
#define scd second

#define X fst
#define Y scd

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

int main( void )
{
	int n, m;
	pii p[5010];

	while (cin >> n >> m)
	{
		rep (i, n)
		{
			cin >> p[i].X >> p[i].Y;
		}
		
		sort(p, (p + n));
		
		const int rp = (int)1e9, rm = -(int)1e9;
		
		rep (i, m)
		{
			int l, t, r, b;
			cin >> l >> t >> r >> b;

			pii *ll, *hh;
			ll = lower_bound(p, (p + n), mp(l, rm));
			hh = upper_bound(p, (p + n), mp(r, rp));
			
			int ans = 0;
			
			for (pii *itr=ll; itr != hh; ++itr)
			{
				if (t <= (itr->Y) && (itr->Y) <= b)
					++ans;
			}
			
			cout << ans << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1204
#include <stdio.h>

int main() {
    int n, cur, num, count;
    scanf("%d", &n);
    cur = 1;
    count = 0;
    for (; cur <= n; cur++) {
        scanf("%d", &num);
        if (num != cur) count++;
    }
    
    if (count == 2 || count == 0) printf("YES\n");
    else printf("NO\n");
}

Measured memory_bytes: 128
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)


a, b, c, d = [int(_) for _ in input().split()]
print(b - a + 1 - ((b // c - (a-1) // c) + (b // d - (a-1) // d) - (b // lcm(c, d) - (a-1) // lcm(c, d))))


Measured memory_bytes: 38256
//Create Time: 2018-04-14 23:20:20
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <functional>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cctype>
#include <ctime>
#include <utility>
#include <complex>
#include <cassert>
#include <climits>
using namespace std;
#define snuke(i,x) for (__typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i)
#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define per(i,n,a) for (int i=(n)-1;i>=(a);i--)
#define OUT(x) std::cout<<(#x)<<":"<<(x)<<std::endl
#define TST(x) std::cout<<(#x)<<":"<<(x)<<" "
#define SZ(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define unq(x) sort(all(x)),(x).erase(unique(all(x)),(x).end())
#define mem(f,x) memset((f), (x), sizeof(f))
#define clr(f) mem(f,0)
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define DEBUG
template<class T> void rd(T&ret){ret=0;bool ok=0,u=0;for(;;){int c=getchar();if(c>='0'&&c<='9')ret=(ret<<3)+(ret<<1)+c-'0',ok=1;else if(c=='-')u=1;else if(ok){if(u)ret*=-1;return;}}}
long long powmod(long long p,long long n,long long mod){long long ret=1;for(;n;n>>=1){if(n&1)ret=ret*p%mod;p=p*p%mod;}return ret;}
template <class T> bool chmin(T& a, const T &b) {return b < a? a = b, 1: 0;}
template <class T> bool chmax(T& a, const T &b) {return b > a? a = b, 1: 0;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi > vii;
/****head****/
const int N=(int)1e5+9;
int an[N];
int main(){
    int n;scanf("%d",&n);
    rep(i,0,n)scanf("%d",an+i);
    sort(an,an+n);
    int t=an[n-1];
    pi bt={min(an[0],t-an[0]),an[0]};
    rep(i,1,n-1)bt=max(bt,{min(an[i],t-an[i]),an[i]});
    printf("%d %d\n",t,bt.y);
    return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
    long long N,flag=1,Min=0x7fffffff;
    long long Sum=0;
    scanf("%d",&N);
    while(N--){
        long long A,B;
        scanf("%lld%lld",&A,&B);
        Sum+=A;
        if(A>B)
            Min=min(Min,B);
        if(A!=B) flag=0;
    }
    if(flag) Min=Sum;
    printf("%lld",Sum-Min);
    return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
# 割り算の商
a = N // 2
# 割り算のあまり
b = N % 2
# 余りが計算
if b == 0 :
  #出力
  print(a)
else:
  print(a + 1)

Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
class BIT(object):
    def __init__(self,A,dot,e,inv=None):
        n=len(A)
        self.__n=n
        self.__dot=dot
        self.__e=e
        self.__inv=inv
        self.__node=['$']+A # 1-indexed
        for i in range(1,n+1):
            j=i+(i&-i)
            if(j<=n): self.__node[j]=dot(self.__node[i],self.__node[j])

    def add(self,i,w=1):
        i+=1
        while(i<=self.__n):
            self.__node[i]=self.__dot(self.__node[i],w)
            i+=i&-i

    def sum(self,i):
        i+=1
        res=self.__e
        while(i>0):
            res=self.__dot(res,self.__node[i])
            i-=i&-i
        return res

from operator import add
def resolve():
    n=int(input())
    A=list(map(lambda x:int(x)-1,input().split()))
    A.reverse()

    bit=BIT([0]*n,add,0)
    fact=1
    ans=0
    for i in range(n):
        a=A[i]
        s=bit.sum(a)
        ans+=fact*s
        bit.add(a)
        fact*=i+1
    p=ans

    A=list(map(lambda x:int(x)-1,input().split()))
    A.reverse()


    bit=BIT([0]*n,add,0)
    fact=1

    ans=0
    for i in range(n):
        a=A[i]
        s=bit.sum(a)
        ans+=fact*s
        bit.add(a)
        fact*=i+1
    q=ans

    print(abs(p-q))
resolve()

Measured memory_bytes: 38332
fn main() {
    let num: usize = {
        let mut buffer = String::new();
        std::io::stdin().read_line(&mut buffer).unwrap();

        buffer.trim().parse().unwrap()
    };

    let mut len: Vec<u64> = {
        let mut buffer = String::new();
        std::io::stdin().read_line(&mut buffer).unwrap();

        buffer.split_whitespace().map(|i| i.parse().unwrap()).collect()
    };

    len.sort();
    len.reverse();

    let mut sum = 0;
    for i in 0..num {
        sum += len[i * 2 + 1];
    }
    println!("{}", sum);
}


Measured memory_bytes: 380
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

int cnt_2(int a) {
  int cnt = 0;
  while(a%2 == 0) {
    a /= 2;
    cnt++;
  }
  return cnt;
}

int main () {
  int N; cin >> N;
  vi a(N); rep(i,N) cin >> a[i];

  int ans = 0;
  rep(i,N) {
    ans += cnt_2(a[i]);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

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

	int x, k, d;
	cin >> x >> k >> d;
	x = abs(x);
	if (x / d >= k) {
		cout << x - k * d << endl;
		return 0;
	}
	int cnt_plus = (x / d);
	int cnt_minus = cnt_plus + 1;
	if (cnt_plus % 2 == k % 2) {
		cout << abs(x - cnt_plus * d) << endl;
	} else {
		cout << abs(x - cnt_minus * d) << endl;
	}
}

Measured memory_bytes: 3192
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REP(i,a,b) for(ll i=(a);i<(b);++i)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define endl '\n'
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ld EPS=10e-8;
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();
    ll H,W,A,B,C=0;
    cin >> H >> W >> A >> B;
    rep(i,H-A){
        C+=COM(i+B-1,B-1)*COM(W-B+H-i-2,W-B-1);
        C%=MOD;
    }
    cout  << C << endl;
}

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

int64_t count(int64_t N) {
  if (N == 1) return 1;
  
  return 2 * count(N / 2) + 1;
}

int main() {
  int64_t H;
  cin >> H;
  
  cout << count(H) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a, b, c;
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);

    if(a < b && b < c){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2044
import java.util.*;
import java.lang.Math;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	long lim = 1000000007;
      	long nums[] = new long[4];
      	long a = 1;
      	long b = 1;
      	long c = 1;
      	long c2;
      	long ans;
  
      	for(int i = 0;i < n;i++) {
          a *= 10;
          b *= 8;
          c *= 9;
          a %= lim;
          b %= lim;
          c %= lim;
        }
      	c2 = (2*c)%lim;
      	ans = a + b - c2;
      	if(ans < 0) ans += lim;
      	else ans %= lim;
           
      	System.out.println(ans);
        
	}
}


Measured memory_bytes: 35748
///Bismillahir Rahmanir Rahim
///ALLAH HU AKBAR
#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector<pair<int,int> >a;
    int n;
    cin>>n;
    vector<double> dis;
    for(int i=0; i<n; i++)
    {
        int x,y;
        cin>>x>>y;
        a.push_back(make_pair(x,y));
    }
    double sum=0.0;
    int arr[n];
    for(int i=0;i<n;i++)
        arr[i]=i;
    do
    {
     for(int i=1; i<n; i++)
        {
            double x=(a[arr[i]].first-a[arr[i-1]].first)*(a[arr[i]].first-a[arr[i-1]].first);
            double y= (a[arr[i]].second-a[arr[i-1]].second)*(a[arr[i]].second-a[arr[i-1]].second);
            double val=sqrt(x+y);
           // cout<<x<<" "<<y<<endl;
            sum=sum+val;
            //cout<<sum<<endl;
        }
    }
    while(next_permutation(arr,arr+n));

    double fac=1.0;
    for(int i=n; i>=1; i--)
        fac=fac*i;
    //cout<<fac<<endl;
     cout<<fixed<<setprecision(10)<<sum/fac<<endl;



}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;


signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string S, T;
	cin >> S;
	T = S.substr(1);
	bool ok{};
	rep(i,T.size()){
		if(T[i] != '9') ok = true;
	}
	if(!ok){
		cout << (S[0] - '0' + 9 * T.size()) << endl;
	}
	else{
		cout << (S[0] - '1' + 9 * T.size()) << endl;
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N = ni()

a_array = na()

a_array.sort(reverse=True)

ans = a_array[0]

idx = 1

depth = 1

start = 1
end = 2

while(N - 1 > idx):
    start = 2 ** (depth-1)
    end = 2 ** depth
    if idx + 2 ** depth < N:
        ans += sum(a_array[start:end]) * 2
        idx = idx + 2 ** depth
    else:
        rest = (N - 1) - idx
        ans += sum(a_array[start:(start+rest//2)]) * 2
        ans += (rest % 2) * a_array[start+rest//2]
        idx = N - 1
    depth += 1
    # print(idx, ans)


print(ans)


Measured memory_bytes: 104136
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<queue>
#include<math.h>
#include<stdlib.h>
using namespace std;
typedef pair<int, int>pii;
vector<int>pat[202020];
int ans[202020];
bool flag[202020];
void no()
{
	printf("No\n");
	exit(0);
}
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num - 1; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		za--, zb--;
		pat[za].push_back(zb);
		pat[zb].push_back(za);
	}
	priority_queue<pii>que;
	int query;
	scanf("%d", &query);
	vector<pii>v;
	for (int i = 0; i < query; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		za--;
		que.push(make_pair(zb, za));
		v.push_back(make_pair(za, zb));
	}
	for (;;)
	{
		if (que.empty())break;
		pii z = que.top();
		que.pop();
		if (flag[z.second])continue;
		flag[z.second] = true;
		ans[z.second] = z.first;
		for (int i = 0; i < pat[z.second].size(); i++)que.push(make_pair(z.first - 1, pat[z.second][i]));
	}
	for (int i = 0; i < query; i++)if (ans[v[i].first] != v[i].second)no();
	for (int i = 0; i < num; i++)for (int j = 0; j < pat[i].size(); j++)if (abs(ans[i] - ans[pat[i][j]]) != 1)no();
	printf("Yes\n");
	for (int i = 0; i < num; i++)printf("%d\n", ans[i]);
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

int n, p[100];
signed main() {
    cin >> n;
    for (int i=0;i<n;i++) cin >> p[i];

    int cnt = 0;
    for (int i=1;i<n-1;i++) {
        int v[3] = {p[i-1],p[i],p[i+1]};
        sort(v, v+3);
        if (v[1] == p[i]) cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
from math import gcd

"""
pairwise coprimeであるための条件は、全てのAに関して素因数に重複がないことである。
したがって、各Aに関して素因数分解を行う⇒各数の素因数の種類数をカウントし総和する。⇒全体の素因数の種類数をカウントし、先ほどの総和と比較する。
"""
N = int(input())
A = list(map(int,input().split()))
primes = []
def primeFinder(n):
    memo = [1]*(n+1)
    memo[0] = 0
    memo[1] = 0
    for i in range(2,n+1):
        if memo[i] == 1:
            primes.append(i)
            for j in range(i*2,n+1,i):
                memo[j] = 0
primeFinder(1000000)

primeMemo = set()
cnt = 0
for i in range(N):
    a = A[i]
    for p in primes:
        if p*p > a:
            break
        if a%p == 0:
            cnt += 1
            primeMemo.add(p)
        while a%p==0:
            a //= p
    if a != 1:
        cnt += 1
        primeMemo.add(a)

if cnt == len(primeMemo):
    print('pairwise coprime')
    exit()
g = A[0]
for i in range(1,N):
    g = gcd(g,A[i])
if g == 1:
    print('setwise coprime')
else:
    print('not coprime')

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

namespace abc060
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int a, b;
            string op;

            a = int.Parse(s[0]);
            b = int.Parse(s[2]);
            op = s[1];

            int result = 0;

            if (op == "+")
                result = a + b;
            else
                result = a - b;
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 2900
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define pb(a) push_back(a)
using namespace std;
typedef long long ll;

int main()
{
    int N, Q;
    string S;
    cin >> N >> Q >> S;

    vector<int> sum(N);
    sum.at(0) = 0;
    FOR(i, 1, S.size())
    {
        if (S.at(i - 1) == 'A' && S.at(i) == 'C')
        {
            sum.at(i) = sum.at(i - 1) + 1;
        }
        else
        {
            sum.at(i) = sum.at(i - 1);
        }
    }

    int l, r;
    REP(i, Q)
    {
        cin >> l >> r;
        cout << sum.at(r - 1) - sum.at(l - 1) << endl;
    }
}

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

int main() {
    int n, m;
    cin >> n >> m;

    vector<vector<int>> g(n);

    rep(i,m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }


    queue<int> que;
    vector<int> pre(n, -1);
    vector<int> dist(n, -1);

    dist[0] = 0;
    que.push(0);
    while (!que.empty()) {
        int v = que.front();
        que.pop();

        for (int nv : g[v]) {
            if (dist[nv] != -1) {
                continue;
            }

            dist[nv] = dist[v] + 1;
            pre[nv] = v;
            que.push(nv);
        }

    }

    cout << "Yes" << endl;
    rep(i,n) {
        if (i == 0) {
            continue;
        }
        cout << pre[i]+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 10548
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
// #include <unordered_map>
// #include <unordered_set>
#include <utility>
#include <vector>

#define pb push_back
#define mp make_pair

#ifdef ONLINE_JUDGE
#define link renamelink
#define next renamenext
#define prev renameprev
#endif

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef long double ld;

inline void EnableFileIO(const string& fileName, bool local = 0) {
  if (fileName.empty()) return;
  if (local) {
    freopen((fileName + ".in").c_str(), "r", stdin);
    freopen((fileName + ".out").c_str(), "w", stdout);
    return;
  }
#ifdef ONLINE_JUDGE
  freopen((fileName + ".in").c_str(), "r", stdin);
  freopen((fileName + ".out").c_str(), "w", stdout);
#endif
}

const int INF = (1 << 30) - 1;
const LL LINF = (1LL << 61) - 1;
const double EPS = 1e-10, PI = acos(-1);

LL n, m, k;

int main() {
  // srand((int)time(0));
  // printf("Hello, world!\n");
  // EnableFileIO("");

  cin >> n >> m >> k;
  LL lft = n * m - k;

  for(int a=0;a<=n;a++) {
    for(int b=0;b<=m;b++) {
      if(n*m-k==a*b+(n-a)*(m-b)) {
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


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

void output_vector(vector<string> &A) {
  int vector_size = A.size();
  
  for (int i = 0; i < vector_size-1; i++) {
    cout << A.at(i) << " ";
  }
  cout << A.at(vector_size-1) << endl;
}

vector<string> BubbleSort(vector<string> C, int N) {
  bool flag = true;
  while (flag) {
    flag = false;
    for (int j = N-1; j >=1; j--) {
      if (C.at(j).at(1) < C.at(j-1).at(1)) {
        string tmpC = C.at(j);
        C.at(j) = C.at(j-1);
        C.at(j-1) = tmpC;
        flag = true;
      }
    }
  }
  return C;
}

vector<string> SelectionSort(vector<string> C, int N) {
  for (int i = 0; i < N; i++) {
    int minj = i;
    for (int j = i; j < N; j++) {
      if (C.at(j).at(1) < C.at(minj).at(1)) {
        minj = j;
      }
    }
    if (minj != i) {
      string tmpC = C.at(i);
      C.at(i) = C.at(minj);
      C.at(minj) = tmpC;
    }
  }
  return C;
}

string isStable(vector<string> C, vector<string> result, int N) {
  for (int i = 0; i < N; i++) {
    for (int j = i+1; j < N; j++) {
      for (int a = 0; a < N; a++) {
        for (int b = a+1; b < N; b++) {
          if (C.at(i).at(1) == C.at(j).at(1) &&
             C.at(i) == result.at(b) &&
             C.at(j) == result.at(a)) {
            return "Not stable";
          }
        }
      }
    }
  }
  return "Stable";
}
  
int main() {
  int N;
  cin >> N;
  vector<string> C(N), result(N);

  for (int i = 0; i < N; i++) cin >> C.at(i);
  
  result = BubbleSort(C, N);
  output_vector(result);
  cout << isStable(C, result, N) << endl;
  
  result = SelectionSort(C, N);
  output_vector(result);
  cout << isStable(C, result, N) << endl;
  
}


Measured memory_bytes: 3216
import java.util.Scanner;

public class Main {

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

		int r1 = sc.nextInt() * sc.nextInt();
		int r2 = sc.nextInt() * sc.nextInt();

		int ans = r1 > r2 ? r1 : r2;

		System.out.println(ans);

		sc.close();
	}

}


Measured memory_bytes: 22996
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

struct card {
    char suit;
    int value;
};

void bubbleSort(card A[], const int N){
    int flag = 1;

    for(int i = 0; flag;i++){
        flag = 0;

        for( int j = N-1;j>i;j--)
            if( A[j].value < A[j-1].value ){
                swap(A[j], A[j-1]);
                flag = 1;
            }
    }
}

void selectionSort(card A[], const int N){
    for(int i = 0; i < N;i++){
        int minj = i;
        for(int j = i; j < N;j++){
            if(A[j].value < A[minj].value){
                minj = j;
            }
        }
        if(i != minj) swap(A[i], A[minj]);
    }
}
int main()
{
    int N;
    scanf("%d%*c", &N);
    card A[N], B[N];
    for( int i = 0; i < N; ++i ){
        scanf("%c%d%*c", &A[i].suit, &A[i].value);
        B[i] = A[i];
    }

    bubbleSort(A, N);
    selectionSort(B, N);
    
    for(int i = 0; i < N;i++){
        if(i>0) printf(" ");
        printf("%c%d", A[i].suit, A[i].value);
    }
    printf("\n");
    printf("Stable\n");

    int flag = 1;
    for(int i = 0; i < N;i++){
        if(i>0) printf(" ");
        printf("%c%d", B[i].suit, B[i].value);
        if( !(B[i].suit == A[i].suit && B[i].value == A[i].value) ) flag = 0;
    }
    printf("\n");
    if( flag ){
        printf("Stable\n");
    }else{
        printf("Not stable\n");
    }

    return 0;
}


Measured memory_bytes: 3216
/*
        karmany evadhikaras te
        ma phalesu kadacana 
        ma karma-phala-hetur bhur
        ma re sango'stv akarmani (B.G.-2.47)
 
Translation:
        Lord Krsna to Arjuna.
You have a right to perform your prescribed duty, 
but you are not entitled to the fruits of action. 
Never consider yourself the cause of the results of your activities, 
and never be attached to not doing your duty.    
*/
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define int long long
const int N = 1005;
const ll mod = 1e9+7;
#define ld long double
#define PI 3.14159265358979323846
const int INF = 10000000;

void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(2);
}

//3. Structure or classes
//3. Ends here

//1. Data structures declaration here
//1. Ends here

//2. Extra Functions here
string next(string s){
    reverse(s.begin(),s.end());

    string s2=s;
    int j;
    for(j=0;j<s.length();j++){
        if(s2[j]=='9'){
            s2[j]='0';
        }
        else break;
    }

    if(s.length()==j){
        s=s2;
        s+='1';
        reverse(s.begin(),s.end());
        return s;
    }

    if(s.length()==1){
        int c1=s[0]-'0';
        s[0]=(c1+1)+'0';
    }

    for(j=0;j<s.length()-1;j++){
        int c1 = (s[j]-'0');
        int c2 = (s[j+1]-'0');
        if(abs(c1-c2)<=1)continue;
        else if(abs(c1+1-c2)<=1){
            //doing part 1
            c1++;
            s[j]=c1+'0';
            s[j+1]=c2+'0';
        }
        else{
            c1=c2;
            c2++;
            s[j+1]=c2+'0';
            s[j]=c1+'0';
        }
    }

    reverse(s.begin(),s.end());
    return s;
}
//2. Ends here


void solve();
int32_t main()
{
    flash();
    int t;
    t = 1;
    //cin>>t;
    while(t--){
        solve();
        //cout<<"\n";
    }
    return 0;
}

void solve()
{
    
    int k;
    cin>>k;

    queue<int>q;

    for(int i=1;i<=9;i++)q.push(i);

    for(int i=0;i<k-1;i++){
        int d = q.front();
        q.pop();

        if(d%10!=0){
            q.push(10*d+(d%10)-1);
        }
        q.push(10*d+(d%10));
        if(d%10!=9){
            q.push(10*d+(d%10)+1);
        }
    }

    cout<<q.front();

    return;
}
// how r u bro

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

int main(void){
    string a, b;
    cin >> a >> b;
    int count = 0;
    if(a.length()==b.length()){
        for(int i = 0; i < a.length(); i++){
            if(a[i] < b[i]){
                cout << "LESS" << endl;
                break;}
            if(a[i] > b[i]){
                cout << "GREATER" << endl;
                break;}
            count++;
        }
        if(count == a.length())
            cout << "EQUAL" << endl;
    }
    if(a.length()>b.length())
        cout << "GREATER" << endl;
    if(a.length()<b.length())
        cout << "LESS" << endl;
    return 0;
}
    

Measured memory_bytes: 256
//“ In order to be irreplaceable, one must always be different”
#include <bits/stdc++.h>
using namespace std;
# define ll long long
#define endl "\n"
# define pi 3.14159265359
# define str string
# define vll vector<ll>
# define vstr vector<str>
# define vchar vector<char>
# define pb push_back
# define popb pop_back
# define pf push_front
# define popf pop_front
# define sll set<ll>
# define schar set<char>
//find()
//erase(x) removes element x
//erase(position,position)
# define qll queue<ll>
# define qstr queue<str>
//front(),back()
# define stll stack<ll>
# define ststr stack<str>
//top()
# define dll deque<ll>
//at()
# define mll map<ll,ll>
#define mchar map<char, ll>
# define mstr map<str,ll>
# define mss map<str,str>
# define mci map<char,ll>
# define vp vector< pair<ll,ll> >
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
# define r(x,y) for(int x=y;x>=0;x--)
# define fr(x,y,z) for(int x=y;x<z;x++)
# define rr(x,y,z) for(int x=y;x>z;x--)
ll power(ll a , ll b){ll res=1;for(ll i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll gcd(ll a, ll b){
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}
void print(vll a){
    for(int i=0;i<a.size();i++){
        cout<<a[i]<<' ';
    }
    cout<<endl;
}
vll inp(int n){
    vll a;
    ll x;
    f(i,n){
        cin>>x;
        a.pb(x);
    }
    return a;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll x;
    cin>>x;
    mll m;
    ll a[x-1];
    f(i,x-1){
        cin>>a[i];
        m[a[i]]++;
    }
   for(ll i=1;i<=x;i++){
       cout<<m[i]<<endl;
   }
}

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

/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)

/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair 

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */

/*struct*/
struct aaa {
	aaa() {
		cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//Counterclockwise from the 9o'clock direction
//Take the x-axis downward and the y-axis right

//#define int ll
//#define int long long

signed main()
{
//input
	int n; cin >> n;
	map<string, int> ms;

    REP(i, n){
      string s;cin >> s;
      ms[s]++;
    }
  
    int m;cin >> m;
    REP(i, m) {
      string s;cin >> s;
      ms[s]--;
    }

//process



//output
    int ans = 0;
    for(auto& p : ms){
      ans = max(ans, p.second);
    }
    cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256