akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
template <class T> class BIT {
public:
  BIT() {}
  BIT(int N) : N(N) { dat.assign(N, 0); }
  // sum [0,i)
  T sum(int i) {
    T ret = 0;
    for (--i; i >= 0; i = (i & (i + 1)) - 1)
      ret += dat[i];
    return ret;
  }
  // sum [i,j)
  T sum(int i, int j) { return sum(j) - sum(i); }
  // add x to i
  void add(int i, T x) {
    for (; i < N; i |= i + 1)
      dat[i] += x;
  }
  int size() { return N; }

private:
  int N;
  vector<T> dat;
};

const int MAX_N = 200010;

int N,K;
vector<ll> A;
vector<ll> sum;
int main() {
  cin >> N >> K;
  A.resize(N);

  BIT<ll> bit(MAX_N);

  for (auto &val : A){
    cin >> val;
    val -= K;
  }
  sum.resize(N + 1);
  for (int i = 0; i < A.size(); i++){
    sum[i + 1] += sum[i] + A[i];
  }
  vector<ll> tmp_sum(sum.begin(), sum.end());
  sort(tmp_sum.begin(), tmp_sum.end());
  map<ll, int> dic_vals;
  for (auto &val : tmp_sum){
    if (dic_vals.count(val) > 0){
      continue;
    }
    dic_vals[val] = dic_vals.size();
  }
  ll res = 0;
  for (int i = N; i >= 0; i--){
    ll val = sum[i];
    int dic_val = dic_vals[val];
    res += bit.sum(dic_val, MAX_N);
    bit.add(dic_val, 1);
    // cout << res << " " << val << " " << dic_val << endl;
  }
  cout << res << endl;

  return 0;
}


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

void printA(int A[], int N){
	printf("%d",A[0]);
	for(int i=1; i<N; ++i){
		printf(" %d",A[i]);
	}
	printf("\n");
}

main(){
	int A[10];
	
	for(int i=0;i <10; ++i){
		cin >> A[i];
	}
	
	sort(A, A + 10);
	
	cout << A[9] << endl;
	cout << A[8] << endl;
	cout << A[7] << endl;
}


Measured memory_bytes: 3084
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		List<Integer> list=new ArrayList<Integer>();
		int c=1000;
		while(c>0) {
			if(n>=c) {
			    list.add(n/c);
			}else {
				list.add(0);
			}
			n%=c;
			c/=10;
		}


		for(int i=0;i<=7;i++) {
			String s=Integer.toBinaryString(i);

			int a=Integer.valueOf(s);
			String b=String.format("%03d",a);
			;
			char[] e=b.toCharArray();
			int k=keisan(list,e);
			if(k==7) {
				e[0]=(e[0]=='1')?'+':'-';
				e[1]=(e[1]=='1')?'+':'-';
				e[2]=(e[2]=='1')?'+':'-';
				for(int j=0;j<3;j++) {
					System.out.print(list.get(j));
					System.out.print(e[j]);
				}
				System.out.print(list.get(3)+"=7");
				break;
			}


		}



	}

	public static int keisan(List<Integer> list,char[] e) {
		int k=list.get(0);
		if(e[0]=='1') {
			k+=list.get(1);
		}else {
			k-=list.get(1);
		}
		if(e[1]=='1') {
			k+=list.get(2);
		}else {
			k-=list.get(2);
		}
		if(e[2]=='1') {
			k+=list.get(3);
		}else {
			k-=list.get(3);
		}
		return k;

	}



}


