akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
    using namespace std;
    
    #define ll long long
    #define pb push_back
    #define printV(v) for(int i=0;i<v.size();i++){cout << v[i]<< " ";} cout << endl
    #define printRev(v) for(int i=v.size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
    #define sortV(v) sort(v.begin(),v.end())
    #define revV(v) reverse(v.begin(),v.end())
    #define FOR(i,from,n) for(int i=from;i<n;i++)
    #define FOL(i,from,n) for(int i=from;i >= n;i--)

        ll a,b,c,d,e,f,g,n,m,k,t,x,h,w,p,q,y;
        string str = "";
        ll mod = 1e9 + 7;

        ll pow(ll base, ll q, ll mod){
            ll answer = 1;
            while(q > 0){
                if(q & 1LL)
                    answer = (answer * base) % mod;

                q = q >> 1LL;
                base = (base*base) % mod;
            }
            return answer % mod;
        }

        ll factorial(ll n, ll mod){
            ll answer = 1;
            for(int i=2; i<=n; i++){
                answer = (answer * i) % mod;
            }
            return answer % mod;
        }

        ll inverse(ll base, ll mod){
            return pow(base, mod-2, mod) % mod;
        }

        /*ll C(ll n, ll m, ll mod){
            return (factorial(n, mod) * inverse(factorial(m,mod) * factorial(n-m, mod)%mod, mod) ) % mod;
        } */  

        

        void solve(){
            cin >> n;
            vector<int> mp(1000009,0);
            vector<int> v;
            for(int i=1; i <=n; i++){
                int a; cin >> a;
                v.pb(a);
               
                mp[a]++;
            }
            if(mp[1] > 1){
                cout << "0\n";
                return;
            }else if(mp[1] == 1){
                cout << "1\n";
                return;
            }
            int cnt =0;
            for(int i=0 ; i <n; i++){
                if(mp[v[i]] > 1) continue;
                bool ok = 1;
                for(int j=2;  j <= sqrt(v[i]); j++){
                    if(v[i] % j == 0){
                        if(mp[j] || mp[v[i] / j]){
                            ok = false;
                            break;
                        }
                    }
                }
                if(ok) cnt++;
            }
            cout << cnt << endl;
            
            
        }

       
    


        int main(){
            ios_base::sync_with_stdio(false);

          

            

            int cases = 1;
            //cin >> cases;

            while(cases--) solve();
            return 0;

        }

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

int dp[2][1111111];

int main(){
	string S;
	cin >> S;
	vector<int> N(S.size());
	for(int i=0;i<S.size();i++)N[i]=S[i]-'0';
	
	dp[1][0]=1;
	
	for(int i=0;i<N.size();i++){
		dp[0][i+1]=min(dp[0][i]+N[i],dp[1][i]+10-N[i]);
		dp[1][i+1]=min(dp[0][i]+N[i]+1,dp[1][i]+9-N[i]);
	}
	cout << dp[0][N.size()] << endl;
	return 0;
}

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

using namespace std;

const int MOD=1e9+7;

//const int MOD=998244353;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;
    
    vector<vector<int>> gr(n+1);
    
    int goal=(n%2?n:n+1);
    
    int ct=0;
    for(int i=1; i<=n; i++){
        for(int j=i+1; j<=n; j++){
            if(i+j!=goal){
                gr[i].push_back(j);
                ct++;
            }
        }
    }
    cout<<ct<<'\n';
    for(int i=1; i<=n; i++){
        for(int j:gr[i]){
            cout<<i<<' '<<j<<'\n';
        }
    }
    
}

Measured memory_bytes: 384
import collections
n = int(input())
a = list(map(int, input().split(' ')))
l, r = [], []
for i in range(n):
    l.append(i + a[i])
    r.append(i - a[i])
c = collections.Counter(r)
ans = 0
for i in l:
    ans += c.get(i, 0)
print(ans)


Measured memory_bytes: 50684
#include <iostream>
#include <cmath>
#include <string>
#include <boost/multi_array.hpp>

