akhauriyash/Code-Regression huggingface dataset:
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 50;
int n, m;
string a[MAX_N];
string b[MAX_N];

int main() {
    fastio();

    cin >> n >> m;
    forn(i, n) cin >> a[i];
    forn(i, m) cin >> b[i];

    forn(i, n) forn(j, n) {
        if (i + m > n || j + m > n) continue;
        bool ok = true;
        forn(k, m) forn(l, m) {
            ok &= a[i + k][j + l] == b[k][l];
        }

        if (ok) {
            cout << "Yes\n";
            return 0;
        }
    }

    cout << "No\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

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

  string  A, B ; cin >> A >> B ;
  reverse(all(A));
  if(A==B) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,a[100001];
ll f[100001],b[100001],ans;
ll gcd(ll a,ll b)
{
	if (b==0) return a;
	return gcd(b,a%b);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for (int i=0;i<n;++i)
	{
		cin>>a[i];
		if (i==0) f[i]=a[i];
		if (i!=0) f[i]=gcd(f[i-1],a[i]);
	}
	b[n-1]=a[n-1];
	for (int i=n-2;i>=0;--i) b[i]=gcd(a[i],b[i+1]);
	for (int i=0;i<n;++i)
	{
		ll t;
		if (i==0) t=b[1];
		else if (i==n-1) t=f[n-2];
		else t=gcd(f[i-1],b[i+1]);
		ans=max(ans,t);
	}
	cout<<ans;
	return 0;
}

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

int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
    int small=max(a,c);
  	int big=min(b,d);
    if(small>big)
      cout<<"0"<<endl;
	else
      cout<<big-small<<endl;
  
  
  
  
}  

Measured memory_bytes: 256
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
#import numpy as np
from itertools import product
def main():
    n, m, x = map(int, input().split())
    books = []
    for _ in range(n):
        books.append(tuple(map(int, input().split())))
    p = tuple(product((0, 1), repeat=n))
    r = float('inf')
    for pe in p:
        effects = [0] * (m + 1)
        for i1 in range(n):
            if pe[i1]:
                for i2 in range(m+1):
                    effects[i2] += books[i1][i2]
        if all([e >= x for e in effects[1:]]):
            r = min(r, effects[0])
    if r == float('inf'):
        print(-1)
    else:
        print(r)

if __name__ == '__main__':
    main()


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