Measured memory_bytes: 23252
import java.util.*;
public class Main {
    public static int max(int a, int b){return (a > b ? a : b);}
    public static int min(int a, int b){return (a < b ? a : b);}
    public static int gcd(int a, int b){return (b > 0 ? gcd(b, a % b) : a);}
    public static int lcm(int a, int b){return a / gcd(a, b) * b;}
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int A[] = new int[N + 1];
        int L[] = new int[N + 1];
        int R[] = new int[N + 1];
        for(int i = 1; i <= N; i++){
            A[i] = sc.nextInt();
        }
        L[1] = A[1];
        for(int i = 2; i <= N; i++)L[i] = gcd(L[i - 1], A[i]);
        R[N] = A[N];
        for(int i = N - 1; i >= 1; i--)R[i] = gcd(R[i + 1], A[i]);
        // for(int i = 1; i <= N; i++)System.out.print(L[i] + (i == N ? "\n" : " "));
        // for(int i = 1; i <= N; i++)System.out.print(R[i] + (i == N ? "\n" : " "));
        int ans = max(L[N - 1], R[2]);
        for(int i = 2; i < N; i++)ans = max(ans, gcd(L[i - 1], R[i + 1]));
        System.out.println(ans);
    }
}


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

int main(){
  int i,j,len,N,Q;
  char ss[100];
  unsigned long long p,ppow;
  vector<pair<long long,pair<int,int>>> xa;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%s",ss);
    scanf("%d",&Q);
    len=strlen(ss);
    p=0;
    ppow=205891132094649;
    for(j=0;j<len;j++){
      p+=(ss[j]-'a')*ppow;
      ppow=ppow/27;
    }
    xa.push_back(pair<long long,pair<int,int>>(p,pair<int,int>(-Q,i)));
  }
  sort(xa.begin(),xa.end());
  for(i=0;i<N;i++){
    printf("%d\n",xa[i].second.second+1);
  }

  return 0;
}

Measured memory_bytes: 256
import string
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n = ri()
s = rs()
res = ''
for c in s:
    res += string.ascii_uppercase[(ord(c) - ord('A') + n) % 26]
print(res)

Measured memory_bytes: 4020
n=int(input())
def f(s):
  return len(set([s[i] for i in range(len(s))]))
alphabet = [chr(i) for i in range(97, 97+26)]
for i in range(1,n+1):
  if i==1:
    iso=["a"]
  else:
    iso_new=[]
    for s in iso:
      for j in range(f(s)+1):
        iso_new.append(s+alphabet[j])
    iso = list(set(iso_new))

iso.sort()
for s in iso:
  print(s)

Measured memory_bytes: 20076
import math

a, b, x = map(int, input().split())

half = a * a * b / 2
theta = 0.
if half < x:
    temp = a*a*b-x
    temp = temp * 2 / (a*a*a)
    theta = math.atan(temp)
else:
    temp = a*b*b/2/x
    theta = math.atan(temp)

res = theta * 180 / math.acos(-1)
print('{:.10f}'.format(res))

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

int main() {
    string s;
    cin >> s;
    
    string t = "";
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'B') {
            if (t.size() > 0) {
                t.pop_back();
            }
        } else {
            t += s[i];
        }
    }
    
    cout << t << endl;
}

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

int main() {
   int k, x;
   cin >> k >> x ;
   for (int i=0;i<k ;i++)
     cout << x - k +1 +i << ' ' ;
  for (int i=0;i<k-1;i++)
     cout << x+1+i <<' ' ;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int main()
{
	int H, W;
	cin >> H >> W;
	int c[11][11], A, res = 0;
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> c[i][j];
		}
	}
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				if (c[i][j] > c[i][k] + c[k][j]) {
					c[i][j] = c[i][k] + c[k][j];
				}
			}
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> A;
			if (A >= 0) res += c[A][1];
		}
	}
	cout << res << endl;
	return 0;
}

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

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

    vector<int> a(n, 0);
    vector< vector<int> > claim(n, vector<int>(n, -1));
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        for(int j = 0; j < a[i]; j++) {
            int x, y;
            cin >> x >> y;
            x--;
            claim[i][x] = y;
        }
    }

