akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

struct Block {
    int w, s, v;

    bool operator < (const Block &other) const {
        return w + s < other.w + other.s;
    }
};

long long dp[20001] = {};
Block blocks[1000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, maxW = 0;
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> blocks[i].w >> blocks[i].s >> blocks[i].v;
        maxW = max(maxW, blocks[i].w + blocks[i].s);
    }

    sort(blocks, blocks + n);
    for (int i=0; i<n; i++)
        for (int j=min(blocks[i].w + blocks[i].s, maxW); j>=blocks[i].w; j--)
            dp[j] = max(dp[j], dp[j-blocks[i].w] + blocks[i].v);

    long long ret = 0;
    for (int i=0; i<=maxW; i++)
        ret = max(ret, dp[i]);

    cout << ret << "\n";

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
 
//keep coding
//-Roshan Mitra (SIT Pune) 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define endl "\n"
#define f0(i,n) for(int i=0;i<n;i++) 
#define f1(i,n) for(int i=1;i<=n;i++)
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define pb push_back
#define MP make_pair
#define FF first
#define SS second
#define int long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int n;
int a[1001] , w[1001];
int dp[100001][101];
int sack(int sum , int ind  )
{
    if(sum<0)
        return INT_MIN;
    if(ind==n)
        return 0;
    if (dp[sum][ind] != -1)
        return dp[sum][ind];
    int left=max(a[ind]+sack(sum-w[ind],ind+1),sack(sum,ind+1));
    int right=sack(sum,ind+1);
   return dp[sum][ind]=max(left,right);
}
signed main()
{

 FIO;
 int s;
    cin >> n >> s;
    f0(i, n) cin >> w[i] >> a[i];
for(int i=0;i<100001;i++){
    for(int j=0;j<101;j++)
        dp[i][j]=-1;
}
 cout<<sack(s,0);
}