int n, h[100010], l[100010], r[100010], st[100010];
signed main(void)
{
  cin >> n;
  REP(i, n) cin >> h[i];
  int t = 0;
  REP(i, n) {
    while(t>0 && h[st[t-1]] >= h[i]) t--;
    l[i] = t == 0 ? 0 : (st[t-1]+1);
    st[t++] = i;
  }
  t = 0;
  for(int i=n-1; i>=0; --i) {
    while(t > 0 && h[st[t-1]] >= h[i]) t--;
    r[i] = t == 0 ? n : st[t-1];
    st[t++] = i;
  }
  ll ret = 0;
  REP(i, n) ret = max(ret, (ll)h[i]*(r[i]-l[i]));
  cout << ret << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl

int main(){
    int n,i,c;
    vi primes(998);
    cin>>n;
    REP(i,1,n+1){
        c=i;
        int p=2;
        while(c!=1){
            if(c%p)p++;
            else{
                c/=p;
                primes[p]++;
            }
        }
    }
    ll ans=1;
    REP(i,998){
        if(primes[i]){
            ans*=primes[i]+1;
            ans%=MOD;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	N*=3;
	vector<int> A(N);
	rep(i,N)cin >> A[i];
	sort(ALL(A));
	ll ans = 0;
	for(int i=0;i<N/3;i++){
		int left = A[i];
		int sec  = A[(N-2)-i*2];
		ans += sec;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1408
import bisect,sys
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac =fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % mod) % mod
        
    return CONV()



sys.setrecursionlimit(200005)

def main():
    N,K = isRaw()
    modN = N%K
    return min(modN,abs(K-modN))

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


Measured memory_bytes: 38256
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <chrono> 
using namespace std::chrono;
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_mset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fr(i,a,b) for (ll i=(a); i<(b);++i)
#define frr(i,a,b) for(ll i=(a-1);i>=(b);--i)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define F first
#define S second
#define pii pair<ll,ll> 
#define rev(a) reverse(a.begin(),a.end())
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.begin(),a.end(),greater<ll>())
#define sz(a) (ll)a.size()
#define endl "\n"
#define po(a,b) (ll)(pow(a,b)+0.5)
#define double long double
#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
#define setbits(a) __builtin_popcount(a)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll M=1e9+7;
const ll mxx=1e6+5;

int main()
{  
     
    fast
  
   int n;
   cin>>n;
   int a[n];
   fr(i,0,n)cin>>a[i];

   ll ans=0;
   fr(i,1,n){
     
      if(a[i]<a[i-1])
      {
         int cur=a[i-1]-a[i];
         a[i]=a[i-1];
         ans+=cur;
      }
   }
   cout<<ans;
}

Measured memory_bytes: 4372
N = int(input())
s = input()
numE = s.count('E')
numW = 0
answer = numE
for i in range(N):
    if s[i] == 'W':
        answer = min(answer, numE + numW)
        numW += 1
    else:
        numE -= 1
        answer= min(answer, numE + numW)
 
print(answer)

Measured memory_bytes: 3700
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> v(100, 0);
    rep(i, m*2){
        int a;
        cin >> a;
        v[a]++;
    }
    for(int i = 1; i <= n; i++){
        cout << v[i] << endl;
    }
    return 0;
}

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

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)
#define sz(x) int32_t(x.size())

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// --------------------------------------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9 + 7;
const int INF = 2e18;
const ld EPS = 1e-9;
const int NN = 2e5 + 2;
map<int, int> cnt;
vi a(NN);
void solve() {
      int i = 0, j = 0, k = 0, n = 0, m = 0; 
      cin >> n;

      fr(i, 1, n+1) {
            cin >> a[i];
      }

      fr(i, 1, n+1) {
            if(cnt.count(i - a[i]))
                  m += cnt[i - a[i]];
            
            cnt[i + a[i]]++;
      }
      cout << m << endl;
}

int32_t main() {
      ios::sync_with_stdio(false); cin.tie(0); 
      int T = 1; 
      // cin >> T;
      for(int tc = 1; tc <= T; tc++) {
            solve();
       }
      return 0;
}

Measured memory_bytes: 17096
A,B=map(int,input().split())
S=input()
flag=False
for i in range(len(S)):
  if i!=A and ((ord(S[i])-ord('0'))<0 or 9<(ord(S[i])-ord('0'))):
    break
  if i==A and S[i]!='-':
    break
  
  if i==len(S)-1:
    flag=True
    
if flag:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
string to_string(string s) {
  return '"' + s + '"';
}
string to_string(const char* s) {
  return to_string((string) s);
}
string to_string(bool b) {
  return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifndef ONLINE_JUDGE
#define show(...) cerr << "[" << #__VA_ARGS__ << "] :", debug_out(__VA_ARGS__)
#else
#define show(...) 42
#endif
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define  oo 1e15
#define limit 1000000007
#define two pair<int,int>
#define ll long long int
#define int long long int
#define mod(x,m) ((x%m+m)%m)
#define all(v) v.begin(),v.end()
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define fori(x,n) for(int i = x; i < n; i++)
#define forj(y,m) for(int j = y; j < m; j++)
#define fork(z,p) for(int k = z; k < p; k++)
#define speedforces std::ios::sync_with_stdio(false)
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file  freopen("output.txt", "w", stdout);

int dp[105][100005];

signed main(){
  //input_from_file;
  speedforces;
  int n,w; cin>>n>>w;
  int wi[n+1] , vi[n+1];
  fori(1,n+1) cin>>wi[i]>>vi[i];
  memset(dp,0,sizeof dp);
  fori(1,n+1) forj(1,w+1){
   dp[i][j] = dp[i-1][j];
   if(wi[i] <= j)
   dp[i][j] = max(dp[i][j],dp[i-1][j-wi[i]]+vi[i]);
  }
  cout<<dp[n][w];
 }


Measured memory_bytes: 82304
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int f(int n) {
  int sum = 0;
  for(int i = 1; i<=n; i++) {
    sum += i;
  }
  return sum;
}


int main() {
  int a, b;
  cin >> a >> b;
  int x = b - a;
  cout << f(x) - b << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include<string>
using namespace std;

int main(){
    string s;
    cin >> s;
    if(s=="SUN"){
        cout << 7 << endl;
    }
    if(s=="MON"){
        cout << 6 << endl;
    }
    if(s=="TUE"){
        cout << 5 << endl;
    }
    if(s=="WED"){
        cout << 4 << endl;
    }
    if(s=="THU"){
        cout << 3 << endl;
    }
    if(s=="FRI"){
        cout << 2 << endl;
    }
    if(s=="SAT"){
        cout << 1 << endl;
    }
    return 0;
}



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

const int N = 100009;

int a[N], b[N], c[N];
LL f[N];


int main()
{
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);
    for(int i = 0; i < n; i++) scanf("%d", &b[i]);
    for(int i = 0; i < n; i++) scanf("%d", &c[i]);
    sort(a, a+n);
    sort(b, b+n);
    sort(c, c+n);
    LL ans = 0;

    for(int i = 0; i < n; i++)
    {
        if(b[i] >= c[n-1]) break;
        f[i+1] = 1ll*n - (upper_bound(c, c+n, b[i]) - c);
    }
    f[0] = 0;
    for(int i = 1; i <= n; i++) f[i] += f[i-1];

    for(int i = 0; i < n; i++)
    {
        if(a[i] >= b[n-1]) break;
        int s = upper_bound(b, b+n, a[i]) - b;
        ans += f[n] - f[s];
    }

    printf("%lld\n", ans);
    return 0;



}




Measured memory_bytes: 2176
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define ld long double
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void fx(vector<int> &a,int n, int m){

}

// -----------------------------------------------------------------------

int arr[3000000];
void input(int n){
	for(int i=0;i<n;++i)
	cin>>arr[i];
}

// -----------------------------------------------------------------------



void q1(){
	
	int a=0,b=0;
	int t;
	for(int i=0;i<3;++i){
		cin>>t;
		if(t==5)
		a++;
		else if(t==7)
		b++;
	}
	if(a==2 && b==1)
	cout<<"YES\n";
	else 
	cout<<"NO\n";
}
// -----------------------------------------------------------------------


void q2(){
	int n,l;
	cin>>n>>l;
	vector<string> v(n);
	for(int i=0;i<n;++i)
	cin>>v[i];
	sort(all(v));
	for(int i=0;i<n;++i)
	cout<<v[i];
	cout<<endl;
}

// -----------------------------------------------------------------------

void q3(){
	int n,k;
	cin>>n>>k;
	int brr[10];
	for(int i=0;i<10;++i)
	brr[i]=1;
	while(k--){
		int t;
		cin>>t;
		brr[t]=0;
	}
	stack<int> st;
	while(n!=0){
		int num=n%10;
		n/=10;
		int next=num;
		while(brr[next]==0){
			next++;next%=10;
		}
		st.push(next);
		if(next<num)
			n++;	//carry	
	}
	while(!st.empty()){
		int t=st.top();
		st.pop();
		cout<<t;
	}
}


// -----------------------------------------------------------------------

void q4(){
	int h,w,A,b;
	cin>>h>>w>>A>>b;
	vector<int> a(w),ret(w),res(w-b);
	for(int i=0;i<w;++i)
	a[i]=1; ret[0]=1;
	int n,m;n=w;m=h-A-1;
	while(m--){
		for(int i=1;i<n;++i){
			ret[i]=ret[i-1]+a[i];
		}
		for(int i=0;i<n;++i){
			a[i]=ret[i];
		}
		ret[0]=1;
	}
	for(int i=0;i<n;++i)
	cout<<a[i]<<" ";
	cout<<endl;
	res[0]=a[b];
	for(int i=b+1;i<n;++i)
	res[i-b]=res[i-b-1]+a[i];
	m=A-1;	ret[0]=res[0];	n=n-b;
	while(m--){
		for(int i=1;i<n;++i){
			ret[i]=ret[i-1]+res[i];
		}
		for(int i=0;i<n;++i){
			res[i]=ret[i];
		}
	} 
	cout<<res[n-1];
}

// -----------------------------------------------------------------------


int32_t main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	q2();
	return 0;
}


Measured memory_bytes: 256
/* D-"Median of Medians" */
/*  */
//include <bits/stdc++.h>
#include <iostream>
#include <deque>
#include <vector>
#include <math.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++) 
using namespace std;

int main(){
    ll n , k,z;
    cin >> n >> k;
    z = n%k;
    if(k - z < z) z = k-z;
    cout << z;
    return 0;
}
    

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))

