akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(void){
  int i,n,count=0;
  scanf("%d",&n);
  int p[n];
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
  }

  for(i=0;i<n-2;i++){
    if((p[i]<p[i+1])&&(p[i+1]<p[i+2])){
      count+=1;
    }
    else if((p[i]>p[i+1])&&(p[i+1]>p[i+2])){
      count+=1;
    }
  }

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

  return 0;
}


Measured memory_bytes: 256
N = gets.chomp.to_i
A = gets.chomp.split(' ').map(&:to_i)

temp = Hash.new(0)
av = []
A.each do |a|
  temp[a] += 1
  if temp[a] % 2 == 0
    av << a
  end
end

if av.length < 2
  print 0
else
  print av.sort {|a, b| b <=> a }[0..1].inject(:*)
end

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

using namespace std;

typedef long double ld;

int main(){
        ld N;
        cin>>N;
        bool res=false;
        for(int i=1;i<=3500;i++){
                for(int j=1;j<=3500;j++){
                        ld w=N*i*j/(4*i*j-N*i-N*j);
                        if(w<0){
                                continue;
                        }
                        int w2=w;
                        if(w2==w){
                                res=true;
                                cout<<i<<" "<<j<<" "<<w2<<endl;
                                break;
                        }
                }
                if(res){
                        break;
                }
        }
        return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const int MAXN=520;
    static const int MAXC=35;
    int N,C;
    ll d[MAXC][MAXC];
    ll c[MAXN][MAXN];
    ll mcost[3][MAXC];
    void solve(){
        ios::sync_with_stdio(false); 
        cin.tie(0);
        cin>>N>>C;
        for(int u=1;u<=C;u++){
            for(int v=1;v<=C;v++){
                cin>>d[u][v];
            }
        }
        for(int u=1;u<=N;u++){
            for(int v=1;v<=N;v++){
                cin>>c[u][v];
            }
        }
        for(int u=1;u<=N;u++){
            for(int v=1;v<=N;v++){
                for(int w=1;w<=C;w++){
                    mcost[(u+v)%3][w]+=d[c[u][v]][w];
                }
            }
        }
        ll ans=1e18;
        for(int u=1;u<=C;u++){
            for(int v=1;v<=C;v++){
                for(int w=1;w<=C;w++){
                    if(u==v||v==w||u==w)continue;
                    ans=min(ans,mcost[0][u]
                    +mcost[1][v]+mcost[2][w]);
                }
            }
        }
        cout<<ans;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)++)
#define p(...) printf(__VA_ARGS__); cout << endl;
#define input(x) x; cin >> x;
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](const a, const b){ return c ;}
#define key(t, x, compare) [](const t& a, const t& b){ return a x compare b x ;}

using namespace std;

using pii = pair<int, int>;

int main(){
  string input(s);
  replace(s.begin(), s.end(), ',', ' ');
  cout << s << endl;
}


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

