akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int map[][] = new int[n][3];
		for (int i = 0; i < n; i++) {
			map[i][0] = sc.nextInt();
			map[i][1] = sc.nextInt();
			map[i][2] = sc.nextInt();
		}
		int h;
		boolean b;
		loop: for (int i = 0; i <= 100; i++) {
			for (int j = 0; j <= 100; j++) {
				h = -1;
				b = true;
				for (int k = 0; k < n; k++) {
					if (h == -1) {
						if (map[k][2] > 0) {
							h = map[k][2] + Math.abs(map[k][0] - i) + Math.abs(map[k][1] - j);
							break;
						}
					}
				}

				for (int k = 0; k < n; k++) {
					if (Math.max(h - Math.abs(map[k][0] - i) - Math.abs(map[k][1] - j), 0) != map[k][2]) {
						b = false;
						break;
					}
				}

				if (b) {
					System.out.println(i + " " + j + " " + h);
					break loop;
				}
			}
		}
	}
}


Measured memory_bytes: 21844
import numpy as np

N = int(input())

ans = np.zeros(int(N))

if N<10001 and N>3:
    maxa = int(np.sqrt(N-2))
    for x in range(1,maxa):
        for y in range(1,x):
            for z in range(1,y):
                p = x*x+y*y+z*z+x*y+y*z+z*x
                if p<N+1:
                    ans[p-1] += 6


    for x in range(1,maxa):
        for y in range(1,x):
            p = x*x*3+y*y+x*y*2
            if p<N+1:
                ans[p-1] += 3
            p = y*y*3+x*x+x*y*2
            if p<N+1:
                ans[p-1] += 3

    for x in range(1,maxa):
        p = x*x*6
        if p<N+1:
            ans[p-1] += 1

for x in range(0,N):
    print(int(ans[x]))

Measured memory_bytes: 27164
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

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

    static class CChristmasEve {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            ArrayList<Integer> a = new ArrayList<>();
            for (int i = 0; i < n; i++) a.add(in.nextInt());
            Collections.sort(a);
            long ans = Integer.MAX_VALUE;
            for (int i = 0; i + k - 1 < n; i++) {
                ans = Math.min(ans, a.get(i + k - 1) - a.get(i));
            }
            out.println(ans);
        }

    }

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

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

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

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

    }
}



Measured memory_bytes: 39200
#include<bits/stdc++.h>
using namespace std;
int main() {
  string n;
  int k,l,i;
  long a;
  cin>>n>>k;
  a=0;
  l=n.length();
  if (k==1) a+=9*(l-1)+(n.at(0)-'0');
  else if (k==2 && l>=2) {
    a+=81*(l-1)*(l-2)/2+(n.at(0)-'1')*9*(l-1);
    i=1;
    while (i<l && n.at(i)=='0') i++;
    if (i<l) a+=9*(l-i-1)+(n.at(i)-'0');
  }
  else if (k==3 && l>=3) {
    a+=729*(l-1)*(l-2)*(l-3)/6+(n.at(0)-'1')*81*(l-1)*(l-2)/2;
    i=1;
    while (i<l-1 && n.at(i)=='0') i++;
    if (i<l-1) {
      a+=81*(l-i-1)*(l-i-2)/2+(n.at(i)-'1')*9*(l-i-1);
      i++;
      while (i<l && n.at(i)=='0') i++;
      if (i<l) a+=9*(l-i-1)+(n.at(i)-'0');
    }
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

A, B, C = map(int, input().split())

print("Yes" if A + B >= C else "No")


Measured memory_bytes: 9568
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n,m,x,c[15],a[15][15],tt[15],res;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m>>x;
	for(int i=0;i<n;i++){
		cin>>c[i];
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	}
	int ans=1e9;
	for(int ii=0;ii<(1<<12);ii++){
		memset(tt,0,sizeof(tt));
		res=0;
		for(int i=0;i<n;i++){
			if(!((ii>>i)&1)) continue;
			res+=c[i];
			for(int j=1;j<=m;j++){
				tt[j]+=a[i][j];
			}
		}
		int mn=x;
		for(int i=1;i<=m;i++){
			mn=min(mn,tt[i]);
		}
		if(mn<x) continue;
		ans=min(ans,res);
	}
	if(ans>=1e8) ans=-1;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3628
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[4];
		for (int i = 3; i>=0; i--) {
			a[i] = n%10;
			n/=10;
		}
		if (a[0] == a[1] || a[1] == a[2] || a[2] == a[3]) {
			System.out.println("Bad");
		} else {
			System.out.println("Good");
		}
	}
}


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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
  if ( A + B > C + D){  
	cout << "Left" << endl;
  }
  else if ( A + B == C + D){
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }

}

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

using namespace std;
const int N=5e5+5,mod=1e9+7;
#define ll long long
int cnt[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        if(cnt[x]==0) k--;
        cnt[x]++;
    }
    vector<int>v;
    for(int i=0;i<N;i++)
        if(cnt[i]>0)
            v.push_back(cnt[i]);
    sort(v.begin(),v.end());
    int ans=0;
    for(auto x:v)if(k<0)
        ans+=x,k++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2168
