akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main(){
  int n;
  int i,j,k;
  int build[4][3][10]={{{}}};
  cin >> n;
  int b,f,r,v;
  for(i=0;i<n;i++){
    cin >> b >> f >> r >> v;
    build[b-1][f-1][r-1]+=v;
  }
  for(i=0;i<4;i++){
    for(j=0;j<3;j++){
      for(k=0;k<10;k++){
	cout << " ";
	cout << build[i][j][k];
      }
      cout << endl;
    }
    if(i<3)cout << "####################" << endl;
  }
  return 0;
}



Measured memory_bytes: 3112
def decompose_by_2(n):
    cnt = 0
    while True:
        if n % 2 == 1:
            return cnt
        n = n / 2
        cnt += 1
        
_ = input()
A = list(map(int, input().split()))
cnt = 0
for a in A:
    cnt += decompose_by_2(a)
    
print(cnt)

Measured memory_bytes: 4148
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(void){

  ll n;
  cin>>n;
  string s;
  cin>>s;

  ll r=0,b=0;

  for(auto c:s){
    if(c=='R') r++;
    else b++;
  }

  if(r>b) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int a;
  cin>>a;
  int b=0,c,d=0;
  for(int i=0;i<a;i++){
    cin>>c;
    d+=c;
    b=max(b,c);
  }
  cout<<d-b/2<<endl;
}

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