int main() {
  int W, H, N;
  cin >> W >> H >> N;
  vector< vector<bool> > R(W);
  for (int i = 0; i < W; i++) {
    for (int j = 0; j < H; j++) {
      R.at(i).push_back(false);
    }
  }

  int x, y, a, xst, xen, yst, yen;
  for (int i = 0; i < N; i++) {
    cin >> x >> y >> a;
    if (a == 1) {
      xst = 0; xen = x; yst = 0; yen = H;
    } else if (a == 2) {
      xst = x; xen = W; yst = 0; yen = H;
    } else if (a == 3) {
      xst = 0; xen = W; yst = 0; yen = y;
    } else if (a == 4) {
      xst = 0; xen = W; yst = y; yen = H;
    }
    for (int xi = xst; xi < xen; xi++) {
      for (int yi = yst; yi < yen; yi++) {
        R.at(xi).at(yi) = true;
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < W; i++) {
    for (int j = 0; j < H; j++) {
      if (!R.at(i).at(j)) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
var n,max,min,d,i:longint;
begin
        readln(n);
        min:=maxlongint;
        for i:=1 to n do
                begin
                read(d);
                if d>max then max:=d;
                if d<min then min:=d;
                end;
        write(max-min);
end.


Measured memory_bytes: 128
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
#define MAX 100000
#define INFTY (1<<30)

class Edge{
public:
	int t,w;
	Edge(){}
	Edge(int t,int w):t(t),w(w){}
};

vector<Edge> G[MAX];
int n,d[MAX];

bool vis[MAX];
int cnt;

void bfs(int s){
	for(int i=0;i<n;i++){
		d[i]=INFTY;
	}
	queue<int>Q;
	Q.push(s);
	d[s]=0;
	int u;
	while(Q.size()){
		u=Q.front();
		Q.pop();
		for(int i=0;i<G[u].size();i++){
			Edge e=G[u][i];
			if(d[e.t]==INFTY){
				d[e.t]=d[u]+e.w;
				Q.push(e.t);
			}
		}
	}
}

void solve(){
	bfs(0);
	int maxv=0;
	int tgt=0;
	for(int i=0;i<n;i++){
		if(d[i]==INFTY)continue;
		if(maxv<d[i]){
			maxv=d[i];
			tgt=i;
		}
	}
	bfs(tgt);
	maxv=0;
	for(int i=0;i<n;i++){
		if(d[i]==INFTY)continue;
		maxv=max(maxv,d[i]);
	}
	printf("%d\n",maxv);
}

int main(void){
	int s,t,w;
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		scanf("%d %d %d",&s,&t,&w);
		G[s].push_back(Edge(t,w));
		G[t].push_back(Edge(s,w));
	}
	solve();
}

Measured memory_bytes: 7828
N,M=map(int,input().split())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

import bisect
def find_lt(a,x):
    i = bisect.bisect_right(a,x)
    if i:
        return a[i-1]
    else:
        return -1

MD=make_divisors(M)
print(find_lt(MD,M//N))

Measured memory_bytes: 3064
W,H = map(int,input().split())
ps = [int(input()) for i in range(W)]
qs = [int(input()) for i in range(H)]

es = []
for p in ps:
    es.append((p,0))
for q in qs:
    es.append((q,1))
es.sort()

ans = 0
xn,yn = W+1,H+1
for d,t in es:
    if t:
        ans += d * xn
        yn -= 1
    else:
        ans += d * yn
        xn -= 1
print(ans)    

Measured memory_bytes: 27540
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    s = input()
    if len(s) % 2 == 0:
        i = len(s) - 2
    else:
        i = len(s) - 1
    while True:
        if s[:int(i/2)] ==  s[int(i/2):i]:
            print(i)
            break
        i -= 2
        


if __name__ == '__main__':
    main()


Measured memory_bytes: 10464
#include <bits/stdc++.h>
#define ll long long
using namespace std;
struct nod{int p,l,r;ll w;}a[2000005];bool operator<(nod a,nod b){return a.p<b.p;}
int n,m,L[5005],R[5005],P=1,t;ll s[5005],c[5005],ans,d[5005],b[5005][205];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=2;i<=n;i++) scanf("%lld",&d[i]),d[i]+=d[i-1];
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) scanf("%lld",&b[i][j]);
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=n;j++) for(L[j]=j-1;L[j]>=1&&b[L[j]][i]<b[j][i];L[j]=L[L[j]]);
		for(int j=n;j>=1;j--) for(R[j]=j+1;R[j]<=n&&b[R[j]][i]<b[j][i];R[j]=R[R[j]]);
		for(int j=1;j<=n;j++) a[++t]=(nod){L[j]+1,j,R[j]-1,b[j][i]},a[++t]=(nod){j+1,j,R[j]-1,-b[j][i]};
	}
	sort(a+1,a+t+1);
	for(int i=1;i<=n;i++)
	{
		for(memset(c,0,sizeof(c));P<=t&&a[P].p==i;P++) c[a[P].l]+=a[P].w,c[a[P].r+1]-=a[P].w;
		for(int j=1;j<=n;j++) c[j]+=c[j-1],s[j]+=c[j],ans=max(ans,j<i?ans:s[j]-d[j]+d[i]);
	}
	printf("%lld\n",ans);
}

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

int main()
{
	int x, n; cin >> x >> n;
	set<int> s; int num;
	for(int i = 0; i < n; ++i)
	{
		cin >> num;
		s.insert(num);
	}
	int mini = 1000;
	int ans = 1000;
	for(int p = 0; p <= 101; ++p)
	{
		if(s.find(p) == s.end())
		{
			int diff = p - x;
			if(diff < 0) diff = -diff;
			if(diff < mini)
			{
				mini = diff;
				ans = p;
			}
			else if(diff == mini)
			{
				ans = min(ans, p);
			}
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3524
n=int(input())
f=[]
for i in range(n):
    f.append([int(i) for i in input().split()])
p=[]
for i in range(n):
    p.append([int(i) for i in input().split()])

cnt=[0]*n
ans=tmp=0
for i in range(1,1<<10):
    tmp=0
    cnt=[0]*n
    for j in range(10):
        if (i&(1<<j)):
            for k in range(n):
                if (f[k][j]): cnt[k]+=1
    for l in range(n):
       tmp+=p[l][cnt[l]]
    if i==1: ans=tmp
    else: ans=max(ans,tmp)

print(ans)

Measured memory_bytes: 42452
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

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

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            List<Integer> s = new ArrayList<>();
            int g = 0;
            for (int i = 0; i < n; i++) {
                s.add(in.nextInt());
                g += s.get(i);
            }
            if (g % 10 != 0) {
                out.println(g);
            } else {
                Collections.sort(s);
                for (int c : s) {
                    if (c % 10 != 0) {
                        g -= c;
                        break;
                    }
                }
                if (g % 10 == 0) {
                    out.println(0);
                } else {
                    out.println(g);
                }
            }
        }

    }
}



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

int main() {
	string s, t;
	char c = 'A';
	cin >> s >> t;
	for(int i = 0; i < s.length(); i++) {
		if('A' <= s[i] && s[i] <= 'Z') {
			continue;
		} else {
			char cur = s[i];
			for(int j = i; j < s.length(); j++) {
				if(s[j] == cur) {
					s[j] = c;
				}
			}
			c++;
		}
	}
	c = 'A';
	for(int i = 0; i < t.length(); i++) {
		if('A' <= t[i] && t[i] <= 'Z') {
			continue;
		} else {
			char cur = t[i];
			for(int j = i; j < t.length(); j++) {
				if(t[j] == cur) {
					t[j] = c;
				}
			}
			c++;
		}
	}
	if(s.compare(t)) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}
	return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allg(v) v.begin(), v.end(), greater<int>()



signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string n;
  int d;
  cin >> d >> n;
  
  if(n == "100") {
    if(d == 0) n = "101";
    if(d == 1) n = "10100";
    if(d == 2) n = "1010000";
  }
  else {
    if(d == 1) n += "00";
    if(d == 2) n += "0000";
  }
  
  cout << n << "\n";

}