int main() {
    int K, X;
    
    std::cin >> K >> X;
    
    int start = std::max(X-K+1, -1000000);
    int end = std::min(1000000, X+K-1);
    for (int i = start; i <= end; i++) {
        std::cout << i << " ";
    }
    std::cout << std::endl;
    
    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc100/tasks/abc100_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int d, n;

  cin >> d >> n;

  if (n == 100)
    n = 101;
  int r = powf(100, d) * n;

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 256
private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map(String::toInt) // list of ints
private fun readLongs() = readStrings().map(String::toLong) // list of longs

fun main(args: Array<String>) {
    val n = readLong()
    println((1L..n).filter { it % 3L != 0L && it % 5L != 0L }.sum())
}

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

using namespace std;

int main() {
    
    int n; cin >> n;
    vector<double> dp(n + 1, 0), ndp(n + 1, 0);
    dp[0] = 1;

    for (int i = 0; i < n; ++i) {
        double prob; cin >> prob;
        for (int j = 0; j <= n; ++j) {
            ndp[j] = dp[j] * (1 - prob);
            if (j > 0) ndp[j] += dp[j - 1] * prob;
        }
        swap(dp, ndp);
    }

    double ans = 0;
    for (int i = 0; i <= n; ++i) {
        if (i >= n - i) {
            ans += dp[i];
        }
    }
    cout << fixed << setprecision(20) << ans << endl;

     
    return 0;
}


Measured memory_bytes: 256
import itertools

n, d = map(int, input().split())
x = []
ans = 0


def distancePoint(l1, l2):
    s = 0
    for j in range(d):
        s += (l1[j] - l2[j])**2
    return s**0.5


for i in range(n):
    x.append(list(map(int, input().split())))

for k in itertools.combinations(x, 2):
    dist = distancePoint(k[0], k[1])
    if dist.is_integer():
        ans += 1

print(ans)


Measured memory_bytes: 3064
#include<stdio.h>
   
 int main()
{
  int a,b;
 
    int i,j,Ya = 0;
 
int f, g, h;
 
  scanf("%d",&a);
 
  int array1[a];
  char array2[12];
  
  for(i = 0;i < a;i++){
    scanf("%s %d",array2,&b);
  
    if(array2[0] == 'i'){
      array1[i] = b;
    }
  
    else if(array2[6] == 'F'){
      i -= 2;
      a -= 2;
    }
  
    else if(array2[6]=='L'){
      i--;
      a--;
      Ya++;
    }
  
    else{
      i--;
      a--;
      f = 0;
      for(j = i; j >= 0;j--){
  
    if(f > 0)break;
  
    if(b == array1[j]){
      h = 0;
      g = i - j;
      f++;
      while(g != h++)array1[j + h - 1] = array1[j + 1 + h - 1];
      i--;
      a--;
    }
      }
    }
  }
  for(i = 0;i < a - Ya;i++){
    if(i == a - Ya - 1)
      printf("%d\n",array1[a - 1 - i]);
    else printf("%d ",array1[a - 1 - i]);
  }
  return 0;
}


Measured memory_bytes: 5636
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  int d;
  if (a < b) {
    if (a + W >= b) d = 0;
    else d = b - (a + W);
  } else {
    if (b + W >= a) d = 0;
    else d = a - (b + W);
  }

  cout << d << endl;

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/python

import sys

def main(argv):
    line = sys.stdin.readline()
    while line:
        N = int(line.rstrip("\n"))

        timestamps = [0]
        for i in xrange(N - 1):
            if i > 0:
                timestamps.append(0)

            c, s, f = map(
              lambda i: int(i), sys.stdin.readline().rstrip("\n").split(" "))

            for i in xrange(len(timestamps)):
                if timestamps[i] <= s:
                    timestamps[i] = s + c
                else:
                    d = timestamps[i] % f
                    if d == 0:
                        timestamps[i] += c
                    else:
                        timestamps[i] += (f - d) + c

        for timestamp in timestamps:
            print timestamp
        print 0

        line = sys.stdin.readline()

if __name__ == "__main__":
    main(sys.argv)

Measured memory_bytes: 2696
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
const long long MOD = 1e9+7;
struct union_find{
    vector<int> par; 
    vector<int> size;
    //1からnまで初期化:par[i] = i(1<=i<=n)
    union_find(int n){
        par.push_back(0);
        size.push_back(0);
        for(int i = 1;i<=n;i++){
            par.push_back(i);
            size.push_back(1);
        }
    }
    int root(int a){
        if (par[a] == a) return a;
        par[a] = root(par[a]);
        return root(par[a]);
    }
    void unite(int a,int b){
        if (root(a) == root(b)) return;
        size[root(b)]+=size[root(a)];
        par[root(a)] = root(b);
    }
    bool same(int a,int b){
        return (root(a) == root(b));
    }
    //頂点aが含まれる木の大きさ(頂点数)
    int treesize(int a){
        return size[root(a)];
    }
};
int main(){
    int n,m,k;
    cin >> n >> m >> k;
    union_find tree(n);
    int a,b;
    int mustminus[n+1];
    fill_n(mustminus,n+1,1);
    rep(i,m){
        cin >> a >> b;
        tree.unite(a,b);
        mustminus[a]++;
        mustminus[b]++;
    }
    rep(i,k){
        cin >> a >> b;
        if(tree.same(a,b)){
            mustminus[a]++;
            mustminus[b]++;            
        }
    }
    rep(i,n) cout << tree.treesize(i+1)-mustminus[i+1] << " ";
    cout << endl;
}

Measured memory_bytes: 2932
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define queint queue<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>//大きい順
#define pqg priority_queue<int,vec,greater<int>>//小さい順
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
int main(){
    int n=in();
    cout<< n*n*3<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	int n, m, c, i, j;
	char s[1000001];
	bool b;
	while (cin >> n, n)
	{
		cin >> m >> s;
		for (i = c = 0; i < m-1-n*2;)
		{
			b = true;
			if (s[i] == 'I')
			{
				for (j = 1; j < 1+n*2; j += 2)
				{
					if (s[i+j] != 'O' || s[i+j+1] != 'I')
					{
						b = false;
						break;
					}
				}
				if (b)
					c++, i++;
			}
			i++;
		}
		cout << c << endl;
	}
}

Measured memory_bytes: 1848
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;

#define int           long long 
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define ub            upper_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (int)(4e18)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>
#define ordered_set   tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){ cerr << name << " = " << arg1 << endl;}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args)
{ const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);}

