akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
using namespace std;
#define repr(i,a,b) for(int i=a; i<b; i++)

bool has_key_using_count(map<int, int> &mp, int n) {
  if(mp.count(n) == 0) {
    return false;
  } else return true;
}

int main() {
  int N;
  map<int, int> mp;
  cin >> N;
  repr(i,1,10) {
    repr(j,1,10) {
      mp[i*j] = i*j;
    }
  }

  bool ans = has_key_using_count(mp,N);
  
  if(ans == true) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,m,n) for(int i=m;i<(n);i++)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> pii;


bool isLetter[100][100];
int H,W;
char A[101][101];
string dp[101][101];
bool isBigger(const string &s1,const string &s2){
	if(s1.size()>s2.size())return true;
	else if(s1.size()<s2.size())return false;
	else{
		int N = s1.size();
		REP(i,N){
			if(s1[i]>s2[i])return true;
			else if(s1[i]<s2[i])return false;
		}
		return false;
	}
}
void init(){
	cin>>W>>H;
	if(W==0)exit(0);
	REP(i,H+1)REP(j,W+1){
		isLetter[i][j]=false;
		dp[i][j].clear();
	}

}
void solve(){
	init();
	REP(i,H){
		REP(j,W){
			cin>>A[i][j];
			if('A'<=A[i][j]&&A[i][j]<='Z')isLetter[i][j]=true;
			else dp[i][j]=A[i][j];
		}
	}
	REP(i,H){
		REP(j,W){
			if(isLetter[i][j]||dp[i][j].size()==0||dp[i][j][0]=='0')continue;
			if(i<H-1&&!isLetter[i+1][j]){
				if(isBigger(dp[i][j]+A[i+1][j],dp[i+1][j])){
					dp[i+1][j]=dp[i][j]+A[i+1][j];
				}
			}
			if(j<W-1&&!isLetter[i][j+1]){
				if(isBigger(dp[i][j]+A[i][j+1],dp[i][j+1])){
					dp[i][j+1]=dp[i][j]+A[i][j+1];
				}
			}
		}
	}
	string ans ="";
	REP(i,H){
		REP(j,W){
			if(!isLetter[i][j]){
				if(isBigger(dp[i][j],ans))ans=dp[i][j];
			}
		}
	}
	cout<<ans<<endl;
}

signed main() {
	while (true) {
		solve();
	}
}


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

int main()
{
    int h, w;
    cin >> h >> w;

    string a[h];
    for(int i = 0; i < h; ++i)
    {
        cin >> a[i];
    }
    
    for(int i = 0; i < w + 2; ++i)
    {
        cout << "#";
    }
    cout << endl;
    
    for(int i = 0; i < h; ++i)
    {
        cout << "#" << a[i] << "#" << endl;
    }
    
    for(int i = 0; i < w + 2; ++i)
    {
        cout << "#";
    }
    cout << endl;

    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;
const int mod = 1e9 + 7;

int main(){
    ll a;
    cin >> a;
    ll ba, bb;
    scanf("%lld.%lld", &ba, &bb);
    cout << (a * (ba * 100 + bb)) / 100 << endl;
}

Measured memory_bytes: 3764
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する


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

    int n, m, q;
    cin >> n >> m >> q;
    using P = pair<int, int>;
    vector<P> vp(m);
    rep(i, 0, m) {
        cin >> vp[i].first >> vp[i].second;
    }
    vector<vector<int> > memo(n + 1, vector<int>(n + 1));

    for (int i = 1; i <= n; ++i) {
        vector<int> rs;
        for (auto e : vp) {
            if (e.first >= i) {
                rs.push_back(e.second);
            }
        }
        for (auto e : rs) {
            memo[i][e]++;
        }
        for (int j = 1; j < n; ++j) {
            memo[i][j + 1] += memo[i][j];
        }
    }

    while (q--) {
        int p, q;
        cin >> p >> q;
        cout << memo[p][q] << endl;
    }

    return 0;
}


Measured memory_bytes: 4648
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define MXN 100010

int n,
	a[MXN];

/*
[Discretization] by.YXH_XianYu
void Discretization(int a[], int n);
	a[] : Array that will be Modified
	n   : the Length of Array a
This function can discretize a[]. 
(It can't Remove duplicate elements)
 */
void Discretization(int a[], int n){
	struct Sort{
		int va,no;
		bool operator < (const Sort &cp) const {
			return va<cp.va;}
	}s[n+1];
	for(int i=1;i<=n;i++)
		s[i].va=a[i],
		s[i].no=i;
	std::sort(s+1,s+n+1);
	for(int i=1;i<=n;i++)
		a[s[i].no]=i;
	return;
}



int main(){
	
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	Discretization(a,n);
	int ans=0;
	for(int i=1;i<=n;i++)
		if( (a[i]-i)&1 )
			ans++;
	printf("%d\n",ans/2);
	//system("pause");
	return 0;
}

Measured memory_bytes: 1408
import re

S = input()
T = []