Measured memory_bytes: 384
n=int(input())
A=[int(i) for i in input().split()]
n_output=max(A)
mean=n_output/2
r=10000000000
r_output=10000000000
for i in range (n):
    if abs(A[i]-mean)<=r:
        r=abs(A[i]-mean)
        r_output=A[i]
list=[]
list.append(n_output)
list.append(r_output)
list.sort()
list.reverse()
print(list[0],list[1])

Measured memory_bytes: 14060
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string sub(int a,int b,string S){
    string R;
    for(int i=a;i<b;i++){
        R+=S[i];
    }
    return R;
}
string Rev(int a,int b,string S){
    string R;
    for(int i=a;i<b;i++){
        
    }
}
int main(void){
    // Your code here!
    int i,n,m,t=0,h=0;
    string T,H,A="",B,C;
    cin>>H>>n;
    //cout<<H<<endl;
    for(i=0;i<n;i++){
        cin>>T;
        if(T=="print"){
            cin>>m>>t;
            
            cout<< sub(m,t+1,H)<<endl;
        }else if(T=="reverse"){
            cin>>m>>t;
            C=sub(m,t+1,H);
            
            reverse(C.begin(),C.end());
            //cout<<H<<endl;
            H.replace(m,C.size(),C);
            
            //cout<<H<<endl;
        }else if(T=="replace"){
            cin>>m>>t>>B;
            H.replace(m,B.size(),B);
            //cout<<H<<endl;
        }
        
    }
    return 0;
}



Measured memory_bytes: 3168
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;


int main() {
    
    int N;
    cin >> N;
    vector<long long> A(N),B(N),C(N);
        
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }    
    for ( int i = 0; i < N; i++ ) {
        cin >> B[i];
    }    
    for ( int i = 0; i < N; i++ ) {
        cin >> C[i];
    }
    sort( A.begin(), A.end() );
    sort( B.begin(), B.end() );
    sort( C.begin(), C.end() );
    
    long long ans = 0;
    for ( int i = 0; i < N; i++ ) {
        decltype(B)::iterator it1 = lower_bound(A.begin(), A.end(), B[i]);
        decltype(B)::iterator it2 = upper_bound(C.begin(), C.end(), B[i]);
        
        ans += ( it1 - A.begin() ) * ( C.end() - it2 );
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h>
int main()
{
    char str[200000];
    int len,i,j,x,y,z;
    gets(str);
    len=strlen(str);
    for(i=0; i<=len; i++)
    {
        if(str[i]=='A')
        {
            x=i;
            break;
        }
    }
    for(j=len; j>=0; j--)
    {
        if(str[j]=='Z')
        {
            y=j;
            break;
        }
    }
    z=y-x+1;
    printf("%d\n",z);
    return 0;
}


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

// #define set unordered_set
// #define map unordered_map

using namespace std;

class UnionFind {
private:
	int size;
	int parent[40000];
	int rank[40000];

public:
	UnionFind() {}
	UnionFind(int sz) {
		init(sz);
	}
	void init(int sz) {
		size = sz;
		fill(rank, rank+sz, 0);
		for (int i = 0; i < sz; ++i) {
			parent[i] = i;
		}
	}
	int root(int n) {
		if (parent[n] == n) return n;
		return parent[n] = root(parent[n]);
	}
	void unite(int n, int m) {
		int x = root(n);
		int y = root(m);
		if (x == y) return;

		if (rank[x] < rank[y]) {
			parent[x] = y;
		}
		else if (rank[x] > rank[y]) {
			parent[y] = x;
		}
		else {
			parent[x] = y;
			++rank[y];
		}
	}
	bool isUnited(int n, int m) {
		return root(n) == root(m);
	}
};


typedef pair<int, int> P;

struct Query {
	int type, u, v;
};

typedef vector< set<int> > Graph;

const int bucket = 100;

map<int, int> make_table(set<P>& use) {
	map<int, int> res;
	set<int> s;
	for (P p : use) {
		s.insert(p.first);
		s.insert(p.second);
	}
	int n = 0;
	for (int v : s) {
		res[v] = n++;
	}
	return res;
}
Graph trim(Graph& G, set<P>& use, map<int, int>& tbl) {
	tbl = make_table(use);

	int i = 0;
	Graph res(tbl.size());
	UnionFind uf(G.size());
	for (int i = 0; i < G.size(); ++i) {
		for (int v : G[i]) {
			if ( !use.count( P(i, v) ) ) {
				uf.unite(i, v);
			}
		}
	}
	for (P p1 : tbl) {
		for (P p2 : tbl) {
			int a = p1.first, b = p2.first;
			if ( uf.isUnited(a, b) ) {
				tbl[a] = tbl[b];
			}
		}
	}
	for (P p1 : tbl) {
		for (P p2 : tbl) {
			int a = p1.first, b = p2.first;
			if ( G[b].count(a) ) {
				res[tbl[b]].insert(tbl[a]);
			}
		}
	}
	return res;
}
void unite(Graph& G, int u, int v) {
	G[u].insert(v);
	G[v].insert(u);
}
void remove(Graph& G, int u, int v) {
	G[u].erase(v);
	G[v].erase(u);
}
bool judge(Graph& G, int v, int t, vector<bool>& reached) {
	if (v == t) return true;
	reached[v] = true;
	for (int to : G[v]) {
		if ( !reached[to] ) {
			if ( judge(G, to, t, reached) ) return true;
		}
	}
	return false;
}
bool judge(Graph& G, int s, int t) {
	vector<bool> reached(G.size(), false);
	return judge(G, s, t, reached);
}

set<P> Use[40000/bucket+1];
int main() {
	int N, M; cin >> N >> M;
	Query Q[40000];
	for (int i = 0; i < M; ++i) {
		int t, u, v; scanf("%d%d%d", &t, &u, &v);
		Q[i] = (Query){t, u, v};
	}
	for (int i = 0; i < M; ++i) {
		int type = Q[i].type, u = Q[i].u, v = Q[i].v;
		Use[i/bucket].insert( P(u, v) );
		Use[i/bucket].insert( P(v, u) );
	}
	Graph G(N);
	Graph g;
	map<int, int> tbl;
	for (int i = 0; i < M; ++i) {
		int type = Q[i].type, u = Q[i].u, v = Q[i].v;
		if (i % bucket == 0) {
			g = trim(G, Use[i/bucket], tbl);
		}
		switch (type) {
		case 1: // unite
			unite(G, u, v);
			unite(g, tbl[u], tbl[v]);
			break;
		case 2: // remove
			remove(G, u, v);
			remove(g, tbl[u], tbl[v]);
			break;
		case 3: // judge
			if ( judge(g, tbl[u], tbl[v]) ) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;
			}
			break;
		}
	}
}