def check(card):
    for i in range(3):
        if all(card[i][j] == 'o' for j in range(3)):
            return True
    for j in range(3):
        if all(card[i][j] == 'o' for i in range(3)):
            return True
    if all(card[i][j] == 'o' for (i, j) in [(0, 0), (1, 1), (2, 2)]):
        return True
    if all(card[i][j] == 'o' for (i, j) in [(0, 2), (1, 1), (2, 0)]):
        return True
    return False


card = [[0] * 3 for _ in range(3)]
mapping = {}
for i in range(3):
    for j, x in enumerate(map(int, input().split())):
        card[i][j] = x
        mapping[x] = (i, j)
N = int(input())
for _ in range(N):
    y = int(input())
    if y in mapping:
        i, j = mapping[y]
        card[i][j] = 'o'

if check(card):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>
#include <utility>

using namespace std;

int main() {
  int nbr_vertices, nbr_edges, source;

  cin >> nbr_vertices >> nbr_edges >> source;

  vector<pair<bool, int> > distances(nbr_vertices);
  vector<pair<int, pair<int, int> > > edges_list;
  int src, dest, dist;

  distances[source] = make_pair(true, 0);

  // Fill the edges_list with distances get from input
  for (int i = 0; i < nbr_edges; i++) {
    cin >> src >> dest >> dist;
    edges_list.push_back(make_pair(src, make_pair(dest, dist)));
  }

  for (int i = 0; i < nbr_vertices; i++) {
    for (int j = 0; j < nbr_edges; j++) {
      if (distances[edges_list[j].first].first) {
        if (distances[edges_list[j].second.first].first) {
          if (distances[edges_list[j].second.first].second > distances[edges_list[j].first].second + edges_list[j].second.second) {
            distances[edges_list[j].second.first] = make_pair(true, distances[edges_list[j].first].second + edges_list[j].second.second);
          }
        } else {
          distances[edges_list[j].second.first] = make_pair(true, distances[edges_list[j].first].second + edges_list[j].second.second);
        }
      }
    }
  }

  for (int i = 0; i < nbr_edges; i++) {
    if (distances[edges_list[i].first].first) {
      if (distances[edges_list[i].second.first].first) {
        if (distances[edges_list[i].second.first].second > distances[edges_list[i].first].second + edges_list[i].second.second) {
          cout << "NEGATIVE CYCLE" << endl;
          return 0;
        }
      }
    }
  }

  for (int i = 0; i < nbr_vertices; i++) {
    if (distances[i].first)
      cout << distances[i].second << endl;
    else
      cout << "INF" << endl;
  }
}


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

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	vector<pair<int,int>> facts;
	int minb = MOD;
	int minbat = MOD;
	for(int i = 0; i < n; i++) {
		int a,b;
		cin >> a >> b;
		if(b < minb) {
			minb = b;
			minbat = a;
		}
	}
	cout << minb+minbat;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main (void) {
    char x[1000];
    int res;

    for (;;) {
        res = 0;
        scanf ("%s", x);
        if (x[0]=='0') break;
        for (int i=0; x[i]!='\0'; i++) {
            res += x[i] - '0';
        }
        printf ("%d\n", res);
    }

    return 0;
}


Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
 
char ch[2][2]={{'R','B'},{'G','Y'}}; int n,m,k;
char calc(int x,int y){
	int a=x+y,b=x-y;
	a+=2000; b+=2000;
	a/=k; b/=k; a&=1; b&=1;
	return ch[a][b];
}
int main(){
	scanf("%d%d%d",&m,&n,&k);
	int i,j;
	for (i=1; i<=m; i++){
		for (j=1; j<=n; j++) printf("%c",calc(i,j)); puts("");
	}
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static double temp(int t, int x) {
        return t - x * 0.006;
    }

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

        int n = sc.nextInt();
        int t = sc.nextInt();
        int a = sc.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i ++) {
            h[i] = sc.nextInt();
        }

        double minDiff = Math.abs(a - temp(t, h[0]));
        int num = 0;
        for (int i = 1; i < n; i++) {
            double hoge = Math.abs(a - temp(t, h[i]));
            if (minDiff > hoge) {
                minDiff = hoge;
                num = i;
            }
        }

        System.out.println(num + 1);
    }
}

Measured memory_bytes: 23124
D = int(input())
c = [int(i) for i in input().split()]
s = []
for i in range(D):
  tmp = [int(j) for j in input().split()]
  s.append(tmp)
t = []
for i in range(D):
  t.append(int(input()))
  
sat = 0
lst = [0 for i in range(26)]

for i in range(D):
  sat += s[i][t[i]-1]
  lst[t[i]-1] = i + 1
  for j in range(26):
    sat -= c[j] * ((i + 1) - lst[j])
  print(sat)