a = re.split('eraser', S)
a1 = ''.join(a)
a2 = re.split('erase', a1)
a3 = ''.join(a2)
a4 = re.split('dreamer|dream', a3)
a5 = ''.join(a4)

if(a5 == ''):
    print('YES')
else:
    print('NO')


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

using namespace std;

using ll = long long;

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

    ll D, N, M;
    while (cin >> D, D)
    {
        cin >> N >> M;
        vector<ll> d(N, 0);
        for (int i = 1; i < N; i++)
            cin >> d[i];
        d.push_back(D);
        sort(d.begin(), d.end());
        ll ret = 0;
        for (int i = 0; i < M; i++)
        {
            ll k;
            cin >> k;
            if (k == 0)
                continue;
            auto itr = lower_bound(d.begin(), d.end(), k);
            auto itr2 = itr;
            itr2--;
            ret += min(abs(*itr - k), abs(*itr2 - k));
        }
        cout << ret << endl;
    }
}



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

int main() {
  vector<int>x(5);
  for (int i=0;i<5;i++){
    cin >> x.at(i);
    if (x.at(i) == 0){
      cout << i+1 << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int K,X;
  	cin>>K>>X;
  	if(K*500>=X){
      cout << "Yes"<<endl;
    }
  	else{
      cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define fill(a,val) memset(a,val,sizeof(a))
#define REP(i,a,b) for (auto i = a; i < b; i++)
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 998244353
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define pb push_back
#define SQ(a) (a)*(a)
#define N 200006
#define M 315
using namespace std;
vector<ll> A;
int firstMissingPos(int n) 
{ 
  
    // To mark the occurrence of elements 
    bool present[n + 1] = { false }; 
  
    // Mark the occurrences 
    for (int i = 0; i < n; i++) { 

        if (A[i] > 0 && A[i] <= n) 
            present[A[i]] = true; 
    } 
  
    // Find the first element which didn't 
    // appear in the original array 
    for (int i = 1; i <= n; i++) 
        if (!present[i]) 
            return i; 
  
    // If the original array was of the 
    // type {1, 2, 3} in its sorted form 
    return n + 1; 
}

int main()
{
    std::ios::sync_with_stdio(false);
    int T = 1;
    //cin>>T;
    while(T--)
    {
        int n,m;
        cin>>n>>m;
        cout<<n*m<<endl;
        
    }   
    
    return 0;
}


Measured memory_bytes: 3652
import java.util.Arrays;

public class Main {
  private static void solve() {
    int n = ni();
    int[] x = na(n);
    int[] y = Arrays.copyOf(x, n);
    Arrays.sort(y);
    
    int m1 = y[(n - 1) / 2];
    int m2 = y[n / 2];
    
    for (int i = 0; i < n; i ++) {
      if (x[i] <= m1) {
        out.println(m2);
      } else if (x[i] >= m2) {
        out.println(m1);
      }
    }
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}




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

using namespace std;

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

    vector<int> a(n);

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

    sort(a.rbegin(), a.rend());

    int ans = 0;
    int before = -1;
    for (int i = 0; i < n; i++) {
        if (a[i] != before) {
            before = a[i];
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const int MOD = 1e9+7;
const int INF = 1<<30;
const ll LINF = 1LL<<60;

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

    int r, g, b ,n;
    cin >> r >> g >> b >> n;


    int sum = 0;
    rep(i, n+1) {
        rep(j, n+1) {
            int k = n - r * i - g * j;
            if (k < 0 || k % b != 0) continue;
            sum++;
        }
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

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

const int N = (int)1e5 + 123;
const int MOD = (int)1e9 + 7;
const int inf = (int)5e8;
const long long infll = (long long)1e17;

int a[N];
bool dp[N];

void solve() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    dp[0] = true;
    for (int i = 0; i < n; ++i) {
        for (int s = N - 1; s >= 0; --s) {
            if (dp[s] && s + a[i] < N) {
                dp[s + a[i]] = true;
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if (dp[i]) {
            if (i % 10 != 0) {
                ans = max(ans, i);
            }
        }
    }
    printf("%d\n", ans);
}

int main() {
#ifdef __APPLE__
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    while (t--) {
        solve();
    }
    return 0;
}

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

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

    int n;
    cin >> n;

    set<string> st;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << (int)st.size() << endl;
}

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

const char a[26] ={'a','b','c', 'd','e', 'f', 'g', 'h', 'i', 'j', 'k','l','m','n','o', 'p', 'q', 'r', 's', 't','u', 'v', 'w', 'x', 'y', 'z'};

int main(void) 
{
    ll n;
    cin >> n;
    ll tmp = n;
    ll base = 26;
    ll cnt =0;  //桁数
    while(tmp > 0) 
    {
        tmp -= base;
        base *= 26;
        cnt++;
    }
    vector<char> ans(cnt);
    rep(i,cnt)
    {
        ll rem = (n%26) -1;
        n = n/ 26;
       // cout << n << " " << rem << endl;
        if( rem == -1) 
        {
            ans[cnt -i-1] = 'z';
            n--;
        }
        else ans[cnt-i-1] = a[rem];
    }

    rep(i,cnt) cout << ans[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		int[][] map = new int[10][10];
		int[][][] drop = {
				{
					{0, 0, 0, 0, 0},
					{0, 0, 1, 0, 0},
					{0, 1, 1, 1, 0},
					{0, 0, 1, 0, 0},
					{0, 0, 0, 0, 0}
				},
				{
					{0, 0, 0, 0, 0},
					{0, 1, 1, 1, 0},
					{0, 1, 1, 1, 0},
					{0, 1, 1, 1, 0},
					{0, 0, 0, 0, 0}
				},
				{
					{0, 0, 1, 0, 0},
					{0, 1, 1, 1, 0},
					{1, 1, 1, 1, 1},
					{0, 1, 1, 1, 0},
					{0, 0, 1, 0, 0}
				}
		};
		
		while (sc.hasNextLine() == true) {
			String[] params = sc.nextLine().split(",");
			int x = Integer.parseInt(params[0]);
			int y = Integer.parseInt(params[1]);
			int d = Integer.parseInt(params[2]) - 1;
			
			for (int i = 0; i < 5; i++) {
				int xi = x + i - 2;
				if ((xi < 0) || (xi >= 10)) continue;
				
				for (int j = 0; j < 5; j++) {
					int yj = y + j - 2;
					if ((yj < 0) || (yj >= 10)) continue;
					
					map[xi][yj] = map[xi][yj] + drop[d][i][j];
				}
			}
		}

		int count = 0;
		int max = 0;
		for (int i = 0; i < map.length; i++) {
			for (int j = 0; j < map[0].length; j++) {
				if (map[i][j] == 0) count++;
				if (max < map[i][j]) max = map[i][j];
			}
		}
		System.out.println(count);
		System.out.println(max);
	}
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll n;
vll G[100005];
ll dist[100005];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n;
  rep(i,n-1){
    ll a,b; cin>>a>>b; a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  queue<pll> q;
  q.emplace(0,1);
  q.emplace(n-1,2);
  
  fill(dist,dist+n,-1);
  dist[0]=1;
  dist[n-1]=2;
  
  while(!q.empty()){
    auto p=q.front(); q.pop();
    ll v=p.first, w=p.second;
    for(auto nv: G[v]){
      if(dist[nv]!=-1) continue;
      dist[nv]=w;
      q.emplace(nv,w);
    }
  }
  
  ll a=0, b=0;
  rep(i,n){
    if(dist[i]==1) a++;
    else b++;
  }
  
  if(a>b) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
  
}

Measured memory_bytes: 7424
mod = 998244353

n, k = map(int, input().split())

s = []
for _ in range(k):
    l, r = map(int, input().split())
    s.append((l, r))

dp = [0] * (n + 1)
dp[1] = 1
for i in range(2, n+1):
    for l, r in s:
        jl = max(i - l, 0)
        jr = max(i - r - 1, 0)
        dp[i] = (dp[i] + dp[jl] - dp[jr]) % mod
    dp[i] += dp[i-1]
print((dp[n] - dp[n-1]) % mod)


Measured memory_bytes: 75156
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int b[4000006];

int main() {
    ios::sync_with_stdio(false);
    b[0] = -1;
    int n, a[2003] = {}, c = 0;
    cin >> n;
    fr(n) cin >> a[0], a[a[0]]++;
    //fr1(n) a[i]++;
    fr1(2000) if (a[i]) {
        int ai = a[i] * i;
        c += ai;
        for (int j = 0; j < i; j++) {
            int l = -10000006;
            for (int k = j; k <= c; k += i) {
                if (b[k] && b[k] < i) l = k;
                else if (l + ai >= k) b[k] = i;
            }
        }
    }
    for (int i = (c - 1) / 2 + 1; ; i++) if (b[i]) {
        cout << i;
        return 0;
    }
    //fr(20) cout << b[i] << ' ';
}


Measured memory_bytes: 15488
def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

n = inp[0]
v = inp
h1 = Hash.new(0)
h2 = Hash.new(0)
v.each.with_index do|d, i|
  if(i.even?)
    h2[d] += 1
  else
    h1[d] += 1
  end
end
a = h1.to_a.map{|u|[u[1],u[0]]}.sort.reverse+[[0,-1]]
b = h2.to_a.map{|u|[u[1],u[0]]}.sort.reverse+[[0,-1]]
if(a[0][1] == b[0][1])
  puts n - [a[0][0]+ b[1][0],a[1][0] + b[0][0]].max
  exit
end
puts n - a[0][0] - b[0][0]

Measured memory_bytes: 27028
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve(){
	int i, j, k, p, q, r, x, y, u, v, n, m;
    string s;
    u=0;
    cin>>s;
    v=0;
    for(i=0;i<s.length();i++){
        if(s[i]=='R'){
            u+=1;
        }
        else{
            u=0;
        }
        v=max(v,u);
    }
cout<<v<<endl;

}

int main() {
	ios_base::sync_with_stdio(0);
	int i,t=1;
	//cin>>t;
	for(i=1;i<=t;i++){
		solve();
	}
	return 0;
}

int mpow(int base, int exp) {
	base %= mod;
	int result = 1;
	while (exp > 0) {
		if (exp & 1) result = ((ll)result * base) % mod;
		base = ((ll)base * base) % mod;
		exp >>= 1;
	}
	return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}




Measured memory_bytes: 10640
/*
*	how_many_islands.cpp
*	by otaks , 2010-06-20
*/
#include <iostream>
#include <string>

using namespace std;

const int w=12,h=12;
int dx[] = {-1, 1, 0, 0};
int dy[] = { 0, 0,-1, 1};
string map[20];

void check(int x , int y){
	int mx,my;

	for(int i=0 ; i<4 ; i++){//üÍ4ûüð²×é
		mx = x + dx[i];
		my = y + dy[i];

		//tB[hOÉoÄ¢È¯êÎ²×é(0ÈãE³Èà)
		if(mx>=0 && mx<w && my>=0 && my<h){
			if(map[my][mx]=='1'){//¾Á½ç
				map[my][mx] = '2';//ñdÉ²×È¢½ßÉÊÌlðüêé
				check( mx , my );
			}
		}
	}
}

int main(){
	int count;//ÌðJEg·éÏ
	bool flag = false;

	while(1){
		//ÏÌú»
		count = 0;

		//tB[hª©C©ÌîñðüÍ
		for(int y=0 ; y<h ; y++){
			if(cin >> map[y]);
			else{
				flag = true;
				break;
			}
		}
		if(flag)break;

		for(int y=0 ; y<h ; y++){
			for(int x=0 ; x<w ; x++){
				if(map[y][x]=='1'){//¾Á½çÄAÖðÄÑo·
					map[y][x] = '2';
					count++;
					check( x , y );
				}
			}
		}

		//¦ÌoÍ
		cout << count << endl;
	}

	return 0;
}

Measured memory_bytes: 0
M, K = map(int, input().split())

if M == 1:
    if K == 0:
        print("1 1 0 0")
    else:
        print(-1)
elif 2**M > K:
    X = list(range(K)) + list(range(K+1, 2**M))
    ans = " ".join(map(str, X + [K] + X[::-1] + [K]))
    print(ans)
else:
    print(-1)

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

using namespace std;

void doc() {
    freopen("OB.inp", "r", stdin);
    freopen("OB.out", "w", stdout);
}

const   int MaxN = 1e5 + 5;
int n, m, deg[MaxN], f[MaxN];
vector<int> a[MaxN];

void solve(){
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        x--; y--;
        a[x].push_back(y);
        deg[y]++;
    }

    queue<int> q;
    while(!q.empty()) q.pop();
    for(int i = 0; i < n; i++)
        if (deg[i] == 0) q.push(i);

    memset(f, 0, sizeof(f));
    while(!q.empty()){
        int u = q.front();
        q.pop();
        for(int v : a[u]){
            f[v] = max(f[v], f[u] + 1);
            deg[v]--;
            if (deg[v] == 0) q.push(v);
        }
      //  cout << u << " " << f[u] << '\n';
    }

    int res = 0;
    for(int i = 0; i < n; i++)
        res = (res < f[i]) ? (f[i]) : (res);
    cout << res;
}

int main()
{
//    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
   // doc();
    solve();
}



Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  multiset<string> mset;
  string s;
  int maxlen = 0, maxc = 0;
  string ans, ans2;
  while(cin>>s) {
    mset.insert(s);
    if (maxlen<s.length()) {
      maxlen = s.length();
      ans2 = s;
    }
    if (maxc<mset.count(s)) {
      maxc = mset.count(s);
      ans = s;
    }
  }
  cout << ans << " " << ans2 << endl;
  
  
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

int main() {
    int n;
    cin >> n;
    int x[n];
    for(int i = 0; i < n; i++) cin >> x[i];
    int y[n];
    for(int i = 0; i < n; i++) cin >> y[i];
    
    double a1 = 0;
    double a2 = 0;
    double a3 = 0;
    double al = 0;
    for(int i = 0; i < n; i++){
        a1 += abs(x[i]-y[i]);
        a2 += pow(abs(x[i]-y[i]),2);
        a3 += pow(abs(x[i]-y[i]),3);
        if(al < abs(x[i]-y[i])) al = abs(x[i]-y[i]);
    }
    a2 = pow(a2,0.5);
    a3 = pow(a3,0.3333333333);
    cout << fixed << setprecision(6) << a1 << endl;
    cout << fixed << setprecision(6) << a2 << endl;
    cout << fixed << setprecision(6) << a3 << endl;
    cout << fixed << setprecision(6) << al << endl;
    return 0;
}



Measured memory_bytes: 3468
#include<stdio.h>
#define N 1000

void swap(int a[],int x,int y){
	int temp=a[x];
	a[x]=a[y];
	a[y]=temp;
	return;
}



int main(){
	int n,q,i;
	int a[N];
	int x,y;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	
	scanf("%d",&q);
	
	for(i=0;i<q;i++){
		scanf("%d %d",&x,&y);
		
		for(int j=x;j<(x+y)/2;j++)swap(a,j,y-(j-x)-1);
		
	}
	
	for(i=0;i<n-1;i++)printf("%d ",a[i]);
	printf("%d\n",a[n-1]);
	
	return 0;
	
}


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

using namespace std;

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

  int32_t N, Q;
  string S;

  cin >> N >> S >> Q;

  while (Q--) {
    int32_t K, SD = 0, SM = 0;
    int64_t ans = 0, sum = 0;

    cin >> K;

    for (int i = 0; i < N; i++) {
      if (i >= K) {
        if (S[i - K] == 'D') {
          SD--;
          sum -= SM;
        }
        else if (S[i - K] == 'M')
          SM--;
      }

      if (S[i] == 'D')
        SD++;
      else if (S[i] == 'M') {
        SM++;
        sum += SD;
      }
      else if (S[i] == 'C')
        ans += sum;
    }

    cout << ans << '\n';
  }

  return 0;
}


Measured memory_bytes: 1948
#include<bits/stdc++.h>
#define LL long long
#define dl double
template <class T>
void rd(T &x){
  x=0;T f=1;char ch=getchar();
  while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch<='9' && ch>='0')x=x*10+ch-'0',ch=getchar();x*=f;
}

using namespace std;

int get(int x){
 if(x >= 1800)return 1;
 if(x >= 1600)return 2;
 if(x >= 1400)return 3;
 if(x >= 1200)return 4;
 if(x >= 1000)return 5;
 if(x >=  800)return 6;
 if(x >=  600)return 7;
 return 8;
}

int main(){
 // freopen("in.txt","r",stdin);
 // freopen("o.txt","w",stdout);
 int x;
 rd(x);
 printf("%d\n",get(x));
 return 0;
}
/**/

Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = (1e9)+7;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  ll k,a,b;
  cin>>k>>a>>b;
  ll o = k;
  k-=a-1;
  ll tot = a;
  if(k<=0){
  	cout<<o+1<<endl;
  }else{
  	if(b-a>=2){
  		tot+=(b-a)*(k/2);
  		tot+=(k%2);
  		cout<<tot<<endl;
  	}else{
  		cout<<o+1<<endl;
  	}
  }
}  


Measured memory_bytes: 256
//~ #include <cmath>
//~ #include <cassert>
#include <iostream>
//~ #include <iomanip>
//~ #include <map>
//~ #include <set>
//~ #include <vector>
//~ #include <algorithm>
#include <queue>
//~ #include <cstring>

using namespace std;

#define forsn(i,s,n) for (int i = (s);i < (int)(n);i++)
#define forn(i,n) forsn(i,0,n)
#define dforsn(i,s,n) for (int i = (n-1);i >= (int)(s);i--)
#define dforn(i,n) dforsn(i,0,n)
#define all(v) (v).begin(), (v).end()
#define F first
#define S second
#define dbg(x) cerr << #x << " = " << x << endl

typedef long long int tint;

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

	tint x, y; cin >> x >> y;
	
	tint res = 1;
	while (x <= y) {
		x *= 2;
		res += (x <= y);
	}
	
	cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define tr(con, it) \
    for (auto it = con.begin(); it != con.end(); it++)
#define present(con, ele) (con.find(ele) != con.end())
#define cpresent(con, ele) (find(all(con), ele) != con.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double lf;
typedef pair<int, int> pi;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
int32_t main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k, ans = 0;
    cin >> n >> k;
    vint a(n);
    fr(i, 0, n) cin >> a[i];
    sort(all(a));
    fr(i, 0, k) ans += a[i];
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<int,P> PP;
struct edge { int to, cor; };
int a[114514][3];
int dp[114514][5];
signed main() {
	int n; cin >> n;
	rep(i, n)cin >> a[i][0] >> a[i][1] >> a[i][2];
	dp[0][0] = a[0][0];
	dp[0][1] = a[0][1];
	dp[0][2] = a[0][2];

	for (int i = 1; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (j == k)continue;
				dp[i][k] = max(dp[i][k], dp[i - 1][j] + a[i][k]);
			}
		}
	}
	cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]) << endl;
}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

string a[10]={"pon","pon","hon","bon","hon","hon","pon","hon","pon","hon"};

int main(){
    string s; cin >> s;
    int n=s[s.length()-1]-'0';
    cout << a[n] << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

signed main(){
	int n;
	scanf("%lld", &n);
	if(n < 1200)printf("ABC\n");
	else if(n < 2800)printf("ARC\n");
	else printf("AGC\n");
	return 0;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int count=0;
  if(N%2==1)cout<<"No"<<endl;
  else{
	rep(i,N/2){
     if(s.at(i)== s.at(N/2+i) )count++; 
    }
    if(count==N/2)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
   

}

Measured memory_bytes: 256
#include <stdio.h>

typedef struct { char s; int v; } Card;

void card_swap(Card *a, Card *b)
{
	Card t = *a; *a = *b; *b = t;
}

void card_print(Card *cards, int n)
{
	for(int i = 0; i < n - 1; ++i)
	{
		printf("%c%d ", cards[i].s, cards[i].v);
	}
	printf("%c%d\n", cards[n-1].s, cards[n-1].v);
}

void bubble_sort(Card *cards, int n)
{
	for(int i = 0; i < n; ++i)
	{
		for(int j = n - 1; j > i; --j)
		{
			if(cards[j].v < cards[j-1].v)
			{
				card_swap(&cards[j], &cards[j-1]);
			}
		}
	}
}

void select_sort(Card *cards, int n)
{
	for(int i = 0; i < n; ++i)
	{
		int minj = i;
		for(int j = i + 1; j < n; ++j)
		{
			if(cards[j].v < cards[minj].v)
			{
				minj = j;
			}
		}
		card_swap(&cards[i], &cards[minj]);
	}
}

int main()
{
	int n, match;
	Card b[36], s[36];
	
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
	{
		char input[4];
		scanf("%s", input);

		b[i].s = s[i].s = input[0];
		b[i].v = s[i].v = input[1] - '0';
	}
	
	bubble_sort(b, n);
	select_sort(s, n);
	
	match = 1;
	for(int i = 0; i < n; ++i)
	{
		if(b[i].s != s[i].s)
		{
			match = 0;
			break;
		}
	}
	
	card_print(b, n);
	printf("Stable\n");
	card_print(s, n);
	printf(match ? "Stable\n" : "Not stable\n");
}



Measured memory_bytes: 2040
//*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define MAX2 0x3f3f3f3f3f3f3f3fll
#define ERR 1e-10
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

int n;
pll a[200000];
int px, py;
ll d;

map<ll, set<pll>> xmq, ymq;
map<ll, map<ll, ll>> xmq2, ymq2;

int main()
{
	int i, j, k, l;
	cin>>n>>px>>py, px--, py--;
	for(i=0;i<n;i++) scanf("%lld%lld", &a[i].first, &a[i].second), tie(a[i].first, a[i].second)=mp(a[i].first+a[i].second, a[i].first-a[i].second);
	d=max(abs(a[px].first-a[py].first), abs(a[px].second-a[py].second));
	vector<int> v;
	v.push_back(px), v.push_back(py);
	for(i=0;i<n;i++)
	{
		if(i != px && i != py)
		{
			xmq[a[i].first].emplace(a[i].second, i);
			ymq[a[i].second].emplace(a[i].first, i);
		}
		xmq2[a[i].first][a[i].second]++;
		ymq2[a[i].second][a[i].first]++;
	}
	for(auto &e : xmq2)
	{
		e.second[-MAX2]=e.second[MAX2]=0;
		ll now=0;
		for(auto &f : e.second)
		{
			now+=f.second;
			f.second=now;
		}
	}
	for(auto &e : ymq2)
	{
		e.second[-MAX2]=e.second[MAX2]=0;
		ll now=0;
		for(auto &f : e.second)
		{
			now+=f.second;
			f.second=now;
		}
	}
	for(i=0;i<v.size();i++)
	{
		int now=v[i];
		ll x=a[now].first, y=a[now].second;
		set<ll> xnew;
		auto ix=xmq[x-d].lower_bound(mp(y-d, -MAX));
		for(;ix != xmq[x-d].end() && ix->first <= y+d;ix++)
		{
			xnew.insert(ix->second);
		}
		ix=xmq[x+d].lower_bound(mp(y-d, -MAX));
		for(;ix != xmq[x+d].end() && ix->first <= y+d;ix++)
		{
			xnew.insert(ix->second);
		}
		ix=ymq[y-d].lower_bound(mp(x-d, -MAX));
		for(;ix != ymq[y-d].end() && ix->first <= x+d;ix++)
		{
			xnew.insert(ix->second);
		}
		ix=ymq[y+d].lower_bound(mp(x-d, -MAX));
		for(;ix != ymq[y+d].end() && ix->first <= x+d;ix++)
		{
			xnew.insert(ix->second);
		}
		for(auto e : xnew)
		{
			v.push_back(e);
			xmq[a[e].first].erase(mp(a[e].second, e));
			ymq[a[e].second].erase(mp(a[e].first, e));
		}
	}
	ll ans=0;
	for(auto e : v)
	{
		ll x=a[e].first, y=a[e].second;
		auto dodo=[](map<ll, map<ll, ll>> &mq, ll x, ll y1, ll y2)
		{
			if(!mq.count(x)) return 0ll;
			auto ix1=prev(mq[x].lower_bound(y1));
			auto ix2=prev(mq[x].lower_bound(y2+1));
			return ix2->second-ix1->second;
		};
		ans+=dodo(xmq2, x-d, y-d, y+d-1);
		ans+=dodo(ymq2, y+d, x-d, x+d-1);
		ans+=dodo(xmq2, x+d, y-d+1, y+d);
		ans+=dodo(ymq2, y-d, x-d+1, x+d);
	}
	cout<<ans/2<<endl;
	return 0;
}
//*/

Measured memory_bytes: 98808
#include<stdio.h>
bool prime(int x){
  if(x<=1){
    return false;
  }
  for(int loop=2;loop*loop<=x;loop++){
    if(x%loop==0){
      return false;
    }
  }
  return true;
}
signed main(void){
  int x;
  scanf("%d",&x);
  int p=x;
  while(!prime(p)){
    p++;
  }
  printf("%d\n",p);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<double> v(N);
  for(int i = 0; i < N; i++) cin >> v[i];

  sort(v.begin(), v.end());
  for(int i = 0; i < N-1; i++){
    v[i+1] = (v[i] + v[i+1])/2.0;
  }

  cout << v[N-1] << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    REP(i, N){
        if(A[i] % 2 == 0){
            if(A[i] % 3 && A[i] % 5){
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}


Measured memory_bytes: 256
////#include<iostream>
////#include<set>
////#include<algorithm>
////using namespace std;
////int main()
////{
//////	long long n, k;
//////	long long sum = 0;
//////	multiset< pair<long long, long long> >m;
//////	scanf("%lld%lld", &n, &k);
//////	while(n--)
//////	{
//////		long long a, b;
//////		scanf("%lld%lld", &a, &b);
//////		m.insert(make_pair(a, b));	
//////	}
//////	for(auto it = m.begin();it!=m.end();it++)
//////	{
//////		sum += it->second;
//////		if(sum >= k)
//////		{
//////			cout << it->first << endl;
//////			break;			
//////		}
//////	}	
////
////set<int> a = {0,1,2,9};
////set<int> b = {3,4,5};
////auto first = b.begin();
////auto second = b.end();
////a.insert(first,second);
////for(auto it = a.begin();it != a.end();it++)	
////cout<<*it;
////	return 0;
////}
//
//#include<iostream>
//#include<set>
//#include<algorithm>
//using namespace std;
//int main()
//{
//	unordered_set<int> a{1,2,4,9};
//unordered_set<int> b{3,4,5};
//auto first = b.begin();
//auto second = b.end();
//a.insert(first,second);
//for(auto it = a.begin();it != a.end();it++)	
//cout << *it;
//return 0;
//}
# include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
multiset<pair<LL, LL> >s;
int main()
{
    LL n, k, a, b;
    scanf("%lld%lld",&n,&k);
    while(n--)
    {
        scanf("%lld%lld",&a,&b);
        s.insert(make_pair(a, b));
    }
    LL sum = 0;
    for(auto it = s.begin(); it!=s.end(); ++it)
    {
        sum += it->second;
        if(sum >= k)
            return 0*printf("%d\n",it->first);
    }
    return 0;
}

Measured memory_bytes: 6528
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	long double n;
	cin >> n;
	cout << fixed << setprecision(100) << ((n-floor(n/2))/n) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> void vector_print(vector<T> vec) {
  for (unsigned int i = 0; i < vec.size(); i++) {
    cout << vec.at(i);
    if (i < vec.size()-1) {
      cout << " ";
    } else if (i == vec.size()-1) {
      cout << endl;
    }
  }
}

int main() {
  int n, A;
  cin >> n;
  vector<int> cnt(n, 0);
  for (int i = 0; i < n-1; i++) {
    cin >> A;
    cnt[A-1] = cnt[A-1] + 1;
  }
  for (int i = 0; i < n; i++) {
    cout << cnt[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 4052
#include<stdio.h>
#include<string.h>
int main()
{
    int i,j,a[1000]={0};
    char s[1000];
    scanf("%s",s);
    for(i=0;i<strlen(s);i++)
    {
        a[s[i]]++;
    }
    for(i=97;i<=122;i++)
    {
        if(a[i]%2!=0)
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	int N;
	string s, t;
	cin >> N >> s >> t;
	
	int ans = 2 * N;
	for (int x = N; x > 0; --x) {
		if (s.substr(N - x) == t.substr(0, x)) {
			ans = min(ans, 2 * N - x);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int a,b;
  int coin = 0;
  scanf("%d %d", &a, &b);
  for(int i=1; i <= 2; i++){
    if(a > b){
      coin = coin + a;
      a--;
    } else if(b > a){
      coin = coin + b;
      b--;
    } else {
      coin = coin + a;
      a--;
    }
  }
  printf("%d", coin);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if(a+b > c+d) {
    cout << "Left" << endl;
  }
  
  else if(a+b < c+d) {
    cout << "Right" << endl;
  }
  
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <cmath>
#include <queue>
typedef long long ll;
using namespace std;

int main(void){
    string S, T, U;
    int A, B;
    cin >> S >> T;
    cin >> A >> B;
    cin >> U;
    
    if(U==S){
        cout << A-1 << " " << B << endl;
    } else{
        cout << A << " " << B-1<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>

using namespace std;

typedef unsigned long long ULL;

struct Pattern {
    bool permit;
    ULL src, dst, smask, dmask;
    Pattern() : src(0), dst(0), smask(~0LL), dmask(~0LL) {}
};

int main() {
    while(true) {
        int N, M;
        cin >> N >> M;
        if(!N && !M) break;

        vector<Pattern> rules;

        for(int i = 0; i < N; ++i) {
            string cmd, src, dst;
            cin >> cmd >> src >> dst;
            Pattern pat;

            for(int j = 0; j < 8; ++j) {
                if(src[j] != '?') pat.src |= (ULL)(src[j]-'0') << (7-j)*8;
                else pat.smask ^= (ULL)0xff << (7-j)*8;
                if(dst[j] != '?') pat.dst |= (ULL)(dst[j]-'0') << (7-j)*8;
                else pat.dmask ^= (ULL)0xff << (7-j)*8;
            }
            pat.permit = (cmd == "permit");
            rules.push_back(pat);
        }

        vector<string> allowed;
        for(int i = 0; i < M; ++i) {
            string src, dst, msg;
            cin >> src >> dst >> msg;
            ULL srcpat = 0, dstpat = 0;

            for(int j = 0; j < 8; ++j) {
                srcpat |= (ULL)(src[j]-'0') << 8*(7-j);
                dstpat |= (ULL)(dst[j]-'0') << 8*(7-j);
            }
//            printf("%llx %llx\n", srcpat, dstpat);

            bool denied = true;
            for(int j = rules.size()-1; j >= 0; --j) {
                if((srcpat & rules[j].smask) == rules[j].src &&
                   (dstpat & rules[j].dmask) == rules[j].dst) {
                    denied = !rules[j].permit;
                    break;
                }
            }
            if(denied) continue;
            allowed.push_back(src + " " + dst + " " + msg);
        }

        cout << allowed.size() << endl;
        for(int i = 0; i < allowed.size(); ++i) {
            cout << allowed[i] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1008
# coding: utf-8
# Your code here!
L=input()

N=len(L)

dp=[[0 for i in range(2)] for j in range(N)]
dp[0][0]=1
dp[0][1]=2
#print(dp)

mod=10**9+7
for i in range(N-1):
    dp[i+1][0]=(3*dp[i][0]+(0 if L[i+1]=="0" else dp[i][1]))%mod
    dp[i+1][1]=(dp[i][1] if L[i+1]=="0" else 2*dp[i][1])%mod


#print(dp)
print((dp[-1][0]+dp[-1][1])%mod)



Measured memory_bytes: 25508
n,k=map(int,input().split())
s=input()

if 2<=k<n:
  print(s[:k-1] + chr(ord(s[k-1])+32) + s[k:n])
elif k==1:
  print(chr(ord(s[0])+32) + s[1:n])
else:
  print(s[:n-1] + chr(ord(s[n-1])+32))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{
    int[] mny = {100, 500, 1000};

    Main(){
	Scanner sc = new Scanner(System.in);
	int[] res = new int[3];

	while(sc.hasNext()){
	    int a = sc.nextInt(), b = sc.nextInt();
	    if(a+b == 0) break;
	    b -= a;

	    for(int i = 2; i >= 0; i--){
		res[i] = b/mny[i];
		b %= mny[i];
	    }

	    System.out.print(Integer.toString(res[0]));
	    for(int i = 1; i < 3; i++)
		System.out.print(" "+Integer.toString(res[i]));
	    System.out.println();
	}
    }

    public static void main(String[] args){
	new Main();
    }
}

Measured memory_bytes: 12000
fun main(args: Array<String>) {
    val (n,m) = readLine()!!.split(" ").map { it.toInt() }
    val h = readLine()!!.split(" ").map { it.toInt() }
    val results = Array<Boolean>(n) { true }
    repeat(m) {
        val (a,b) = readLine()!!.split(" ").map { it.toInt() }
        if (h[a-1] <= h[b-1]) results[a-1] = false
        if (h[b-1] <= h[a-1]) results[b-1] = false
    }
    println(results.count { it })
}



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

int main() {
	long long int n,sum;
		
	cin>>n;
   sum=9999999999999;
        for(long long int i=1;i*i<=n;i++){
            if(n%i==0){
                long long int minsum=i+n/i-2;
                if(sum>minsum)
                sum=minsum;
            }
        } 
	       cout<<sum;
	       
	    
	
	return 0;
}


Measured memory_bytes: 3600
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main()
{
  string s;
  cin>>s;
  int cnt=0;
  for(int i=0; i<3; i++)
  {
      if(s[i]=='o') ++cnt;
  }
  cout<<700+100*cnt<<endl;
}


Measured memory_bytes: 256