akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int k = saori.saori_hayami();
		Integer[] h = new Integer[n];
		for(int i = 0;i < n;i++){
			h[i] = saori.saori_hayami();
		}
		Arrays.sort(h, Collections.reverseOrder());
		long ans = 0;
		for(int i = k; i < n;i++){
			ans += h[i];
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 29668
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
///////////////////////////////////////


int p[200100];
double key[200100];
int main() {
	int N, K; cin >> N >> K;
	REP(i, N)cin >> p[i];
	REP(i, N) {
		key[i] = (1 + p[i])*p[i] / (2.0 * p[i]);
	}
	long double ans = 0;
	vector<long double>sum;
	sum.push_back(0);
	REP(i, N) {
		sum.push_back(sum[i] + key[i]);
	}
	REP(i, N - K + 1) {
		ans = max(ans, sum[i + K] - sum[i]);
	}
	cout << fixed << setprecision(12) << ans << endl;
	return 0;
}

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

using namespace std;
using llint = long long;

const int N = 2e5 + 10, L = 1e8;
const double PI = acos(-1.0);

#define y1 myy1
#define mid ((l + r) >> 1)

int x1, y1, x2, y2, n;
int x[N], y[N];
/*
struct {
  int lson, rson;
  int f;
} tr[N * 20];
int trn;
int root;

int query(int p, int l, int r, int ll, int rr) {
  if (ll > rr) return 0;
  if (ll <= l && rr >= r) return tr[p].f;
  int ret = 0;
  if (ll <= mid) ret = max(ret, query(tr[p].lson, l, mid, ll, rr));
  if (rr > mid) ret = max(ret, query(tr[p].rson, mid + 1, r, ll, rr));
  return ret;
}

int update(int p, int l, int r, int x, int v) {
  int rt = ++trn;
  tr[rt] = tr[p];
  tr[rt].f = max(tr[rt].f, v);
  if (l == r) return rt;
  if (x <= mid) tr[rt].lson = update(tr[rt].lson, l, mid, x, v);
  else tr[rt].rson = update(tr[rt].rson, mid + 1, r, x, v);
  return rt;
}*/

int lis(vector < pair <int, int> > &v, bool up) {
  int ret = 0;
  int n = v.size();
  vector <int> opt;
  opt.push_back(-L - 1);
  for (int i = 0; i < v.size(); ++i) {
    int t = lower_bound(opt.begin(), opt.end(), up ? v[i].second : -v[i].second) - opt.begin();
    if (t == opt.size()) opt.push_back(up ? v[i].second : -v[i].second);
    else opt[t] = min(opt[t], up ? v[i].second : -v[i].second);
    ret = max(ret, t);
  }
  return ret;
}

int main() {
  scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", x + i, y + i);
  }
  if (x1 > x2) {
    swap(x1, x2);
    swap(y1, y2);
  }
  int mxy = max(y1, y2);
  int mny = min(y1, y2);
  vector < pair <int, int> > v;
  for (int i = 1; i <= n; ++i) {
    if (x[i] >= x1 && x[i] <= x2 && y[i] >= mny && y[i] <= mxy) {
      v.push_back(make_pair(x[i], y[i]));
    }
  }
  sort(v.begin(), v.end());
  int c = lis(v, y1 < y2);
  double ans = double(x2 - x1) * 100 + fabs(mxy - mny) * 100 - c * (10 * 2 - 10 * PI / 2);
  int t = min(x2 - x1, mxy - mny);
  if (c >= t + 1) {
    ans += 1 * (10 * 2 - 10 * PI / 2);
    ans += 1 * (10 * PI - 10 * 2);
  }
  printf("%.12f\n", ans);
  return 0;
}