/*
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            cout << claim[i][j] << " ";
        }
        cout << endl;
    }
*/

    vector<bool> coherence(2 << (n - 1), false);
    for(int i = 0; i < 2 << (n - 1); i++) {
        // cout << "iter: " << i << endl;
        vector<bool> attr(n, false);
        int i2 = i;
        int p = 0;
        while(i2 > 0) {
            if(i2 % 2 == 1) attr[p] = true;
            i2 >>= 1;
            p++;
        }
        coherence[i] = true;
        for(int j = 0; j < n; j++) {
            if(attr[j] == true) {
                // cout << "attr true: " << j << endl;
                for(int k = 0; k < n; k++) {
                    if(claim[j][k] != -1) {
                        // cout << "(j, k) = (" << j << ", " << k << ")" << endl;
                        if((claim[j][k] == 0 && attr[k] == true) || (claim[j][k] == 1 && attr[k] == false)) {
                            coherence[i] = false;
                            // cout << "wrong" << endl;
                            break;
                        }
                    }
                }
                if(!coherence[i]) {
                    // cout << "break" << endl;
                    break;
                }
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < 2 << (n - 1); i++) {
        if(coherence[i] == true) {
            // cout << i << endl;
            int i2 = i;
            int tmp = 0;
            while(i2 > 0) {
                tmp += i2 % 2;
                i2 >>= 1;
            }
            if(tmp > ans) ans = tmp;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/**
       **********    ************
	  Author : Avi J Patel
	  University : DAIICT
       **********    ************
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair 
#define mt make_tuple
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define Mod 998244353
#define N 200001
#define large 10000000000000001
#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    if(a.second < b.second) return true; 
    else if(a.ss==b.ss) return a.ff<b.ff;
	else return false;
}
bool sortbyboth(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.first<b.first) return true;
	else if(a.first==b.first) return a.second<b.second;
	else return false;
} 
ull powr(ull x1, ull n1) {
    if(x1==0)
    {
        return 0;
    }
    ull result=1;
    while(n1>0)
    {
        if(n1&1)
        {
            result=(result*x1);
        }
        n1=n1>>1;
        x1=(x1*x1);
    }
    return result;
} 
int  days(int month, int year)
{
	if( month == 2)
	{
		if((year%400==0) || (year%4==0 && year%100!=0))	
			return 29;
		else	
			return 28;
	}
	else if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8
	||month == 10 || month==12)	
		return 31;
	else 		
		return 30;
} 
int dayofweek(int d, int m, int y)  
{  
    static int t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };  
    y -= m < 3;  
    return ( y + y / 4 - y / 100 + y / 400 + t[m - 1] + d) % 7;  
}  
int main()
{
	FAST
//	string s,t,u;
//	cin>>s>>t;
//	int a,b;
//	cin>>a>>b;
//	cin>>u;
//	if(u==s){
//		cout<<a-1<<" "<<b;
//	}
//	else 
//	cout<<a<<" "<<b-1;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++) cout<<"x";
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll n, a, ans = 0;

int main() {
	cin >> n;
	rep(i, n) {
		cin >> a;
		if (a % 2 && i % 2 == 0)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>

int main(){
 long long N;
 std::cin>>N;
 long long ans=0;
 if(N%2==1){
  std::cout<<ans<<std::endl;
  return 0;
 }
 N=N/2;
 while(N>0){
  ans+=N/5;
  N=N/5;
 }
 std::cout<<ans<<std::endl;
}

Measured memory_bytes: 3608
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return is_prime

X = int(input())
Y = X + 10000

P = primes(Y)

k = 0
while True:
    if P[X+k]==True:
        print(X+k)
        break
    k += 1

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define ALL(v) (v).begin(),(v).end()
#define REP(i, x, n) for(ll (i)=(x); (i)<(n); (i)++)
#define RREP(i, x, n) for(ll (i)=(n)-1; (i)>=x; (i)--)
#define FOR(i, n) for(ll (i)=0; (i)<(n); (i)++)
#define RFOR(i, n) for(ll (i)=(n)-1; (i)>=0; (i)--)

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

        ll x;
        FOR(i, 5) {
                cin >> x;
                if (x == 0) cout << i + 1 << endl;
        }

        return 0;
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		string[] str = Console.ReadLine().Split();
		int[] A = new int[N];
		var dic = new Dictionary<int,int>();
		int ans = 0;
		for(var i=0;i<N;i++){
			A[i] = int.Parse(str[i]);
			if(dic.ContainsKey(A[i])){
				dic[A[i]] += 1;
			} else {
				dic[A[i]] = 1;
			}
		}
		Array.Sort(A);
		for(var i=N-1;i>=0;i--){
			for(var j=31;j>=1;j--){
				int a = (int)Math.Pow(2,j);
				if(dic.ContainsKey(a-A[i]) && dic[a-A[i]] > 0 && dic.ContainsKey(A[i]) && dic[A[i]] > 0){
					if(a==A[i]*2){
						if(dic[A[i]] >= 2){
							ans += 1;
							dic[A[i]] -= 2;
						}
					} else {
						ans += 1;
						dic[A[i]] -= 1;
						dic[a-A[i]] -= 1;
					}
					break;
				}
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 37440
#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
ll d[1000005],hell=pow(10,9);
void solve(){
	ll n,m,x0,y0,x1,y1;
	cin>>n>>m>>x0>>y0>>x1>>y1;
	x0--,y0--,x1--,y1--;
	vector<string> g(n);
	for(ll i=0;i<n;i++)
		cin>>g[i];
	vector<vector<p2>> adj(n*m);
	for(ll i=0;i<n;i++)
		for(ll j=0;j<m;j++){
			if(g[i][j]=='.'){
				for(ll x=i-2;x<=i+2;x++)
					for(ll y=j-2;y<=j+2;y++){
						if(x<0||x>=n||y<0||y>=m||g[x][y]=='#')
							continue;
						if(x==i&&y==j)
							continue;
						adj[i*m+j].push_back({x*m+y,0});
						if(abs(x-i)+abs(y-j)>1)
							adj[i*m+j].back().second=1;
					}
			}
			d[i*m+j]=hell;
		}
	ll s=x0*m+y0;
	d[s] = 0;
	deque<ll> q;
	q.push_front(s);
	while (!q.empty()) {
	    ll v = q.front();
	    q.pop_front();
	    for (auto edge : adj[v]) {
	        ll u = edge.first;
	        ll w = edge.second;
	        if (d[v] + w < d[u]) {
	            d[u] = d[v] + w;
	            if (w == 1)
	                q.push_back(u);
	            else
	                q.push_front(u);
	        }
	    }
	}
	if(d[x1*m+y1]==hell)
		cout<<"-1";
	else
		cout<<d[x1*m+y1];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    clock_t z=clock();
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}

Measured memory_bytes: 101404
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define F first
#define S second
#define lint long long
#define mp make_pair
#define pii pair<int, int>
#define pll pair<lint, lint>
#define ld long double
#define inlld(x) scanf("%lld", &x)
#define ind(x) scanf("%d", &x)
#define vi vector<int>
#define sz(x) (int)x.size()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int N=1e5+5, MOD=1e9+7;
const lint INF=1e18;

lint _add(lint x, lint y) {
    lint ret=x+y;
    while(ret<0LL) ret+=MOD;
    return ret;
}
lint _mult(lint x, lint y) {
    x%=MOD; y%=MOD;
    lint ret=x*y;
    ret%=MOD;
    while(ret<0LL) ret+=MOD;
    return ret;
}
inline int modpow(lint base, int exp, int modulo) {
  base %= modulo;  lint result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulo;
    base = (base * base) % modulo; exp >>= 1;
  }
  return result;
}
using namespace std;
using namespace __gnu_pbds;
template <typename T> 
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int n, arr[N];
signed main()
{
    bool flag=true;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> arr[i];
        if(arr[i]%2==0)
        {
            if(arr[i]%3 == 0 || arr[i]%5 == 0)
            {
                continue;
            }
            else
            {
                flag=false;
            }
        }
    }
    if(flag) cout << "APPROVED";
    else cout << "DENIED";
}

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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);


template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	while(1){
		ll d; cin >> d;
		if(d==0) return 0;
		ll n,m; cin >> n >> m;
		V<ll> a(n+1,0);
		for(int i = 1; i < n; ++i) cin >> a[i];
		a[n] = d;
		sort(ALL(a));
		V<ll> k(m);
		for(int i = 0; i < m; ++i) cin >> k[i];
		ll ans = 0;
		for(int i = 0; i < m; ++i){
			ll cnt = LLINF;
			auto itr = lower_bound(ALL(a),k[i]);
			chmin(cnt,abs(k[i]-*itr));
			if(itr!=a.begin()) itr--;
			chmin(cnt,abs(k[i]-*itr));
			ans += cnt;
		}
		cout << ans << endl;
	}


	return 0;
}



Measured memory_bytes: 3680
// AtCoder Grand Contest 017
// B - Moderate Differences

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;


int N;
ll A, B, C, D;


bool can() {
    for (int k = 0; k < N; k++) {
        if (k * C - (N - k - 1) * D <= B - A && B - A <= k * D - (N - k - 1) * C) {
            return true;
        }
    }
    return false;
}

int main() {

    cin >> N;
    cin >> A >> B >> C >> D;

    cout << (can() ? "YES" : "NO") << endl;

    return 0;

}





Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

using Graph = vector<vector<pair<ll, ll>>>;
using Pi = pair<ll, ll>;
const ll MOD = 1e9 + 7;

//準備...Graph g;
//入力...g[Node].push_back(make_pair(nextNode, weight));

vector<ll> djkstra(Graph &g, ll s) {
	vector<ll> dist(g.size(), MOD);
	dist[s] = 0;
	priority_queue<Pi, vector<Pi>, greater<Pi>> que;
	que.emplace(dist[s], s);
	while ( !que.empty() ) {
		ll cost; ll u; tie(cost, u) = que.top(); que.pop();
		if (dist[u] < cost) continue;
		for (auto &x : g[u]) {
			ll v; ll nc; tie(v, nc) = x;
			if (chmin(dist[v], dist[u] + nc)) que.emplace(dist[v], v);
		}
	}

	return dist;
}

int main(void) {
    int n, u, v;
    cin >> n >> u >> v;

    Graph gT(n), gA(n);
    rep (i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        gT[a].eb(b, 1);
        gT[b].eb(a, 1);
        gA[a].eb(b, 1);
        gA[b].eb(a, 1);
    } 

    vector<ll> dT = djkstra(gT, u - 1);
    vector<ll> dA = djkstra(gA, v - 1);

    ll ans = -1;

    rep (i, n) {
        if (dA[i] <= dT[i]) continue;
        chmax(ans, dA[i]);
    }

    cout << ans - 1 << endl;
    return 0;
}

Measured memory_bytes: 17220
def main():
    n,k = map(int,input().split())
    plist = list(map(int,input().split()))
    summax = sum(plist[:k])
    temp = summax
    for i in range(1,n-k+1):
        temp = temp + plist[i+k-1] - plist[i-1]
        if temp > summax:
            summax = temp
    print((summax+k)/2)
if __name__ == '__main__':
    main()

Measured memory_bytes: 25060
import Data.Bool
import Data.List

main :: IO ()
main = do
    [a,b,c] <- map read . words <$> getLine
    putStrLn . toAnswer $ equitable a b c

toAnswer :: Bool -> String
toAnswer = bool "No" "Yes"

equitable :: Int -> Int -> Int -> Bool
equitable a b c = a == b+c || b == c+a || c == a+b

Measured memory_bytes: 508
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  ll cnt= 0;
  rep(i,s.size()) if(s[i]=='x') cnt++;
  if(cnt<8) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

LL dp1[4][5010] = {};
LL dp2[4][25000005] = {};

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[3] = {};
    int B[3] = {};
    REP(i,3) cin >> A[i];
    REP(i,3) cin >> B[i];

    for(int i = 0; i < 3; i++){
        for(int j = 0; j <= N; j++){
            if(j - A[i] >= 0){
                dp1[i+1][j] = max(dp1[i][j], dp1[i+1][j-A[i]] + (B[i]-A[i]));
            }
            else{
                dp1[i+1][j] = dp1[i][j];
            }
        }
    }
    for(int i = 0; i < 3; i++){
        for(int j = 0; j <= dp1[3][N]+N; j++){
            if(j - B[i] >= 0){
                dp2[i+1][j] = max(dp2[i][j], dp2[i+1][j-B[i]] + (A[i]-B[i]));
            }
            else{
                dp2[i+1][j] = dp2[i][j];
            }
        }
    }

    cout << dp1[3][N] + N + dp2[3][dp1[3][N]+N] << endl;

}

Measured memory_bytes: 587136
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    int n;
    cin>>n;
    string s;
    cin>>s;

    vvl cs(3);
    rep(i, n) {
        if (s[i] == 'R') cs[0].push_back(i);
        else if (s[i] == 'G') cs[1].push_back(i);
        else if (s[i] == 'B') cs[2].push_back(i);
    }
    ll ans = 0;
    rep(i, 3) {
        rep(j, 2) {
            int c1 = i, c2 = (c1 + j + 1) % 3, c3 = 3 - c1 - c2;
            for (auto r : cs[c1]) {
                auto it = lower_bound(rng(cs[c2]), r);
                for (; it != cs[c2].end(); ++it) {
                    auto it2 = lower_bound(rng(cs[c3]), *it);
                    ans += cs[c3].end() - it2;
                    auto it3 = lower_bound(rng(cs[c3]), 2 * (*it) - r);
                    if (it3 != cs[c3].end() && *it3 == 2 * (*it) - r) ans--;
                }
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3704
# n = 3
n = int(input())

arr = [0]*n

for i in range(n):
	arr[i] = (int(input()), i)

sorted_arr = sorted(arr, reverse=True)
lg, slg = sorted_arr[0][1], sorted_arr[1][1]
for i in range(n):
	if i==lg:
		print(arr[slg][0])
	else:
		print(arr[lg][0])

Measured memory_bytes: 66768
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	int L, R, d;
	cin >> L >> R >> d;
	int ans = 0;
	for (int i = L; i <= R; i++) {
		if (i % d == 0)ans++;
	}
	cout << ans;
}

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

int main()
{
    int m, n_min, n_max;
    while (true)
    {

        cin >> m >> n_min >> n_max;
        if (m == 0 && n_min == 0 && n_max == 0)
            break;
        int p[m];

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

        int gap = 0, ans;
        for (int j = n_min; j <= n_max; j++)
        {
            if (gap <= p[j - 1] - p[j])
            {
                gap = p[j - 1] - p[j];
                ans = j;
            }
        }

        cout << ans << endl;
    }
}



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

typedef long long ll;

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

    ll X;
    cin >> X;

    ll ans = 0;

    ans += 1000 * (X / 500);
    ll x = X % 500;
    ans += 5 * (x / 5);

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*


@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = Array(n) { read() }
fun readLines(n: Int) = Array(n) { readLn() }
fun readInts(n: Int) = Array(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = Array(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = Array(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

fun getMatrix(bits: Int, n: Int, m: Int): Array<Array<Int>> {
    val mat = Array(n) { Array(m) {0} }
    for (i in 0 until n) {
        for (j in 0 until m) {
            val id = (i * m + j)
            if (bits.shr(id).and(1) == 1) {
                mat[i][j] = 1
            }
        }
    }
    return mat
}

fun getOdness(mat: Array<Array<Int>>): Int {
    var odds = 0
    for (i1 in 0 until mat.size) {
        for (i2 in i1 until mat.size) {
            for (j1 in 0 until mat[i1].size) {
                for (j2 in 0 until mat[i2].size) {
                    var sm = 0
                    for (i in i1..i2) {
                        for (j in j1..j2) {
                            sm += mat[i][j]
                        }
                    }
                    if (sm % 2 == 1) {
                        odds++
                    }
                }
            }
        }
    }
    return odds
}

fun getMatrix(n: Int) : Array<IntArray> {
    if (n == 1) {
        return Array(1) { IntArray(1) {1} }
    }
    val ref = getMatrix(n - 1)
    val mt = Array(1.shl(n) - 1) { IntArray(1.shl(n) - 1) { 0 } }
    for (i in 0 until ref.size) {
        for (j in 0 until ref[i].size) {
            mt[i][j] = ref[i][j]
            mt[1.shl(n-1) + i][j] = ref[i][j]
            mt[i][1.shl(n-1) + j] = ref[i][j]
            mt[1.shl(n-1) + i][1.shl(n-1) + j] = ref[i][j]
        }
    }
    mt[1.shl(n-1) - 1][1.shl(n-1) - 1] = 1
    return mt
}

fun printMatrix(mt: Array<IntArray>) {
    for (i in 0 until mt.size) {
        for (j in 0 until mt[i].size) {
            print("${mt[i][j]} ")
        }
        println()
    }
}

fun main(args: Array<String>) {
    output {
        val (N, M) = readInts(2)
        val ans = getMatrix(Math.max(N, M))
        for (i in 0 until (1.shl(N) - 1)) {
            for (j in 0 until (1.shl(M) - 1)) {
                print("${ans[i][j]}")
            }
            println()
        }
    }

}

/*
1 1 5 -> 3
1 5 1 -> 2
5 1 1 -> 1
 */


Measured memory_bytes: 55864
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

namespace std {
    template <>
    class hash<std::pair<int, int>> {
    public:
        size_t operator()(const std::pair<int, int>& x) const{
            return hash<int>()(x.first) ^ hash<int>()(x.second);
        }
    };
}

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

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

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int N; cin >> N;
    int dx[] = {0, 1, 0, -1};
    int dy[] = {1, 0, -1, 0};

    string S; cin >> S;
    int x = 0;
    int y = 0;
    for (int i = 0; i < S.length(); i++) {
        if ('A' <= S[i] && S[i] <= 'M') {
            x += dx[0];
            y += dy[0];
        } else if ('N' <= S[i] && S[i] <= 'Z') {
            x += dx[2];
            y += dy[2];
        }else if ('a' <= S[i] && S[i] <= 'm') {
            x += dx[1];
            y += dy[1];
        } else {
            x += dx[3];
            y += dy[3];
        }
    }
    string ans;
    for (int i = 0; i < x; i++) {
        ans += 'a';
    }
    for (int i = 0; i > x; i--) {
        ans += 'n';
    }
    for (int i = 0; i < y; i++) {
        ans += 'A';
    }
    for (int i = 0; i > y; i--) {
        ans += 'N';
    }
    cout << ans.length() << endl;
    cout << ans << endl;
}



Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
	int N,A,B;
	int t;
	int ans=0;
	cin >> N >> A >> B;
	REP(i,N){
	    cin >> t;
	    if(t<A || B<=t){ans++;}
	}
	cout << ans << endl;
	return 0;
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

int main(){
    int h,a;cin >> h >> a;
    cout << (h+a-1)/a << endl;    
    return 0;
}

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

#define all(x) x.begin(),x.end()
#define pb(x) emplace_back(x)
#define forn(i,N) for(int i=0;i<N;i++)

using namespace std;
using ll=long long int;
using ld=long double;
using vi=vector<int>;
using vll=vector<ll>;
using vd=vector<double>;
int ctoi(char c) {return c-'0';}

const int mxn=3005;
int dp[mxn][mxn];

int main() {
//freopen("input.txt","rt",stdin);
ios::sync_with_stdio(false);
cin.tie(nullptr);

int N,M;
string s,t;
cin>>s>>t;
N=s.length();
M=t.length();
for(int i=1;i<=N;i++) {
  for(int j=1;j<=M;j++) {
    if(s[i-1]==t[j-1]) {
      dp[i][j]=dp[i-1][j-1]+1;
    }
    else {
      dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
  }
}
if(dp[N][M]==0) {
  cout<<string()<<endl;
  return 0;
}
int i=N,j=M;
string ans="";
while(i>0 and j>0) {
  if(s[i-1]==t[j-1]) {
    ans+=s[i-1];
    i--;
    j--;
  }
  else {
    if(dp[i-1][j]>dp[i][j-1])
      i--;
    else
      j--;
  }
}
reverse(all(ans));
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 38860
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
}init;

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

    vector<int> h(n); cin >> h;

    int ans = 0;
    for(auto x : h){
      if(x >= k){
        ++ans;
      }
    }


    cout << ans << endl;
  }


  return 0;
}


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

int main() {
  int N, Y;
  cin >> N >> Y;

  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= N - i; j++) {
      int z = N - i - j;
      if (10 * i + 5 * j + z == Y / 1000) {
        cout << i << " " << j << " " << z << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256
# coding: utf-8
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
j = m
# aa[i], bb[i]は、i冊目まで読むのにかかる時間
aa, bb = [0], [0]

for i in range(n):
    aa.append(aa[i] + a[i])

for i in range(m):
    bb.append(bb[i] + b[i])

for i in range(n + 1):
    if aa[i] > k:
        break
    while bb[j] > k - aa[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 47500
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
//#define mod 998244353
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline void out(T a){ cout << a << '\n'; }
void YN(bool ok){if(ok) cout << "Yes" << endl; else cout << "No" << endl;}
//void YN(bool ok){if(ok) cout << "YES" << endl; else cout << "NO" << endl;}


const ll INF=1e18;
const int mx=200005;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int h,w,kk;
    cin>>h>>w>>kk;
    char s[h][w];
    rep(i,h) rep(j,w) cin>>s[i][j];
    int ans=int(1e9);
    rep(i,(1<<h)){
        int cur=0;
        V<int> div;
        div.push_back(0);
        for(int j=1;j<h;j++){
            if(i>>j&1){
                div.push_back(j);
                cur++;
            }
        }
        div.push_back(h);
        V<int> cnt((int)div.size()-1,0);
        for(int j=0;j<w;j++){
            int id=0;
            V<int> tmp((int)div.size()-1,0);
            for(int k=0;k<h;k++){
                if(s[k][j]=='1'){
                    tmp[id]++;
                }
                if(div[id+1]-k==1){
                    id++;
                }
            }
            bool ok=1;
            rep(k,cnt.size()){
                if(cnt[k]+tmp[k]>kk) ok=0;
                if(tmp[k]>kk){
                    cur=int(1e9);
                    break;
                }
            }
            if(ok){
                rep(k,cnt.size()) cnt[k]+=tmp[k];
            }else{
                cur++;
                rep(k,cnt.size()) cnt[k]=tmp[k];
            }
        }
        chmin(ans,cur);
    }
    out(ans);
}

Measured memory_bytes: 3584
#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.at(i);
    sort(a.begin(),a.end());
    int ans = 0, now = 0, cnt, nval;
    while(now < n){
        cnt = 0;
        nval = a.at(now);
        while(now < n && a.at(now) == nval){
            cnt++;
            now++;
        }
        ans += cnt % 2;
    }
    cout << ans << endl;
    return 0;
}

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

#define sz(x) (int)x.size()
#define ld long double
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

ll n;
vector<ll> a, b;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    a.assign(n, 0);
    b.assign(n, 0);
    for(int i = 0; i < n; ++i){
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    if(n%2){
        ll m1 = a[n/2];
        ll m2 = b[n/2];
        cout << m2 - m1 + 1;
    }
    else{
        ll m1 = (a[n/2] + a[n/2 - 1]);
        ll m2 = (b[n/2] + b[n/2 - 1]);
        ll res = (m2 - m1 + 1);
        cout << res;
    }
    return 0;
}

Measured memory_bytes: 6364
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    Ti = input()
    if Ti == '':
        break
    else:
        T.append(int(Ti))

def base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*T):
    return reduce(base, T, 1)

print(lcm(*T))

Measured memory_bytes: 5384
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <functional>
#include <array>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long int ull;
typedef vector<int> vi;
#define rep(i,a,n) for(int i = (a);i < (n);i++)
#define per(i,a,n) for(int i = (a);i > (n);i--)
#define lep(i,a,n) for(int i = (a);i <= (n);i++)
#define pel(i,a,n) for(int i = (a);i >= (n);i--)
#define all(v) (v).begin(),(v).end()
#define clr(a,b) memset((a),(b),sizeof(a))
#define sz size()
#define pb push_back
#define print(x) cout << x << endl
#define INF 1e+9
int n,m,l;
string s,t;

int main(){
  cin >> n >> m >> l;
  if(n == m)print(l);
  else if(n == l)print(m);
  else print(n);
  return 0;
}


Measured memory_bytes: 256