Measured memory_bytes: 11840
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n, x, m[100];
    cin >> n >> x;
    for (int i = 0; i < n; i++) cin >> m[i];
    sort(m, m + n);
    int sum = 0;
    for (int i = 0; i < n; i++) sum += m[i];
    cout << n + (x - sum) / m[0] << endl;
}

Measured memory_bytes: 256
#include<stack>
#include<cstdio>
#include<vector>

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

using namespace std;

typedef long long ll;

template<class T>
class segment_tree{
	static const int N_MAX=1<<17;
	int n;
	T dat[2*N_MAX];

	void update_min(int l,int r,int a,int b,int u,T v){
		if(l<=a && b<=r){ dat[u]=min(dat[u],v); return; }

		int c=(a+b+1)/2;
		if(l<c && a<r) update_min(l,r,a,c,2*u,v);
		if(l<b && c<r) update_min(l,r,c,b,2*u+1,v);
	}

public:
	void build(int N,T val){
		for(n=1;n<N;n*=2);
		rep(u,2*n) dat[u]=val;
	}

	void update_min(int l,int r,T v){ update_min(l,r,0,n,1,v); }

	T query(int u){
		u+=n;
		T res=dat[u];
		for(u/=2;u>=1;u/=2) res=min(res,dat[u]);
		return res;
	}
};

int main(){
	for(int n,q;scanf("%d%d",&n,&q),n;){
		static vector<int> T[100000]; // tree
		rep(u,n) T[u].clear();
		rep(i,n-1){
			int u,v=i+1; scanf("%d",&u); u--;
			T[u].push_back(v);
		}

		// euler tour technique
		static int start[100000],end[100000];
		int idx=0;
		stack< pair<int,int> > D; D.push(make_pair(0,0));
		while(!D.empty()){
			int u=D.top().first,type=D.top().second; D.pop();
			if(type==0){ // in
				start[u]=idx++;
				D.push(make_pair(u,1));
				rep(i,T[u].size()) D.push(make_pair(T[u][i],0));
			}
			else{ // out
				end[u]=idx;
			}
		}

		static int f[100000]; // f : start[u] -> u
		rep(u,n) f[start[u]]=u;

		static segment_tree<int> S;
		S.build(n,0);

		ll ans=0;
		while(q--){
			char c;
			int u; scanf(" %c%d",&c,&u); u--;
			if(c=='Q'){
				ans+=f[-S.query(start[u])]+1;
			}
			else{
				S.update_min(start[u],end[u],-start[u]);
			}
		}
		printf("%lld\n",ans);
	}

	return 0;
}

Measured memory_bytes: 9944
#include <iostream>

int main(){
    int a, b, c, d, n, count;
    while(std::cin >> n){
        count = 0;
        for(a=0; a<=9; a++)
            for(b=0; b<=9; b++)
                for(c=0; c<=9; c++)
                    for(d=0; d<=9; d++)
                        if(a + b + c + d == n)
                            count++;
        std::cout << count << std::endl;
    }
        
    return 0;
}

Measured memory_bytes: 1160
using System;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = int.Parse(Console.ReadLine());
            int[] c = new int[4];
            for (int i = 0; i < n; i++)
            {
                var s = Console.ReadLine();
                if (s == "AC") c[0]++;
                else if (s == "WA") c[1]++;
                else if (s == "TLE") c[2]++;
                else if (s == "RE") c[3]++;
            }

            Console.WriteLine($"AC x {c[0]}");
            Console.WriteLine($"WA x {c[1]}");
            Console.WriteLine($"TLE x {c[2]}");
            Console.WriteLine($"RE x {c[3]}");
            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 30676
#include<iostream>
#include<algorithm>
bool fuc(int i,int j)
{
    return i>j;
}
int a[10007];
using namespace std;
int main()
{
    int n,k;
    int sum=0;
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+1+n,fuc);
    for(int i=1;i<=k;i++) sum+=a[i];
    cout<<sum<<'\n';
    return 0;
}

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