dp = [float('inf')] * n
dp[0] = 0

for i in range(n):
    if i < n - 2:
        dp[i+2] = min(dp[i+2], dp[i]+abs(h[i] - h[i+2]))
        dp[i+1] = min(dp[i+1], dp[i]+abs(h[i] - h[i+1]))
    elif i == n - 2:
        dp[i+1] = min(dp[i+1], dp[i]+abs(h[i] - h[i+1]))

print(dp[-1])

Measured memory_bytes: 85732
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace ARC095C
{
    public class Program
    {
        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var N = ss.Next(int.Parse);
            var X = ss.Next(int.Parse, N);
            var seq = X.OrderBy(x => x).ToArray();
            var midLeft = seq[seq.Length / 2 - 1];
            var midRight = seq[seq.Length / 2];

            foreach (var x in X) sw.WriteLine(x >= midRight ? midLeft : midRight);
            //---------------------------------
        }

        static void Main()
        {
            var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput()));
            var sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            new Program().Solve(ss, sw);
            sw.Flush();
        }

        static readonly Func<string, string> String = s => s;
    }

    public class StreamScanner
    {
        static readonly char[] Sep = {' '};
        readonly Queue<string> buffer = new Queue<string>();
        readonly TextReader textReader;

        public StreamScanner(TextReader textReader)
        {
            this.textReader = textReader;
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (buffer.Count != 0) return parser(buffer.Dequeue());
            var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries);
            foreach (var nextString in nextStrings) buffer.Enqueue(nextString);
            return Next(parser);
        }

        public T[] Next<T>(Func<string, T> parser, int x)
        {
            var ret = new T[x];
            for (var i = 0; i < x; ++i) ret[i] = Next(parser);
            return ret;
        }

        public T[][] Next<T>(Func<string, T> parser, int x, int y)
        {
            var ret = new T[y][];
            for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);
            return ret;
        }
    }
}

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