Measured memory_bytes: 9424
#include<stdio.h>
int main(void){
  char b;
  char a[5]="ACGT";
   
   scanf("%s",&b);
  
  if(b=='A'||b=='C'||b=='G'||b=='T'){
   if(b==a[0]){
     printf("T");
   }
   if(b==a[3]){
   printf("A");
  }
   if(b==a[1]){
    printf("G");
  }
   if(b==a[2]){
    printf("C");
  }
 }
  return 0;
}

Measured memory_bytes: 128
n,m = map(int, input().split())
num = list(int(input()) for _ in range(m))

count = [-1]*(n+1)
for stair in num:
  count[stair] = 0
  
count[0] = 1
count[1] = 1 if 1 not in num else 0

for i in range(2,n+1):
  if count[i] != 0:
  	count[i] = (count[i-1]+count[i-2]) % (10**9+7)
  
print(count[n])

Measured memory_bytes: 7836
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
#define mem(a,b) memset(a,b,sizeof(a))
const int maxn = 1e5+5;
const int ff = 0x3f3f3f3f;

int num[maxn];

int main()
{
	int n;
	cin>>n;
	for(int i = 1;i<= n;i++)
	{
		int t;
		scanf("%d",&t);
		if(t> 0)
		{
			num[t-1]++;
			num[t]++;
			num[t+1]++;
		}
		else
			num[t]++,num[t+1]++;
	}
	int ans = 0;
	for(int i = 0;i<= 1e5+1;i++)
		if(num[i]> ans)
			ans = num[i];
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <list>
//#include <bits/stdc++.h>


using namespace std;

#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
typedef long long ll;

int main(){
    int R;
    double PI=3.14159265358979323846;
    cin >> R;
    cout << 2 * R * PI << endl;
    return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
 
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(200010);

int main(){
    ll N, K;
    cin >> N >> K;
    K = min(K,N-1);
    mint ans = 0;
    rep(i,K+1){
        ans += comb(N,i)*comb(N-i+i-1,i);//N-i kokara chofuku i ko 
    }
    cout << ans << endl;
}

Measured memory_bytes: 6232
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}


int main()
{
    string a, b;
    cin >> a >> b;
    int ab = stoi(a+b);

    if (sqrt(ab) - floor(sqrt(ab)) == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
X, Y, Z, K = map(int, input().split())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
 
AB = sorted([a + b for a in A for b in B])[-1:-K-1:-1]
ABC = sorted([ab + c for ab in AB for c in C])[-1:-K-1:-1]
print('\n'.join(map(str, ABC)))

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

int main() {
    int N;
    bool Z = true;
    cin >> N;
    for (int i = 1; i < 10 && Z; i++) {
        for (int j = 1; j < 10 && Z; j++) {
            if (i * j == N) {
                cout << "Yes" << endl;
                Z = false;
                break;
                break;
            }
        }
    }
    if (Z) {
        cout << "No" << endl;
    }
    
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = (1 << 30);
constexpr ll L_INF = (1ll << 62);

//==================================

template <typename _Ty>
class BIT {
private:
    size_t m_n;
    std::vector<_Ty> m_vec;

public:
    BIT(size_t num) : m_n(num), m_vec(m_n + 1) {}

    // i 番目の要素に a を足す
    void add(size_t i, const _Ty& a) noexcept {
        for (++i; i <= m_n; i += i & (-i)) {
            m_vec[i] += a;
        }
    }

    // 区間[0, i)の総和を求める
    _Ty sum(size_t i) const noexcept {
        _Ty res = 0;
        for (++i; i >= 1; i -= i & (-i)) {
            res += m_vec[i];
        }
        return res;
    }

    // 区間[i, j)の総和を求める
    _Ty sum(size_t i, size_t j) {
        return sum(j) - sum(i);
    }

    size_t size() const noexcept {
        return m_n;
    }

    void assign(const _Ty& a) {
        std::fill(m_vec.begin(), m_vec.end(), a);
    }
};

ll N, M;

bool check(int x, const Vl& a) {
    static Vl S(N + 1);
    static BIT<ll> bit(N * 2 + 1);

    S.assign(N + 1, 0);
    bit.assign(0);

    for (int i = 0; i < N; ++i) {
        S[i + 1] = S[i] + ((a[i] >= x) ? 1 : -1);
    }

    ll cnt = 0;
    for (int j = 0; j <= N; ++j) {
        cnt += bit.sum(S[j] + N);
        bit.add(S[j] + N, 1);
    }

    if (cnt >= (M + 1) / 2) {
        return true;
    }
    else {
        return false;
    }
}

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

    cin >> N;

    M = N * (N - 1) / 2 + N;

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

    int left = 1, right = 1000000001;
    while (right - left > 1) {
        int mid = (left + right) / 2;
        if (check(mid, a)) {
            left = mid;
        }
        else {
            right = mid;
        }
    }

    cout << left << endl;

    return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    long long a[100000+5];
    scanf("%d",&n);
    int flag=1,i,tag=0;
    for(i=0;i<n;i++)
        scanf("%lld",&a[i]);
    a[i]=a[i-1];
    for(i=1;i<n;i++)
    {

        if(a[i-1]-a[i]>=2)
        {
            flag=0;
            break;
        }
        if(a[i]>a[i-1])
			tag=0;
        if(a[i]<a[i-1]&&tag==0)
        {
        	tag=1;
		}
		else if(a[i]<a[i-1]&&tag==1)
		{
            flag=0;
            break;
        }
    }
    if(flag==0)
        printf("No\n");
    else
        printf("Yes\n");
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main(void){
    // Your code here!
    char b;
    scanf("%c",&b);
    switch(b){
        case 'A':
        printf("T");
        break;
        case 'T':
        printf("A");
        break;
        case 'C':
        printf("G");
        break;
        case 'G':
        printf("C");
        break;
    }
}


Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  if 1<=a[i]<=399:
    a[i]="gray"
  elif 400<=a[i]<=799:
    a[i]="brown"
  elif 800<=a[i]<=1199:
    a[i]="green"
  elif 1200<=a[i]<=1599:
    a[i]="lightblue"
  elif 1600<=a[i]<=1999:
    a[i]="blue"
  elif 2000<=a[i]<=2399:
    a[i]="yellow"
  elif 2400<=a[i]<=2799:
    a[i]="orange"
  elif 2800<=a[i]<=3199:
    a[i]="red"
  elif 3200<=a[i]:
    a[i]="free"

from collections import Counter

c=Counter(a)
ans=len(c)
free=c["free"]
v_min=ans
v_max=ans
if free>0:
  v_min-=1
if free>0:
  v_max+=free-1
if free==n:
  v_min=1
print(v_min,v_max)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    long x;
    cin >> x;
    for(int a=0;a<=1000;a++){
        for(int b=-1000;b<=1000;b++){
            if(pow(a,5)-pow(b,5)==x){
                cout << a <<' ' << b << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3992
N,K = map(int,input().split())
ans = 0
for k in range(N):
    b = k + 1
    p = int(N//b)
    r = N%b
    ans += p*max(0,b-K) + max(0,r-K+1)
if K == 0:
    ans -= N
print(ans)


Measured memory_bytes: 2940
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N = int(input())
XYi = []
for i in range(N):
    tmp = list(map(int,input().split()))
    XYi.append(tmp+[i])

edges = []
E = 0

XYi.sort(key=lambda x:x[0])
for i in range(N-1):
    A,B,ind1 = XYi[i]
    C,D,ind2 = XYi[i+1]
    edges.append((min(abs(A-C),abs(B-D)), ind1, ind2))
    E+=1

XYi.sort(key=lambda x:x[1])
for i in range(N-1):
    A,B,ind1 = XYi[i]
    C,D,ind2 = XYi[i+1]
    edges.append((min(abs(A-C),abs(B-D)), ind1, ind2))
    E+=1

edges.sort()
def kruskal(n, edges):#edges: wでソート済み
    U = UnionFind(n)
    res = 0
    for e in edges:
        w, s, t = e
        if not U.same(s, t):
            res+=w
            U.union(s, t)
    return res
print(kruskal(N, edges))

Measured memory_bytes: 130072
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define INF_LL 1e18
#define INF 1e9

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

#define fst first
#define snd second

using namespace std;

using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

ll MOD = 1e9+7;
int M;
string s, s1;
int dp[510][501][2][3][10];

void dec1(){
	for(int i = s1.size()-1;i >= 0;i--){
		if(s1[i] == 0) s1[i] = 9;
		else{
			s1[i]--;
			break;
		}
	}
}

const int up = 1, down = 2, stay = 0;

int dfs(int dig, int md, bool tight, int ud, int be){
	if(dig == s.size()) return ud ? md ? 0 : 1 : 0;
	if(~dp[dig][md][tight][ud][be]) return dp[dig][md][tight][ud][be];

	int lim = tight ? s[dig] : 9;
	ll res =0;
	REP(i, lim+1){
		if(ud == stay){
			if(dig < s.size()-1 && be == i){
				res += dfs(dig+1, (md*10)%M, tight & (i==lim), stay, i);
			}else if(be != i){
				res += dfs(dig+1, (md*10+i)%M, tight & (i==lim), up, i);
				if(dig < s.size()-1)
					res += dfs(dig+1, (md*10+i)%M, tight & (i==lim), down, i);
			}

		}else if(ud == up){
			if(be > i)
				res += dfs(dig+1, (md*10+i)%M, tight & (lim==i), down, i);
		}else{
			if(be < i)
				res += dfs(dig+1, (md*10+i)%M, tight & (lim==i), up, i);
		}
	}
	res %= 10000;

	return dp[dig][md][tight][ud][be] = res;
}

int main(void){
	cin >> s1 >> s >> M;
	REP(i, s.size()) s[i] -='0';
	REP(i, s1.size()) s1[i] -= '0';
	dec1();

	memset(dp, -1, sizeof dp);
	ll res1 = dfs(0,0,1,0,0);
	memset(dp, -1, sizeof dp);
	s = s1;
	ll res2 = dfs(0,0,1,0,0);
	cout << (res1-res2+10000)%10000 << endl;
}

Measured memory_bytes: 63056
const long long MOD = 1e9 + 7;
const int N = 203010;

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <bitset>
#include <deque>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(N);
    __ufact.resize(N);
    __rev.resize(N);
    __rev[1] = 1;
    for (int i = 2; i < N; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < N; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int n;
vector<int> a;
int dp[N];
int summ[N];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    a.push_back(-1);
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        if (a.size() && a.back() == x)
        {
            continue;
        }
        a.push_back(x);
    }
    n = a.size() - 1;
    dp[0] = 1;
    summ[a[1]] = 1;
    for (int i = 1; i <= n; i++)
    {
        dp[i] = summ[a[i]];
        if (i + 1 <= n) summ[a[i + 1]] = (summ[a[i + 1]] + dp[i]) % MOD;
    }
    cout << dp[n];
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 2804
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
const long double EPS = 1e-6, PI = acos((long double)-1);

//ここから編集
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(4);
  
  int N;cin >> N;
  vector<ll> v(N);
  
  REP(i,N) cin >> v[i];

  ll ans = 0;
  ll mx = v[0];
  for(int i=1; i<N; i++){
    ans += max(0LL, mx-v[i]);
    mx = max(mx, v[i]);
    
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4740
n=int(input())
a=list(map(int,input().split()))
x=0
cnt=0
sum=0
for i in a:
  if x==0:
    x=i
  elif i<=x:
    cnt+=1
    sum=max(sum,cnt)
    x=i
  else:
    cnt=0
    x=i
print(sum)

Measured memory_bytes: 14252
import bisect
import itertools

#n桁のm値のbitを生成
def bit(n, m):
    bit_list = list(itertools.product([i for i in range(m)], repeat=n))
    return bit_list

A, B, Q = map(int, input().split())
s = [int(input()) for _ in range(A)]
t = [int(input()) for _ in range(B)]
x = [int(input()) for _ in range(Q)]


for i in range(Q):

    insert_index = bisect.bisect_left(s,x[i])
    if insert_index >= A:
        insert_index = insert_index -1
        tmp1 = s[insert_index]
        tmp2 = s[insert_index]
        
    else:   
        tmp1 = s[insert_index]
        tmp2 = s[insert_index-1]
    
    insert_index = bisect.bisect_left(t,x[i])
    if insert_index >= B:
        insert_index = insert_index -1
        tmp3 = t[insert_index]
        tmp4 = t[insert_index]
        
    else:
        tmp3 = t[insert_index]
        tmp4 = t[insert_index-1]
    
    result = 10 ** 11
    for j, k in ([0,1], [0,0], [1,0], [1,1]):
        tmp = 0
        if j == 0:
            tmp += abs(tmp1 - x[i])
            now = tmp1
        else:
            tmp += abs(tmp2 - x[i])
            now = tmp2
                
        if k == 0:
            tmp += abs(now - tmp3)
        else:
            tmp += abs(now - tmp4)
                
        result = min(tmp, result)
        
    for j, k in ([0,1], [0,0], [1,0], [1,1]):
        tmp = 0
        
        if k == 0:
            tmp += abs(x[i] - tmp3)
            now = tmp3
        else:
            tmp += abs(x[i]- tmp4)
            now = tmp4
            
        if j == 0:
            tmp += abs(now - tmp1)
        else:
            tmp += abs(now - tmp2)
                
        result = min(tmp, result)
                
    print(result)



Measured memory_bytes: 93552
#include <stdio.h>


int main()
{
	int width, height, x, y, radius;
	scanf("%d%d%d%d%d", &width, &height, &x, &y, &radius);

	if (x - radius < 0 || width < x + radius || y - radius < 0 || height < y + radius){
		puts("No");
	}
	else{
		puts("Yes");
	}
	return 0;
}

Measured memory_bytes: 584
s = gets.chomp
d = 0
high = []
a = []
ans = []
len = s.size
len.times do |i|
  a.push([d,i])
  high
  if(s[i] == "\\")
    d -= 1
  elsif(s[i] == "/")
    d += 1
  end
end
a.push([d,len])

b = Marshal.load(Marshal.dump(a))
a.sort!{|a,b| b <=> a}
h = 0
men = 0

if(a[0][1] > a[1][1])
r =dr= a[0][1]
l =dl= a[1][1]
else
l =dl = a[0][1]
jj = 1
while(a[jj+1]!=nil and a[jj][0] == a[jj+1][0]and a[jj+1][1] >dl+1)
  jj += 1
end
a[1..jj] = a[1..jj].sort{|a,b| a[1] <=> b[1]}
r =dr = a[1][1]
end
menp=0
men = 0
h = a[1][0]

(l..(r-1)).each do |i|
  if(s[i] == "\\")
    menp = 0.5 + (h-b[i][0])
  elsif(s[i] == "/")
    menp = -1*0.5 + (h-b[i][0])
  else
    menp = (h-b[i][0])
  end
  men += menp if(menp >= 0)
end
ans.push(men.to_i)
a.slice!(0,2)
f= 0
while(a.size > 0)
  menko = 0
  if(a[0][1] > dr)
    unless(high.include?(a[0][0]))
    jj = 0
    while(a[jj+1]!=nil and a[jj][0] == a[jj+1][0]and a[jj+1][1] >dr)
      jj += 1
    end
      a[0..jj] = a[0..jj].sort{|a,b| a[1] <=> b[1]}
        high.push(a[0][0])
    end
    l = dr
    dr =r = a[0][1]
    h = a[0][0]
    f = 1
  elsif(a[0][1] < dl)
    r = dl
    dl = l = a[0][1]
    h = a[0][0]
    f = 2
  else
    a.delete_at(0)
    next
  end
  (l..(r-1)).each do |i|
    if(s[i] == "\\")
      menp = 0.5 + (h-b[i][0])
    elsif(s[i] == "/")
      menp = -0.5 + (h-b[i][0])
    else
      menp = (h-b[i][0])
    end
    menko += menp if(menp > 0)
  end
  a.delete_at(0)
  if(f==1)
    ans.push(menko.to_i)
  elsif(f==2)
    ans.unshift(menko.to_i)
  end
end
max = 0
p ans.inject(:+)
ans.delete(0)
print l = ans.size
ans.each do |d|
  print(" #{d}")
end
puts ""

Measured memory_bytes: 39908
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val s = sc.next().toCharArray.foldLeft(0) {
      case (a, '+') => a + 1
      case (a, '-') => a - 1
    }

    println(s)
  }

  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }
}


Measured memory_bytes: 25672
# -*- coding: utf-8 -*-

N = int(input().strip())
A_list = list(map(int, input().rstrip().split()))
Q = int(input().strip())
BC_list = [list(map(int, input().rstrip().split())) for i in range(Q)]
#-----

A_dic = {}
sum_A = 0

for num in A_list:
    A_dic.setdefault(num, 0)
    A_dic[num] += 1

    sum_A += num


for b,c in BC_list:
    if b in A_dic:
    
        if c in A_dic:
            A_dic[c] += A_dic[b]
            
        else:
            A_dic[c] = A_dic[b]
    
        sum_A += (c-b) * A_dic[b]
        del A_dic[b]
    
    print(sum_A)


Measured memory_bytes: 37124
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int[][] input = new int[n][3];

		for(int i = 0; i < n; i++){
			for(int j = 0; j < 3; j++){
				input[i][j] = sc.nextInt();
			}
		}

		int centerX = 0;
		int centerY = 0;
		int centerH = 0;

loop1:		for(int x = 0; x <= 100; x++){
loop2:			for(int y = 0; y <= 100; y++){
				for(int i = 0; i < n; i++){
					if(input[i][2] > 0){
						centerH = input[i][2] + Math.abs(input[i][0] - x) + Math.abs(input[i][1] - y);
//						System.out.println("Now decided : height "+ centerH);
						break;
					}
				}

				for(int i = 0; i < n; i++){
					if(input[i][2] != Math.max(centerH - Math.abs(input[i][0] - x) - Math.abs(input[i][1] - y), 0)){
						continue loop2;
					}
				}

				centerX = x;
				centerY = y;
				break loop1;
			}
		}

		System.out.println(centerX+ " " + centerY + " " + centerH);
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define contests_de_diya_kar 0
#define PB push_back
#define MP make_pair
#define int long long
#define MOD ((long long) (1000*1000*1000 + 7))
#define inf (int) 2e15
#define exit(a, b) return cout << a, b;
#define eps (double)1e-8
#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define vi vector<int>
#define vb vector<bool>
#define all(v) v.begin(), v.end() 
#define pii pair<int, int>
#define mii map<int, int> 
#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

const int maxn = (int) 1e5;
const int MODULO = MOD;

vi parent, sz, primes;
vector<vi> sieve;

void run_sieve () {
	sieve.resize(maxn + 1);
	for (int i = 2; i <= maxn; i += 1) {
		if (!sieve[i].empty()) continue;
		primes.PB(i);
		for (int j = i; j <= maxn; j += i) sieve[j].PB(i);
	}
}

void make_set (int x) {
	parent[x] = x;
	sz[x] = 1;
}

int find (int a) {
	while (a != parent[a]) a = parent[a];
	return a;
}

void merge (int a, int b) {
	a = find(a), b = find(b);
	if (a == b) return;

	if (sz[a] > sz[b]) {
		parent[b] = a;
		sz[a] += sz[b];
	}
	else {
		parent[a] = b;
		sz[b] += sz[a];
	}
}

int modexp (int a, int b, int mod) {
	if (b == 0) return 1;
	int ans = 1;
	while (b) {
		if (b & 1) ans = (ans * a) % mod;
		a = (a * a) % mod, b /= 2;
	}
	return ans;
}

signed main () {
	start_routine;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif

	string s;
	cin >> s;

	if (s[0] != 'A') print("WA");
	else {
		int cnt = 0;
		bool low = true;

		forn(1, len(s), i) {
			if (i == 1 && (!(s[i] >= 'a' && s[i] <= 'z'))) {
				print("WA");
				return 0;
			} 
			if (i == len(s) - 1 && (!(s[i] >= 'a' && s[i] <= 'z'))) {
				print("WA");
				return 0;
			} 
			if (s[i] == 'C') cnt += 1;
			else {
				if (!(s[i] >= 'a' && s[i] <= 'z')) low = false;
			}
		}

		if (cnt == 1 && low) print("AC");
		else print("WA");
	}

	end_routine;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

const int MAX = 510000;
const int MOD = 1000000007;

int main() {
  int N, K;
  ll t = 0, sum = 0;
  cin >> N >> K;
  vector<ll> a(N+1); // 階差数列
  rep(i, N+1){
    t += i;
    a[i] = t;
  }


  for(int i = K-1; i < N; i++){
    t = (a[N] - a[N-i-1]) - (a[i] - a[0]) + 1;
    sum += t % MOD;

  }
  // 最後のぶん
  t = (a[N] - a[0]) - (a[N] - a[0]) + 1;  
  sum += t % MOD;
  cout << sum%MOD << endl;
  

}


Measured memory_bytes: 4744
#!/usr/bin/env python3

def main():
    A, B, K = map(int, open(0).read().split())

    ANS = []
    for i in range(1, max(A+1, B+1)):
        if (A % i == 0) and (B % i == 0):
            ANS.append(i)
    print(ANS[-K])


main()

Measured memory_bytes: 2940
#include <iostream>
using namespace std;
long long a,b,n,s1,s2;
int main(){
	cin>>a>>b>>n;
	if(a%n==0)s1=a/n;
	else s1=a/n+1;
	s2=b/n;
	cout<<(s2-s1+1)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=2e5+5,MOD=998244353;
int n,ans,l,r;
int f[N];
bool vis[N];
int cnt,head[N];
struct edge{int next,to;}e[N<<1];
struct number{int x,d;}num[N];
struct node{int x,id;}q[N];

inline bool cmp(number a,number b){return a.x<b.x;}

inline void add(int u,int v)
{
	cnt++;
	e[cnt].next=head[u];
	e[cnt].to=v;
	head[u]=cnt;
}

void dfs(int u)
{
	vis[u]=true;
	f[u]=1;
	for (register int i=head[u]; i; i=e[i].next)
	if (!vis[e[i].to])
	{
		dfs(e[i].to);
		f[u]=f[u]*f[e[i].to]%MOD;	
	}
	f[u]=(f[u]+1)%MOD;
}

signed main(){
	scanf("%lld",&n);
	for (register int i=1; i<=n; ++i) scanf("%lld%lld",&num[i].x,&num[i].d);

	sort(num+1,num+n+1,cmp);	
	l=1; r=0;
	for (register int i=n; i>=1; --i)
	{
		while (l<=r && num[i].x+num[i].d>q[r].x) 
		{
			add(i,q[r].id);
			r--;
		}
		q[++r]=((node){num[i].x,i});
	}
	ans=1;
	for (register int i=1; i<=n; ++i) 
	if (!vis[i]) 
	{
		dfs(i); 
		ans=ans*f[i]%MOD;	
	}
	printf("%lld\n",ans);
return 0;	
}

Measured memory_bytes: 21376
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    ll n, k;
    cin>>n>>k;

    int cnt = 0;
    rep(i, n) {
        int h;
        cin>>h;
        if (h >= k) cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

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

		 for (int i = 0; i < N; i++) {
		 	arr[i] = sc.nextInt();
		 }
		 int[] dp = new int[N];
		 dp[0] = 0;
		 dp[1] = Math.abs(arr[0] - arr[1]);

		 for (int i = 2; i < N; i++) {
		 	dp[i] = Math.min(dp[i-1] + Math.abs(arr[i-1] - arr[i]), dp[i-2] + Math.abs(arr[i-2] - arr[i]));
		 }
		 System.out.println(dp[N-1]);
	}
}

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

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

bool good(int x, set<int> &st) {
	while(x) {
		int d=x%10; x/=10;
		if(st.find(d)!=st.end())
			return false;
	}
	return true;
}

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,k,d; cin>>n>>k;
	set<int> ok;
	for (int i=0; i<k; i++)
		cin>>d, ok.insert(d);	
	for (int i=0; i<100000; i++) {
		if(good(i,ok)&&i>=n) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <cmath>
#include<queue>
#define PI 3.141592653589793238
#define INF -1
using namespace std;

int main()
{
	int x, y;

	cin >> x >> y;

	if (x == y) {
		printf("Yes");
	} else {
		printf("No");
	}

	return 0;
}

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

using namespace std;

bool test(const string &s) {
	const int n = s.size();
	for (int i = 0; i < n/2; i++) {
		int j = n/2-1-i;
		int k = n-1-i;
		if (s[i] != s[j] || s[i] != s[k]) return false;
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	string s;
	cin>>s;
	if (test(s)) {
		cout<<"Yes"<<endl;
	}
	else {
		cout<<"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 drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  

class UnionFind {
  public:
    vi Parent;
    UnionFind(int N) {
      Parent = vi(N,-1);
    }
  
    int root(int A) {
      if(Parent[A] < 0) return A;
      return Parent[A] = root(Parent[A]);
    }
  
    int size(int A) {
      return -Parent[root(A)];
    }
  
    bool connect(int A,int B) {
      A = root(A);
      B = root(B);
      if(A == B) return false;
      if(size(A) < size(B)) swap(A,B);
      Parent[A] += Parent[B];
      Parent[B] = A;
      return true;
    }
};

int main() {
  int N,M;
  cin >> N >> M;
  vi A(N);
  vp B(N);
  rep(i,N) {
    cin >> A[i];
    B[i] = P(A[i],i);
  }
  sort(rng(B));
  UnionFind t = UnionFind(N);
  rep(i,M) {
    int x,y;
    cin >> x >> y;
    t.connect(x,y);
  }
  if(M == N-1) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = B[0].first;
  v(bool) used(N,false);
  int root = B[0].second;
  used[0] = true;
  int cnt = 1;
  rep(i,N) {
    if(t.root(B[i].second) != t.root(root)) {
      t.connect(B[i].second,root);
      used[i] = true;
      ans += B[i].first;
      cnt++;
    }
  }
  rep(i,N) {
    if(cnt == ((N-1)-M)*2) break;
    if(!used[i]) {
      ans += B[i].first;
      cnt++;
    }
  }
  if(cnt != ((N-1)-M)*2) {
    cout << "Impossible" << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
# import sys
# input = sys.stdin.readline

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))


h,w,k = mp()
ans = 0
grid = []
for i in range(h):
    grid.append(list(input()))
h_pat = []
w_pat = []
for i in range(2**h):
    p = bin(i)[2:].zfill(h)
    h_pat.append(p)
for i in range(2**w):
    p = bin(i)[2:].zfill(w)
    w_pat.append(p)
import copy
for i in range(len(h_pat)):
    for j in range(len(w_pat)):
        tar_g = copy.deepcopy(grid)
        cnt = 0
        h_tar = h_pat[i]
        w_tar = w_pat[j]
        for v in range(len(h_tar)):
            if h_tar[v] == "1":
                tar_g[v] = ["R"]*w
        tar_g = [list(x) for x in zip(*tar_g)]
        for v in range(len(w_tar)):
            if w_tar[v] == "1":
                tar_g[v] = ["R"]*h
        for v in range(w):
            cnt += tar_g[v].count("#")
        if cnt == k:
            ans += 1
print(ans)





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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;

	cin>>s;

    if(s=="SSS") cout<<0;
     if(s=="SSR") cout<<1;
      if(s=="SRS") cout<<1;
       if(s=="SRR") cout<<2;
        if(s=="RRR") cout<<3;
         if(s=="RRS") cout<<2;
          if(s=="RSR") cout<<1;
           if(s=="RSS") cout<<1;
	return 0;
}

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

Measured memory_bytes: 1804
h, w = map(int, input().split())

ls = [input() for _ in range(h)]
drops_h = []
drops_w = []

for i in range(h):
    if all([ls[i][j] == '.' for j in range(w)]):
        drops_h.append(i)

for i in range(w):
    if all([ls[j][i] == '.' for j in range(h)]):
        drops_w.append(i)

for i in range(h):
    if i in drops_h:
        continue
    else:
        for j in range(w):
            if j in drops_w:
                continue
            else:
                print(ls[i][j], end='')
        print()

Measured memory_bytes: 4468
#include <iostream>
using namespace std;
typedef long long LL;
const int N = 52;
const int mod = 1e9+7;
int n,k;
int dp[N][N][2*N*N];
void upd(int &x,LL y){
    x=(x+y)%mod;
}
int main() {
    cin>>n>>k;
    int B=N*N;
    dp[0][0][0+B]=1;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=i;j++){
            for(int k=0;k<=B+i*i;k++){
                upd(dp[i+1][j][k],dp[i][j][k]);
                if(k>=2*i) upd(dp[i+1][j+1][k-2*(i+1)],1LL*dp[i][j][k]);
                upd(dp[i+1][j][k],1LL*dp[i][j][k]*j*2);
                if(j && k+2*(i+1)<2*N*N) upd(dp[i+1][j-1][k+2*(i+1)],1LL*dp[i][j][k]*j*j);
            }
        }
    }
    cout<<dp[n][0][B+k]<<endl;
}


Measured memory_bytes: 55296
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>

#define X first
#define Y second
#define PB push_back

using namespace std;

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

const int N = 1e5 + 500;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int LOG = 20;
const int OFF = (1 << LOG);

ll A, B, v, w, T;

int main(){
	scanf("%lld%lld%lld%lld%lld", &A, &v, &B, &w, &T);
	ll dis = (B > A ? B - A : A - B);
	if((v - w) * T >= dis)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 1664