main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
     long long i,j,m,a,b,k,n,w,p,l;
    while(cin>>m>>n>>p){
     i=m/p;
     if(m%p>0)i++;
     if(i<=n)cout<<"Yes"<<endl;
     else cout<<"No"<<endl;
    }
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  
  int a = S.size();
  int count=0;
  
  for(int i=0; i<a/2; i++){
    if(S.at(i)!=S.at(a-1-i)){
      count++;
    }
  }
  
  cout << count << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;//d, v
const int max_n = 1e4;
const ll INF = 1e18;
ll n,m,k,q;
int color[max_n] = {0};
struct edge{
  ll to, cost;
};
vector<edge> G[max_n];
ll h,w;
ll d[max_n][max_n]={0};
int main(){
  cin >> h >> w;
  for(int i=0 ; i<10 ; i++){
    for(int j=0 ; j<10 ; j++){
      cin >> d[i][j];
    }
  }
  for(int k=0 ; k<10 ; k++){
    for(int i=0 ; i<10 ; i++){
      for(int j=0 ; j<10 ; j++){
        d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
      }
    }
  }
  ll sum = 0;
  for(int i=0 ; i<h ; i++){
    for(int j=0 ; j<w ; j++){
      ll x; cin >> x;
      if(x != -1){
        sum += d[x][1];
      }
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
const int INF = 1e9;

struct edge{
  int to, cap, rev;
  edge(int t, int c, int r){
    to = t; cap = c; rev = r;
  }
};

void add_edge(int from, int to, int cap, vector< vector<edge> > &g){
  g[from].push_back( edge(to,cap,g[to].size()) );
  g[to].push_back( edge(from,0,g[from].size()-1) );
}

int dfs(int v,int t, int f, vector< vector<edge> > &g, vector<int> &used){
  //cout << v << " " << f << endl;
  if(v==t)return f;
  used[v] = 1;
  //for(edge &e : g[v]){
  for(int i=0;i<(int)g[v].size();i++){
    edge &e = g[v][i];
    if(!used[e.to] && e.cap>0){
      int d = min(e.cap, dfs(e.to,t,f,g,used));
      if(d>0){
	e.cap -= d;
	g[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s, int t, vector< vector<edge> > &g){
  int flow = 0;
  while(1){
    vector<int> used(g.size(),0);
    int f = dfs(s,t,INF,g,used);
    //cout << "---" << f << "---" << endl;
    if(f==0)return flow;
    flow += f;
  }
}

int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}

int main(){
  int m,n;
  while(1){
    cin >> m >> n;
    if(!m && !n)break;

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

    vector< vector<edge> > g(n+m+2);
    for(int i=1;i<=m;i++)add_edge(0,i,1,g);
    for(int i=m+1;i<=m+n;i++)add_edge(i,m+n+1,1,g);

    for(int i=0;i<m;i++){
      for(int j=0;j<n;j++){
	if(gcd(b[i],r[j])>1)add_edge(i+1,m+j+1,1,g);
      }
    }

    cout << max_flow(0,m+n+1,g) << endl;
  }
}

Measured memory_bytes: 5648
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let t: usize = sc.read();
    let x: usize = sc.read();
    let res: f64 = t as f64 / x as f64;
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] a = new int[100005];
        for (int i = 0; i < N; i++) {
            int x = scan.nextInt()+1;
            a[x-1] += 1;
            a[x] += 1;
            a[x+1] += 1;
        }
        long answer = 0;
        for (int i = 0; i < 100005; i++) {
            answer = Math.max(answer, a[i]);
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 46736
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;

int main(){
lint N,Y,a=0,b=0,c=0;
cin >>N>>Y;
    rep(i,N+1){
        rep(j,N+1){
            a=N-i-j;
            if(a<0)continue;
            b=1000*i+5000*j+10000*a;
            if(b==Y){cout<<a<<" "<<j<<" "<<i;
            return 0;
            }
        }
    }
    cout<<-1<<" "<<-1<<" "<<-1;
}
 



  


Measured memory_bytes: 256
N,M=map(int,input().split())
xyz=[list(map(int,input().split())) for _ in range(N)]

xyz111=sorted(xyz,key=lambda x:x[0]+x[1]+x[2],reverse=True)[:M]
xyz110=sorted(xyz,key=lambda x:x[0]+x[1]-x[2],reverse=True)[:M]
xyz101=sorted(xyz,key=lambda x:x[0]-x[1]+x[2],reverse=True)[:M]
xyz100=sorted(xyz,key=lambda x:x[0]-x[1]-x[2],reverse=True)[:M]
xyz011=sorted(xyz,key=lambda x:-x[0]+x[1]+x[2],reverse=True)[:M]
xyz010=sorted(xyz,key=lambda x:-x[0]+x[1]-x[2],reverse=True)[:M]
xyz001=sorted(xyz,key=lambda x:-x[0]-x[1]+x[2],reverse=True)[:M]
xyz000=sorted(xyz,key=lambda x:-x[0]-x[1]-x[2],reverse=True)[:M]

def sumxyz(_list):
	a,b,c=0,0,0
	for i in _list:
		a+=i[0]
		b+=i[1]
		c+=i[2]
	return abs(a)+abs(b)+abs(c)
	
xyz2=[0]*8
xyz2[0]=sumxyz(xyz111)
xyz2[1]=sumxyz(xyz110)
xyz2[2]=sumxyz(xyz101)
xyz2[3]=sumxyz(xyz100)
xyz2[4]=sumxyz(xyz011)
xyz2[5]=sumxyz(xyz010)
xyz2[6]=sumxyz(xyz001)
xyz2[7]=sumxyz(xyz000)

print(max(xyz2))

Measured memory_bytes: 3412
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793




int main(){
    vector<ll> sum(500001);
    ll sumo=0;
    rep(i,500001){
        sumo+=i;
        sum.at(i)=sumo;
    }
   string s;
   cin >> s;
   int n=s.size();
   ll ans=0;
   ll cntl=0;
   ll cnts=0;
   int x=0;
   int y=0;
   rep(i,n){
       if(s.at(i)=='<'){
           if(cntl==0){
               x=0;
               y=0;
               cnts=0;
           }
           if(i==n-1){
               cntl++;
               ans+=cntl;
           }
           else if(i!=n-1 && s.at(i+1)=='>'){
               cntl++;
               x=cntl;
           }
           else if(cntl==0){
               x=0;
               y=0;
               cnts=0;
               cntl++;
               ans+=cntl;
           }
          
           else{
               cntl++;
               ans+=cntl;
           }

       }
       else if(s.at(i)=='>'){
           if(cnts==0){
               y=0;
               cntl=0;
           }
           if(i==n-1){
               cnts++;
               y=cnts;
               ans+=max(x,y);
               ans+=sum.at(cnts-1);
            }
           else if(i!=n-1 && s.at(i+1)=='<'){
               cnts++;
               y=cnts;
               ans+=max(x,y);
               ans+=sum.at(cnts-1);
           }
           else if(cnts==0){
               y=0;
               cntl=0;
               cnts++;
           }
           else{
               cnts++;
           }
       }
   }
   cout << ans << endl;
}
       

Measured memory_bytes: 8216
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    int A,B,C;
    cin>> A >> B >> C;

    if (B / A >= C) {
        cout << C << endl;
    } else {
        cout << B / A << endl;
    }

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
	cin>>n>>m;
	//n=> number of heads
	//m=> number of legs

	int x,y;
	//x=> number of cranes
	//y=> number of turtles

	y = (m-2*n)/2;
	x = n-y;

	if(2*x+4*y==m and x>=0 and y>=0){
		cout<<"Yes";
	}else{
		cout<<"No";
	}

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
#include<string>
int main(){
	string S,sunadatyan,sunadakun,sunadasan="aaa";
      cin>>S>>sunadakun>>sunadatyan;
      sunadasan[0]=S[0];
      sunadasan[1]=sunadakun[1];
      sunadasan[2]=sunadatyan[2];
      cout<<sunadasan<<endl;
}

Measured memory_bytes: 256
import numpy as np
from numba import njit
from numba.types import int64
i8 = np.int64


@njit((int64, int64[:,::-1]), cache=True)
def solve(n, qr):
    col = np.zeros(n - 1, i8)
    col[0] = 0
    col_min = n - 1
    row = np.zeros(n - 1, i8)
    row[0] = 0
    row_min = n - 1
    white = 0
    for i in range(qr.shape[0]):
        j = qr[i, 1] - 1
        if qr[i, 0] == 1:
            if j < col_min:
                white += row_min - 1
                for m in range(j + 1, col_min):
                    col[m] = row_min - 1
                col_min = j
            else:
                white += col[j]
        else:
            if j < row_min:
                white += col_min - 1
                for m in range(j + 1, row_min):
                    row[m] = col_min - 1
                row_min = j
            else:
                white += row[j]
    return white


def main():
    f = open(0)
    n, q = [int(x) for x in f.readline().split()]
    qr = np.fromstring(f.read(), i8, sep=' ').reshape((-1, 2))
    white = solve(n, qr)
    print((n - 2) ** 2 - white)

main()

Measured memory_bytes: 114096
#include<bits/stdc++.h>
using namespace std;
int main()
{   int a,b,c;
    cin>>a>>b>>c;
    if(a!=b&&a!=c&&b!=c)
        cout<<3;
    else if(a==b&&b!=c)
        cout<<2;
    else if(b==c&&a!=c)
        cout<<2;
    else if(c==a&&b!=a)
    cout<<2;
 
    else cout<<1;

	return 0;
}



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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int main(){
char c[3][3];
rep(i,3){
  rep(j,3){
    cin>>c[i][j];
  }
}
cout<<c[0][0]<<c[1][1]<<c[2][2]<<endl;


  return 0;
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

int main() {
  int N;

  cin >> N;

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

  int ans = 0;
  for (int i = 0; i <= N - 2; i++) {
    for (int j = i + 1; j <= N - 1; j++) {
      int tmp = abs(arr[i] - arr[j]);
      if (tmp > ans) ans = tmp;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
using namespace std;
typedef long long LL;
LL X,Y;
int main()
{
	scanf("%lld %lld",&X,&Y);
	if (X > Y) swap(X,Y);
	if (Y - X <= 1) puts("Brown");
	else puts("Alice"); 
	return 0;
}


Measured memory_bytes: 256
S=input()
s,e=-1,-1
if len(S)==2 and S[0]==S[1]:
    s,e=1,2
for i in range(len(S)-2):
    if S[i]==S[i+1] or S[i]==S[i+2] or S[i+1]==S[i+2]:
        s,e=i+1,i+3
        break
print(s,e)

Measured memory_bytes: 3188
n, k = list(map(int, input().split()))

scores = list(map(int, input().split()))

answers = []

prev_score = scores[0]

for i in range(k, n):
    if prev_score < scores[i]:
        answers.append('Yes')
    else:
        answers.append('No')

    prev_score = scores[i - (k - 1)]

for answer in answers:
    print(answer)


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

using namespace std;

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

  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];

  int left = 0, i;
  int ans = 0;
  for (i = 1; i < n; ++i) {
    if (h[i] > h[i - 1]) {
      ans = max(ans, (i - 1) - left);
      left = i;      
    }
  }
  ans = max(ans, (i - 1) - left);
  cout << ans << endl;
  return 0;
}



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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main(){
  ll N,A[200000];
  cin>>N;
  for(int i(0);i<N;i++){
    cin>>A[i];
  }
  map<ll,ll> cnt;
  for(int i(0);i<N;i++){
    cnt[i+1-A[i]]++;
  }
  ll ans(0);
  for(int i(0);i<N;i++){
    ll tmp = A[i] + i+1;
    ans += cnt[tmp];
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 27832
const log = console.log;

// ----

function Main(input: string): void {
  const characters = input.trim();
  const len = characters.length;
  let newStr = "";

  for (let i = 0; i < len; i += 2) {
    newStr += characters[i];
  }

  log(newStr);
}

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

Measured memory_bytes: 10060
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator
#define VL V<LL>::iterator
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define MAX 1e18
#define MIN -1e18
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
V<LL>v;
int main()
{
    LL n,m,i,j,k,p,q,o,l,s,t,z=0,r;
    string a,b;
 cin>>n>>m>>s;
 k=0;
 for(i=0;i<m;i++)
 {
     cin>>o;
     v.PSB(o);
 }
 for(i=0;i<n;i++)
 {
     l=s;
     for(j=0;j<m;j++)
     {
         cin>>o;
         l+=(o*v[j]);
     }
     if(l>0)
     {
         k++;
     }
 }
 cout<<k<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int k[1000][1000], x[1000][1000], n, cnt, maxn = -10000000;
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			scanf("%d", &k[i][j]);
		}
	}
	for (int i = 1; i <= n; i++) {
		cnt = 0;
		for (int j = 1; j <= n; j++) {
			cnt += k[i][j];
			x[i][j] = cnt + x[i - 1][j];
		}
	}
	if (n <= 200) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				for (int k = i + 1; k <= n; k++) {
					for (int l = j + 1; l <= n; l++) {
						if (k - i >= 3 && l - j >= 3) {
							maxn = max(maxn, (x[i][j] + x[k][l] - x[i][l] - x[k][j]) - (x[i + 1][j + 1] + x[k - 1][l - 1] - x[i + 1][l - 1] - x[k - 1][j + 1]));
						}
						else {
							maxn = max(maxn, x[i][j] + x[k][l] - x[i][l] - x[k][j]);
						}
					}
				}
			}
		}
	}
	else {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				for (int k = i + 1; k <= n; k++) {
					if (k - i >= 180) {
						for (int l = j + 1; l <= n; l++) {
							if (l - j >= 180) {
								maxn = max(maxn, (x[i][j] + x[k][l] - x[i][l] - x[k][j]) - (x[i + 1][j + 1] + x[k - 1][l - 1] - x[i + 1][l - 1] - x[k - 1][j + 1]));
							}
						}
					}
				}
			}
		}
	}
	cout << maxn << endl;
}

Measured memory_bytes: 5596
import java.util.HashMap;
import java.util.Scanner;

class Main{
	static Scanner s=new Scanner(System.in);
	static int gInt(){return Integer.parseInt(s.next());	}

	public static void main(String[] $){
		int n=gInt(),k=gInt();
		HashMap<Integer,Integer>map=new HashMap<>();
		for(int i=0;i<n;i++){
			int a=gInt();
			map.merge(a,1,Integer::sum);
		}
		System.out.println(
				map.values().stream()
				.sorted()
				.limit(Math.max(0,map.size()-k))
				.mapToInt(i->i)
				.sum()
				);
	}
}

Measured memory_bytes: 70960
#include<stdio.h>

int main(void)
{
	int a,b,c;
	
	//printf("??´??°A");
	scanf("%d %d %d",&a,&b,&c);
	
	if(a<b)
	{
		if(b<c)
		{
				printf("Yes\n");
		}else
	    {
		printf("No\n");
		}
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 576
import std.array;
import std.range;
import std.stdio;
import std.conv;
import std.string;
import std.algorithm;

int bsearch(int[] a, int b) {
    size_t lo=0,hi=a.length-1;
    while(hi>=lo) {
    	size_t mi = (hi+lo)/2;

	if(a[mi] > b) hi = mi - 1;
	else lo = mi + 1;
    }

    return a[hi];
}

int[] uniq(int[] a)
{
	int[] res;
	foreach(v; a)
	  if(res.empty||res[$-1] != v) res ~= v;

	return res;
}
 
void main()
{
    while(true) {   
        int N,M;
	scanf("%d%d", &N, &M);
        if(N==0&&M==0) break;
         
	int[] inp = new int[](N+1);
        inp[0] = 0;
 
        foreach(i; 0..N) {
	    scanf("%d", &inp[i+1]);
        }
 
        N++;
 
        int[] add2 = new int[](N*N);
 
        foreach(i; 0..N) foreach(j; 0..N)
            add2[j*N + i] =  inp[i] + inp[j];
     
        add2.sort;
	int[] a = uniq(add2);

        int res;
        foreach(v; a)
        {
            if(v > M) break; 
            res = max(res, v + bsearch(a, M-v));
        }
 
        writeln(res);
      }
}

Measured memory_bytes: 19856
#include<bits/stdc++.h>
#include<tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define lll bignum
#define ls(x) ( x << 1 )
#define rs(x) ( x << 1 | 1 )
//#define mid ( ( l + r ) >> 1 )
#define lowbit(x) ( x & -x )
#define debug(x) cout << "#x = " << x << endl
#define re register
#define For(i, j, k) for(re int i = (j); i <= (k); i++)
#define foR(i, j, k) for(re int i = (j); i >= (k); i--)
#define cross(i, k) for(re int i = head[k]; i; i = e[i].next)
using namespace std;
typedef long long ll;
const ll N = 4000011;
const ll inf = 0x3f3f3f3f3f3f;

/*
	f[i] 表示 f[i] 是否能被表示出来。
	显然，想要找到非空子集和的中位数，就是找到小于等于 sum / 2 的最小值。
	由于如果 f[i] 能被表示出来， f[i - s] 必然能被表示出来，即子集具有对称性。
	所以直接枚举 sum + 1 >> 1 - sum 那一段是否有能被表示出来的即可。 
*/

bitset < N > f;

ll n, v, sum = 0;

namespace IO {

	inline ll read() {
		ll x = 0; bool f = 0; char ch = getchar();
		for(; !isdigit( ch ); ch = getchar()) f^=( ch == '-' );
		for(; isdigit( ch ); ch = getchar()) x = ( x << 3 ) + ( x << 1 ) + ( ch ^ 48 );
		return f? -x: x;
	}

	inline void write( ll x ) {
		if( x < 0 ) putchar( '-' ), x = -x;
		if( x > 9 ) write( x / 10 );
		putchar( x % 10 | 48 );
	}

	inline void wln( ll x ) { write( x ); putchar( '\n' ); }

}

using namespace IO;

int main() { 
	f[0] = 1; 
	n = read(); For ( i, 1, n ) v = read(), f |= f << v, sum += v; 
	For ( i, ( sum + 1 ) >> 1, sum ) if ( f[i] ) return wln (i), 0;
}

/*
3
1 2 1

2
*/



Measured memory_bytes: 1664
using System;

class Program
{
    static void Main()
    {
        int[] counter = {0, 0, 0, 0};
        for (; ; )
        {
            var line = Console.ReadLine().Split(' ');
            int a = int.Parse(line[0]);
            int b = int.Parse(line[1]);
            int c = int.Parse(line[2]);

            if (!Exists(a, b, c)) break;
            else 
            {
                counter[0]++;
                Sort(ref a, ref b, ref c); //cが最大辺
                if (a * a + b * b == c * c) counter[1]++;
                else if (a * a + b * b > c * c) counter[2]++;
                else counter[3]++;
            }
        }
        Console.WriteLine("{0} {1} {2} {3}", counter[0], counter[1], counter[2], counter[3] );
        
    }

    static bool Exists(int a, int b, int c)
    {
        bool flag = false;
        if (a + b > c && b + c > a && c + a > b) flag = true;
        return flag;
    }

    static void Sort(ref int a, ref int b, ref int c)
    {
        int tmp=0;
        if (c < a) { tmp = c; c = a; a = tmp; }
        if (c < b) { tmp = c; c = b; b = tmp; }
        if (b < a) { tmp = b; b = a; a = tmp; }    
    }

}
  


Measured memory_bytes: 7876
import java.util.Scanner;
import java.text.DecimalFormat;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        DecimalFormat d1 = new DecimalFormat("0.000000");

        double r = scanner.nextDouble();
        double pi = Math.PI;

        System.out.println(d1.format(r*r*pi)+" "+d1.format(2*r*pi));

    }
}



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

int main() {
  
  int n,m,x,a;
  cin >> n >> m >> x;
  
  int cntMx = 0,cntMn = 0;
  
  for ( int i = 0; i < m; i++){
    cin >> a;
    if ( a < x ){
      cntMn++;
    }else if ( a > x ){
      cntMx++;
    }
  }
  
  cout << min(cntMn,cntMx) << endl;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int N; ll K;
const int maxn=1e6+5;
ll maxn2=1e12;
ll ans;
ll cnta;
ll A[maxn],F[maxn];
bool check(ll x){
	ll cnt=0;
	for(int i=1;i<=N;i++){
        if(A[i]*F[i]<=x)
            continue;
        else{
            ll p=x/F[i];
            cnt+=A[i]-p;
        }
	}
	if(cnt<=K) return true;
	else return false;
}
int main(){
    ios::sync_with_stdio(false);
    cin>>N>>K;
    for(int i=1;i<=N;i++) {cin>>A[i]; cnta+=A[i];}
    for(int i=1;i<=N;i++) {cin>>F[i];}
    sort(A+1,A+N+1);
    sort(F+1,F+N+1,greater<ll>());
    if(cnta<=K) ans=0;
    else{
        ll left=0,right=maxn2,mid;
        while(left<=right){
            mid=(right-left)/2+left;
            if(check(mid)) right=mid-1,ans=mid;
            else left=mid+1;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 5888
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, x, a[111], res;

signed main() {
	cin >> n >> x;
	rep(i,n) cin >> a[i];
	sort(a,a+n);
	rep(i,n)if (a[i]==x || (i!=n-1 && a[i]<x)) x -= a[i], res++;
	cout << res << endl;
}


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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    ll x; cin>>x;
    ll ha=0;
    ha += (x/500)*1000;
    x -= (x/500)*500;
    ha += (x/5)*5;
    x -= (x/5)*5;
    cout<<ha<<endl;
}


Measured memory_bytes: 256