using namespace std;
#define ll long long
const int N = 1e6 + 5;
int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n ;
    cin >> n;
    n %= 10;
    if (n == 2 ||n == 4 ||n == 5 ||n == 7   ||n == 9 ) cout << "hon";
    else if (n == 3) cout <<"bon";
    else cout << "pon";
    return 0;
}


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

int main(){
    int N, even;
    cin >> N;
    
    if(N % 2 == 0){
        cout << 0.5000000000 << endl;
    }
    else{
        even = N / 2;
        cout << (double)(N - even) / N << endl;
    }

    return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;

	int n = s.size();

	vector<pair<int, int> > v;

	int cnt = 0;

	for(int i = 0; i < n; ++i) {
		if(i == 0 || s[i] == s[i - 1]) {
			++cnt;
		} else {
			v.emplace_back(cnt, s[i - 1] == '>' ? 1 : -1);
			cnt = 1;
		}
	}
	v.emplace_back(cnt, s[n - 1] == '>' ? 1 : -1);

	long long ans = 0;

	for(int i = 0; i < (int)v.size(); ++i) {
		ans += 1LL * (v[i].first - 1) * v[i].first / 2;
	}

	for(int i = 0; i < (int)v.size() - 1; ++i) {
		if(v[i].second == -1 && v[i + 1].second == 1) {
			ans += max(v[i].first, v[i + 1].first);
		}
	}

	if(*s.begin() == '>') {
		ans += v.begin() -> first;
	}

	if(s.back() == '<') {
		ans += v.back().first;
	}

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

Measured memory_bytes: 3068
#include <iostream>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;

  if(a*b==15) {
    cout << "*" << endl;
  } else if(a+b == 15 ) {
    cout << "+" << endl;
  } else {
    cout << "x" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double[] v = new double[n];
		for (int i = 0; i < n; ++i) {
			v[i] = sc.nextDouble();
		}
		Arrays.sort(v);
		double cur = v[0];
		for (int i = 1; i < n; ++i) {
			cur = (v[i] + cur) / 2;
		}
		System.out.println(cur);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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

typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;

#define endl '\n'
#define ff first
#define ss second
#define int long long
#define pb push_back
#define f(i,l,r) for(ll i=l;i<=r;i++)
#define rf(i,r,l) for(ll i=r;i>=l;i--)
#define Max 5000001
#define inf 2147483647
#define llinf 9223372036854775807
#define all(v) v.begin(),v.end()
#define bp(n) __builtin_popcountll(n)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

#define d0(a) cout<<a<<' ';
#define d1(a) cout<<a<<endl;
#define d2(a,b) cout<<a<<' '<<b<<endl;
#define d3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define d4(a,b,c,d) cout<<a<<' '<<b<<' '<<c<<' '<<d<<endl;
#define d5(a,b,c,d,e) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<endl;
#define d6(a,b,c,d,e,f) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<endl;

const ll N=2e5+5,mod=1e9+7,bit=61;



signed main()
{
    fast;

    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n,kk;
        cin>>n>>kk;
        ll ans=0;
        f(k,kk,n+1)
        {
            ll mn=((k-1)*k)/2;
            ll mx=(n*(n+1))/2;
            mx-=((n-k)*(n-k+1))/2;
            ans+=(mx-mn+1);
            ans%=mod;
        }
        cout<<ans<<endl;
    }
    return 0;
}


















Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
//---------------------------------------------------------------------------------------------------

int main(void){
    // Your code here!
    string s; cin >> s;
    int n = s.size();
    if (s[n-1] != 's') s += 's';
    else s += "es";
    cout << s << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <istream>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define vec vector<int>a(n)
#define soot(a) sort(a.begin(),a.end())
/*int n;
cin >> n;
vector<int>a(n);
rep0(i, n - 1)cin >> a[i];*/
using namespace std;
int main() {
	string s;
	cin >> s;
	int N = s.length();
	cout << s[0] << N - 2 << s[N - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int x,y,t;

	scanf("%d%d",&x,&y);

	t=4*x;
	for(int i=0;i<=x;i++)
		if(t-i*2==y){
			puts("Yes");
			return 0;
		}
	puts("No");
	return 0;
}

Measured memory_bytes: 1628
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <iomanip>

using namespace std;
typedef long long ll;

void solve() {
	int n;
	cin >> n;
	vector<int> arr(n);
	vector<int> dp(n);
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}

	dp[0] = 0;
	dp[1] = abs(arr[0] - arr[1]);
	for (int i = 2; i < n; i++) {
		dp[i] = min(dp[i - 2] + abs(arr[i - 2] - arr[i]), dp[i - 1] + abs(arr[i - 1] - arr[i]));
	}

	cout << dp[n-1];
}


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

	/*
	int t;
	cin >> t;
	while (t) {
		solve();
		cout << "\n";
		t--;
	}
	*/

}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
#define int long long
#define pb(x) push_back(x)
#define fi first
#define se second
#define mp(x,y) make_pair(x,y);
/*struct comp
{
    bool operator()()
    {
        
    }
};*/

void LIS(int idx,vector<int>&A, vector<vector<int> >&G,vector<int> &ANS,int SIZE, vector<int>&curr, int parent)
{
    ANS[idx]=SIZE;
    
    if(A[idx]>curr[SIZE-1])
    {
        curr[SIZE]=A[idx];
        SIZE++;
        ANS[idx]++;
        for(int i=0;i<G[idx].size();i++)
        {
            if(G[idx][i]==parent) continue;
            
            LIS(G[idx][i],A,G,ANS,SIZE,curr,idx);
        }
    }
    else
    {
        int j=-1;
        int val;
        
        if(curr[0]>A[idx])
        {
            j=0;
            val=curr[0];
            curr[0]=A[idx];
        }
        
        else
        {
            int st=0,e=SIZE-1;
            j=-1;
            while(st<=e)
            {
                int mid=st+(e-st)/2;
                if(curr[mid]>=A[idx])
                {
                    j=mid;
                    e=mid-1;
                }
                else
                {
                    st=mid+1;
                }
            }
            val=curr[j];
            curr[j]=A[idx];
        }
        for(int i=0;i<G[idx].size();i++)
        {
            if(G[idx][i]==parent) continue;
            
            LIS(G[idx][i],A,G,ANS,SIZE,curr,idx);
        }
        curr[j]=val;
    }
    return;
}
int32_t main() {
    
    int N;
    cin>>N;
    vector<int>A(N+1);
    for(int i=1;i<=N;i++)
    cin>>A[i];
    vector<vector<int> >G(N+1);
    for(int i=0;i<N-1;i++)
    {
        int u,v;
        cin>>u>>v;
        G[u].pb(v);
        G[v].pb(u);
    }
    vector<int>ANS(N+1,0);
    vector<int>curr(N);
    ANS[1]=1;
    curr[0]=A[1];
    
    for(int i=0;i<G[1].size();i++)
    {
        LIS(G[1][i],A,G,ANS,1,curr,1);    
    }
    for(int i=1;i<=N;i++)
    {
        cout<<ANS[i]<<endl;
    }
    
    return 0;
}

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

int n;
vector<int> edges[100];

pair<int, size_t> leaves(int u, int v){
    vector<int> level[100];
    bool used[100];
    size_t count[100];
    for(int i=0;i<100;++i){ used[i] = false; count[i] = 0; }
    int col;

    level[0].push_back(u);
    used[u] = true;
    level[0].push_back(v);
    used[v] = true;

    for(col=0;level[col].size();++col){
        for(int v: level[col]){
            count[col] = max(count[col], edges[v].size() - 1);
            for(int to: edges[v]){
                if(used[to]) continue;
                used[to] = true;
                level[col+1].push_back(to);
            }
        }
    }
    size_t ret = 2;
    for(int i=0;count[i];++i) ret *= count[i];
    return {col, ret};
}
pair<int, size_t> leaves(int v){
    vector<int> level[100];
    bool used[100];
    size_t count[100];
    for(int i=0;i<100;++i){ used[i] = false; count[i] = 0; }
    int col;

    level[0].push_back(v);
    used[v] = true;

    for(col=0;level[col].size();++col){
        for(int v: level[col]){
            count[col] = max(count[col], edges[v].size() - 1);
            for(int to: edges[v]){
                if(used[to]) continue;
                used[to] = true;
                level[col+1].push_back(to);
            }
        }
    }
    size_t ret = count[0] + 1;
    for(int i=1;count[i];++i) ret *= count[i];
    return {col, ret};
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    vector<pair<int, int>> e;

    cin >> n;
    for(int i=1;i<n;++i){
        int a, b;
        cin >> a >> b;
        --a; --b;
        edges[a].push_back(b);
        edges[b].push_back(a);
        e.emplace_back(a, b);
    }

    pair<int, size_t> ans = {INT32_MAX, ~0};
    for(auto edge: e) ans = min(ans, leaves(edge.first, edge.second));
    for(int v=0;v<n;++v) ans = min(ans, leaves(v));
    cout << ans.first << " " << ans.second << endl;
   
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int64_t INF=999999999;

int main() {
   int A,B,C;
   cin>>A>>B;
   for(int i=0;i<=3;i++){
      C=i;
      if(A*B*C%2!=0){cout<<"Yes"<<endl;return 0;}
   }
   cout<<"No"<<endl;
return 0;}

Measured memory_bytes: 256
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
def conbination(l1, l2):
  con_l = []
  for i in l1:
    for j in l2:
      con_l.append(i+j)
  con_l.sort(reverse=True)
  con_l = con_l[:k]
  return con_l
ans = []
ans += (conbination(conbination(a, b),c))

ans.sort(reverse=True)
ans = ans[:k]
for i in ans:
  print(i)

Measured memory_bytes: 160212
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n;
    cin>>n;
    vector<ll> p(n);
    for(ll i=0;i<n;++i){
        cin>>p[i];
    }

    ll ans = 0;
    for(ll i=0;i<n;++i){
        if(p[i] == i+1){
            if(i+1 < n){
                swap(p[i], p[i+1]);
            }else{
                swap(p[i], p[i-1]);
            }
            ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 4036
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
using namespace std;
#define ll       long long
#define ull       unsigned long long
#define  sci(x)   scanf("%d", &x)
#define  scl(x)   scanf("%lld", &x)
#define  scd(x)   scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
#define MAX       100000
#define maxn 	  200002
#define pb 		  push_back
#define mk 		  make_pair
#define endl	  "\n"
#define INF 	  1000000000


int main ()
{
		ios::sync_with_stdio(0);
		cin.tie(0);
		//CODE TONOY
		int n,q;
		cin >> n >> q;
		string s;
		cin >> s;
		vector<int> a(maxn);
		for (int i=0 ; i<n ; i++)
		{
			if (i+1<n && s[i]=='A' && s[i+1]=='C')
			a[i+1]=a[i]+1;
			else
			a[i+1]=a[i];
		}
		for (int i=0 ; i<q ; i++)
		{
			int l,r;
			cin >> l >> r;
			l--;
			r--;
			
			cout << a[r]-a[l] << endl;
			
		}
		
		return 0;
}


Measured memory_bytes: 4248
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sstream>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
  
    vector<int> A(M, 0), B(M, 0);

    int K, temp;
    cin >> K;
  
    for(int i = 0; i < K; i++){
        cin >> temp;
        A[temp - 1] = 1;
    }
  	
    for(int i = 0; i < N - 1; i++){
        cin >> K;
        for(int j = 0; j < K; j++){
            cin >> temp;
            B[temp - 1] = 1;
        }
        for(int j = 0; j < M; j++){
            A[j] *= B[j];
        }
        for(int j = 0; j < M; j++){
            B[j] = 0;
        }
    }

    int ans = accumulate(A.begin(), A.end(), 0);

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

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int A, B, C, D, E;
	int second = 0;
	
	cin >> A;
	cin >> B;
	cin >> C;
	cin >> D;
	cin >> E;
	
	if (A < 0){
		while (A != 0){
			second += C;
			A++;
		}
	}
	
	if (A == 0){
		second += D;
	}
	while (A != B){
		second += E;
		A++;
	}
	
	cout << second << endl;
	
	return (0);
}

Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>

class Matryoshika{
public:
    int h, r;

    bool operator<(const Matryoshika& m)const{ return h < m.h; }
    bool operator>(const Matryoshika& m)const{ return h > m.h; }
    bool operator<<(const Matryoshika& m)const{ return h < m.h && r < m.r; }
    bool operator>>(const Matryoshika& m)const{ return h > m.h && r > m.r; }
};

const int MAX_HR = 1001, MAX_NM = 201;
int N, M;
Matryoshika datas[MAX_NM];
int dp[MAX_NM];

int main(){
    while(true){
        std::cin >> N;
        if(N == 0) break;
        for(int i = 0; i < N; ++i){
            std::cin >> datas[i].h >> datas[i].r;
            dp[i] = 1;
        }
        std::cin >> M;
        for(int i = N; i < N + M; ++i){
            std::cin >> datas[i].h >> datas[i].r;
            dp[i] = 1;
        }
        std::sort(datas, datas + (N + M));

        int ans = 0;
        bool flag = true;

        for(int i = 0; i < (N + M - 1); ++i){
            for(int j = i + 1; j < (N + M); ++j){
                if(datas[i] << datas[j]){
                    flag = false;
                    dp[j] = std::max(dp[i] + 1, dp[j]);
                    ans = std::max(dp[j], ans);
                }
            }
        }
        std::cout << ans + flag << std::endl;
    }

    return 0;
}

Measured memory_bytes: 1180
n,m = map(int,input().split())
x = input().split()

if n >= m:
  	print(0)
else:
  for i in range(m):
    x[i] = int(x[i])
  x.sort()
  ans = x[-1] - x[0]
  #print(ans)
  b = []
  for i in range(m-1):
  	b.append(x[i+1]-x[i])
  b.sort()
  #print(b)
  for i in range(1,n):
    #print(i,b[-i])
    ans -= b[-i]
  print(ans)


Measured memory_bytes: 10748
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc112_a.cpp
 * time   : Fri May  1 02:09:44 2020
 * quest  : A - Programming Education
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  if (n == 1)
    cout << "Hello World\n";
  else {
    int a, b;
    cin >> a >> b;
    cout << a + b << "\n";
  }
  return 0;
}


Measured memory_bytes: 256
def solve():
    N = int(input())
    s_lst = [input() for i in range(N)]
    s_lst.sort()
    a_lst = []
    s_dict = {}
    for w in s_lst:
        if not w in s_dict.keys():
            s_dict[w] = 1
        else:
            s_dict[w] += 1
    s_max = max(list(s_dict.values()))
    i = 0
    while i < len(s_lst):
        w = s_lst[i]
        if s_dict[w] == s_max:
            a_lst.append(w)
        i += s_dict[w]
    for i in range(len(a_lst)):
        print(a_lst[i])

if __name__ == '__main__':
    solve()


Measured memory_bytes: 35216
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int A, B, C, K; cin >> A >> B >> C >> K;
    while (B <= A || C <= B) {
        while (B <= A) {
            B *= 2; K--;
        }
        while (C <= B) {
            C *= 2; K--;
        }
        if (K < 0) {
            cout << "No" << nl; return 0;
        }
    }
    cout << "Yes" << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 3520
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        scanner.close();

        char[] directions = s.toCharArray();
        boolean flag = true;

        for(int i = 0; i < directions.length; i++){
            if((i+1) % 2 == 0) {
                if(directions[i] == 'R') flag = false;
            } else {
                if(directions[i] == 'L') flag = false;
            }
        }

        System.out.println(flag ? "Yes" : "No");
    }
}


