akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << c <<" "<<a<< " "<<b<<endl;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if((A==B&&A!=C)||(A==C&&A!=B)||(B==C&&B!=A)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProCon
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] nums = Console.ReadLine().Split(new string[] {" "}, N, StringSplitOptions.None);

            int sum = 0;

            int x = 0, y = 0;

            for(int i = 0; i < N - 1; i++)
            {
                for (int j = i + 1; j < N; j++ )
                {
                    x = int.Parse(nums[i]);
                    y = int.Parse(nums[j]);
                    sum += x * y;
                }
                    
            }

            Console.WriteLine(sum);
            //Console.ReadKey();
        }

    }
}


Measured memory_bytes: 13140
def count(limit, max, n, queue, black_list)
  if queue.size == limit
    if queue.inject(:+) == max
      return 1
    else
      return 0
    end
  end

  result = 0
  (0..9).step do |i|
    next if queue.include?(i)
    queue << i
    if black_list.include?(queue.sort)
      queue.pop
      next
    end
    black_list << queue.sort
    result += count(limit, max, result, queue, black_list)
    queue.pop
  end
  result
end

def bfs
  while gets
    limit, max = $_.split.map(&:to_i)

    break if limit == 0 && max == 0

    puts count(limit, max, 0, [], [])
  end
end

bfs