template< typename T1, typename T2 > istream& operator>>(istream& in, pair<T1, T2> &q){ in >> q.F >> q.S; return in;}
template< typename T1, typename T2 > ostream& operator<<(ostream& out, pair<T1, T2> &q){ out << q.F << " " << q.S; return out;}
template< typename T1, typename T2 > pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F+p2.F, p1.S+p2.S};}
template< typename T1, typename T2 > pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F-p2.F, p1.S-p2.S};}
template< typename T1, typename T2 > bool operator<(pair<T1, T2> p1, pair<T1, T2> p2){ return p1 < p2 ;}

template<typename T> void Unique(vector<T> &v) {
    sort(all(v)), v.resize(distance(v.begin(), unique(all(v))));
}


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

	int d[n][2];
	for(int i = 0; i < n; i++) {
		cin >> d[i][0] >> d[i][1];
	}
	for(int i = 0; i < n-2; i++) {
		bool f = 1;
		for(int j = 0; j < 3; j++) {
			if(d[i+j][0] != d[i+j][1])f = 0;
		}
		if(f) {
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   
    start = clock(); 

   
    int test = 1;
    // cin >> test;
    
    cout << fixed << setprecision(2);
     
    for(int i = 1; i <= test; ++i){
    	solve();
    }

    cerr << time(start);
    return 0;
}


Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
    int x, n; cin >> x >> n;
    set<int> s;
    rep(i, n){
        int a; cin >> a;
        s.insert(a);
    }
    if(n == 0){
        cout << x << endl;
        return 0;
    }
    int cnt = 0;
    while(1){
        if(!s.count(x-cnt)){
            cout << x-cnt << endl;
            system("pause");
            return 0;
        }
        else if(!s.count(x+cnt)){
            cout << x+cnt << endl;
            system("pause");
            return 0;
        }
        cnt++;
    }

    system("pause");
}

Measured memory_bytes: 3696
import java.util.*;

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

        int N = sc.nextInt();
        int L = sc.nextInt();
        List<String> ss = new ArrayList<>();

        for (int i=0; i<N; i++) {
            ss.add(sc.next());
        }
        ss.sort((String a, String b) -> Main.compare(a, b));

        System.out.println(String.join("", ss));
    }

    static int compare(String a, String b) {
        char[] ac = new char[a.length()+1];
        char[] bc = new char[b.length()+1];

        for (int i=0; i<a.length(); i++) {
            ac[i] = a.charAt(i);
        }
        ac[a.length()] = 0;
        for (int i=0; i<b.length(); i++) {
            bc[i] = b.charAt(i);
        }
        bc[b.length()] = 0;

        for (int i=0; i<a.length() + 1; i++) {
            if (ac[i] != bc[i]) {
                return ac[i] - bc[i];
            }
        }
        return 0;
    }
}



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

using namespace std;

string C(int N, int M, vector<int>& s, vector<int>& c) {
	string num(N, '?');
	for (int i = 0; i < M; i++) {
		int pos = s[i] - 1;
		char d = c[i] + '0';
		if (num[pos] != d && num[pos] != '?')
			return "-1";
		num[pos] = d;
	}
	for (int i = 1; i < N; i++)
		if (num[i] == '?')
			num[i] = '0';
	if (num[0] == '?')
		num[0] = (N > 1) ? '1' : '0';
	if (N > 1 && num[0] == '0')
		return "-1";
	return num;
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> s(M), c(M);
	for (int i = 0; i < M; i++)
		cin >> s[i] >> c[i];
	cout << C(N, M, s, c);
	return 0;
}

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

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

	vector<vector<int>> A(k);
	rep(i, k){
		int d;
		cin >> d;
		rep(j, d){
			int kari;
			cin >> kari;
			A.at(i).push_back(kari);
		}
	}

	set<int> arr_list;

	rep(i, k){
		rep(j, A.at(i).size()){
			arr_list.insert(A.at(i).at(j));
		}
	}

	cout << n - arr_list.size() << endl;
}


Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define case(i) printf("Case #%d: ",i);
using namespace std;
typedef long long int ll;
typedef complex<double> com;
typedef pair<int, int> P;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 4e18;