void solve(long long N, std::deque<long long> A){
    long long m = 1000;
    long long s = 0;
    A.push_back(0);
    for (int i = 0; i < N; i++) {
        if (A[i+1] > A[i]) {
            s += m / A[i];
            m = m % A[i];
        } else if (A[i+1] > A[i]) {
            // pass
        } else {
            m += A[i] * s;
            s = 0;
        }
        // cout << m << "," << s << endl;
    }
    cout << m << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::deque<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 3652
n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
b = []
for i in 0..n/2-1
  b.push(a[i*2]).unshift(a[i*2+1])
end
if n%2 == 1
  b.push(a[-1]).reverse!
end
b.each do |num|
  print num,"\s"
end
print "\n"

Measured memory_bytes: 25440
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
count=0
ans=[]
cnt1=sum(a)
cnt2=sum(b)
for i in range(n):
    ans.append(count+a[i]+cnt2)
    cnt1-=a[i]
    cnt2-=b[i]
    count+=a[i]
#print(ans)
print(max(ans))
    

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const int64_t INF = 1LL << 58;
const ll mod = 1e9 + 7;

int main(){
    ll n,k;
    cin >> n >> k;
    vector<int64_t> a(n);
    
    for (int i = 0;i < n;i++) cin >> a[i];

    int64_t res = INF;

    for (int bit = 0;bit < (1 << n);bit++){
        if (__builtin_popcount(bit) < k) continue;

        int64_t cost = 0,last = 0;

        for (int i = 0;i < n;i++){
            if (bit & (1 << i)){
                last = max(last + 1,a[i]);
                cost += last - a[i];
            }
            else if (a[i] > last){
                cost = INF;
            }
        }

        res = min(res,cost);
    }       
    
    cout << res << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int ans = -1;
        for (int i=1;i<=5;i++) {
            int x = sc.nextInt();
            if (i != x) ans = i;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35728
#include "bits/stdc++.h"
using namespace std;
using namespace std;
 
int main(){
    int n,cnt;
    string s;
    cin >> n;
    while(n--){
        map <int,char> data;
        map <int,char>::iterator itr;
        cnt = 0;
        cin >> s;
        for(int i=0;i<s.length();i++){
            if(isalpha(s[i])){
                data.insert(map<int,char>::value_type(cnt,s[i]));
            }
            else if(s[i] == '<') cnt--;
            else if(s[i] == '>') cnt++;
        }
        for(itr=data.begin();itr!=data.end();itr++){
            cout << itr->second;
        }
        cout << endl;
    }
}

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

using namespace std;

typedef long long int lli;

int main() {
    lli n, r;
    cin >> n >> r;
    if(n >= 10) {
        printf("%lld\n", r);
    } else {
        printf("%lld\n", (r+100*(10-n)));
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

    String s = sc.next();

    int first = Integer.parseInt(s.substring(0,2), 10);
    int second = Integer.parseInt(s.substring(2,4), 10);

    if (second >= 1 && second <= 12) {
      if (first >= 1 && first <= 12) {
        System.out.println("AMBIGUOUS");
      } else {
        System.out.println("YYMM");
      }
    } else {
      if (first >= 1 && first <= 12) {
        System.out.println("MMYY");
      } else {
        System.out.println("NA");
      }
    }
  }
}


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

string _tolower(string str){
  for (int i=0; i<str.size(); i++){
    if (str[i]>='A' && str[i]<='Z') str[i]+='a'-'A';
  }
  return str;
}

int main(void){
  string tgt, tword;
  int ans = 0;
  cin >> tgt;
  tgt = _tolower(tgt);
  while (cin >> tword){
    if (tword == "END_OF_TEXT") break;
    if (_tolower(tword) == tgt) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define cal(a,b) ((a+=b)%=mo)
using namespace std;
const int N=6050,mo=1e9+7;
int gi(){
    char ch=getchar(); int x=0,q=0;
    while(ch<'0'||ch>'9') q=ch=='-'?1:q,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return q?-x:x;
}
int n,m,ans,f[2][N][2];
int main(){
    cin>>n>>m;
    for (int i=1; i<=n; ++i) f[0][i][0]=1;
    f[0][0][1]=1;
    int t=0;
    for (int i=0; i<2*m; ++i){
	t^=1; memset(f[t],0,sizeof(f[t]));
	for (int j=0; j<=2*m; ++j)
	    for (int p=0; p<=1; ++p)
		if (f[t^1][j][p]){
		    int z=j+(i&1);
		    if (n+2*(i/2)-j-i+(i&1)>=1)
			cal(f[t][z][p],f[t^1][j][p]);
		    if (z>=1)
			cal(f[t][z-1][p|(z==1)],f[t^1][j][p]);
		}
    }
    for (int i=0; i<=2*m; ++i)
	cal(ans,f[t][i][1]);
    cout<<ans;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  bool ans = false;
  int a,b,c;
    a=N/100;
  N %= 100;
  b=N/10;
  c=N%10;
  if(a==7)
    ans=true;
  if(b==7)
    ans=true;
  if(c==7)
    ans=true;
  
  if(ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define int long long
signed  main(){
  int N,K;
  str S;
  cin>>N>>K;
  if(N%K==0)cout<<0<<endl;
  else cout<<1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main()
{
    int n;
    cin >> n;
    assert(n != 1);
    if (n == 2)
    {
        cout << -1 << endl;
        return 0;
    }
    if (n % 2 == 1)
    {
        rep(i, n)
        {
            rep(j, n - 1)
            {
                cout << (i + 1 + j) % n + 1 << " ";
            }
            cout << endl;
        }
    }
    else
    {
        rep(i, n - 2)
        {
            rep(j, n - 2)
            {
                cout << (i + 1 + j) % (n - 1) + 1 << " ";
            }
            cout << n << endl;
        }
        cout << n << " ";
        int tmp = 0;
        int cnt = 0;
        int cur = 2;
        while (cnt != n - 2)
        {
            if (cur == n - 1)
            {
                cur = (cur + 1) % (n - 1);
            }
            cout << cur << " ";
            cur++;
            cnt++;
        }
        cout << endl;
        rep(i, n - 2)
        {
            cout << (i) % (n - 1) + 1 << " ";
        }
        cout << n - 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n;
    cin >> n;

    string s;
    cin >> s;

    bool one = false;
    vector <int> vec(n - 1);
    for (int i = 0; i < n - 1; i++) {
        vec[i] = abs(s[i + 1] - s[i]);
        if (vec[i] == 1) one = true;
    }

    int ans = 0;

    int num = 0, num2 = n - 2;
    int den = 0, den2 = 1;

    for (int i = 0; i < n - 1; i++) {
        if (num - den == 0) {
            if (one) vec[i] %= 2;
            ans ^= vec[i];
        }

        int tmp = num2;
        while (tmp && tmp % 2 == 0) {
            num++;
            tmp /= 2;
        }
        num2--;

        tmp = den2;
        while (tmp % 2 == 0) {
            den++;
            tmp /= 2;
        }
        den2++;
    }

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

Measured memory_bytes: 5236
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
minus=[]
plus=[]
cnt=Counter(a)
zerocnt=cnt[0]
minuscnt=0
pluscnt=0
for i in range(n):
    if a[i]<0:
        minuscnt+=1
        minus.append(a[i])
    elif a[i]>0:
        pluscnt+=1
        plus.append(a[i])


if n==k:
    ans=1
    for i in range(n):
        ans*=a[i]
        ans%=mod
    print(ans%mod)
    quit()

if minuscnt==n:
    ans=1
    if k%2==0:
        for i in range(k):
            ans*=a[i]
            ans%=mod
        print(ans)
    else:
        for i in range(k):
            ans*=a[-1-i]
            ans%=mod
        print(ans)
    quit()

if minuscnt%2==1:
    minuscnt-=1

# print(minus)
plus.reverse()
# plus.append(0)
# plus.append(0)
# print(plus)

ans=1
nokori=k
m,p=0,0
# minuscnt=max(minuscnt,1)

while nokori:
    # print(pluscnt,p,m,nokori)
    if m==minuscnt:
        if p!=pluscnt:
            ans*=plus[p]
            p+=1
            nokori-=1
        else:
            ans=0
            nokori=0
    elif p==pluscnt:
        if nokori==1:
            ans=0
            nokori-=1
        else:
            ans*=minus[m]*minus[m+1]
            m+=2
            nokori-=2
    elif p+1==pluscnt:
        if nokori%2==0:
            ans*=minus[m]*minus[m+1]
            m+=2
            nokori-=2
            # if nokori==1:
        else:
            ans*=plus[p]
            p+=1
            nokori-=1
            # elif plus[p]>minus[m]*minus[m+1]:
            #     ans*=plus[p]
            #     p+=1
            #     nokori-=1
            # else:
            #     ans*=minus[m]*minus[m+1]
            #     m+=2
            #     nokori-=2
    elif nokori==1:
        ans*=plus[p]
        nokori-=1
    elif plus[p]*plus[p+1]>minus[m]*minus[m+1]:
        # if nokori%2==0:
        #     ans*=plus[p]*plus[p+1]
        #     p+=2
        #     nokori-=2
        # else:
        ans*=plus[p]
        p+=1
        nokori-=1
    else:
        ans*=minus[m]*minus[m+1]
        m+=2
        nokori-=2
    ans%=mod
print(ans%mod)

Measured memory_bytes: 123204
n,k=io.read("*n","*n","*l")
a={}
for i=1,n do
    a[i]=io.read("*n")
end

path={1}
visited={}
position=1
for i=1,n do
    table.insert(path,a[position])
    if not visited[position] then
        visited[position]=true
    else
        break
    end
    if i==k then
        print(a[position])
        return
    end
    position=a[position]
end

loop=0
distance=0
for i=1,#path do
    if path[i]==a[position] then
        loop=#path-i
        distance=i-2
        break
    end
end

x=(k-distance)%loop
for i=1,x do
    position=a[position]
end
print(position)

Measured memory_bytes: 18944
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
int t[100][100];
int main() {
	int N, K, a, b;
	cin >> N >> K;
	rep(i, 0, K) {
		cin >> a;
		rep(i2, 0, a) {
			cin >> b;
			t[i][b - 1] = 1;
		}
	}
	int C = 0;
	rep(i, 0, N) {
		bool f = 1;
		rep(i2, 0, K) {
			if (t[i2][i]) {
				f = 0;
				break;
			}
		}
		if (f)C++;
	}
	printf("%d\n", C);
	return 0;
}

Measured memory_bytes: 3796
readlines.each do |line|
  n, x = line.split.map(&:to_i)
  break if n == 0 && x == 0

  solves = []
  # i + j + j == x
  (1..n - 2).each do |i|
    # j + k == x - i
    (i + 1..n - 1).each do |j|
      # k == x - i - j
      k = x - i - j
      solves << [i, j, k] if j < k && k <= n
    end
  end
  puts solves.count
end

Measured memory_bytes: 6120
#include<bits/stdc++.h>
using namespace std;
double dp[3005][3005];
double solve(vector<double> &p,int i,int x){
    if(x==0){
        return 1;
    }
    if(i==0){
        return 0;
    }
    if(dp[i][x]>-0.9){
        return dp[i][x];
    }
    return dp[i][x]=p[i]*solve(p,i-1,x-1)+(1-p[i])*solve(p,i-1,x);
}
int main(){
  int n;
  cin>>n;
  vector<double> p(n+1);
  for(int i=1;i<=n;i++){
    cin>>p[i];
  }

  memset(dp,-1,sizeof(dp));

  cout<<fixed<<setprecision(10)<<solve(p,n,(n+1)/2)<<endl;
  
  return 0;
}

Measured memory_bytes: 71168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int h,w,n;
    cin>>h>>w>>n;
    ll ans=INF;
    rep(i,h+1)rep(j,w+1){
        if(i*w+j*h-i*j>=n)  chmin(ans,i+j);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define guard(x) if( not (x) ) continue;
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif

template<typename T>
using RQ = std::priority_queue<T, std::vector<T>, std::greater<T>>;

struct Tree {
   Tree(Int n)
      : ps(n, -1) {}
   std::vector<Int> ps;
   Int root(Int x) {
      if( ps[x] == -1 ) return x;
      return ps[x] = root(ps[x]);
   }
   void connect(Int parent, Int child) {
      parent = root(parent), child = root(child);
      if( parent == child ) return;
      ps[root(child)] = root(parent);
   }
};

int main() {
   Int v, e, r;
   std::cin >> v >> e >> r;
   std::vector<Int> ss(e), ts(e), ws(e);
   rep(i, e) std::cin >> ss[i] >> ts[i] >> ws[i];
   std::vector<RQ<std::pair<Int,Int>>> qs(v);
   std::vector<Int> os(v);
   rep(i, e) {
      Int s = ss[i], t = ts[i], w = ws[i];
      qs[t].emplace(w, s);
   }
   Tree tree(v);
   auto f = [&]() -> Int {
      Int res = 0;
      std::vector<Int> pws(v), pis(v);
      std::vector<bool> finished(v);
      finished[r] = true;
      rep(ii, v) {
         Int i = tree.root(ii);
         guard( not finished[i] );
         std::vector<Int> ys;
         std::vector<bool> visited(v);
         while( not finished[i] ) {
            ys.emplace_back(i);
            visited[i] = true;
            if( qs[i].empty() ) return -1;
            Int w, p;
            do {
               std::tie(w, p) = qs[i].top(); qs[i].pop();
               w += os[i];
               p = tree.root(p);
            } while( p == tree.root(i) );
            pws[i] = w;
            pis[i] = p;
            res += w;
            if( not visited[p] ) {
               i = p;
            }
            else {
               Int maxI = i;
               for(Int k = pis[i]; k != i; k=pis[k]) {
                  if( qs[maxI].size() < qs[k].size() ) maxI = k;
               }
               os[maxI] -= pws[maxI];
               for(Int k = pis[maxI]; k != maxI; k=pis[k]) {
                  tree.connect(maxI, k);
                  while( not qs[k].empty() ) {
                     Int w2, p2; std::tie(w2, p2) = qs[k].top(); qs[k].pop();
                     Int nw = w2 + os[k] - pws[k] - os[maxI];
                     qs[maxI].emplace(nw, p2);
                  }
               }
               i = maxI;
            }
         }
         for(Int y : ys) finished[y] = true;
      }
      return res;
   };
   printf("%ld\n", f());
}



Measured memory_bytes: 3372
#include <cstdio>
using namespace std;
char a,b;
int main() {
	scanf("%c %c",&a,&b);
	if (a=='H'&&b=='H')
		printf("H\n");
	else if (a=='H'&&b=='D')
		printf("D\n");
	else if (a=='D'&&b=='H')
		printf("D\n");
	else printf("H\n");
	return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N;
ll X[15], Y[15], P[15], ans[16];
vector <int> non;
vector <ll> x, y;

int Solve(int turn){
  int cnt = 0;
  non.clear();
  x.clear(); y.clear();
  x.push_back(0); y.push_back(0);
  for (int i = 0; i < N; i++){
    int now = turn % 3; turn /= 3;
    if (now == 0) non.push_back(i);
    else{
      cnt++;
      if (now == 1) x.push_back(X[i]);
      else y.push_back(Y[i]);
    }
  }
  ll res = 0;
  for (int i = 0; i < non.size(); i++){
    int Index = non[i];
    ll Dist = 1e16;

    for (int j = 0; j < x.size(); j++){
      Dist = min(Dist, abs(X[Index] - x[j]));
    }
    for (int j = 0; j < y.size(); j++){
      Dist = min(Dist, abs(Y[Index] - y[j]));
    }
    res += P[Index] * Dist; 
  }
  ans[cnt] = min(ans[cnt], res);
  return 0;
}

int main(){
  cin >> N;
  fill(ans, ans + N + 1, 1e16);
  for (int i = 0; i < N; i++) cin >> X[i] >> Y[i] >> P[i];
  for (int i = 0; i < pow(3, N); i++) Solve(i);
  for (int i = 0; i <= N; i++) cout << ans[i] << endl;
  
  return 0;
}


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

int mod = 1e9+7;

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

    int a[n+1];
    int sum = 0;

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

    int x = sum/n;
    int y = (sum+n-1)/n;

    int res = 0, res2 = 0;

    for(int i = 1; i<=n;i++){
        res+=pow(a[i]-x,2);
        res2+=pow(a[i]-y,2);
    }
    cout << min(res, res2) << endl;
  //cout << fixed << setprecision(8) << ans << endl;
  return 0;
}
    


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

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

  vector<ll> a(n), b(n), plus(n);
  ll sumb = 0, sum = 0;

  rep(i,n) {
    cin >> a[i] >> b[i];
    plus[i] = a[i] + b[i];
    sumb += b[i];
  }
  sortd(plus);
  bool flag = true;
  rep(i,n) {
    if (flag) sum += plus[i];
    flag = !flag;
  }
  cout << sum - sumb << endl;
}


Measured memory_bytes: 2688
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;

using namespace std;


int main(int argc, char* argv[])
{
    int n, k;
    scanf("%d%d", &n, &k);
    char str[55]={0};
    scanf("%s", str);
    str[k-1]=str[k-1]-'A'+'a';
    printf("%s\n", str);

    return 0;
}


Measured memory_bytes: 128
from collections import defaultdict
n,m = map(int,input().split())
h_list = list(map(int,input().split()))
connect_dic = defaultdict(set)

for i in range(m):
    a,b = map(int,input().split())
    connect_dic[a].add(b)
    connect_dic[b].add(a)

count = 0
for k,v in connect_dic.items():
    if h_list[k-1]>max([h_list[num-1] for num in v]):
        count += 1

print(count + n - len(connect_dic))

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

xy = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for j in range(A):
        x,y = map(int,input().split())
        xy[i].append([x,y])

ans = 0
for s in range(2**N-1,-1,-1):
    s = (N-len(bin(s))+2)*'0'+bin(s)[2:]
    pos = True
    for i in range(N):
        if s[i]=='1':
            for x,y in xy[i]:
                if s[x-1]!=str(y):
                    pos = False
                    break
    if pos:
        ans = s.count('1')
        break
print(ans)

Measured memory_bytes: 44268
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)


n, m = map(int, input().split())
uf = UnionFind(n)
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    uf.union(a, b)

s = set([])
for i in range(n):
    s.add(uf.find(i))

print(len(s)-1)

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

int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (b-a>k||c-a>k||d-a>k||e-a>k) {
		cout << ":(" << endl;
	}
	else if (c - b > k || d - b > k || e - b > k) {
		cout << ":(" << endl;
	}
	else if ( d - c > k || e - c > k) {
		cout << ":(" << endl;
	}
	else if (e - d > k) {
		cout << ":(" << endl;
	}
	else {
		cout << "Yay!" << endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include<math.h>
#include <algorithm>

using namespace std;


int main(){

	int n,table[101],count;
	bool FLG;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		for(int i=0; i< 101; i++)table[i] = 0;
		int array[n],pre[n];
		count = 0;

		for(int i=0; i< n; i++){
			scanf("%d",&array[i]);
			table[array[i]]++;
		}

		while(true){
			FLG = true;

			if(count != 0){
				for(int i=0; i < n; i++){
					if(array[i] != pre[i]){
						FLG = false;
						break;
					}
				}
				if(FLG)break;
			}

			for(int i=0; i< n; i++){
				pre[i] = array[i];
				array[i] = table[array[i]];
			}

			for(int i=0; i< 101; i++)table[i] = 0;

			for(int i=0; i < n; i++)table[array[i]]++;
			count++;
		}

		printf("%d\n",count-1);

		printf("%d",array[0]);
		for(int i=1; i<n; i++)printf(" %d",array[i]);
		printf("\n");

	}

    return 0;
}

Measured memory_bytes: 2672
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
			int[,] g = new int[3, 3];
			
			for (int i = 0; i < 3; i++)
			{
				var arr = cin.ReadIntArray(3);
				for(int j = 0; j < 3; j++)
				{
					g[i, j] = arr[j];
				}
			}
			int[] a = new int[3];
			int[] b = new int[3];
			var t = g[0, 0];
			for(int i = 0; i <= t; i++)
			{
				b[0] = g[0, 0] - i;
				b[1] = g[0, 1] - i;
				b[2] = g[0, 2] - i;
				a[0] = g[0, 0] - b[0];
				a[1] = g[1, 0] - b[0];
				a[2] = g[2, 0] - b[0];
				if (check(a, b, g)) { WriteLine("Yes");goto end; }
			}
			WriteLine("No");
		end:;
		}
		public static bool check(int[] a, int[] b, int[,] g)
		{
			for (int i = 0; i < 3; i++)
				for (int j = 0; j < 3; j++)
					if (g[i, j] != a[i] + b[j]) return false;
			return true;
		}
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

ll gcd(ll a, ll b) 
{
	if (a < b) gcd(b, a);
	if (b == 0) return a;
	else gcd(b, a % b);
}
ll A[100010];
int main()
{
	ll N, K, max = 0;
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (A[i] > max) max = A[i];
	}
	if (K > max) {
		cout << "IMPOSSIBLE" << endl;
	}
	else if (max == K) {
		cout << "POSSIBLE" << endl;
	}
	else {
		int num = A[0];
		for (int i = 1; i < N; i++) {
			num = gcd(num, A[i]);
		}
		if (K % num == 0) {
			cout << "POSSIBLE" << endl;
		}
		else {
			cout << "IMPOSSIBLE" << endl;
		}
	}
}


Measured memory_bytes: 1024
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
string s;
int main() {
	cin >> s;
	char c = s[0];
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" << endl;
	else cout << "consonant" << endl;
	return 0;
}

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

par=[i for i in range(n)]
size=[1]*n

def find(x):
  if par[x]==x:
    return x
  else:
    par[x]=find(par[x])
    return par[x]
def union(a,b):
  x=find(a)
  y=find(b)
  if x!=y:
    if size[x]<size[y]:
      par[x]=par[y]
      size[y]+=size[x]
    else: 
      par[y]=par[x]
      size[x]+=size[y]
  else:
    return

ans=[n*(n-1)//2]
bridge=[]

for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  bridge.append([a,b])

bridge.reverse()
bridge.pop()

for i in bridge:
  if find(i[0]) != find(i[1]):
    ans.append(ans[-1]-size[find(i[0])]*size[find(i[1])])
    union(i[0],i[1])
  else:
    ans.append(ans[-1])


ans.reverse()

for i in ans:
  print(i)

Measured memory_bytes: 96876
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s, t; cin >> s >> t;
  vector<int> As[26], At[26];
  for(int i=0; i<(int)s.length(); ++i)
    As[s[i] - 'a'].push_back(i);
  for(int i=0; i<(int)t.length(); ++i)
    At[t[i] - 'a'].push_back(i);
  for(int i=0; i<26; ++i)
    sort(all(As[i]));
  for(int i=0; i<26; ++i)
    sort(all(At[i]));
  for(int i=0; i<26; ++i){
    if((int)As[i].size() > 0){
      int flag = 1;
      for(int j=0; j<26; ++j){
           if((int)At[j].size() == (int)As[i].size()){
             //cout << char(i+'a') << " " << char(j+'a') << "\n";
             int fflag = 1; 
             for(int k=0; k<(int)As[i].size(); ++k){
                if(As[i][k] != At[j][k]){
                  fflag = 0;
                  break;
                }
                //cout << As[i][k] << ", ";
              }
              //cout << "\n";
              if(fflag){
                flag = 0;
                At[j].clear();
                break;
              }
           }
      }
      if(flag){
       cout << "No\n";
       return 0;
      }
    }
  }
  cout << "Yes\n";
  return 0;
}


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

using namespace std;

int main()
{
    long long n, a, b;
    cin >> n >> a >> b;
    if (a % 2 == b % 2)
        cout << (b - a) / 2 << endl;
    else
    {
        long long ans = (n - b) + (b - a + 1) / 2;
        ans = min(ans, (a - 1) + (b - a + 1) / 2);
        cout << ans << endl;
    }
    return 0;
}


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

int base[6], out = 0, score = 0, n, eventnum = 0, a = 0;
vector<string> event;
string s;

void Hit()
{
	base[2] = 0;
	if (base[1]) base[2] = 1;
	if (base[0]) base[1] = 1;
	base[0] = 1;
}

void Homerun()
{
	for (int j = 0; j < 3; j++)	{
		base[j] = 0;
	}
}

int main()
{
	cin >> n;
	for (int i = 0; i < 3*n; i++) {
		while (true) {
			cin >> s;
			event.push_back(s);
			a++;
			eventnum++;
			if (event.at(a - 1) == "OUT") break;
		}
	}
	for (int i = 0; i < eventnum; i++) {
		if (event.at(i) == "HIT") {
			if (base[2] == 1) score += 1;
			Hit();
		}
		else if (event.at(i) == "HOMERUN")	{
			score += (base[0] + base[1] + base[2] + 1);
			Homerun();
		}
		else {
			out++;
			if (out == 3) {
				cout << score << endl;
				for (int j = 0; j < 3; j++) base[j] = 0;
				score = out = 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1224
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Problem solver = new Problem();
        solver.solve(0, in, out);
        out.close();
    }

    static class Problem {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt(), K = in.nextInt();
            int[] stones = new int[N];
            for (int i = 0; i < N; i++)
                stones[i] = in.nextInt();

            int[] dp = new int[N];
            dp[0] = 0;
            dp[1] = Math.abs(stones[1] - stones[0]);

            for (int i = 2; i < N; i++) {
                dp[i] = Integer.MAX_VALUE;
                for (int j = 1; j <= K && (i - j) >= 0; j++) {
                    int jump = Math.abs(stones[i] - stones[i - j]) + dp[i - j];
                    dp[i] = Math.min(dp[i], jump);
                }
            }

            out.println(dp[N - 1]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 39396
N, L = [int(x) for x in input().split()]
head = L
tail = L+N-1
s = (N * (head+tail)) // 2
if (head <= 0 and tail >= 0):
    print(s)
else:
    if (tail<0):
        print(s-tail)
    elif (head>0):
        print(s-head)            


Measured memory_bytes: 38384
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C){
    if(A==B && A!=C)cout<<YES<<endl;
    else if(A==C && A!=B)cout<<YES<<endl;
    else if(B==C && A!=B)cout<<YES<<endl;
    else cout<<NO<<endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


bool pairCompare(const Pi& firstElof, const Pi& secondElof)
{
	return firstElof.second > secondElof.second;
}

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

	int a, b, c;
	cin >> a >> b >> c;
	if (c > a && b > c) {
		cout << "Yes" << endl;
	}
	else if (c<a && b<c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#ABC095C
a,b,c,x,y=map(int,input().split())
ans=0
if a>2*c:
	ans+=2*c*x
	y=max(0,y-x)
	x=0
if b>2*c:
	ans+=2*c*y
	x=max(0,x-y)
	y=0
if a+b>2*c:
	p,q=max(x,y),min(x,y)
	ans+=2*c*q
	x-=q
	y-=q
if x>0:
	ans+=a*x
if y>0:
	ans+=b*y
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
    int a,i;
    scanf("%d",&a);
    int check=0;
    for (i=9;i>1;i--)
    {
        if (a%i==0)
        {
            a=a/i;
            check+=1;
            break;
        }
    }
    for (i=9;i>0;i--)
    {
        if (a%i==0)
        {
            a=a/i;
            check+=1;
            break;
        }
    }
    if (a==1)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;
ll INF = 1e9+10;
#define what_is(x) cerr << #x << " is " << x << endl;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
vector<pair<ll, ll> > pairs;

ll n, mod = 998244353;
const ll MAX = 1e7 + 1;
vector<ll> v(MAX);

ll inv[MAX];

int main()
{
    ll N;
    cin >> N;
    string S;
    cin >> S;
    for (int i = 0; i < S.length(); i++){
        int n = S[i] - 'A';
        fprintf(stdout, "%c", 'A' + (n + N) % 26);
    }
    cout << endl;
    return 0;    
}


Measured memory_bytes: 78464
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
 
struct c{
  int a;
  int b;
  
  bool operator<( const c& right ) const {
        return b == right.b ? a < right.a : b < right.b;
    }
  
};

int main(){
  int n,i,wa=0,kotae=0;
  cin>>n;
  vector<c> d(n);
  for(i=0;i<n;i++){
    cin>>d[i].b;
    d[i].a=i+1;
  }
  sort(d.begin(), d.end());
  for(i=0;i<n;i++){
    cout<<d[i].a<<' ';
  }
}
  


Measured memory_bytes: 1536
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int i = 0;i <n;i++)
class Monoid {
public:
	int unit;
	Monoid(){
		unit = 2147483647;
	}int calc(int a, int b) {
		return min(a, b);
	}
};
struct RUP {
	int n;
	Monoid mono;
	vector<int> dat, laz;
	RUP() {}
	RUP(int n_) { init(n_); }
	void init(int n_) {
		n = 1;
		while (n < n_) n *= 2;
		dat.clear();
		dat.resize(2 * n - 1, mono.unit);
		laz.clear();
		laz.resize(2 * n - 1, -1);
	}
	inline void eval(int len, int k) {
		if (laz[k] < 0) return;
		if (k * 2 + 1 < n * 2 - 1) {
			laz[k * 2 + 1] = laz[k];
			laz[k * 2 + 2] = laz[k];
		}
		dat[k] = laz[k];
		laz[k] = -1;
	}
	int update(int a, int b, int x, int k, int l, int r) {
		eval(r - l, k);
		if (r <= a || b <= l) return dat[k];
		if (a <= l && r <= b) return laz[k] = x;
		eval(r - l, k);
		dat[k] = mono.calc(update(a, b, x, k * 2 + 1, l, (l + r) / 2),
			update(a, b, x, k * 2 + 2, (l + r) / 2, r));
		return dat[k];
	}
	int query(int a, int b, int k, int l, int r) {
		eval(r - l, k);
		if (r <= a || b <= l) return mono.unit;
		if (a <= l && r <= b) return dat[k];
		int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return mono.calc(vl, vr);
	}
	void update(int a, int b, int x) {
		update(a, b, x, 0, 0, n);
	}
	int query(int a, int b) {
		return query(a, b, 0, 0, n);
	}
};
int main(){
	int n, q; cin >> n >> q;
	RUP rup(n);
	rep(i, q) {
		int a; cin >> a;
		if (a == 0) {
			int s, t, x; cin >> s >> t >> x;
			rup.update(s, t + 1, x);
		}
		else {
			int s, t; cin >> s >> t;
			cout << rup.query(s, t + 1) << endl;
		}
	}
}


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

int main(void){
  ll n; cin >> n;
  ll a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  ll ans = n % min(a,min(b,min(c,min(d,e)))) != 0 ? floor(n/min(a,min(b,min(c,min(d,e))))+1)+4 : floor(n/min(a,min(b,min(c,min(d,e))))+1)+3;
  cout << ans << endl;
  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++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;

int main() {
	int n;
	cin >> n;
	if (n % 2 == 0) cout << (double)n / (2 * n) << endl;
	else cout << (double)(n+1)/(2*n) << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a[4],cnt[4] = {};
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    for(int i = 0;i < 4;i++){
        if(a[i] == 1) cnt[0]++;
        if(a[i] == 9) cnt[1]++;
        if(a[i] == 7) cnt[2]++;
        if(a[i] == 4) cnt[3]++;
    }
    if(cnt[0] != 0 &&cnt[1] != 0 &&cnt[2] != 0 &&cnt[3] != 0){
        cout << "YES" << endl;
        return 0;
    }else{
        cout << "NO" << endl;
        return 0;
    }
}


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


int main()
{
	int n, x;
	int a, b, c, sum;
	int count = 0;

	cin >> n >> x;
	while (n != 0 || x != 0){
		for (int i = 1; i < n; i++){
			for (int j = i + 1; j <= n; j++){
				sum = x - i - j;
				if (j < sum && sum <= n ){
					count++;
				}
			}
		}
		cout << count << endl;
		count = 0;
		cin >> n >> x;
	}



	
	
	return 0;
}


Measured memory_bytes: 3080