Measured memory_bytes: 9144
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
priority_queue<int,vector<int>,greater<int> >Heap;
#define lson rt<<1,l,m
#define rson rt<<1|1,m+1,r
int v[200005],first[200005],nex[200005],e;
void AddEdge(int U,int V){
	v[++e]=V;
	nex[e]=first[U];
	first[U]=e;
}
int a[200005],cnt,ma[200005],pai[200005];
int minv[2][100005<<4],n,pos[200005];
void update(int o,int p,int v,int rt,int l,int r)
{
    if(l==r)
      {
        minv[o][rt]+=v;
        return;
      }
    int m=(l+r>>1);
    if(p<=m) update(o,p,v,lson);
    else update(o,p,v,rson);
    minv[o][rt]=min(minv[o][rt<<1],minv[o][rt<<1|1]);
}
int query(int o,int ql,int qr,int rt,int l,int r)
{
    if(ql<=l&&r<=qr) return minv[o][rt];
    int m=(l+r>>1);
    int res=2147483647;
    if(ql<=m) res=min(res,query(o,ql,qr,lson));
    if(m<qr) res=min(res,query(o,ql,qr,rson));
    return res;
}
void work(int l,int r,int f){
	if(l>=r){
		return;
	}
	int L=pos[query(l&1,ma[l],(l%2 == r%2) ? ma[r] : ma[r-1],1,1,n/2)];
	int R=pos[query((L+1)&1,ma[L+1],((L+1)%2 == r%2) ? ma[r] : ma[r-1],1,1,n/2)];
	pai[a[L]]=a[R];
	AddEdge(a[f],a[L]);
	work(l,L-1,f);
	work(L+1,R-1,L);
	work(R+1,r,f);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		pos[a[i]]=i;
		update(i&1,i/2+(i&1),a[i],1,1,n/2);
		ma[i]=i/2+(i&1);
	}
	if(n==2){
		printf("%d %d\n",a[1],a[2]);
		return 0;
	}
	work(1,n,0);
	for(int i=first[0];i;i=nex[i]){
		Heap.push(v[i]);
	}
	while(!Heap.empty()){
		int U=Heap.top(); Heap.pop();
		cnt+=2;
		printf("%d %d%c",U,pai[U],cnt==n ? '\n' : ' ');
		for(int i=first[U];i;i=nex[i]){
			Heap.push(v[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 19968
import java.util.*;
import java.util.Arrays;
import java.util.Set;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String a=sc.next();
        String b=sc.next();
        String c=sc.next();
        System.out.print(a.charAt(0));
        System.out.print(b.charAt(0));
        System.out.println(c.charAt(0));


        
        
}
        
        
    }


Measured memory_bytes: 20820
import itertools
N, M, Q = map(int, input().split())

dic = {}
for i in range(Q):
  a, b, c, d = map(int, input().split())
  dic[(a-1, b-1, c-1)] = d
ans = 0
for ar in itertools.combinations_with_replacement(range(1, M+1), N):
  D = 0
  for com in dic.keys():
    if ar[com[1]] - ar[com[0]] == com[2]+1:
      D += dic[com]
  if D > ans:
    ans = D
print(ans)

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(){    
  ll a,b;
  cin >> a >> b;
  
  if (a < b){
    for(ll i = 0; i < b; i++){
      cout << a;
    }
  }
  else{
    for(ll i = 0; i < a; i++){
      cout << b;
    }
  }
  cout << endl;
}


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

#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define MOD 1000000007

const int MAX_M = 100000;


int main(){
  ll a, b, c, d;
  //string s;
  cin >> a >> b >> c >> d;
  
  //vector<ll> a(n);
  //queue<ll> q;
  //map<string,ll> d{};
  
  ll n = a * c;
  ll m = a * d;
  if(m > n) n = m;
  
  m = b * c;
  if(m > n) n = m;
  
  m = b * d;
  if(m > n) n = m;
  
  cout << n << endl;
}

Measured memory_bytes: 3612
#include <stdio.h>
#include <math.h>
int main() {
    int year = 0;
    double x, account = 100.0;
    scanf("%lf", &x);
    while (account < x) {
        account = floor(1.01 * account);
        year++;
    }
    printf("%d\n", year);
    return 0;
}

Measured memory_bytes: 1740
#include <stdio.h>
#include <stdlib.h>
#include <string.h> 
typedef struct { int i, p; char *s; } T;
T t[105];
int cmp(const void *u, const void *v) {
	int t;
	if (t = strcmp(((T *)u)->s, ((T *)v)->s)) return t;
	return ((T *)v)->p - ((T *)u)->p;
}
char S[105][15];
int main(){
	int i, N;
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%s%d", S[i], &t[i].p);
		t[i].s = S[i], t[i].i = i;
	}
	qsort(t, N, sizeof(T), cmp);
	for (i = 0; i < N; i++) printf("%d\n", t[i].i+1);
	return 0;
}

Measured memory_bytes: 128
<?php
fscanf(STDIN, "%d %d", $n, $k);
$ds = explode(' ', trim(fgets(STDIN)));

while (1) {
	foreach ($ds as $d) {
		if (strpos($n, $d) !== false) {
			$n++;
			continue 2;
		}
	}
	break;
}
echo $n, "\n";

Measured memory_bytes: 3576
#include<bits/stdc++.h> 
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
const int N = 2000 + 5;
int main()
{
	int n;
	cin>>n;
	if(n>=30) cout<<"Yes"<<"\n";
	else cout<<"No"<<"\n";
    return 0;
}


Measured memory_bytes: 3620
def main():
    N,K = map(int,input().split())
    XY = [list(map(int,input().split())) for _ in [0]*N]
    iX = [0]*N
    iY = [0]*N
    for i,xy in enumerate(XY):
        x,y = xy
        iX[i] = x
        iY[i] = y
    iX.sort()
    iY.sort()
    X = {x:i for i,x in enumerate(iX)}
    Y = {y:i for i,y in enumerate(iY)}

    c = [[0]*(N+1) for i in [0]*(N+1)]
    for x,y in XY:
        c[Y[y]+1][X[x]+1] = 1

    for i in range(N):
        ci1 = c[i+1]
        for j in range(N):
            ci1[j+1] += ci1[j]
    for i in range(N):
        ci1 = c[i+1]
        ci = c[i]
        for j,cij in enumerate(ci[1:],1):
            ci1[j] += cij

    ans = 10**20
    for u in range(N):
        for d in range(u+K-1,N):
            l = 0
            r = K-1
            dY = iY[d]-iY[u]
            cd = c[d+1]
            cu = c[u]
            while r<N:
                if cd[r+1]+cu[l]-cu[r+1]-cd[l] >=K:
                    ans = min(ans, (iX[r] - iX[l])*dY)
                    l+=1
                else:r+=1

    print(ans)
main()

Measured memory_bytes: 3188
N, K = map(int, input().split())
expectation = list(map(lambda x: (x+1) / 2, map(int, input().split())))
cur_expectation = sum(expectation[:K])
max_expectation = cur_expectation
for i in range(N - K):
    cur_expectation -= expectation[i]
    cur_expectation += expectation[i + K]
    if cur_expectation > max_expectation:
        max_expectation = cur_expectation
print(max_expectation)


Measured memory_bytes: 31944
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}


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

    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(c>=0&&d>=0){
        if(c>d)cout<<"Alice"<<endl;
        if(c<d)cout<<"Bob"<<endl;
        if(c==d)cout<<"Draw"<<endl;
    }else{
        if(a<b)cout<<"Alice"<<endl;
        if(a>b)cout<<"Bob"<<endl;
        if(a==b)cout<<"Draw"<<endl;

    }
}