Measured memory_bytes: 21972
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main(){

	long n,a;
	cin >> n;
	a = n%10 + n/10%10 + n/100%10 + n/1000%10 + n/10000%10 + n/100000%10
	 + n/1000000%10 + n/10000000%10 + n/100000000%10;

	if(n%a == 0){
		cout << "Yes" <<endl;
	}
	else{
		cout << "No" <<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
  int count[27];
  char buf[1200 + 3];
  int i;

  for (i = 0; i <= 26; i++) count[i] = 0;

  while (fgets(buf, 1203, stdin) != NULL) {
    for (i = 0; i < strlen(buf); i++) {
      if ('A' <= buf[i] && buf[i] <= 'Z') count[buf[i] - 0x40]++;
      else if ('a' <= buf[i] && buf[i] <= 'z') count[buf[i] - 0x60]++;
    }
  }

  for (i = 1; i <= 26; i++) {
    printf("%c : %d\n", i + 0x60, count[i]);
  }

  return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long x;
  cin >> x;
  if(x%11==0)cout << (x/11)*2;
  else if(x%11<=6){
    cout << (x/11)*2 + 1;
  }else{
    cout << (x/11)*2 + 2;
  }
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            double[] x = new double[n];
            String u[] = new String[n];
            for (int i = 0; i < n; i++) {
                x[i] = Double.parseDouble(in.next());
                u[i] = in.next();
            }
            double ans = 0.0;
            final double parbtc = 380000.0;

            for (int i = 0; i < n; i++) {
                if ("JPY".equals(u[i])) {
                    ans += x[i];
                } else {
                    ans += x[i] * parbtc;
                }
            }
            // 出力
            out.printf("%f\n", ans);

        }

    }
}