int main(){
	int n; cin >> n;
	string s, t; cin >> s >> t;
	string u = "";
	rep(i, 0, s.size()) {
		if (s[i] == t[i]) u += "x";
		else {
			u += "y"; i++;
		}
	}
	int ans = (u[0] == 'x' ? 3 : 6);
	rep(i, 1, u.size()) {
		if (u[i - 1] == 'x') {
			if (u[i] == 'x') {
				ans = (2LL * ans) % mod;
			}
			else {
				ans = (2LL * ans) % mod;
			}
		}
		else {
			if (u[i] == 'y'){ 
				ans = (3LL * ans) % mod;
			}
		}
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
mod = 10**9 + 7
H, W = list(map(int, input().split()))
grid = [[1]*W for _ in range(H)]
for h in range(H):
    row = input()
    for w in range(W):
        if row[w] == '#':
            grid[h][w] = 0

dp = [[0]*W for _ in range(H)]

# initialize
dp[0][0] = 1
for h in range(1, H):
    if grid[h][0]:
        dp[h][0] = dp[h-1][0]
for w in range(1, W):
    if grid[0][w]:
        dp[0][w] = dp[0][w-1]

# solve
for h in range(1, H):
    for w in range(1, W):
        if grid[h][w]:
            dp[h][w] = (dp[h-1][w] + dp[h][w-1])%mod
print(dp[-1][-1])

Measured memory_bytes: 82304
import collections
n=int(input())
way=[[] for i in range(n)]
for i in range(n-1):
  u,v,w=list(map(int,input().split()))
  u-=1
  v-=1
  way[u].append((v,w))
  way[v].append((u,w))
visited=[False]*n
ans=[0]*n

q=collections.deque()
q.append(0)
while len(q)>0:
  c=q.popleft()
  visited[c]=True
  for next in way[c]:
    if not visited[next[0]]:
      ans[next[0]]=(ans[c]+next[1])%2
      q.append(next[0])
for i in ans:
  print(i)

Measured memory_bytes: 43692
#include<bits/stdc++.h>
using namespace std;
long long a[100002];
int main(){
	long long n,x,ans=0;
	cin>>n>>x;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=2;i<=n;i++){
		if(a[i]+a[i-1]>x){
			ans+=(a[i-1]+a[i])-x;
			if(a[i-1]>x){
				a[i]=0;
				a[i-1]-=a[i-1]-x;
			}else{
				a[i]-=((a[i-1]+a[i])-x);
			}
		}
	}
	cout<<ans;
	return 0;
}


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

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

#define uint8_t unsigned char
#define uint16_t unsigned short
#define uint32_t unsigned int
#define uint64_t unsigned long long

#define int8_t signed char
#define int16_t signed short
#define int32_t signed int
#define int64_t signed long long



using namespace std;
// #define PI 3.14159265358979323846
// cout << fixed << setprecision(20);

int main(int argc, char const* argv[])
{
    int N = 0;
    int K = 0;
    cin >> N >> K;
    vector<int> p;
    int index = 0;
    REP(i, N) {
        int a;
        cin >> a;
        p.push_back(a);
    }
    sort(p.begin(), p.end());

    int total = 0;
    REP(i, K) total+=p[i];
    cout << total << endl;


    return 0;
}



Measured memory_bytes: 3620
#include <iostream>
#include <fstream>
using namespace std;
const long long Nmax = 1e6 + 5;
long long n, c, tmpbi, tmpai;
long long p[Nmax], q[Nmax], h[Nmax], cost[Nmax];
double x[Nmax];
bool ok(long long u)
{
    if (p[u] == tmpai) return false;
    double xM = (double) (tmpbi - q[u]) / (p[u] - tmpai);
    u--;
    double xN = (double) (tmpbi - q[u]) / (p[u] - tmpai);
    return xM > xN;

}
int main()
{
    //freopen("frog.inp","r",stdin);
    cin >> n >> c;
    for (long long i = 1; i <= n; ++i)
    {
        cin >> h[i];
    }
    cost[1] = 0;
    x[1] = -1e18;
    p[1] = (-2) * h[1];
    q[1] = h[1] * h[1] + c;
    long long m = 1;
    long long u = 1;
    for (long long i = 2; i <= n; ++i)
    {
        while (u <= m && x[u] <= h[i]) ++ u;
        --u;
        cost[i] = p[u] * h[i] + q[u] + h[i] * h[i];

        tmpbi = h[i] * h[i] + c + cost[i];
        tmpai = (-2) * h[i];
        if (tmpai == p[m] && tmpbi >= q[m]) continue;
        while (m > 1 && !ok(m)) m--;
        if (u > m) u = m;
        if (m == 1 && tmpai == p[1]) q[1] = tmpbi; else
        {
            p[++m] = tmpai;
            q[m] = tmpbi;
            x[m] = (double) (q[m] - q[m-1]) / (p[m-1] - p[m]);
        }
    }
    cout << cost[n];
    return 0;
}

Measured memory_bytes: 11416
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	int n;
	double t,a;
	cin>>n>>t>>a;
	double x[n];
	int ans=0;
	double ret=inf;
	rep(i,n){
		cin>>x[i];
		x[i]=t-0.006*x[i];
		if(ret>abs(x[i]-a)){
			ans=i+1;
			ret=abs(x[i]-a);
		}
	}
	cout<<ans<<endl;

	return 0;
}


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