Measured memory_bytes: 3212
/**
 *    author:  morato
 *    created: 13.09.2020 09:00:22
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x; cin >> x; cout << !x << '\n';
  return 0;
}

Measured memory_bytes: 3648
input_number = int(input())                                                                 
count = 0 
buff_rank = []

for i in range(1,input_number+1):
    num = i 
    while num % 2 == 0:
        num = num // 2
        count = count + 1 
    buff_rank.append(count)
    count = 0 

print(buff_rank.index(max(buff_rank))+1)

Measured memory_bytes: 3060
/* ***********************************************
Author        :dasinlsb
Created Time  :2018/6/5 16:12:33
File Name     :C:\dasin\duipai.cpp
************************************************ */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const int N=1000005;
const int mod=1000*1000*1000+7;
int n,ans,fac[N],inv[N];
int Pow(int x,int y){
  int t=1;
  for(;y;y>>=1,x=(ll)x*x%mod)if(y&1)t=(ll)t*x%mod;
  return t;
}
int main(){
 // freopen("C:/dasin/aa.in","r",stdin);
  //freopen("C:/dasin/mine.out","w",stdout);
  int i,j;
  scanf("%d",&n);
  for(fac[0]=i=1;i<=n;++i)fac[i]=(ll)fac[i-1]*i%mod;
  inv[n]=Pow(fac[n],mod-2);
  for(i=n;i;--i)inv[i-1]=(ll)inv[i]*i%mod;
  int pre=0;
  for(i=(n+1)/2;i<n;++i){
    //printf("ans %d:  %d,%d,%d ",i,i-1,i,2*i-n);
    int now=(ll)fac[i-1]*fac[i]%mod*inv[2*i-n]%mod;
    ans=(ans+(ll)i*(now-pre+mod))%mod;
    pre=now;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 8064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		sc.close();
		
		String[] tokens = s.split(" ");
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < tokens.length;++i)
			sb.append(tokens[i].toUpperCase().charAt(0));
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 22740
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
using namespace std;
const long long INF = 1LL << 60;    // 1.15x10^18
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using edge = pair<int, long long>;
using Graph = vector<vector<edge>>;

vector<long long> dijkstra(const Graph &g, int s) {
    vector<long long> dist(g.size(), INF);
    using Pi = pair<long long, int>;
    priority_queue<Pi, vector<Pi>, greater<Pi>> que;
    dist[s] = 0; que.emplace(dist[s], s);
    while (!que.empty()) {
        long long cost; int u; tie(cost, u) = que.top(); que.pop();
        if (dist[u] < cost) continue;
        for (auto &e: g[u]) {
            int v; long long nc; tie(v, nc) = e;
            if (chmin(dist[v], dist[u] + nc)) que.emplace(dist[v], v);
        }
    }
    return dist;
}

int main() {
    int n, k;
    while (cin >> n >> k, n) {
        Graph g(n);
        while (k--) {
            int com; cin >> com;
            if (com == 0) {
                int a, b; cin >> a >> b; a--, b--;
                auto res = dijkstra(g, a)[b];
                cout << (res == INF ? -1 : res) << endl;
            } else if (com == 1) {
                int c, d, e; cin >> c >> d >> e; c--, d--;
                g[c].emplace_back(d, e);
                g[d].emplace_back(c, e);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3064
def contest(val):
    a_str, b_str, c_str = val.split(' ')

    a = int(a_str)
    b = int(b_str)
    c = int(c_str)

    if a == b & b == c:
        return 'No'
    elif a == b:
        return 'Yes'
    elif b == c:
        return 'Yes'
    elif a == c:
        return 'Yes'
    else:
        return 'No'


if __name__ == "__main__":
    val = input()

    print(contest(val))


Measured memory_bytes: 3060
package main

import (
    "fmt"
    "math"
)

func main() {
    var a, b int
    _, _ = fmt.Scanf("%d %d", &a, &b)
    if math.Mod(float64(a*b), 2) == 0 {
      fmt.Println("Even")
    } else {
      fmt.Println("Odd")
    }
}

Measured memory_bytes: 512
#include<iostream>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<queue> 
#include<stack>
#include<vector>
#include<map>
#include<set>

#define ll long long
#define pb push_back
#define ff first
#define ss second

using namespace std;

int main(){
    int a,p;
    cin>>a>>p;
    cout<<(a*3+p)/2<<endl;
    return 0;
}

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

bool is_prime(int X){
  if (X <= 1) return false; 
  for  (int i = 2; i * i <= X; i++) {
    if (X % i == 0) {
      return false;
    }
  }
  return true;
}

signed main() {
  int X;
  cin >> X;
  int p = X;
  while(!is_prime(p)) p++;
  cout << p << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A;
  cin >> N >> A;
 
  if (N % 500 == 0){
    cout << "Yes" << endl;
  }
  else if (N % 500 <= A){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int maximum=0;
struct flower{
	long long int height;
	long long int beauty;
	int pos;
};
bool compare(flower a,flower b){
	return a.height>b.height;
}
void update_element(long long int *seg_tree,int start,int end,int node,int pos,long long int value){
	if(start==end){
		seg_tree[node]=value;
	}
	else{
		int mid=(start+end)/2;
		if(pos<=mid)
		update_element(seg_tree,start,mid,2*node,pos,value);
		else
		update_element(seg_tree,mid+1,end,2*node+1,pos,value);
		seg_tree[node]=max(seg_tree[2*node],seg_tree[2*node+1]);
	}
}
long long int sum(long long int *seg_tree,int start,int end,int node,int left,int right){
	if(right<start||left>end)
	return 0;
	else if(left<=start&&end<=right)
	return seg_tree[node];
	else{
		int mid=(start+end)/2;
		return max(sum(seg_tree,start,mid,2*node,left,right),sum(seg_tree,mid+1,end,2*node+1,left,right));
	}
}
void do_my_job(long long int *seg_tree,int start,int end,int node){
    if(start==end){
    	if(maximum<seg_tree[node]){
    		maximum=seg_tree[node];
		}
		//cout<<seg_tree[node]<<" "<<start<<endl;
	}
	else{
		int mid=(start+end)/2;
		do_my_job(seg_tree,start,mid,2*node);
		do_my_job(seg_tree,mid+1,end,2*node+1);
	}
}
int main(void){
	int n;
	cin>>n;
	long long int height[n];
	long long int arr[n];
	for(int i=0;i<n;i++){
		cin>>height[i];
	}
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	flower help[n];
	for(int i=0;i<n;i++){
		help[i].beauty=arr[i];
		help[i].height=height[i];
		help[i].pos=i+1;
	}
	sort(help,help+n,compare);
	long long int seg_tree[4*n]={0};
	for(int i=0;i<n;i++){
		int start=help[i].pos;
		int end=n-1;
		long long int value=sum(seg_tree,0,n-1,1,start,end);
        value+=help[i].beauty;
        //cout<<value<<endl;
        update_element(seg_tree,0,n-1,1,help[i].pos-1,value);
	}
	do_my_job(seg_tree,0,n-1,1);
	cout<<maximum<<endl;
}

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

long long n, a[100009], A, B, C;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		if (a[i] % 4 == 0) A++;
		else if (a[i] % 2 == 0) B++;
		else C++;
	}
	if (B >= 1) {
		if (C > A) { cout << "No" << endl; }
		else { cout << "Yes" << endl; }
	}
	else {
		if (C > A + 1) { cout << "No" << endl; }
		else { cout << "Yes" << endl; }
	}
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

class my_priority_queue{
public:
	vector<int> line;
	my_priority_queue(){
		line.assign(1, 0);
	}

	void max_heapify(int i){
		int l = i * 2;
		int r = i * 2 + 1;
		int largest = i;
		if(l < line.size() && line[i] < line[l]){
			largest = l;
		}
		if(r < line.size() && line[largest] < line[r]){
			largest = r;
		}
		if(largest != i){
			swap(line[i], line[largest]);
			max_heapify(largest);
		}
	}

	void push(int key){
		line.push_back(key);
		int i = line.size() - 1;
		while(i){
			max_heapify(i);
			i /= 2;
		}
	}

	int pop(){
		int res = line[1];
		line[1] = line.back();
		line.pop_back();
		if(line.size()>1){
			max_heapify(1);
		}
		return res;
	}
};

int main(){
	my_priority_queue pq;
	string op;
	while(cin>>op&&op!="end"){
		if(op=="insert"){
			int key;
			cin >> key;
			pq.push(key);
		}else{
			cout  << pq.pop() << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 7064
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
int n;
double t = 1000000000;
double x[100];
int main() {
    cin >> n;
    rep(i, n) cin >> x[i];
    for (int i = 0; i < 100; i++) {
        double g = 0;
        rep(k, n) g += (x[k] - i) * (x[k] - i);
        t = min(t, g);
    }
    cout << t << endl;
}


Measured memory_bytes: 256
s = input()
q = int(input())
Q = [list(map(str, input().split())) for _ in range(q)]

t = ''
for qi in Q:
  if int(qi[0]) == 1:
    s, t = t, s
  else:
    if int(qi[1])  == 1:
      t += qi[2]
    else:
      s += qi[2]
      
t = t[::-1]
t += s
print(t)

Measured memory_bytes: 40436
n, m = map(int, input().split())
a = [int(input())-1 for i in range(m)]
mod = 1000000007

dp = [0 for i in range(n+1)]
for i in a:
  dp[i+1] = -1

dp[0] = 1
for i in range(n):
  if dp[i+1] >= 0:
    dp[i+1] = (dp[i] + dp[i-1])%mod
  else:
    dp[i+1] = 0
print(dp[len(dp)-1])
  

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

int main(){
  string N;
  cin >> N;
  int L=N.size();
  int p=N.at(L-1)-'0';
  if(p==3){
    cout << "bon" << endl;
  }
  else if(p==0 || p==1 || p==6 || p==8){
    cout << "pon" << endl;
  }
  else{
    cout << "hon" << endl;
  }
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int count=0;
    while(n--)
    {
        int D1,D2;
        cin>>D1>>D2;
        if(D1==D2)
        {
            count++;
            if(count==3)
            break;
        }
        else
        {
            count=0;
        }
    }
    if(count==3)
    {
        cout<<"Yes"<<'\n';
    }
    else
    {
        cout<<"No"<<'\n';
    }
    
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
     
    using namespace std;
    #define ll long long
    const int N = 2e3 + 2, MOD = 924844033;
    int dp[N][N][2][2], F[N][N], fac[N] = {1};
     
    int sum(int a, int b) {return a + b - (a + b >= MOD ? MOD : 0);}
    int mul(ll  a, ll  b) {return a * b % MOD;}
    int DP(int i, int j) {
        if (i < 0 || j < 0) return 0;
        int res = 0;
        for (int t = 0; t < 4; t++) res = sum(res, dp[i][j][t&1][(t>>1)&1]);
        return res;
    }
    int main() {
        ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        for (int i = 1; i < N; i++) fac[i] = mul(fac[i - 1], i);
        int n, k; cin >> n >> k;
        dp[1][0][0][0] = dp[2][0][0][0] = dp[2][1][0][1] = dp[2][1][1][0] = dp[2][2][1][1] = 1;
        int m = (n + k - 1) / k;
        for (int i = 3; i <= m; i++) {
            dp[i][0][0][0] = 1;
            for (int j = 1; j <= i; j++) {
                dp[i][j][0][1] = sum(dp[i - 1][j - 1][0][0], dp[i - 1][j - 1][0][1]);
                dp[i][j][1][0] = sum(dp[i - 1][j - 1][0][0], dp[i - 1][j - 1][1][0]);
                dp[i][j][1][1] = DP(i - 2, j - 2);
                dp[i][j][0][0] = DP(i - 1, j);
            }
        }
        F[0][0] = 1;
        for (int i = 1; i <= k; i++) {
            int len = (n + k - i) / k;
            for (int j = 0; j <= len; j++)
                for (int s = j; s <= n; s++) F[i][s] = sum(F[i][s], mul(DP(len, j), F[i - 1][s - j]));
        }
        int ans = 0;
        for (int s = 0; s <= n; s++) {
            if (s&1) ans = sum(ans, MOD - mul(F[k][s], fac[n - s]));
            else ans = sum(ans, mul(F[k][s], fac[n - s]));
        }
        cout << ans << "\n";
     
        return 0;
    }

Measured memory_bytes: 42380
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int time;
	double m;
	int s[1000];
	double apow;
	while(true){
		cin>>time;
		if(time==0)break;
		apow=0;
		m=0;
		for(int i=0;i<time;++i){
			cin>>s[i];
			m+=s[i];
		}
		m/=(double)time;
		for(int i=0;i<time;++i){
			apow+=pow((double)s[i]-m,2.0);
		}
		cout<<sqrt(apow/(double)time)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1236
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;
use std::collections::HashSet;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let h = scan.read::<i64>();
    let w = scan.read::<i64>();
    let n = scan.read::<usize>();
    let ab = arr(n, |_| (scan.read::<i64>()-1, scan.read::<i64>()-1));
    let ab_set = dup::<_, HashSet<_>>(&ab);
    let mut ans = vec![HashSet::new();10];
    for (y, x) in ab {
        let sy = y-2;
        let sx = x-2;
        for ny in sy..sy + 3 {
            for nx in sx..sx + 3 {
                if ny < 0 || nx < 0 {continue;}
                if ny+2 >= h || nx+2 >= w {continue;}
                let mut cnt = 0;
                for i in ny..ny + 3 {
                    for j in nx..nx + 3 {
                        if ab_set.contains(&(i, j)) {
                            cnt += 1;
                        }
                    }
                }
                ans[cnt].insert((ny, nx));
            }
        }
    }
    let ttl = ans.iter().map(|x| x.len() as i64).sum::<i64>();
    println!("{}", (h-2) * (w-2) - ttl);
    for i in 1..10 {
        println!("{}", ans[i].len());
    }
}

// region template
#[allow(dead_code)]
fn iu(i: isize) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> isize { i as isize }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

#[allow(dead_code)]
fn alt<S, T>(v: Vec<S>) -> T where T: FromIterator<S> {
    v.into_iter().collect::<T>()
}

#[allow(dead_code)]
fn dup<S, T>(v: &[S]) -> T where T: FromIterator<S>, S: Clone {
    v.iter().cloned().collect::<T>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

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

Measured memory_bytes: 51880
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.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);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.println(in.next().replace("0", "").length());
        }

    }

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

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

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

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <string>

using namespace std;

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

  int ns = int(s.size());
  int nt = int(t.size());

  int cnt_max = 0;
  for (int i = 0; i + nt - 1 < ns; ++i) {
    int cnt = 0;
    for (int j = 0; j < nt; ++j) {
      cnt += s[i+j] == t[j];
    }
    cnt_max = max(cnt, cnt_max);
  }

  cout << nt - cnt_max << endl;
}


Measured memory_bytes: 3628
// power socket.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;

int main()
{
	int Nsocket, required;
	cin >> Nsocket >> required;

	if (required == 1) {
		cout << 0;
		return 0;
	}
	int count = 1;
	int empty = Nsocket;

	while (empty < required) {
		count++;
		empty += Nsocket - 1;
	}

	cout << count;
	

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 11092019
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-7
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main() {
    fastio
    int n, m;
    cin>>n>>m;

    map<int, int> taken;
    int i = 1;
    int cur = n;
    while(m>0) {
        if(cur-i != n+i-cur) {
            if(!(taken[cur-i] || taken[n+i-cur])) {
                taken[cur-i] = 1;
                taken[n+i-cur] = 1;
                cout<<i<<" "<<cur<<endl;
                m--;
                i++;
            }
        }
        cur--;
    }
}

Measured memory_bytes: 12024
package main

import "fmt"

func main() {
	var N, x, cnt int
	fmt.Scan(&N, &x)
	a := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&a[i])
	}

	for i := 0; i < len(a)-1; i++ {
		if a[i]+a[i+1] > x {
			w := a[i] + a[i+1] - x
			if w > a[i+1] {
				a[i] = w - a[i+1]
				a[i+1] = 0
			} else {
				a[i+1] -= w
			}
			cnt += w
		}
	}
	fmt.Println(cnt)
}


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

using namespace std;

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

int H, W;
vector<string> G;
int N;
string S;
int sy, sx, sd;

string const DIRS = "LURD";
string const CDIRS = "<^>v";

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

bool in_range(int y, int x) {
  if(!(0<=y&&y<H && 0<=x&&x<W)) return false;
  return true;
}

bool in_move_range(int y, int x) {
  if(!(0<=y&&y<H && 0<=x&&x<W)) return false;
  if(G[y][x] == '*') return false;
  if(G[y][x] == '-') return false;
  if(G[y][x] == '#') return false;
  return true;
}

void solve() {

  int y = sy, x = sx, dir = sd;
  
  rep(idx, N) {
    if(DIRS.find(S[idx]) != string::npos) {
      dir = (int)DIRS.find(S[idx]);
      int ny = y + dy[dir], nx = x + dx[dir];
      if(!in_move_range(ny, nx)) continue;
      y = ny, x = nx;
    }
    else {
      int by = y, bx = x;
      while(1) {
	by += dy[dir], bx += dx[dir];
	if(!in_range(by, bx)) break;
	if(G[by][bx] == '*') {
	  G[by][bx] = '.';
	  break;
	}
	if(G[by][bx] == '#') {
	  break;
	}
      }
    }
  }

  rep(i, H) rep(j, W + 1) {
    if(j == W) cout << endl;
    else {
      if(y == i && x == j) cout << CDIRS[dir];
      else cout << G[i][j];
    }
  }
  
}

int main() {

  int T; cin >> T;
  rep(_, T) {
    if(_) cout << endl;
    
    cin >> H >> W;
    G.clear();
    G.resize(H);
    rep(i, H) {
      cin >> G[i];
    }

    rep(i, H) rep(j, W) {
      if(CDIRS.find(G[i][j]) != string::npos) {
	sd = CDIRS.find(G[i][j]);
	sy = i, sx = j;
	G[sy][sx] = '.';
      }
    }

    cin >> N;

    cin >> S;

    solve();
  }
  
  return 0;
}

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

using namespace std;

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

  int count = 0;
  for(int i = 1; i <= a; i++) {
    int tmp;
    if(i == a) {
      tmp = b;
    }
    else if(i == 2){
      tmp = 28;
    }
    else if(i == 4 || i == 6 || i == 9 || i == 11) {
      tmp = 30;
    }
    else {
      tmp = 31;
    }
    for(int j = 1; j <= tmp; j++) {
      if(i == j) {
	count++;
      }
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

int main(){
    int n;
    string s;
    cin >> n >> s;
    int res = 0;
    for(int i=0;i<1000;i++){
        string p = to_string(i);
        if(p.size()==1){
            p = "00"+p;
        }else if(p.size()==2){
            p = "0"+p;
        }
        int k = 0;
        int id = 0;
        while(k<3&&id<n){
            if(p[k]==s[id]){
                k++;
                id++;
            }else{
                id++;
            }
        }
        if(k==3){
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 888
def main():
    N,K = map(int,input().split())
    XY = [list(map(int,input().split())) for _ in [0]*N]
    iX = [0]*N
    iY = [0]*N
    for i,xy in enumerate(XY):
        x,y = xy
        iX[i] = x
        iY[i] = y
    iX.sort()
    iY.sort()
    X = {x:i for i,x in enumerate(iX)}
    Y = {y:i for i,y in enumerate(iY)}

    c = [[0]*(N+1) for i in [0]*(N+1)]
    for x,y in XY:
        c[Y[y]+1][X[x]+1] = 1

    for i in range(N):
        ci1 = c[i+1]
        for j in range(N):
            ci1[j+1] += ci1[j]
    for i in range(N):
        ci1 = c[i+1]
        ci = c[i]
        for j in range(N):
            ci1[j+1] += ci[j+1]

    ans = 10**20
    for u in range(N):
        for d in range(u+K-1,N):
            l = 0
            r = K-1
            dY = iY[d]-iY[u]
            cd = c[d+1]
            cu = c[u]
            while r<N:
                if cd[r+1]+cu[l]-cu[r+1]-cd[l] >=K:
                    ans = min(ans, (iX[r] - iX[l])*dY)
                    l+=1
                else:r+=1

    print(ans)
main()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <stack>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main(){
	string s;
	stack<double> st;
	while(cin >> s){
		if(s == "+" || s == "-" || s == "*" || s == "/"){
			double a,b;
			a = st.top();
			st.pop();
			b = st.top();
			st.pop();
			if(s == "+") st.push(b + a);
			else if(s == "-") st.push(b - a);
			else if(s == "*") st.push(b * a);
			else if(s == "/") st.push(b / a);
		}
		else st.push(atoi(s.c_str()));
		if(getchar() == '\n'){
			printf("%f\n",st.top());
			st.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 1236
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);





int main() 
{
  ll H,W; cin>>H>>W;
  vector<string> path(H);
  rep(i,H)
  {
    cin>>path.at(i);
  }
  
  /*
  rep(i,H)
  {
    cout<<path.at(i)<<endl;
  }  
  */
  
  ll x=0,y=0;
  rep(i,1<<(H+W-2))
  {
    x=0,y=0;
    vector<string> vec=path;
    ll i2=i;
    rep(j,H+W-1)
    {
      if(j==0) {vec.at(0).at(0)='.'; continue;}
      if(i2&1)
      {
        x+=1;
        if(x>=W) {goto OUT;}
        if(vec.at(y).at(x)=='.') {goto OUT;}
        vec.at(y).at(x)='.';
      }
      else
      {
        y+=1;
        if(y>=H) {goto OUT;}
        if(vec.at(y).at(x)=='.') {goto OUT;}
        vec.at(y).at(x)='.';
      }
      i2>>=1;
    }
    rep(j,H)
    {
      rep(k,W)
      {
        if(vec.at(j).at(k)=='#') {goto OUT;}
      }
    }
    cout<<"Possible"<<endl; return 0;
OUT:
    i2+=1;
  }
  cout<<"Impossible"<<endl;
  return 0;
}


Measured memory_bytes: 3524
N, m = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

dp = [50001] * (N + 1)
dp[0] = 0

for c in C:
    for n in range(c, N + 1):
        dp[n] = min(dp[n], dp[n - c] + 1)

print(dp[N])



Measured memory_bytes: 7516
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

a, b = MAP()
ans = ceil((b - a) / (a - 1) + 1)
print(ans)

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

int main(void) {
	int n, d, x;
	cin >> n >> d >> x;
	int a[n];
	for(int i=0;i<n;i++) cin >> a[i];

	for(int i=0;i<n;i++) {
		x += (d-1) / a[i];
		x++;
	}

	cout << x << endl;
}


Measured memory_bytes: 256
import Control.Applicative
import Data.List

main :: IO ()
main = do
  { [h, w] <- readLineInputs
  ; zss <- loop h
  ; print $ solve zss
  }

loop :: Int -> IO [String]
loop 0 = return []

loop n = do
  { xs  <- getLine
  ; xss <- loop (pred n)
  ; return (xs:xss)
  }

conv :: Char -> (Char, Int)
conv c = (c, case c of {'#' -> 1; _ -> 0})

solve :: [String] -> Int
solve (xs:xss) = iter [] xs xss
  where
    iter [] ys (zs:zss) = iter (tail $ scanl' phi (0,'.') ys) zs zss
    iter xs ys []       = fst $ fst $ fst $ mapAccumL psi ((maxBound, '#'), xs) ys
    iter xs ys (zs:zss) = iter (snd $ mapAccumL psi ((maxBound, '#'), xs) ys) zs zss
    
    phi (m,'.') '#' = (succ m, '#')
    phi (m,_)   c   = (m, c)

    psi ((k,c),(m,d):ys) '.' = ((ne, ys), ne) where ne = (min k m, '.')
    psi ((k,c),(m,d):ys) '#' = case [c,d] of
      ".." -> ((ne, ys), ne) where ne = (min (succ k) (succ m), '#')
      ".#" -> ((ne, ys), ne) where ne = (min (succ k) m, '#')
      "#." -> ((ne, ys), ne) where ne = (min k (succ m), '#')
      "##" -> ((ne, ys), ne) where ne = (min k m, '#')

-- I/O

readLineInputs :: Read a => IO [a]
readLineInputs = map read . words <$> getLine


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

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

    int N, M, X, Y; cin >> N >> M >> X >> Y;
    bool ans = X >= Y;
    vector<int> x(N+1);
    x[0] = X;
    for (int i = 1; i <= N; i++) {
        cin >> x[i];
        ans = ans || x[i] >= Y;
    }
    for (int i = 0; i < M; i++) {
        int y; cin >> y;
        for (int j = 0; j <= N; j++) ans = ans || x[j] >= y;
    }
    cout << (ans ? "War" : "No War") << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;cin>>n;int x;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		if(x%2!=0)
		{
			continue;
		}
		else if(x%2==0)
		{
			if(x%3!=0&&x%5!=0)
			{
				cout<<"DENIED";
				return 0;
			}
		}
	}
	cout<<"APPROVED";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

int fact(int n){
	int factorial=1;
	while(n){
		factorial*=n;
		n--;
	}
	return factorial;
}

int main(){
	int n;
	cin>>n;
	vector<int>x(n),y(n),z(n);
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i];
		z[i]=i;
	}
	double dis=0;
	do{
		for(int i=0;i<n;i++){
			dis+=sqrt((x[i]-x[z[i]])*(x[i]-x[z[i]])+(y[i]-y[z[i]])*(y[i]-y[z[i]]));
		}
	}while(next_permutation(z.begin(),z.end()));
	printf("%.15lf\n",dis/(double)fact(n));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a>=b&&a>=c)cout<<a*10+b+c;
    else if(b>=a&&b>=c)cout<<b*10+a+c;
    else if(c>=b&&c>=a)cout<<c*10+b+a;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int cardCount = Integer.parseInt(reader.readLine());

        String[] marks = {"S", "H", "C", "D"};
        Map<String,List<Integer>> cards = new HashMap<String,List<Integer>>();
        for (String mark : marks) {
            cards.put(mark, new ArrayList<Integer>());
        }

        for (int i = 0; i < cardCount; i++) {
            String line = reader.readLine();
            String[] in = line.split(" ");
            if (cards.containsKey(in[0]))  {
                cards.get(in[0]).add(Integer.parseInt(in[1]));
            }
        }

        for (String mark : marks) {
            List<Integer> cardList = cards.get(mark);
            for (int i = 1; i <= 13; i++) {
                if (!cardList.contains(i)) {
                    System.out.println(mark + " " + i);
                }
            }
        }
   }
}

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

int main()
{
    int d,g;
    cin >> d >> g;
    vector<int> p(d);
    vector<int> c(d);
    int i;
    for(i = 0;i < d;++i){
        cin >> p.at(i) >> c.at(i);
    }
    int ans = 1001;
    int bit;
    for(bit = 0;bit <(1 << d);++bit){
        int sum = 0,num = 0,rest = -1;
        for(i = 0;i < d;++i){
            if(bit & (1 << i)){
                sum += 100*(1+i)*p.at(i)+c.at(i);
                num += p.at(i);
            }else{
                rest = i;
            }
        }
        if(sum < g){
            if(rest == -1){
                continue;
            }
            int need = (g-sum-1)/(100*(rest+1))+1;
            if(need > p.at(rest)){
                continue;
            }else{
                num += need;
            }
        }
        if(ans > num){
            ans = num;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int a[3];
	for(int i=0; i<3; i++) cin >> a[i];
	sort(a, a+3, greater<int>());
	cout << a[0]-a[2] << endl;
	return 0;
}

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

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();

		int x = N * 800;
		int y = (N / 15) * 200;

		System.out.println(x - y);
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 26832
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

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

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

struct edge{
	int to;
	long long int T;
};

P memo[210000];
long long int ex[210000];
vector<edge> E[210000];
long long int ans[210000] = {};

int main(){
	int N, M, Q;
	cin >> N >> M >> Q;
	for(int i = 0; i < M; i++){
		cin >> memo[i].first >> memo[i].second;
		ex[i] = Q + 1;
	}
	for(int i = 1; i <= Q; i++){
		int num;
		cin >> num;
		ex[num - 1] = i;
	}
	for(int i = 0; i < M; i++){
		edge e;
		e.T = ex[i];
		e.to = memo[i].second;
		E[memo[i].first].push_back(e);
		e.to = memo[i].first;
		E[memo[i].second].push_back(e);
	}
	for(int i = 1; i <= N; i++){
		memo[i] = P(INF, -INF);
	}
	queue<int> que;
	que.push(1);
	memo[1] = P(0, Q + 1);
	for(int loop = 1; loop <= N; loop++){
		int sz = que.size();
		if(sz == 0){
			break;
		}
		for(int _ = 0; _ < sz; _++){
			int pos = que.front();
			que.pop();
			for(int i = 0; i < E[pos].size(); i++){
				int to = E[pos][i].to;
				if(memo[to].first < loop){
					continue;
				}
				memo[to].first = loop;
				if(memo[to].second == -INF){
					que.push(to);
				}
				memo[to].second = max(memo[to].second, min(memo[pos].second, E[pos][i].T));
			}
		}
	}
	for(int i = 1; i <= N; i++){
		ans[memo[i].second] += 1;
	}
	for(int i = 1; i <= Q; i++){
		ans[i] += ans[i - 1];
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 24768