Measured memory_bytes: 23124
S = input()
ans = 0
acgt = ["A","C","G","T"]
for i in range(len(S)):
    tmp = 0
    if S[i] in acgt:
        tmp += 1
        for j in range(i+1,len(S)):
            if S[j] in acgt:
                tmp += 1
                continue
            else:
                ans = max(ans,tmp)
                break
        ans = max(ans,tmp)
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<deque>
#include<queue>
#include<numeric>
using namespace std;

using ll = long long;
const int INF = 1001001001;
const ll LLINF = 1001001001001001001;
const int MOD = 1000000007;

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

int main()
{
  int k;
  cin >> k;
  bool isExist = false;
  int now = 0;
  int result = 0;
  rep (i, k) {
    now = (now * 10 + 7) % k;
    if (now == 0) {
      isExist = true;
      result = i+1;
      break;
    }
  }

  if (isExist) {
    cout << result << endl;
  } else {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include<algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPR(i,n) for(int i=n-1; i>=(int)(0); i--)
#define FOR(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define FORR(i,a,b) for(int i=(int)(b)-1; i>=(int)(a); i--)
#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()
//**関数リスト**//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
int nod(ll F) {
	int keta = 1;
	while (F/10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
int gcd(int x, int y) {
	int r;
	if(x<y){
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int isPrime(int x) {
	int i;
	if (x < 2) {
		return 0;
	}
	else if(x==2){
		return 1;
	}
	else if (x % 2 == 0) {
		return 0;
	}
	else {
		for (i = 3; i * i <= x; i += 2) {
			if (x % 1 == 0) {
				return 0;
			}
		}
		return 1;
	}
}
void eratos(vi isPrime) {
	//(注)isPrimeのサイズはN+1にする！実際にはmain内に配置して使用
	int ii, jj;
	REP(ii, isPrime.size()) {
		isPrime[ii] = 1;
	}
	isPrime[0] = 0; isPrime[1] = 0;
	for (ii = 2; ii * ii <= isPrime.size() - 1; ii++) {
		if (isPrime[ii] == 1) {
			jj= ii * 2;
			while (jj <= isPrime.size() - 1) {
				isPrime[jj] = 0;
				jj = jj + ii;
			}
		}
	}
}
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
void bitSearch(int n) {
	//実際にはコピーして中身を改変して使う
	int ii;
	REP(ii, pow(2, n)) {
		ll p = ii;
		REP(ii, n) {
			cout << p % 2;
			p /= 2;
		}
		cout << endl;
	}
}
//**定義場所**//
ll i, j, k, l, m, n;
ll N, M, K, H, W;
ll MOD = 1000000000 + 7;
ll ans = 0;
//***********//
int main() {
	ll A, B;
	cin >> N >> A >> B;
	cout << min(A * N ,B);
}

Measured memory_bytes: 256