int main() {
    string S;
    cin >> S;
    int ans = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == '+')
            ans += 1;
        else
            ans -= 1;
    }
    cout << ans << endl;
    return 0;
}

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 100010
#define inf 1e9

int main()
{

    string s, t;
    ll n;
    cin >> n >> s >> t;
    for(ll i = 0; i < s.size(); i++) cout << s[i] << t[i];
}


Measured memory_bytes: 256
n,m=map(int,input().split())
l=[]
for _ in range(n):
    a=list(map(int,input().split()))
    a=set(a[1:])
    l.append(a)
for i in range(n-1):
    l[i+1]=l[i]&l[i+1]
print(len(l[-1]))

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>
#include <bitset>

using namespace std;

/* typedef */
typedef long long ll;

/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;

/* global variables */

/* function */

/* main */
int main(){
    int a, b, c;
    cin >> a >> b >> c;

    set<int> s = {a, b, c};
    if (s.size() == 2)
        cout << "Yes" << '\n';
    else 
        cout << "No" << '\n';


}


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

#define int long long
#define INT int
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}
typedef long long ll;
const long long INF = 1LL << 60;

signed main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) { cin >> a[i]; }
    int sum = a[0];

    rep1(i, n)
    {
        sum ^= a[i];
    }

    rep(i, n)
    {
        int ans = sum ^ a[i];
        cout << ans << " ";
    }
    cout << endl;

    return 0;
}


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