Measured memory_bytes: 82580
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N, M; cin >> N >> M;
    ll res = min((N*2 + M)/4,M/2);
    cout << res << endl;
    return 0;
}




Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""arc086_a"""

import sys
import pprint
import re

from collections import Counter

from functools import reduce

import itertools
pp = pprint.PrettyPrinter(indent=2)


def main():
    """Main function."""
    n, k = list(map(int, input().split(' ')))
    as_ = list(map(int, input().split(' ')))

    counter = Counter(as_)

    occ_list = sorted(counter.most_common(), key=lambda t: t[1], reverse=True)
    if len(occ_list) <= k:
        print(0)
    elif len(occ_list) == k + 1:
        print(occ_list[-1][1])
    else:
        print(reduce(lambda t1, t2: (0, t1[1] + t2[1]), occ_list[k:])[1])



if __name__ == '__main__':
    sys.exit(main())

Measured memory_bytes: 41368
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int a, b;
    cin >> a >> b;

    if(b%a == 0) cout << a+b << endl;
    else cout << b-a << endl;

    return 0;
}

Measured memory_bytes: 256
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

const long long MAX = 1001000;
const long long MOD = 1000000007;

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(long long n, long long 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() {
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

    ll h,w,a,b;
    cin>>h>>w>>a>>b;

    COMinit();

    ll ans=0;
    for(int i=b+1;i<=w;i++){
        ll cur=com(h-1-a-1+i,h-a-1)*com(a-1+w-i,a-1);
        cur=cur%MOD;
        ans+=cur;
        ans=ans%MOD;
    }

    cout<<ans<<endl;
    return 0;
    
}

Measured memory_bytes: 27088
(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let n = Scanf.sscanf (read_line ()) "%d" (
        fun n -> 
                n
)

let lst = Str.split (Str.regexp " ") (read_line ())
          |> List.map int_of_string

let lst2 = List.map2 (fun i elmnt -> (i, elmnt)) (List.range 1 `To n) lst
           |> List.fast_sort (fun (ai, ae) (bi, be) -> compare ae be)
           |> List.map (fun (i, e) -> i)

let () = 
        List.iter (fun elmnt ->
                Printf.printf "%d " elmnt
        ) lst2;
        Printf.printf "\n"


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

using namespace std;


int main()
{
    int n,m,b[201][201],c[11][11];
       cin>>n>>m;

       for(int i = 0 ; i < 10 ; i++)
            for(int j = 0 ; j < 10 ; j++)
               cin>>c[i][j];

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

      for (int k = 0; k < 10; ++k)
        for (int i = 0; i < 10; ++i)
            for (int j = 0; j < 10; ++j)
                if (c[i][k] + c[k][j] < c[i][j])
                    c[i][j] = c[i][k] + c[k][j];

            int s=0;

      for(int i = 0 ; i < n ; i++)
            for(int j = 0 ; j < m ; j++)
                if(b[i][j]!=-1)
                  s+=c[b[i][j]][1];
        cout<<s;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <tr1/unordered_map>
#define ri register int
using namespace std;
typedef double db;
typedef long double ld;
typedef long long ll;
typedef vector <int> poly;
typedef pair <int, int> pii;
typedef pair <ll, int> pli;
typedef pair <int, ll> pil;
typedef pair <ll, ll> pll;
typedef unsigned long long ulll;
typedef unsigned int uii;
typedef string strr;
#define fi first
#define se second
#define pb push_back
#define ppp pop_back
#define rez resize
const ll Inf = 1e18;
const int rlen = 1 << 20, inf = 0x3f3f3f3f;
char buf[rlen], *ib = buf, *ob = buf;
#define gc() (((ib == ob) && (ob = (ib =  buf) + fread(buf, 1, rlen, stdin)), ib == ob) ? -1 : *ib++)
inline int read() {
  static int ans, f;
  static char ch;
  ans = 0, ch = gc(), f = 1;
  while (!isdigit(ch)) f ^= ch == '-', ch = gc();
  while (isdigit(ch)) ans = (ans << 3) + (ans << 1) + (ch ^ 48), ch = gc();
  return f ? ans: -ans;
}
inline ll readl() {
  static ll ans;
  static char ch;
  for (ans = 0, ch = gc(); !isdigit(ch); ch = gc());
  while (isdigit(ch)) ans = ((ans << 2) + ans << 1) + (ch ^ 48), ch = gc();
  return ans;
}
inline int Read(char *s) {
  static int top;
  static char ch;
  top = 0, ch = gc();
  while (!isalpha(ch) && !isdigit(ch)) ch = gc();
  while (isalpha(ch) || isdigit(ch)) s[++top] = ch, ch = gc();
  return top;
}
namespace modular {
  const int mod = 998244353;
  int ret;
  inline int add(int a, int b) { return a + b < mod ? a + b : a + b - mod; }
  inline int dec(int a, int b) { return a < b ? a - b + mod : a - b; }
  inline int mul(int a, int b) { return (ll) a * b % mod; }
  inline void Add(int &a, int b) { a = a + b < mod ? a + b : a + b - mod; }
  inline void Dec(int &a, int b) { a = a < b? a - b + mod : a - b; }
  inline void Mul(int &a, int b) { a = (ll) a * b % mod; }
  inline int ksm(int a, int p) {
    for (ret = 1; p; p >>= 1, Mul(a, a)) (p & 1) && (Mul(ret, a), 1);
    return ret;
  }
  inline int Inv(int a) { return ksm(a, mod - 2); }
  inline int sqr(int a) { return (ll) a * a % mod; }
  inline int cub(int a) { return (ll) a * a % mod * a % mod; }
} using namespace modular;
template <typename T> inline void ckmax(T &a, T b) { a < b ? a = b : 0; }
template <typename T> inline void ckmin(T &a, T b) { a > b ? a = b : 0; }
template <typename T> inline T Abs(T a) { return a < 0 ? -a : a; }
template <typename T> inline T gcd(T a, T b) {
  T t;
  while (b) t = a, a = b, b = t - t / a * a;
  return a;
}
const int N = 3e5 + 5;
char s[N], t[N];
int n, m;
int main() {
  #ifdef ldxcaicai
  freopen("lx.in", "r", stdin);
  #endif
  n = Read(s), m = Read(t);
  for (ri i = 1; i <= n; ++i) if (s[i] != t[i]) return cout << "No", 0;
  cout << "Yes";
  return 0;
}

Measured memory_bytes: 3604
import java.io.*;
import java.util.*;

public class Main {
    Scanner sc;
    Main() {
        sc = new Scanner(System.in);
    }
    int n, m;
    double[][] gl;
    double[][] dp;
    boolean init() {
        n = sc.nextInt();
        m = sc.nextInt();
        if (n == 0 && m == 0) return false;
        gl = new double[n][n];
        for (int i = 0; i < n; i++) 
            for (int j = 0; j < n; j++)
                gl[i][j] = sc.nextDouble();
        dp = new double[n][m+1];
        for (int i = 0; i < n; i++) Arrays.fill(dp[i], -1);
        return true;
    }
    double solve(double g, int prev, int rem) {
//        System.out.printf("%d %d: %f\n", prev, rem, g);
        if (rem == 0) return g;
        if (dp[prev][rem] != -1) return g * dp[prev][rem];
        double max = 0.0;
        for (int i = 0; i < n; i++) 
            max = Math.max(max, solve(gl[prev][i], i, rem-1));
        dp[prev][rem] = max;
        return g * max;
    }
    void run() {
        while (init()) {
            double max = 0;
            for (int i = 0; i < n; i++) 
                max = Math.max(max, solve(1.0, i, m-1));
            System.out.printf("%.2f\n", Math.round(max*100)/100.0);
        }
    }
    public static void main(String[] args) {
        new Main().run();
    }
}

Measured memory_bytes: 13000
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

int main() {
  int A, B;

  cin >> A >> B;

  if(A > 8 || B > 8){
    cout << ":(" << endl;
  }else{
    cout  << "Yay!" << endl;
  }
}


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

int main() {

    int arr[1001];
    int n, k;

    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr, arr + n);

    int sum=0;
    for (int i = 0; i < k; i++) {
        sum += arr[i];
    }
    
    cout << sum << endl;
    
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);


int main(){
  ll N,A,B;

  cin >> N >> A >> B;
  cout <<  N/(A+B)*A + min(N%(A+B), A) << endl;

}




Measured memory_bytes: 256
/*

*/
#include<iostream>
#include<iomanip>
#include<ios>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
#include<cstdlib>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)
#define MAX_N 10000

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

const int INF = 1<<30;
const ll MOD = ll(1e9+7);

int main(){
  string s;cin>>s;
  rep(i, (int)s.size()){
    cout<<(s[i]=='?'?'D':s[i]);
  }
  cout<<endl;
  // system("read -n 1 -s -p \"Press any key to continue...\"");
}


Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x,y;
    scanf("%d %d", &x,&y);
    char arr[55][55]={};
    int mat[55][55]={0};
    for(int i=1;i<=x;i++){
        scanf("%s", &arr[i][1]);
    }
    for(int i=1;i<=x;i++){
        for(int j=1;j<=y;j++){
            if (arr[i][j]=='#'){
                mat[i][j]=-1;
            }
            else{
                if (arr[i-1][j]=='#')mat[i][j]+=1;
                if (arr[i-1][j+1]=='#')mat[i][j]+=1;
                if (arr[i-1][j-1]=='#')mat[i][j]+=1;
                if (arr[i][j+1]=='#')mat[i][j]+=1;
                if (arr[i][j-1]=='#')mat[i][j]+=1;
                if (arr[i+1][j]=='#')mat[i][j]+=1;
                if (arr[i+1][j+1]=='#')mat[i][j]+=1;
                if (arr[i+1][j-1]=='#')mat[i][j]+=1;
            }
        }
    }
    for(int i=1;i<=x;i++){
        for(int j=1;j<=y;j++){
            if (mat[i][j]==-1){
                printf("#");
            }
            else{
                printf("%d",mat[i][j]);
            }
        }
        printf("\n");
    }
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

const int MAX_N = 10000010;
vector<ll> cnt(MAX_N, 0);

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

    for (int i = 1; i <= N; i++) {
        for (int j = 1; i * j <= N; j++) cnt[i * j]++;
    }

    ll ans = 0;
    for (int i = 1; i <= N; i++) ans += (ll) i * cnt[i];
    cout << ans << endl;
}


Measured memory_bytes: 81248
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;

void solve() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int m = t.size();
  vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
  rep(i, n){
    rep(j, m){
      if(s[i] == t[j]){ 
        dp[i+1][j+ 1] = dp[i][j] + 1;
      }else{ 
          dp[i+1][j+ 1] = max(dp[i+1][j], dp[i][j+1]);
      }
    }
  }
  cout << dp[n][m] << "\n";
}

int main() {
  int q;
  cin >> q;
  rep(i, q)solve();
  return 0;
}


Measured memory_bytes: 6836
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=5005;
int n,k;
string s;
int main()
{
//	freopen("data.in","r",stdin);
//	freopen("data.out","w",stdout);
	cin>>n>>k;
	cin>>s;
	char c='z'+1;
	int L=0,R=0;
	string tmp;
	for(int i=0;i<=n;i++)
		tmp+='z';
	for(int i=0,j=0;i<n;i=j)
	{
		j=i;
		while(j<n&&s[i]==s[j]) j++;
		if(s[i]<c) c=s[i],L=i,R=j-1,tmp=s.substr(j);
		else if(s[i]==c&&j-i>R-L+1) L=i,R=j-1,tmp=s.substr(j);
		else if(s[i]==c&&j-i==R-L+1&&s.substr(j)<tmp) L=i,R=j-1,tmp=s.substr(j);
	}
	if(k==1)
	{
		if(s[n-1]!=c)
		{
			string t=s;
			reverse(t.begin(),t.end());
			s+=t;
			s=s.substr(L,n);
			cout<<s; 
		}
		else
		{
			int cnt=0,now=n-1;
			while(now>=0&&s[now]==c) now--,cnt++;
			string t=s;
			reverse(t.begin(),t.end());
			string st=s+t;
			st=st.substr(now+1,n);
			t=s;
			reverse(t.begin(),t.end());
			s+=t;
			s=s.substr(L,n);
			cout<<min(st,s);
		}
		return 0;
	}
//	cerr<<"caht"<<c<<"\n";
//	cerr<<"now"<<L<<" "<<R<<"\n";
//	cerr<<"char"<<s[R+1]<<"\n";
//	cerr<<tmp<<endl;
//	cerr<<s<<"\n";
	if(R!=n-1)
	{
		int cnt=0,now=n-1;
		while(now>=0&&s[now]==c) now--,cnt++;
		string t=s.substr(0,now+1);
		reverse(t.begin(),t.end());
		if(cnt*2<R-L+1||(cnt*2==R-L+1&&tmp<t))
		{
			string t=s;
			reverse(t.begin(),t.end());
			s+=t;
			int r=(n-1-L)+n,l=r-n+1;
//			cerr<<"ssssss"<<s[r]<<" "<<s[l]<<"\n";
//			exit(1);
			s=s.substr(l,n);
			k--;
		}
		
	}
//	cerr<<s<<"\n";
//	exit(1);
	int pre=n-1;
	while(pre>=0&&s[pre]==c) pre--;
	pre++;
//	cerr<<"pre"<<pre<<"\n";
	for(int i=1;i<k;i++)
	{
		string t=s;
		reverse(t.begin(),t.end());
		s+=t;
		int r=(n-1-pre)+n,l=r-n+1;
		s=s.substr(l,n);
		pre=n-1;
		while(pre>=0&&s[pre]==c) pre--;
		pre++;
		if(pre==0) break;
	}
	string t=s;
	reverse(t.begin(),t.end());
	s+=t;
	int l=pre,r=l+n-1;
	s=s.substr(l,n);
	cout<<s;
	return 0;
}

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

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

  // ここにプログラムを追記
  for(int i=0; i<N; i++){
    string S;
    cin >> S;
    if (S == "Y") {
      Ans = "Four";
      break;
    }else {
      Ans = "Three";
    }
  }
    cout << Ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int N, l, r;

int main(void) {
	int sum = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> l >> r;
		sum += r - l + 1;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }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...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 5*(int)1e5 + 10;
// make sure N size is correctttt!!!!!!!!!


int n;
string a, b, c;

int32_t main(){_

   cin>>n;
   cin>>a>>b>>c;

   int freq[26];
   memset(freq, 0, sizeof freq);
   int ans = 0;
   for (int i = 0; i < n; ++i)
   {
      vector<char> v;
      v.pb(a[i]);
      v.pb(b[i]);
      v.pb(c[i]);
      sort(v.begin(), v.end());
      for(auto it: v){
         freq[it-'a']++;
      }
      int ma = 0;
      for (int j = 0; j < 26; ++j){
         smax(ma, freq[j]);
         freq[j] = 0;
      }
      ans += 3 - ma;
   }

   cout<<ans;
   //make sure N size is correct!!!!!!!!!
   return 0;
}

Measured memory_bytes: 256
N = int(input())


ans = []
index = {}
for i, _ in enumerate(range(N)):
    S, P = input().split()
    ans.append((S, P))
    index[(S, P)] = i + 1

for (S, P) in sorted(ans, key=lambda x: (x[0], -int(x[1]))):
    print(index[(S, P)])

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    int a,b; cin >> a >> b;
    vector<int> v(a);
    rep(i,a) cin >> v[i];
    sort(RALL(v));
    int ans = 0;
    rep(i,b){
        ans+=v[i];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)  cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
// #define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 300005
#define BLOCK 555
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 200005;
const long double epsilon = 1e-9;
inline ll myceil(ll a, ll  b) {
    return (ceil(1.0 * a / b * 1.0));
}
ll binexp(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll modinvfermat(ll a, ll m)
{
    return binexp(a, m - 2, m);
}
void task(bool flag)
{
    if (flag)
        cout << "YES\n";
    else
        cout << "NO\n";
}
ll lcm(ll a, ll b)
{
    return ((1LL * a * b) / (__gcd(a, b)));
}



signed main() {
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    fast
    ll n;
    cin >> n;
    cout << (n ^ 1) << END;


// #ifndef ONLINE_JUDGE
//     cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
    return 0;
}



Measured memory_bytes: 3652
import java.util.*;

public class Main {
    static int[] xArr;
    static int[] yArr;
    static long[] cArr;
    static long[][] xValues;
    static long[][] yValues;
    static int n;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		xArr = new int[n];
		yArr = new int[n];
		cArr = new long[n];
		long[] base = new long[n];
		for (int i = 0; i < n; i++) {
		    xArr[i] = sc.nextInt();
		    yArr[i] = sc.nextInt();
		    cArr[i] = sc.nextInt();
		    base[i] = Math.min(Math.abs(xArr[i]), Math.abs(yArr[i])) * cArr[i];
		}
		xValues = new long[1 << n][];
		yValues = new long[1 << n][];
		xValues[0] = base;
		yValues[0] = base;
		for (int i = 0; i < n; i++) {
		    setX(base, 0, i);
		    setY(base, 0, i);
		}
		long[] ans = new long[n + 1];
		Arrays.fill(ans, Long.MAX_VALUE);
		for (int i = 0; i < (1 << n); i++) {
		    for (int j = 0; j < (1 << n); j++) {
		        if ((i & j) != 0) {
		            continue;
		        }
		        int idx = getIdx(i | j);
		        long sum = 0;
		        for (int k = 0; k < n; k++) {
		            sum += Math.min(xValues[i][k], yValues[j][k]);
		        }
		        ans[idx] = Math.min(ans[idx], sum);
		    }
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i <= n; i++) {
		    sb.append(ans[i]).append("\n");
		}
		System.out.print(sb);
	}
	
	static int getIdx(int x) {
	    int count = 0;
	    while (x > 0) {
	        count += x % 2;
	        x /= 2;
	    }
	    return count;
	}
	
	static void setX(long[] base, int mask, int idx) {
	    mask = (mask | (1 << idx));
	    if (xValues[mask] != null) {
	        return;
	    }
	    xValues[mask] = (long[])base.clone();
	    for (int i = 0; i < n; i++) {
	        xValues[mask][i] = Math.min(xValues[mask][i], Math.abs(xArr[i] - xArr[idx]) * cArr[i]);
	    }
	    for (int i = 0; i < n; i++) {
	        if ((mask & (1 << i)) != 0) {
	            continue;
	        }
	        setX(xValues[mask], mask, i);
	    }
	}

	static void setY(long[] base, int mask, int idx) {
	    mask = (mask | (1 << idx));
	    if (yValues[mask] != null) {
	        return;
	    }
	    yValues[mask] = (long[])base.clone();
	    for (int i = 0; i < n; i++) {
	        yValues[mask][i] = Math.min(yValues[mask][i], Math.abs(yArr[i] - yArr[idx]) * cArr[i]);
	    }
	    for (int i = 0; i < n; i++) {
	        if ((mask & (1 << i)) != 0) {
	            continue;
	        }
	        setY(yValues[mask], mask, i);
	    }
	}
	
}


Measured memory_bytes: 47212
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll a, b, c;
  cin >> a >> b >> c;
  if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = a * b;
  chmin(ans, b * c);
  chmin(ans, c * a);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
local a=io.read()
if a == "SUN" then
  print(7)
elseif a == "MON" then
  print(6)
elseif a == "TUE" then
  print(5)
elseif a == "WED" then
  print(4)
elseif a == "THU" then
  print(3)
elseif a == "FRI" then
  print(2)
else
  print(1)
end

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


int main(){
  int N,Q,b,c,d;
  long long int s = 0;
  int A[100010] = {};
  
  cin >> N;
  
  for(int i=0;i<N;i++){
    cin >> d;
    A[d]++;
    s += d;
  }
  
  cin >> Q;
  
  for(int i=0;i<Q;i++){
    cin >> b >> c;
    
    s = s - A[b] * (b-c);
    A[c] = A[b] + A[c];
    A[b] = 0;
    cout << s << endl;
  }
}

Measured memory_bytes: 4028
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	for (;;) {
		int x, y, s; cin >> x >> y >> s;
		if (x == 0) break;
		int maxi = 0;
		for (int i = 1; i <= s - 1; i++)
			for (int j = 1; j <= s - 1; j++)
				if (i * (100 + x) / 100 + j * (100 + x) / 100 == s)
					maxi = max(maxi, i * (100 + y) / 100 + j * (100 + y) / 100);
		cout << maxi << endl;
	}
}

Measured memory_bytes: 1160
n, m = gets.split.map &:to_i
l, r = 1, n
for i in 0...m
  li, ri = gets.split.map &:to_i
  l = li if li > l
  r = ri if ri < r
  if l > r
    p 0
    exit
  end
end

p r - l + 1

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
const int _N = (int)1e5 + 5;
const long long MOD = (long long)1e9 + 7;

string s;

int main() {
	cin >> s;
	for (int i = 0; i < (int)s.size(); i++) {
		cout << s[i];
		if (i == 3) cout << " ";
	} cout << endl;
	return 0;
}



Measured memory_bytes: 256
import numpy as np
N, K, Q  = map(int, input().split())
score = np.zeros(N)
for i in range(Q):
  num = int(input())
  score[num-1] += 1

for i in range(N):
  if score[i] > Q-K:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 13984
#include<bits/stdc++.h>
#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--)
using namespace std;

int a[10];
int main() {
    for (int i = 1; i <= 9; i++) {
        cin >> a[i];
    }
    if (a[1] + a[5] + a[9] == a[2] + a[6] + a[7] &&
        a[1] + a[5] + a[9] == a[3] + a[4] + a[8]) {
        puts("Yes");
    } else{
        puts("No");
    }
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
	string S, T;
	cin >> S >> T;
	int ans = 0;
	fx(3) {
		if (S.at(x) == T.at(x)) {
			ans++;
		}
	}
	ce(ans)
    return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(H: int, W: int, N: int, a: "List[int]"):
    ans = [[0]*W for _ in range(H)]

    Y, X = 0, 0
    for i, av in enumerate(a):
        for j in range(av):
            ans[Y][X] = i+1
            if Y % 2 == 0 and X == W-1:
                Y += 1
            elif Y % 2 == 1 and X == 0:
                Y += 1
            elif Y % 2 == 0:
                X += 1
            else:
                X -= 1
    for i in range(H):
        print(*ans[i], sep=" ")

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(H, W, N, a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3944
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>

#include <queue>
#include <cstdio>

#include <list>
#include <set>
#include <map>


#define PI (3.14159265358979323846)
#define INF (1e+9)
#define DIV_NUM (1000000007)

using namespace std;


bool seen[501][501];

int N, W;
int X, Y, Z;
int con;
//    string S;


char field[501][501];
int  dist[501][501];

typedef pair<int, int> P;
queue<P> que;


//typedef vector<vector<int>> v;
vector<double> vi;
vector<double> wi;


set<int> s1;
map<string, int> m1;
map<string, int> m2;

int weight[110], value[110];
int dp[110][10010];


int main(){
  
  
    // input data
    string ss ;


    cin >> N >> W;

  
    //        std::cout << m1[ss] << ss  << "\n";


    for (int i = 0; i < N; i++) {
        cin >> value[i] >> weight[i];
    }

    for (int w = 0; w <= W; ++w) {
        dp[0][w] = 0;
    }


    for (int i = 0; i < N; i++) {

      //  std::cout << i << "\n";

        for (int w = 0; w <= W; w++) {
        
        
            if(w>=weight[i]){

                dp[i + 1][w] = max(dp[i][w - weight[i]] + value[i], dp[i][w]);
            }
            else {
                dp[i+1][w] = dp[i][w];

            }
        
        }

    }



 
    
    std::cout << dp[N][W] << "\n";

        return 0;

}



Measured memory_bytes: 7084
#include <iostream>
#include <string>
using namespace std;
 
int main(){
	std::string s(3, 'c');
  	cin >> s;
  	int a=0;
  	int b=0;
  	for(int i=0; i<3; ++i){
    	if (s[i] == 'A'){
        	++a;
        }else if (s[i] == 'B'){
        	++b;
        }
      	if (a>0 && b>0){
        	cout << "Yes";
		return 0;
        }
    }
  cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <queue>
#include <cctype>
#include <stack>
#include <bitset>
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <iomanip>
//#include <bits/stdc++.h>


#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define IFOR(i,a,b) for(int i=(a);i>=(b);--i)

using namespace std;

typedef long long lolo;
typedef pair<int, int> pii;
typedef unsigned long long ulolo;

const int maxn = 100000 + 5;
const int maxm = 300005;
const int INF = 0x3f3f3f3f;
const lolo inf = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-6;
const int MOD = (int)1e9+9;

template<class T>
inline void read(T &x) {
    x = 0; T flag = 1;char c;
    do { c = (char) getchar(); if (c == '-') break; } while (c < '0' || c > '9');
    if (c == '-') c = '0', flag = -1;
    do { x = x * 10 + c - '0';c = (char) getchar();} while (c >= '0' && c <= '9');
    x *= flag;
}
template<class T>
inline void out(T x) {
    if (x > 9) out(x / 10);
    x = x % 10;
    putchar('0' + x);
}
lolo cnt[6];
const char march[10]="MARCH";
int idx(char x) {
    FOR(i,0,4) {
        if(x==march[i]) return i;
    }
    return 5;
}
int cbit(int x) {
    int ret=0;
    for (int i = 0; i < 6; ++i) {
        if(x&(1<<i)) ++ret;
    }
    return ret;
}
int main(){
//    freopen("../in.txt","r",stdin);
    int n;
    char s[12];
    read(n);
    FOR(i,1,n) {
        scanf("%s",s);
        cnt[idx(s[0])]++;
    }
    lolo ans=0;
    FOR(i,7,31) {
        if(cbit(i)==3) {
            lolo tmp=1;
            FOR(j,0,5) {
                if(i&(1<<j)) {
                    tmp*=cnt[j];
                }
            }
            ans += tmp;
        }
    }
    out(ans);
    return 0;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())

if a>b>c:
  print(c,b,a)

elif a>c>b:
  print(b,c,a)

elif b>a>c:
  print(c,a,b)

elif b>c>a:
  print(a,c,b)

elif c>a>b:
  print(b,a,c)

elif a==b>c:
  print(c,a,b)

elif c==a>b:
  print(b,a,c)

elif b==c>a:
  print(a,b,c)

elif a==b<c:
  print(a,b,c)

elif c==a<b:
  print(c,a,b)

elif b==c<a:
  print(b,c,a)

else:
  print(a,b,c)

Measured memory_bytes: 7768
#include<iostream>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//1000000000000223
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
vector<int> v[8];
int n;
void solve(int i, int d)
{
    n-=d;
    while(d--)
        cout<<v[i].back()<<" ", v[i].pop_back();
}
int main()
{
    IO
    cin>>n;
    for(int i=1; i<=3e4; i++)
        v[i%6].push_back(i);
    if(n==3)
        return cout<<"2 5 63", 0 ;
    cout<<v[2].back()<<" "<<v[4].back()<<" "<<v[3].back()<<" ";
    v[2].pop_back();
    v[4].pop_back();
    v[3].pop_back();
    cout<<v[3].back()<<" ";
    v[3].pop_back();
    n-=4;
    while(n>=3&&v[2].size()>=3)
        solve(2,3);

    while(n>=3&&v[4].size()>=3)
        solve(4,3);
    if(n>=2)
        solve(2,1), solve(4,1);
    while(n>=2&&v[3].size()>=2)
        solve(3,2);

    while(n)
        solve(0,1);
    return 0;
}


Measured memory_bytes: 640
let () = Scanf.scanf "%d\n%s" @@ fun n s ->
  print_endline @@
  if
    Array.fold_left ( && ) (n mod 2 = 0) @@
    Array.init (n / 2) @@ fun i -> s.[i] = s.[i + n / 2]
  then "Yes"
  else "No"


Measured memory_bytes: 384
/*
　　　　 ∧＿∧　にっぽんちゃちゃちゃ
　／＼（　・∀・）／ヽ
（ ●　と　　　つ　● ）　にっぽんちゃちゃちゃ
　＼/⊂、 ノ　　＼ノ
　　　　　し'
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define MOD 1000000007
#define INF 9223372036854775807

signed main()
{
int x=0,y=0,z=0,w=0,n=0,d=0;
std::cin >> x>>y>>z;
if(x/2>y){
  if(z%500==0)std::cout << (z/500)*y << '\n';
  else std::cout << ((z/500)+1)*y << '\n';
}else{
  if(z%1000==0)std::cout << (z/1000)*x << '\n';
else{
    if(z%1000<=500){
      if(x<y)std::cout << (z/1000)*x+x << '\n';
      else std::cout << (z/1000)*x+y << '\n';
  }else std::cout << ((z/1000)+1)*x << '\n';
  }
}
}




Measured memory_bytes: 3116
import java.util.Scanner;
public class Main {

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

		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		
		double c = a/0.08;
		double cc = (a+1)/0.08;

		
		double d = b/0.1;
		double dd = (b+1)/0.1;
		
		boolean flag = true;
		
		Outer:for(int i =(int) Math.ceil(c); i < cc; i++) {
			
			for(int j = (int)Math.ceil(d); j < dd; j++) {
				if(i == j) {
					System.out.println(i);
					flag = false;
					break Outer;
				}
				
			}
			
		}
		
		if(flag) {
			
		System.out.println("-1");
		}
		
		

	}

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll aa,cc;
    aa=(c-1)/b+1;
    cc=(a-1)/d+1;
    if(aa<=cc) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3636
while true
  a, op, b = gets.split
  a, b = a.to_i, b.to_i
  case op
  when "?"
    break
  when "+"
    puts a + b
  when "-"
    puts a - b
  when "*"
    puts a * b
  when "/"
    puts a / b
  end
end

Measured memory_bytes: 6864
'use strict';

function Main(input) {
  const N = input.split("\n")[0]
  const A = input.split("\n")[1]
  const B = input.split("\n")[2]
  const C = input.split("\n")[3]
  const D = input.split("\n")[4]
  const E = input.split("\n")[5]

  const ans = Math.max(Math.ceil(N/A), Math.ceil(N/B), Math.ceil(N/C), Math.ceil(N/D), Math.ceil(N/E)) + 4
  console.log(ans)
  
};

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 7372
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
#include <ctype.h> // isdigit
#include <cassert>
using namespace std;

#define LE(n,m) ((n) < (m) + EPS * (abs(n) + abs(m)))
#define GE(n,m) ((n) + EPS * (abs(n) + abs(m)) > (m))
#define LT(n,m) ((n) + EPS * (abs(n) + abs(m)) < (m))
#define GT(n,m) ((n) > (m) + EPS * (abs(n) + abs(m)))
#define EQ(n,m) (abs((n)-(m)) < EPS * (abs(n) + abs(m)))

typedef long long int ll;
const int INF = (1<<30) - 1;
const double EPS = 1e-9;
const int MOD = 1000000007;

//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(16);
    //cout.setf(ios::fixed);
    
    int N, A, B;
    string s;
    cin >> N >> A >> B;
    cin >> s;
    
    int sum = 0;
    int sumb = 0;
    for(int i=0; i<s.size(); i++){
        char c = s[i];
        if(c == 'a'){//国内
            if(sum < A + B){
                cout << "Yes" << endl;
                sum++;
            }else{
                cout << "No" << endl;
            }
        }else if(c == 'b'){//海外
            if(sum < A + B && sumb < B){
                cout << "Yes" << endl;
                sum++;
                sumb++;
            }else{
                cout << "No" << endl;
            }
        }else{
            cout << "No" << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 848
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
    char c11, c12, c13, c21, c22, c23;
    cin >> c11 >> c12 >> c13 >> c21 >> c22 >> c23;
    if (c11 != c23 || c12 != c22 || c13 != c21) puts("NO");
    else puts("YES");
    return 0;
}

Measured memory_bytes: 384
n = int(input())
l = list(map(int, input().split()))


def selectionSort(a, n):
    ans = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j

        a[i], a[minj] = a[minj], a[i]
        if i != minj:
            ans += 1

    print(*a)
    print(ans)


selectionSort(l, n)



Measured memory_bytes: 5604
#include <iostream>
#include <cstring>
#include <string>

using namespace std;

int main(){
	string s;
	int n;
	int c_pos;
	cin>>n;
	cin.ignore();
	while(n--){
		getline(cin,s);
		while((c_pos=s.find("Hoshino"))!=string::npos){
			s.replace(c_pos,7,"Hoshina");
		}
		cout<<s<<endl;
	}
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
long long fac[4010], finv[4010], inv[4010]; 
long long MOD = 998244353;
long long pow2[4010]; 
map<tuple<int, int, int>, long long> mp; 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < 4005; 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;
}
long long power(long long a, int n){
	long long ans = 1; long long mul = a; 
	while(n){
		if(n & 1){
			ans *= mul; ans %= MOD; 
		}
		n >>= 1; 
		mul = mul * mul % MOD; 
	}
	return ans; 
}
long long solve(int n, int k, int p){
/* k面サイコロをn個投げて高々一方しか出ちゃダメなペアがp個 */
	if(mp[make_tuple(n, k, p)]) return mp[make_tuple(n, k, p)]; 
	long long res = 0; 
	for(int t = 0; t <= p; t++){
		res += (((COM(p, t) * pow2[t]) % MOD) * COM(k-p*2+n-1, n-t)) % MOD; 
	 	res %= MOD; 
	}
	return mp[make_tuple(n, k, p)] = res; 
}
int main(){
	int K, N; cin >> K >> N; COMinit(); 
	pow2[0] = 1;
	for(int i = 1; i < 4005; i++){
		pow2[i] = pow2[i-1] * 2 % MOD; 
	}
	for(int i = 2; i <= K*2; i++){
		int t = min((i-1)/2, (K*2+1-i)/2); 
		long long ans = 0; 
		if(i % 2){
			ans += solve(N, K, t);
			ans %= MOD; 
		}
		else{
			ans += solve(N-1, K-1, t); 
			ans += solve(N, K-1, t); 
			ans %= MOD; 
		}
		cout << ans << "\n"; 
	}
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <string>
#include <bitset>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <random>
#include <utility>
#include <set>

using namespace std;
typedef long double ld;
const ld EPS = 10e-12;

struct data_t {
	ld l, r;
	int e, d;
	data_t() {}
	data_t(ld vl, ld vr, int ve, int vd) {
		l = vl;
		r = vr;
		e = ve;
		d = vd;
	}
};

int solve(void);

int main(void) {

	//FILE *fpin = freopen("data.txt", "r", stdin);
	while (solve()) {}


	return 0;

}

int solve(void) {


	int K, R, L;
	ld P, E, T;
	cin >> K >> R >> L >> P >> E >> T;

	/*
		v[?????\??????][?????????????????????] = ??????????????????????????????????????´????????°
	*/
	vector<vector<int>> v(K + 1, vector<int>(K+1,0) );
	stack<data_t> s;
	s.push(data_t((double)L, (double)R, 0, 0));

	while (!s.empty()) {
		data_t current = s.top();
		data_t right(current), wrong(current);
		double h = (current.l + current.r) / 2.0;
		s.pop();
		if (abs(current.r - T) + EPS <= E && abs(current.l - T) + EPS <= E) {
			v[current.d][current.e] ++;
			continue;
		}
		else if ( current.r > T + E || current.l < T - E) {
			continue;
		}
		if (current.d == K) {
			if (abs(h - T) <= E ) {
				v[K][current.e] ++;
			}
			continue;
		}

		right.d = current.d + 1;
		wrong.d = current.d + 1;
		wrong.e = current.e + 1;

		//????????????????????????
		if (h >= T) {
			wrong.r = h;
			right.l = h;
		}
		else {
			wrong.l = h;
			right.r = h;
		}

		if (right.d <= K) {
			s.push(right);
			s.push(wrong);
		}

	}

	double PP = 0.0;
	for (int i = 0; i < v.size(); i++) {
		for (int j = 0; j < v[i].size(); j++) {
			if (P <= EPS) {
				if (j == 0)
					PP += (double)v[i][j] * pow(1.0 - P, (double)(i - j));
			} else if( P + EPS >= 1.0 ) {
				if( i == j )
					PP += (double)v[i][j] * pow(P, (double)j);
			}
			else {
				PP += (double)v[i][j] * pow(P, (double)j)*pow(1.0 - P, (double)(i - j));
			}
		}
	}
	cout << setprecision(6) << fixed << PP << endl;

	return 0;

}

Measured memory_bytes: 3568
/*
 * FileName:     selection_sort
 * CreatedDate:  2020-07-08 13:45:37 +0900
 * LastModified: 2020-07-08 13:51:46 +0900
 */

#include <stdio.h>
#include <stdlib.h>
int selectionSort( int *a, int n){
    int cnt = 0;
    for( int i=0; i<n; i++){
        int minj = i;
        for( int j=i; j<n; j++){
            if(a[j]<a[minj]){
                minj = j;
            }
        }
        if( minj!=i ){
            cnt++;
        }
        int tmp = a[minj];
        a[minj] = a[i];
        a[i] = tmp;
    }
    return cnt;
}
int main(void){
    int n;scanf("%d", &n);
    int *a = malloc(n*sizeof(int));
    for(int i=0;i<n;i++) scanf("%d", a+i);
    int ans = selectionSort( a, n);
    printf("%d", a[0]);
    for(int i=1; i<n; i++){
        printf(" %d", a[i]);
    }
    printf("\n%d\n", ans);
    free(a);
    return 0;
}



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

typedef long long ll;

ll f(vector<ll> &A, vector<ll> &P, ll N, ll X) {
    if (N == 0) {
        if (X <= 0) return 0;
        else return 1;
    } else if (X <= 1 + A[N - 1]) {
        return f(A, P, N - 1, X - 1);
    }  else {
        return P[N - 1] + 1 + f(A, P, N - 1, X - 2 - A[N - 1]);
    }
}

int main() {
    ll N, X;
    cin >> N >> X;
    vector<ll> A(N + 1), P(N + 1);
    A[0] = 1, P[0] = 1;
    for (int i = 1; i <= N; i++) {
        A[i] = A[i - 1] * 2 + 3;
        P[i] = P[i - 1] * 2 + 1;
    }

    cout << f(A, P, N, X) << endl;
    return 0;
}

Measured memory_bytes: 256