Measured memory_bytes: 5232
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
int bsr(int x) { return 31 - __builtin_clz(x); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
    int n, k;
    cin >> n >> k;
    ll a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll sm[n+1], sm2[n+1];
    sm[0] = 0; sm2[0] = 0;
    for (int i = 0; i < n; i++) {
        sm[i+1] = sm[i] + max(0LL, a[i]);
        sm2[i+1] = sm2[i] + a[i];
    }
    ll ans = -TEN(18);
    for (int i = 0; i <= n-k; i++) {
        int l = i, r = i+k;
        ll buf = sm[l]+sm[n]-sm[r];
        buf += max(0LL, sm2[r]-sm2[l]);
        ans = max(ans, buf);
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int N; cin >> N; long long ans = 0;
    vector<int> B(N+1);
    for( int i = 0; i < N - 1; i++ ) cin >> B[i+1];
    B[0] = B[N] = (1 << 21);

    for( int i = 0; i < N; i++ ){
        ans += min( B[i], B[i+1] );
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
b=list(map(int,input().split()))
a=[0]*n
a[0]=b[0]
a[1]=b[0]
for i in range(1,n-1):
    if a[i]>b[i]:
        a[i]=b[i]
        a[i+1]=b[i]
    else:
        a[i+1]=b[i]

print(sum(a))



Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド
		Scanner sc = new Scanner(System.in);
		while(true) {
		int a;
		a = sc.nextInt();
		int b;
		b = sc.nextInt();
		if(a==0&&b==0) {
			break;
		}

		for(int i = 0;i < a ;i++) {
			for(int j = 0; j < b ;j++) {
				if((i%2==1)&&(j%2==1)) {
					System.out.print("#");
				}else if((i%2==1)&&(j%2==0)) {
					System.out.print(".");
				}else if((i%2==0)&&(j%2==1)) {
					System.out.print(".");
				}else {
					System.out.print("#");
				}
				}
			System.out.println("");
			}
		System.out.println("");
		}

	}
	}



Measured memory_bytes: 34400
#include<bits/stdc++.h>
using namespace std;
const bool DBG = 1;

#define TRACE(x)    x
#define WATCH(x)    TRACE(cout << #x" = " << x << endl)
#define WATCHR(a,b) TRACE(for(auto it=a; it!=b;) cout<<*(it++)<<" ";cout<<endl)
#define WATCHC(V)   TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pair<int,int>> vpii;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(15);

	string s;
	cin >> s;

	if(s.size() < 4) {
		cout << "No" << endl;
		return 0;
	}
	if(s.substr(0,4) == "YAKI") {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
typedef std::vector<long long > vi ;
#define F first
#define S second
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define PB push_back
#define MP make_pair
#define PI 3.14159265358979323846
#define all(a) a.begin(),a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define endl '\n'
#define show(a) for(auto el:a)cout<<el<<" "
const ll INF=LLONG_MAX/2;
const ll N=2e5+1;
#define yesno(f) yes(f);no(f);
#define yes(f) if(f)cout<<"YES\n";
#define no(f) if(!f)cout<<"NO\n";
using  namespace std;
int main()
{
    fast;
   ll t=1;
   //std::cin >> t;
   while(t--)
   {
       ll n,i,j=0,m;
       std::cin >> n;
       ll a[n];
       fr(i,0,n)
       std::cin >> a[i];
       m=0;
       sort(a,a+n);
       fr(i,0,n)
       {
           fr(j,i+1,n)
           {
               if(a[i]==a[j])
               continue;
               fr(k,j+1,n)
               {
                   if(a[k]==a[j]||a[k]==a[i])
                   continue;
                   if(a[i]+a[j]>a[k])
                   m++;
                   
               }
           }
       }
       cout<<m<<"\n";
   }
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    string s;cin>>s;
    if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int L,n;
int bitcount(int x)
{
    int res=0;
    for(int i=0;i<n;i++)  res+=((x>>i)&1);
    return res;
}
int main()
{
    cin>>L;  
    n=log2(L);
    n++;
    printf("%d %d\n",n,2*(n-1)+bitcount(L)-1);
    for(int i=1;i<n;i++)
    {
        printf("%d %d %d\n",i,i+1,(1<<(i-1)));
        printf("%d %d 0\n",i,i+1);
    }
    int sum=0;
    for(int i=n-1;i>=0;i--)
    {
        if((L>>i)&1)
        {
            if(i!=n-1)
            {
                printf("%d %d %d\n",i+1,n,sum);
            }
            sum+=(1<<i);
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

struct Node {
  char c;
  Node* next;
};

inline void rotate(Node** headp, Node** tailp, int h) {
  (*tailp)->next = *headp;
  Node* newhead = *headp;
  for (int j = 0; j < h - 1; ++j) {
    newhead = newhead->next;
  }
  *headp = newhead->next;
  *tailp = newhead;
  (*tailp)->next = nullptr;
}

int main() {
  std::string s;
  Node nodes[201];

  for (;;) {
    cin >> s;
    if (s[0] == '-')
      break;

    // Init nodes
    for (size_t i = 0; i < s.length(); ++i) {
      nodes[i].c = s[i];
      nodes[i].next = &nodes[i+1];
    }
    nodes[s.length()].next = nullptr;

    int m;
    cin >> m;

    Node* head = &nodes[0];
    Node* tail = &nodes[s.length() - 1];
    int h;
    for (int i = 0; i < m; ++i) {
      cin >> h;
      rotate(&head, &tail, h);
    }

    for (const Node* p = head; p; p = p->next)
      printf("%c", p->c);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 3092
<?php
list($n, $water_out_time) = explode(" ", trim(fgets(STDIN)));
$t = explode(" ", trim(fgets(STDIN)));

$total = 0;
for ($i = 1; $i < $n; $i++) {
    $total += min($water_out_time, ($t[$i] - $t[$i-1]));
}
$total += $water_out_time;
echo $total.PHP_EOL;


Measured memory_bytes: 40652
#include<bits/stdc++.h>
using namespace std;
bool check(int a,int b,int c)
{
	int n=b*b+c*c+b*c-a;
	int m=b+c;
	if(m*m<=4*n)
	 return false;
	int num=(sqrt(m*m-4*n)-m)/2;
	if(num*num+m*num+n==0 && num>0)
	 return true;
	return false;
	
}
int main()
{
    int n;
	cin>>n;
	for(int i=1; i<=n; i++){
		int cnt=0;
		for(int j=1; j<min(100,i); j++){
			for(int k=1; k<min(100,i); k++){
				if(check(i,j,k))
				 cnt++;
			}
		}
		cout<<cnt<<"\n";
	}
	return 0;
}

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

int main(){
    int N;  cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++)  cin >> A[i];
    int m = 0;

    while(true){
        sort(A.begin()+m, A.end());
        m = lower_bound(A.begin()+m, A.end(), 1) - A.begin();
        if(m==N-1) break;

        for(int i=m+1; i<N; i++) A[i] = A[i]%A[m];
    }
    cout << A[m] << endl;
}


Measured memory_bytes: 640
s,n;main(i,j){
  for(;i=s=scanf("%d",&n)*n;printf("%d\n",s)){
    /*
    for(;++i<=n*2;)for(j=2;j*j<=i&&(i%j++?:!--s););
      */
    for(;j=i++<2*n;)for(;++j*j<=i&&(i%j?:!--s););
  }
}

Measured memory_bytes: 408
#include "bits/stdc++.h"
#include <chrono> 
 
using namespace std;
using namespace std::chrono; 
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
#define gcd(a,b) __gcd(a,b)
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define vc vector<char>
#define pb(n) push_back(n)
#define pp pop_back()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define type(a) typeid(a).name();
#define print(arr) cout << "[" ;for(unsigned int i=0;i<(unsigned int) arr.size();i++){ (i==arr.size()-1)?cout << arr[i]:cout << arr[i] << ",";}cout << "]" << endl
#define Arr(arr,l) cout << "[" ;for(unsigned int i=0;i<(unsigned int) l;i++){ (i==l-1)?cout << arr[i]:cout << arr[i] << ",";}cout << "]" << endl
#define console(arr) cout << "["<<endl; for(ll i=0;i<(ll)arr.size();++i){cout << " [";for(ll j=0;j<(ll)arr[i].size();++j){(j==(int)arr[i].size()-1)?cout << arr[i][j]:cout << arr[i][j] << ",";}cout << "]"<<endl;} cout << "]"<<endl
#define starting() auto start = high_resolution_clock::now()
#define ending() auto stop = high_resolution_clock::now();auto duration = duration_cast<microseconds>(stop - start);cout << endl << endl << "Execution Time : "<<duration.count()/1000 << " ms" << endl
 
template <typename T1,typename T2>
void mapped(map<T1,T2>m){for(auto ite=m.begin();ite!=m.end();++ite){cout << "'" << ite->first << "'"<<" : "<<ite->second <<endl;}}
 
template <typename T1 , typename T2>
void mappedArr(map<T1,vector<T2>>m){for(auto ity=m.begin();ity!=m.end();++ity){cout << "'"<< ity->first <<"'"<<" : "<<"[";
for(int i=0;i<(int)ity->second.size();++i){(i==(int)ity->second.size()-1)?cout << ity->second[i]:cout << ity->second[i] << ",";}cout << "]"<<endl;}}
 
string int_to_string(int x){ stringstream ss; ss << x; string ni = ss.str(); return ni;}
int char_to_int(char c){ int n = (int)c - 48; return n; }
int string_to_int(string x){ int n; stringstream s(x); s >> n; return n; }
 
template <typename T1,typename T2>
void ArrPair(vector<pair<T1,T2>>vp){for(int i=0;i<(int)vp.size();++i){
cout << "(" << vp[i].first << "," << vp[i].second << ")"<<endl ;}}
 
const int MOD = 1e9 + 7;
const ll INF = 1e18L + 5;
 
unordered_map<int,int> um;
unordered_set<int> us;
set<int> s;
// v.front() gives the first element of vector 
// v.back()  gives the last element of vector
// insert erase substr

 
int main(){
  string s1;
  string s2;
  cin >> s1  >> s2;
  string d = s2+s1;
  cout << d;
  return 0;
}  
 















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N;
  cin >> N;
  ll A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  multiset<ll> Set;
  Set.insert(A[0]);
  for (int i = 1; i < N; i++) {
    auto itr = Set.lower_bound(A[i]);
    if (itr == Set.begin()) {
      Set.insert(A[i]);
    } else {
      auto itr2 = prev(itr,1);
      Set.erase(itr2);
      Set.insert(A[i]);
    }
  }
  int ans = Set.size();
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8904
//templates
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <sstream>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define sort_key(struct_name,key_name) [](const struct_name &x, const struct_name &y){return x.key_name < y.key_name;}
#define pb(x) push_back(x)
typedef long long ll;
const ll MOD = 1e9 + 7;
using namespace std;

//main
int main(){
    int N,M; cin >> N >> M;
    vector<int> L(M);
    vector<int> R(M);
    rep(i,M) cin >> L[i] >> R[i];
    int Maximum = *min_element(ALL(R));
    int Minimum = *max_element(ALL(L));
    cout << max(Maximum-Minimum+1,0) << endl;
}



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

namespace AtCoder
{
    class Program
    {

        static void Main()
        {
            //ここから

            int N = ReadLineToInt();
            List<int> L = ReadLineToIntList();
            //ここまで

            L = L.OrderBy(l => l).ToList();
            bool b = L.Last() < L.Sum() - L.Last();

            string ans = b ? "Yes" : "No";
            Console.WriteLine(ans);
            Console.ReadKey();
        }


        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }



        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    }
    
}


Measured memory_bytes: 13396
#include<iostream>
using namespace std;
int N,X,Y;
int cnt[2020];
main()
{
	cin>>N>>X>>Y;
	X--,Y--;
	for(int i=0;i<N;i++)
	{
		for(int j=i+1;j<N;j++)
		{
			cnt[min(j-i,abs(X-i)+1+abs(Y-j))]++;
		}
	}
	for(int k=1;k<N;k++)cout<<cnt[k]<<endl;
}


Measured memory_bytes: 256
module Main where

import           Control.Monad
import           Data.Array.IO
import           Data.Char
import           Data.List
import           Data.List.Split
import           Data.Ord
import qualified Data.Vector.Unboxed as V
import           Text.Printf

main :: IO ()
main = do
  s <- getLine
  let f = read $ take 2 s :: Int
      t = read $ drop 2 s :: Int
      yymm = f >= 0 && f < 99 && t > 0 && t < 13
      mmyy = f > 0 && f < 13 && t >= 0 && t < 99
  if yymm && mmyy
    then putStrLn "AMBIGUOUS"
    else if yymm
         then putStrLn "YYMM"
         else if mmyy
              then putStrLn "MMYY"
              else putStrLn "NA"






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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n;cin >>n;
    string ans="";
    int k=(n%26)?n%26:26;
    ans+=(k-1)+'a';
    n-=k;
    n/=26;
    while(n>0){
        int l=(n%26)?n%26:26;
        ans+=(l-1)+'a';
        n-=l;
        n/=26;
    }
    reverse(all(ans));
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FOR(i,a,b) for (long long i = (a); i <= (b); i++)
#define FORD(i,b,a) for (long long i = (b); i >= (a); i--)
#define endl "\n"
#define ll long long
#define x1 asdasdsaas
#define y1 cdaca1231
#define fi first
#define se second
#define pb push_back
using namespace std;
const int MAXN = 1e6;
const int dx[4] = { -1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};
int n, f[MAXN][4], a[MAXN][4];
void solve() {
	cin >> n;
	FOR(i, 1, n) {
		cin >> a[i][1] >> a[i][2] >> a[i][3];
	}
	FOR(i, 1, 3) f[1][i] = a[1][i];
	FOR(i, 2, n) {
		FOR(j, 1, 3) {
			FOR(k, 1, 3) if (k != j) f[i][j] = max(f[i][j], f[i - 1][k] + a[i][j]);
		}
	}
	cout << max(f[n][1], max(f[n][2], f[n][3]));
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 5888
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	char a = sc.next().charAt(0);
      	if('a'<= a && 'z' >= a) System.out.println("a");
      	else System.out.println("A");
                                                   
    }
}

Measured memory_bytes: 35628
n = input()

R = []
for i in range(n):
    R.append(input())

min_v = R[0]
max_v = -1000000000000
for i in range(1, n):
    temp = R[i] - min_v
    if (temp >= max_v):
        max_v = temp
    temp = R[i]
    if (min_v >= temp):
        min_v = temp
print max_v

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

using namespace std;
const int N=3e5+5;
int a[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int K,n;
    cin>>K>>n;
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(i==0) continue;
        v.push_back(a[i]-a[i-1]);
        if(i==n-1) v.push_back(K-a[i]+a[0]);
    }
    sort(v.begin(),v.end());
    long long ans=0;
    for(int i=0;i<(int)v.size()-1;i++)
        ans+=v[i];
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1912
#include<stdio.h>
#define N 8

int a[N][N]={0};

void PriBor(){
	int i,j;

	for(i = 0 ;i < N ; i++){
		for(j = 0 ; j < N ; j++){
			if(a[i][j] == 1)printf("Q");
			else printf(".");
		}
		printf("\n");
	}

	return;
}

int check(int y,int x){
	int i,j;

	/*横*/
	for(i = 0 ; i < N ; i++){
		if(i != x && a[y][i] == 1)return 0;
	}

	/*縦*/
	for(i = 0 ; i < N ; i++){
		if(i != y && a[i][x] == 1)return 0;
	}

	/*右上*/
	i = y-1;
    j = x+1;
	while(i >= 0 && j < N){
		if(a[i--][j++] == 1)return 0;
	}

	/*左上*/
	i = y-1;
    j = x-1;
	while(i >= 0 && j >= 0){
		if(a[i--][j--] == 1)return 0;
	}

	/*左下*/
	i = y+1;
    j = x-1;
	while(i < N && j >= 0){
		if(a[i++][j--] == 1)return 0;
	}

	/*右下*/
	i = y+1;
    j = x+1;
	while(i < N && j < N){
		if(a[i++][j++] == 1)return 0;
	}

	return 1;

}

int GetAnswer(int d){
	int i;

	for(i = 0 ; i < N ; i++){
		if(a[d][i] == 1){
			if(!GetAnswer(d+1))return 0;
		}
	}

	if(d == N){
		PriBor();
		return 1;
	}

	else {
		for(i = 0 ; i < N ; i++){
			if(a[d][i] == 0 && check(d,i)){
				a[d][i] = 1;
				if(!GetAnswer(d+1)){
					a[d][i] = 0;
				}
			}
		}
	}

	return 0;
}

int main(){
	int n,i,j;
	int x,y;
	int d = 0;

	scanf("%d",&n);

	for(i = 0 ; i < n ;i++){
		scanf("%d %d",&y,&x);
		a[y][x] = 1;
	}

	i = GetAnswer(d);

	return 0;
}



Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n,p;
cin>>n>>p;
ll ca=0;
ll a[n+2]={};
ll b[n+2]={};
ll m=0;
ll f=0;
for(ll i=1; i<n+1; i++){
cin>>a[i];}
for(ll i=0; i<p; i++){
  
for(ll k=1; k<=n; k++){
if(k-a[k]<=0){
b[0]++;}
else{
b[k-a[k]]++;}
if(k+a[k]>=n){
b[n+1]--;}
else{
b[k+a[k]+1]--;}}
ca=b[0];
b[0]=0;
for(ll k=1; k<=n; k++){
ca+=b[k];
b[k]=0;
a[k]=ca;
if(a[k]==n){
m++;}
}
if(m==n) {f++; break;}
m=0;
ca=0;}
for(ll i=1; i<=n; i++){
cout << a[i] << " ";}
cout << endl;}


Measured memory_bytes: 6696
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static HashSet<Character> right = new HashSet<Character>();

	static boolean solve() {
		String s = in.next();
		if ("#".equals(s)) return false;

		boolean f = right.contains(s.charAt(0));

		int cnt = 0;
		for (int i=1; i<s.length(); i++) {
			if ((f && !right.contains(s.charAt(i))) || (!f && right.contains(s.charAt(i)))) {
				cnt++;
				f = !f;
			}
		}

		out.println(cnt);

		return true;
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		right.add('y');
		right.add('u');
		right.add('i');
		right.add('o');
		right.add('p');
		right.add('h');
		right.add('j');
		right.add('k');
		right.add('l');
		right.add('n');
		right.add('m');

		while(solve());
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 27640
import java.util.Arrays;

public class Main {

  private static void solve() {
    int n = ni();
    int k = ni();

    int[] p = na(n);

    Arrays.sort(p);
    int ret = 0;
    for (int i = 0; i < k; i++) {
      ret += p[i];
    }
    System.out.println(ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 36820
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define MAXN 100005
#define INF 0x3f3f3f3f
#define rint register int
#define LL long long
#define LD long double
using namespace std;

int n, k, w[MAXN][3], f[MAXN][3];

int main()
{
	scanf("%d", &n);
	for(rint i=1; i<=n; ++i) scanf("%d%d%d", &w[i][0], &w[i][1], &w[i][2]);
	for(rint i=1; i<=n; ++i)
	{
		for(rint j=0; j<3; ++j)
			for(rint k=0; k<3; ++k)
				if(j!=k) f[i][j]=max(f[i][j], f[i-1][k]+w[i][j]);
	}
	printf("%d\n", max(max(f[n][0], f[n][1]), f[n][2]));
	return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		double x[] = new double[N];
		double y[] = new double[N];

		double p1 = 0;
		double p2 = 0;
		double p3 = 0;
		double pmuge = -1;

		//入力を分ける
		for (int i = 0; i < N; i++) {
			x[i] = sc.nextDouble();
		}
		for (int i = 0; i < N; i++) {
			y[i] = sc.nextDouble();
		}
		for (int i = 0; i < N; i++) {
			double ans = Math.abs(x[i] - y[i]);
			p1 += ans;
			p2 += ans * ans;
			p3 += ans * ans * ans;
			pmuge = Math.max(pmuge, ans);
		}
		System.out.println(p1);
		//平方根 2乗の時
		System.out.println(Math.sqrt(p2));
		//立方根 3乗の時
		System.out.println(Math.cbrt(p3));
		System.out.println(pmuge);

	}

}



Measured memory_bytes: 28968
#include <iostream>
#include <vector>

using namespace std;
typedef pair<int, int> P;

int ans1 = 0;
int ans2 = 0;
int n = 0;
long oV[100001] = { 0 };
long eV[100001] = { 0 };

int main()
{
    cin >> n;
    P oddN, evenN;
    for (int i = 1; i <= n; i++) {
        int x; cin >> x;
        if (i % 2 != 0) {
            oV[x] += 1;
        } else {
            eV[x] += 1;
        }
    }
    int O1 = 0;
    int E1 = 0;
    int O2 = 0;
    int E2 = 0;

    for (int i = 0; i < 100001; i++) {
        if (oV[i] != 0) {
            if (oddN.first <= oV[i]) {
                if (oddN.second < oddN.first) {
                    oddN.second = oddN.first;
                    O2 = O1;
                }
                oddN.first = oV[i];
                O1 = i;
            }
            if (oddN.first > oV[i] && oddN.second < oV[i]) {
                oddN.second = oV[i];
                O2 = i;
            }
        }

        if (eV[i] != 0) {
            if (evenN.first <= eV[i]) {
                if (evenN.second < evenN.first) {
                    evenN.second = evenN.first;
                    E2 = E1;
                }
                evenN.first = eV[i];
                E1 = i;
            }
            if (evenN.first > eV[i] && evenN.second < eV[i]) {
                evenN.second = eV[i];
                E2 = i;
            }
        }
    }
    /*    
    cout << "O1: " << O1 << endl;
    cout << "O2: " << O2 << endl;
    cout << "odd first count: " << oddN.first << endl;
    cout << "odd second count: " << oddN.second << endl;

    cout << "E1: " << E1 << endl;
    cout << "E2: " << E2 << endl;
    cout << "even first count: " << evenN.first << endl;
    cout << "even second count: " << evenN.second << endl;
    */

    if (O1 != E1) {
        int ans = n / 2 - oddN.first + n / 2 - evenN.first;
        cout << ans << endl;
    } else {

        ans1 = n / 2 - oddN.first + n / 2 - evenN.second;
        ans2 = n / 2 - oddN.second + n / 2 - evenN.first;

        cout << ((ans1 < ans2) ? ans1 : ans2) << endl;
    }
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    //長さ
    int n = sc.nextInt();
    //文字列
    String s = sc.next();
    //アスキーコード用変数
    int num = 0;
    //アスキーコード用配列左側
    int asl[] = new int [26];
    //アスキーコード用配列右側
    int asr[] = new int [26];
    //区切った後の左側の文字列
    String strl;
    //区切った後の右側の文字列
	String strr;
    //最大数用
    int max = 0;
    //カウント用
    int count = 0;
    

    
    //区切ってく
    for(int j = 1; j<n; ++j){
          //配列の中身を0で初期化
    	for(int i = 0; i<26; ++i){
      		asl[i] = 0;
      		asr[i] = 0;
    	}
      //左
      strl = s.substring(0,j);
      //右
      strr = s.substring(j,n);
    
    //左側
    for(int i = 0 ; i < strl.length() ; ++i){
      //アスキーコードを0スタートで数える
      num = (int)strl.charAt(i) - 97;//aだったら0になる
      //文字列にあるコードは1にしておく
      asl[num] =1;
    }
    //右側
    for(int i = 0 ; i < strr.length() ; ++i){
      //アスキーコードを0スタートで数える
      num = (int)strr.charAt(i) - 97;//aだったら0になる
      //文字列にあるコードは1にしておく
      asr[num] =1;
    }
      //両側にあるかチェック
    for(int i = 0 ; i < 26 ; ++i){
      //両方あったら
      if((asl[i] ==1) && (asr[i] == 1)){
        
        //カウント増やす
        count+=1;
        
      }
  
    }
      //カウントの方が大きくなったら更新する
      if(max < count){
        max = count;
      }
      
    count = 0;
      
    }
   System.out.println(max);
  }
}

Measured memory_bytes: 35608
#include<cstdio>
#define M 4004
#define N 2002
int A[N],B[M],C[M],a[N],b[M],c[M],d[N],e[N],f[N][N],g[N][N],h[N],m,n,t;bool G[N][N];
inline int _e(int u,int v){return h[u]+h[v]-(h[f[u][v]]<<1);}
void _d(int u,int v){for(int i=A[u];i;i=B[i])if(_e(v,u)+_e(u,C[i])==_e(v,C[i]))_d(C[i],v),t++;}
void _c(int u,int v)
{
    if(g[v][u])B[++t]=A[v],C[A[v]=t]=u;
    else for(int i=a[u];i;i=b[i])if(_e(v,c[i])==_e(v,u)+1)_c(c[i],v);
}
void _b(int u,int v,int w)
{
    if(g[v][u])!G[g[v][u]][w]?G[g[v][u]][w]=G[w][g[v][u]]=1,_b(g[v][u],w,g[v][u]),_b(w,g[v][u],w),0:0;
    else
    {
        g[v][u]=w;
        for(int i=a[u];i;i=b[i])if(_e(v,c[i])==_e(v,u)+1)_b(c[i],v,w);
    }
}
void _a(int u){for(int i=a[e[d[u]=++t]=f[u][u]=u],j,k;i;i=b[i])if(!d[c[i]])for(h[c[i]]=h[u]+1,_a(c[i]),j=d[u];j<d[c[i]];j++)for(k=d[c[i]];k<=t;k++)f[e[j]][e[k]]=f[e[k]][e[j]]=u;}
int i,u,v;
int main()
{
    scanf("%d%d",&n,&m),G[n][n]=1;
    for(i=1;i<n;i++)scanf("%d%d",&u,&v),b[++t]=a[u],c[a[u]=t]=v,b[++t]=a[v],c[a[v]=t]=u,G[i][i]=1;
    for(t=0,_a(i=1);i<=m;i++)scanf("%d%d",&u,&v),!G[u][v]?G[u][v]=G[v][u]=1,_b(u,v,u),_b(v,u,v),0:0;
    for(i=1,t=0;i<=n;i++)g[i][i]=0,_c(i,i);
    for(i=1,t=0;i<=n;i++)_d(i,i);
    return 0&printf("%d\n",t>>1);
}

Measured memory_bytes: 35840
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    A = LI()

    P = [0] * N
    for a in A:
        a -= 1
        P[a] += 1

    printlist(P, '\n')

if __name__ == '__main__':
    solve()


Measured memory_bytes: 32932
#include<bits/stdc++.h>
using namespace std;
using ll=long long;


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


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;


int main(){
    ll S, W;
    cin >> S >> W;
    string res = "safe\n";
    if (S <= W) res = "unsafe\n";
    cout << res;
}


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

#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()

template< typename T >
struct WeightedUnionFind {
  vector< int > data;
  vector< T > ws;

  WeightedUnionFind() {}

  WeightedUnionFind(int sz) : data(sz, -1), ws(sz) {}

  int find(int k) {
    if(data[k] < 0) return k;
    auto par = find(data[k]);
    ws[k] += ws[data[k]];
    return data[k] = par;
  }

  T weight(int t) {
    find(t);
    return ws[t];
  }

  bool unite(int x, int y, T w) {
    w += weight(x);
    w -= weight(y);
    x = find(x), y = find(y);
    if(x == y) return false;
    if(data[x] > data[y]) {
      swap(x, y);
      w *= -1;
    }
    data[x] += data[y];
    data[y] = x;
    ws[y] = w;
    return true;
  }

  T diff(int x, int y) {
    return weight(y) - weight(x);
  }
};

inline void Main() {
  // code
  int n,m,l,r,d;
  cin>>n>>m;
  WeightedUnionFind<int> uf(n);
  rep(i,m) {
    cin>>l>>r>>d;
    l--;r--;

    if(uf.find(l) == uf.find(r)) {
      if(uf.diff(l,r) != d) {
        cout << "No" << endl;
        return;
      }
    }
    else uf.unite(l,r,d);
  }
  cout << "Yes" << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


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


int main()
{
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> score(n, k - q);
  rep(i, q)
  {
    int a;
    cin >> a;
    score[a-1]++;
  }
  rep(i, n)
    if (score[i] > 0)
      puts("Yes");
    else
      puts("No");
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
   
int main(){
   
int a,i,max;
int cnt[101]={0};
 
 for(i=0;i<100;i++){
   scanf("%d\n", &a);
   cnt[a] = cnt[a]+1;
  }
 max=0;
 for(i=0;i<100;i++){
   if(max<=cnt[i])
     max=cnt[i];
  }
 for(i=0;i<100;i++){
   if(max==cnt[i]) 
      printf("%d\n",i);
  }
   
    return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
int main(void) {
	int n, m, a[10001], num = 0;

	scanf("%d%d", &n, &m);
	for (int k = 0; k < m; k++) {
		scanf("%d", &a[k]);
		num = num + a[k];
	}
	if (num > n) printf("%d\n", -1);
	else printf("%d\n", n - num);
	return 0;
}

Measured memory_bytes: 1724
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

//const double PI = 3.1415926535897932384626433832795;

int main() {
  char c, prev;
  cin >> c;
  prev = c;
  REP(i, 3) {
    cin >> c;
    if(prev != c) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    }

    static int solve(int N) {
        return (1000 - N % 1000) % 1000;
    }
}

Measured memory_bytes: 35596
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> paint;
#define x first
#define y second
int main(){
	int n;
	while(1){
		cin>>n;
		if(n==0)	return 0;
		set<paint> lib;
		int a,b;
		for(int i=0;i<n;i++){
			cin>>a>>b;
			lib.insert(make_pair(a,b));
		}
		int ans=0;
		for(set<paint>::iterator i=lib.begin();i!=lib.end();i++){
			set<paint>::iterator j=i;
			for(j++;j!=lib.end();j++){
				int w=i->x-j->x;
				int h=i->y-j->y;
				if(lib.find(make_pair(i->x-h,i->y+w))==lib.end())	continue;
				if(lib.find(make_pair(i->x-w-h,i->y+w-h))==lib.end())	continue;
				ans=max(ans,w*w+h*h);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }


void compute() {

}

int main() {
  int a,b,c,k;
  cin >> a >> b >>c >> k;
  ll maxi = max(a,max(b,c));
  long long sum = a + b + c - maxi;
  rep(i,k) {
    maxi = maxi * 2LL;
  }
  cout << sum + maxi << endl;
  compute();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
const Int OFS = 50000;
const Int MAX = 1e6 + 2 * OFS;
Int s[MAX],d[MAX],f[MAX];
Int u[MAX];

signed main(){
  Int n,m;
  while(cin>>n>>m,n||m){
    m--;    
    vector<Int> a(m),x(m);
    for(Int i=0;i<m;i++) cin>>a[i]>>x[i];

    memset(s,0,sizeof(s));
    memset(d,0,sizeof(d));
    memset(f,0,sizeof(f));
    
    for(Int i=0;i<m;i++){
      x[i]--;
      x[i]+=OFS;
      if(a[i]==1){
	s[x[i]]++;
	s[x[i]+1]--;
	continue;
      }
      Int c=sqrt(a[i])+1;
      while((c+1)*(c+1)< a[i]) c++;
      while(c*c>=a[i]) c--;
      //cout<<a[i]<<":"<<c<<endl;
      Int l=x[i]-c,r=x[i]+c;
      f[l]  +=-2;
      f[r-1]-=-2;
      d[l]  +=2*c-1;
      d[r]  +=2*c-1;
      s[l]  +=a[i]-c*c;
      s[r+1]-=a[i]-c*c;
    }
    
    for(Int i=0;i+1<MAX;i++) f[i+1]+=f[i];
    for(Int i=0;i+1<MAX;i++) d[i+1]+=d[i]+f[i];
    for(Int i=0;i+1<MAX;i++) s[i+1]+=s[i]+d[i];

    if(0){
      for(Int i=OFS-10;i<OFS+n+10;i++) cout<<f[i]<<" ";cout<<endl;
      for(Int i=OFS-10;i<OFS+n+10;i++) cout<<d[i]<<" ";cout<<endl;
      for(Int i=OFS-10;i<OFS+n+10;i++) cout<<s[i]<<" ";cout<<endl;
    }
    Int t;
    cin>>t;
    // cout<<t<<endl;

    auto check=[&](Int x)->Int{
      memset(u,0,sizeof(u));
      Int cnt=0;
      for(Int i=OFS;i<OFS+n;i++){
	Int d=x-s[i];
	if(d<=0) continue;
	if(d>t) return 0;
	Int c=sqrt(t-d)+1;
	//cout<<d<<" "<<t<<" "<<c<<endl;
	while(d<=t-(c+1)*(c+1)) c++;
	while(d>t-c*c) c--;
	assert(d<=t-c*c);
	assert(d>t-(c+1)*(c+1));
	Int l=i-c,r=i+c;
	//cout<<l<<" "<<r<<":"<<c<<endl;
	//assert(l>=0);
	//l=max(0LL,l);
	//r=min(MAX-1,r);
	u[l]++;
	u[r+1]--;
	cnt++;
      }
      for(Int i=1;i<MAX;i++) u[i]+=u[i-1];
      return *max_element(u,u+MAX)==cnt;
    };
    
    Int l=0,r=*max_element(s,s+MAX)+t+1;
    //cout<<l<<" "<<r<<endl;
    while(l+1<r){
      Int m=(l+r)>>1;
      //cout<<l<<" "<<r<<":"<<m<<endl;
      if(check(m)) l=m;
      else r=m;
    }
    cout<<l<<endl;
  }
  return 0;
}



Measured memory_bytes: 38628
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
int main()
{
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    pi ans={0,a*100};
    for(int x=0;x<=30;x++)
    {
        for(int y=0;y<=30;y++)
        {
            for(int u=0;u<=3000;u++)
            {
                for(int v=0;v<=3000;v++)
                {
                    int tot=x*a*100+y*b*100+u*c+v*d;
                    if(tot>f) break;
                    int s=u*c+v*d;
                    if(tot>f||s*100>(tot-s)*e) continue;
                    if(tot*ans.first<s*ans.second) ans=make_pair(s,tot);
                }
            }
        }
    }
    cout<<ans.second<<" "<<ans.first<<'\n';
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	int a[100];

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

	int max = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (abs(a[i] - a[j]) > max) {
				max = abs(a[i] - a[j]);
			}
		}
	}
	cout << max << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A,B;
    cin >> A >> B;
    if (A == B) cout << "Draw" << endl;
    else if (A == 1 && B != 1) cout << "Alice" << endl;
    else if (A != 1 && B == 1) cout << "Bob" << endl;
    else if(A > B) cout << "Alice" << endl;
    else if(B > A) cout << "Bob" << endl; 
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] lengths = new int[n];
        for (int i = 0; i < n; i++) {
            lengths[i] = sc.nextInt();
        }
        Arrays.sort(lengths);
        int maxLength = 0;
        for (int i = 0; i < k; i++) {
            maxLength += lengths[n - 1 - i];
        }
        System.out.println(maxLength);
    }

}


Measured memory_bytes: 23764