/**
 * 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;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AMultipleOf2AndN solver = new AMultipleOf2AndN();
        solver.solve(1, in, out);
        out.close();
    }

    static class AMultipleOf2AndN {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            out.println(n % 2 == 0 ? n : n * 2);
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

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

    }
}



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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define maxn 1e5
#define PI 3.141592653589793
#define int long long int
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0)
    {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}
signed main()
{
  int A,B;
  cin >> A >> B;
  B = 2 * B;
  int ans = A - B;
  if(ans < 0)ans = 0;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
#include <time.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<pii> p_ori(n);
    set<int> xapp, yapp;
    map<int, int> xidx, yidx;
    vii xval, yval;
    rep(i,n){
        int x, y;
        cin >> x >> y;
        xapp.insert(x);
        yapp.insert(y);
        p_ori[i] = mp(x, y);
    }
    int xnum = 0, ynum = 0;
    for (auto x:xapp){
        xidx[x] = xnum;
        xval.eb(x);
        xnum++;
    }
    for (auto y:yapp){
        yidx[y] = ynum;
        yval.eb(y);
        ynum++;
    }
    vector<pii> pnt(n);
    rep(i,n){
        pnt[i] = mp(xidx[p_ori[i].F], yidx[p_ori[i].S]);
    }
    ll ans = 4 *(1e18) + 7;
    rep(xs,xnum){
        repf(xg,xs,xnum){
            rep(ys,ynum){
                repf(yg,ys,ynum){
                    int cnt = 0;
                    rep(i,n){
                        int x = pnt[i].F, y = pnt[i].S;
                        if (xs<=x && x<=xg && ys<=y && y<=yg)
                            cnt++;
                    }
                    if (cnt==k){
                        ans = min(ans, ((ll)xval[xg] - (ll)xval[xs]) * ((ll)yval[yg] - (ll)yval[ys]));
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int A,B,C,D,P,x,y;
    cin>>A>>B>>C>>D>>P;
    x=A*P;
    if(C>P){
        y=B;
    }else{
        y=(P-C)*D+B;
    }
    if(x>y){
        cout<<y;
    }else{
        cout<<x;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3032
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll H, W; cin >> H >> W;
    ll ret = H * W;
    FOR(i, 1, H){
        ll s1 = i * W;
        ll w_mid = W / 2;
        ll s2 = (H - i) * w_mid;
        ll s3 = (H - i) * (W - w_mid);
        ll tmp = max(max(s1, s2), s3) - min(min(s1, s2), s3);
        if(tmp < ret) ret = tmp;
    }
    
    FOR(i, 1, H){
        ll s1 = i * W;
        ll h_rem_mid = (H - i) / 2;
        ll s2 = h_rem_mid * W;
        ll s3 = (H - i - h_rem_mid) * W;
        ll tmp = max(max(s1, s2), s3) - min(min(s1, s2), s3);
        if(tmp < ret) ret = tmp;
    }
    
    FOR(j, 1, W){
        ll s1 = j * H;
        ll h_mid = H / 2;
        ll s2 = (W - j) * h_mid;
        ll s3 = (W - j) * (H - h_mid);
        ll tmp = max(max(s1, s2), s3) - min(min(s1, s2), s3);
        if(tmp < ret) ret = tmp;
    }
    
    FOR(j, 1, W){
        ll s1 = j * H;
        ll w_rem_mid = (W - j) / 2;
        ll s2 = w_rem_mid * H;
        ll s3 = (W - j - w_rem_mid) * H;
        ll tmp = max(max(s1, s2), s3) - min(min(s1, s2), s3);
        if(tmp < ret) ret = tmp;
    }
   
    cout << ret << endstr;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String input = scan.next();
		char [] num = input.toCharArray();

		if(num[0]==num[2]){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}


}


Measured memory_bytes: 21716
#include <iostream>

using namespace std;

int i,n,a[100010],b[100010],c[100010],d1[100010],d2[100010],d3[100010];

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

    d1[1]=a[1];
    d2[1]=b[1];
    d3[1]=c[1];

    for(i=2;i<=n;i++)
    {
        d1[i]=max(d2[i-1],d3[i-1])+a[i];
        d2[i]=max(d1[i-1],d3[i-1])+b[i];
        d3[i]=max(d2[i-1],d1[i-1])+c[i];
    }

    cout<<max(max(d1[n],d2[n]),d3[n]);
    return 0;
}


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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}

int main() {
  int n,m,a,ans=0;
  cin>>n>>m;
  vector<int> k(n),count(m);
  rep(i,n){
    cin>>k[i];
    for(int j=0;j<k[i];j++){
      cin>>a;
      count[a-1]++;
    }
  }
  rep(i,m){
    if(count[i]==n){
      ans++;
    }
  }
  
  cout<<ans<<endl;
  
  
  
  
}


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

int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  string t = s.substr(0, k);
  if (s.size() <= k) cout  << s << endl;
  else cout << t + "..." << endl;
} 

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define il inline
#define ri register int
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define mid ((l+r)>>1)
#define MAXN 100050
#define MAXM
#define mod
#define inf (1<<30)
#define eps (1e-6)
#define alpha 0.75
#define rep(i, x, y) for(ri i = x; i <= y; ++i)
#define repd(i, x, y) for(ri i = x; i >= y; --i)
#define file(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, int> pli;
typedef pair <int, ll> pil;
typedef pair <ll, ll> pll;
template <typename T> il bool chkmin(T &x, T y) {return x > y ? x = y, 1 : 0;}
template <typename T> il bool chkmax(T &x, T y) {return x < y ? x = y, 1 : 0;}
template <typename T> il void read(T &x) {
	char ch = getchar(); int f = 1; x = 0;
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = x*10+ch-'0', ch = getchar();
	x *= f;
}
template <typename T, typename... Args> il void read(T &x, Args &...args) {
	read(x), read(args...);
}
int n, a[MAXN], ans;
map <int, int> pos;
int main() {
	read(n);
	rep(i, 1, n) read(a[i]), pos[a[i]] = i;
	sort(a+1, a+n+1);
	rep(i, 1, n) if(abs(pos[a[i]]-i) & 1) ans++;
	cout << ans / 2 << endl;
	return 0;
}


Measured memory_bytes: 5376
function Main(input){
	input = input.split("\n");
	var sum = 0;
	for(var i=0;i<3;i++){
		var mem = input[i].split(" ").map(Number);
		sum += mem[0]+mem[1];
	}
	console.log(sum%2==1?"YES":"NO")
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 11468
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

ll MODP = 998244353;


int main(){
  ll N;
  cin >> N;
  vector<ll> A(N);
  rep(i,N)cin >> A[i];
  sort(A.begin(),A.end());
  queue<ll> q;
  ll cnt = 2;
  ll ans = A[N-1];
  q.push(A[N-2]);

  for(int i = N-3;i >= 0;i--){
    q.push(A[i]);
    cnt--;
    ans += q.front();
    if(cnt == 0){
      q.pop();
      cnt = 2;
    }
  }

  cout << ans << endl;





  return 0;
}


Measured memory_bytes: 5612
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
 
int main(){
  ll n;
  cin>>n;
  ll x=n%10;
  if(x==2 || x==4 || x==5 || x==7 || x==9)
        cout<<"hon"<<endl;
  else if(x==0 || x==1 || x==6 || x==8)
        cout<<"pon"<<endl;
  else
        cout<<"bon"<<endl;
  return 0;
}

Measured memory_bytes: 3580
from queue import Queue as q
from copy import deepcopy as cp

def l_move(data):
    global flag
    field,n,i,j = data[0],data[1],data[2],data[3]
    if j == 0 or field[i][j-1] == 1 or n == 0:
        return(None)
    while(j):
        if field[i][j-1] == 0:
            j -= 1
        elif field[i][j-1] == 3:
            flag = True
            print(11-n)
            return(None)
        else:
            nfield = field[:i] + [field[i][:j-1] + [0] + field[i][j:]] + field[i+1:]

            n -= 1
            return([nfield,n,i,j])
    return(None)

def u_move(data):
    global flag
    field,n,i,j = data[0],data[1],data[2],data[3]
    if i == 0 or field[i-1][j] == 1 or n == 0:
        return(None)
    while(i):
        if field[i-1][j] == 0:
            i -= 1
        elif field[i-1][j] == 3:
            flag = True
            print(11-n)
            return(None)
        else:
            nfield = field[:i-1] + [field[i-1][:j] + [0] + field[i-1][j+1:]] + field[i:]

            n -= 1
            return([nfield,n,i,j])
    return(None)

def r_move(data):
    global flag
    field,n,i,j = data[0],data[1],data[2],data[3]

    if j == y-1 or field[i][j+1] == 1 or n == 0:
        return(None)
    while(j < y-1):
        if field[i][j+1] == 0:
            j += 1
        elif field[i][j+1] == 3:
            flag = True
            print(11-n)
            return(None)
        else:
            nfield = field[:i] + [field[i][:j+1] + [0] + field[i][j+2:]] + field[i+1:]

            n -= 1
            return([nfield,n,i,j])
    return(None)

def d_move(data):
    global flag
    field,n,i,j = data[0],data[1],data[2],data[3]
    if i == x-1 or field[i+1][j] == 1 or n == 0:
        return(None)
    while(i < x-1):
        if field[i+1][j] == 0:
            i += 1
        elif field[i+1][j] == 3:
            flag = True
            print(11-n)
            return(None)
        else:
            nfield = field[:i+1] + [field[i+1][:j] + [0] + field[i+1][j+1:]] + field[i+2:]

            n -= 1
            return([nfield,n,i,j])
    return(None)

while(True):
    flag = False
    y,x = map(int,input().split())
    lis = q()
    if x == 0:
        break
    field = []
    for i in range(x):
        field.append(list(map(int, input().split())))
    for i in range(x):
        for j in range(y):
            if field[i][j] == 2:
                start_x, start_y = i,j
                field[i][j] = 0
    data = [field,10,start_x,start_y]
    lis.put(data)
    while(lis.qsize()):
        d = lis.get()
        tmp = l_move(d)
        if flag:
            break
        if tmp != None:
            lis.put(tmp)
        tmp = u_move(d)
        if flag:
            break
        if tmp != None:
            lis.put(tmp)
        tmp = d_move(d)
        if flag:
            break
        if tmp != None:

            lis.put(tmp)
        tmp = r_move(d)
        if flag:
            break
        if tmp != None:
            lis.put(tmp)

        
    if not flag:
        print(-1)



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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  LL N,K;
  cin>>N>>K;
  
  vector<LL> A(N);
  
  REP(i,N){
    cin>>A[i];
  }
  
  LL tentou = 0;
  LL hoge = 0;
  REP(i,N){
    FOR(j,i+1,N){
      if(A[i]>A[j]){
        tentou++;
      }
      if(A[i]!=A[j]){
        hoge ++;
      }
    }
  }
  
  cout<<(tentou*K + hoge*((K*(K-1)/2)%mod))%mod<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){

  int m,f,r,sum;
  
  while(1){
    scanf("%d %d %d", &m, &f, &r);
    if ( m == -1 && f == -1 && r == -1 ) break;
    sum = m + f;
    
    if ( m == -1 || f == -1 ) {
      printf("F\n");
    } else if ( sum >= 80 ) {
      printf("A\n");
    } else if ( sum >= 65 ) {
      printf("B\n");
    } else if ( sum >= 50 ){
      printf("C\n");
    } else if ( sum >= 30 && r >=50 ){
      printf("C\n");
    } else if ( sum >= 30 ) {
      printf("D\n");
    } else {
      printf("F\n");
    }

  }

  return 0;

}

Measured memory_bytes: 584
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = 2000000000;
// const ll MOD = 1000000007;

int A, B, C;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> A >> B >> C;

  if (A < C && C < B) {
    cout << "Yes" << endl;
  } else if (B < C && C < A) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int n;
  scanf("%d",&n);
  int a[n];
  for(int i=0;i<n;i++){
	scanf("%d",&a[i]);
  }
     int sum=0;
  for(int i=0;i<n-1;i++){
    int c=0;
    int c1=0;
 
	if(a[i]>a[i+1]){
	for(int j=0;j<n;j++){if(j==i)continue;
	if(a[i]>a[j])c++;		//本来はc番目の要素
    }
      for(int k=0;k<n;k++){
	if(a[c]>a[k])c1++;
      }
      if(c1==i){
        int w=a[i];
        a[i]=a[c];
        a[c]=w;
        sum++;
      //  printf("YES");
        //return 0;
      }
      else {
	printf("NO");
        return 0;
      }
    }
  }
 // printf("%d\n",sum);
  if(sum<=1)
printf("YES");
    else printf("NO");
  return 0;
}

Measured memory_bytes: 128
using System;

namespace AOJ.Volume5
{
    public class StringEdit
    {
        public static int Main()
        {
            while (true)
            {
                int n = int.Parse(Console.ReadLine());
                if (n == 0) { break; }
                string answer = Console.ReadLine();
                // n = 0?????????
                for(int i = 1; i <= n; i++)
                {
                    var tmp = answer;
                    answer = "";
                    int len = tmp.Length;
                    int r = 0;
                    char num = ' ';
                    for(int j = 0; j < len; j++)
                    {
                        if (j == 0)
                        {
                            num = tmp[j];
                            r = 1;
                        }
                        else
                        {
                            if(tmp[j] == num) { r++; }
                            else
                            {
                                answer += r.ToString() + num;
                                num = tmp[j];
                                r = 1;
                            }
                        }
                    }
                    answer += r.ToString() + num;
                }
                Console.WriteLine(answer);
            }
            return 0;
        }
    }
}

Measured memory_bytes: 10336
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

inline void down(int &x,const int &y){if(x>y)x=y;}
const int maxn = 210000;

int n,m,d[maxn];
struct edge{int y,nex;}a[maxn]; int len,fir[maxn];
inline void ins(const int x,const int y){a[++len]=(edge){y,fir[x]};fir[x]=len;}

int cir[maxn],cn;
int t[maxn],tp; bool insta[maxn];
int bel[maxn],dfn[maxn],low[maxn],id;
void tarjan(const int x)
{
	dfn[x]=low[x]=++id; insta[t[++tp]=x]=true;
	for(int k=fir[x],y=a[k].y;k;k=a[k].nex,y=a[k].y)
	{
		if(!dfn[y]) tarjan(y),down(low[x],low[y]);
		else if(insta[y]) down(low[x],dfn[y]);
		if(cn) return;
	}
	if(low[x]==dfn[x])
	{
		int la=0;
		while(la!=x) insta[cir[++cn]=la=t[tp--]]=false;
		if(cn==1) cn=0;
	}
}
bool inc[maxn],v[maxn];
int s[maxn],s2[maxn];
void dfs(const int x,const int fa)
{
	int yn=d[x];
	for(int k=fir[x],y=a[k].y;k;k=a[k].nex,y=a[k].y) if(y!=fa&&!inc[y])
		++yn,dfs(y,x);
	for(int i=0;i<=yn+10;i++) v[i]=false;
	for(int k=fir[x],y=a[k].y;k;k=a[k].nex,y=a[k].y) if(y!=fa&&!inc[y])
		v[s[y]]=true;
	for(int i=0;i<=yn;i++) if(!v[i])
	{
		s[x]=i; break;
	}
}
int c[maxn],dir,now;
bool judge()
{
	if(dir)
	{
		for(int i=2;i<=cn;i++) c[cir[i]]=-1;
		for(int i=2;i<=cn;i++)
		{
			int x=cir[i];
			for(int j=0;j<=d[x]+10;j++) v[j]=false;
			for(int k=fir[x],y=a[k].y;k;k=a[k].nex,y=a[k].y) v[c[y]]=true;
			if(!v[s[x]]) c[x]=s[x];
			else c[x]=s2[x];
		}
		if(now==1?(c[cir[cn]]==s[cir[1]]):(c[cir[cn]]!=s[cir[1]])) return false;
		return true;
	}
	else
	{
		for(int i=2;i<=cn;i++) c[cir[i]]=-1;
		for(int i=cn;i>=2;i--)
		{
			int x=cir[i];
			for(int j=0;j<=d[x]+10;j++) v[j]=false;
			for(int k=fir[x],y=a[k].y;k;k=a[k].nex,y=a[k].y) v[c[y]]=true;
			if(!v[s[x]]) c[x]=s[x];
			else c[x]=s2[x];
		}
		if(now==1?s[cir[1]]==c[cir[2]]:(c[cir[2]]!=s[cir[1]])) return false;
		return true;
	}
}

int main()
{
	scanf("%d",&n); 
	for(int i=1;i<=n;i++)
	{
		int x; scanf("%d",&x); 
		d[x]++; ins(x,i);
	}
	for(int i=1;i<=n&&!cn;i++) if(!dfn[i]) tarjan(i);
	for(int k=fir[cir[1]],y=a[k].y;k;k=a[k].nex,y=a[k].y) if(y==cir[cn]) dir=1;
	for(int i=1;i<=cn;i++) inc[cir[i]]=true;
	
	for(int i=1;i<=cn;i++)
	{
		dfs(cir[i],0);
		for(int j=s[cir[i]]+1;;j++) if(!v[j])
		{
			s2[cir[i]]=j; break;
		}
	}
	for(int i=1;i<=n;i++) c[i]=s[i];
	c[cir[1]]=s[cir[1]];
	now=1; if(judge()) { puts("POSSIBLE");return 0; }
	c[cir[1]]=s2[cir[1]];
	now=2; if(judge()) { puts("POSSIBLE");return 0; }
	
	puts("IMPOSSIBLE");
	
	return 0;
}


Measured memory_bytes: 18304
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#include<string>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){
	string S;

	cin>>S;
	
	sort(S.begin(),S.end());
	
	if(S[0] == S[1] && S[2] == S[3] && S[0] != S[2]){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;

}



Measured memory_bytes: 256