akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<vector<T>> m) {
    repall (v, m)
        init(v);
}

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}
// -------------------------------------------------------------------

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

    int n;
    cin >> n;
    vec a(n);
    init(a);

    int x, y;
    y = a[0];
    rep (i, n) {
        if (i == 0) continue;
        x = a[i];
        if (x < y) swap(x, y);
        while (x % y) {
            int r = x % y;
            x = y;
            y = r;
        }
    }
    print(y);

    return 0;
}


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

int main() {
    int n, a, b;
    cin >> n;
    bool as[n] = {};
    for (int i = 0; i < n; ++i) {
        cin >> a >> b;
        as[i] = a == b;
        if (i >= 2 && as[i] && as[i-1] && as[i-2]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
};

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

int main() {
    
    string S, T;
    int n = 0, sum = 0;
    
    cin >> S >> T;
    S.c_str();
    T.c_str();

    for (int i = 0; S[i] != '\0'; i++){
        int j = (int)S[i];
        int k = (int)T[i];
        if (j == k)n++;
        sum++;
    }
    printf("%d\n", sum - n);
  
    }

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

#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)x.size())
template <class T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

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

/*
*/

int n;

void dfs(string s, char c){
  if(sz(s) == n){
    cout << s << endl;
    return;
  }

  rep(i, 'a', c){
    dfs(s+(char)i, c);
  }
  dfs(s+c, c+1);
}

signed main() {
  cin >> n;

  dfs("", 'a');

  return 0;
}



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

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var N = IO.GetInt();
            var a = IO.GetIntList();

            var n = a.Max();
            var m = 0;
            for(int i = 0; i < N; i++)
            {
                m = Math.Abs(n*1.0 / 2 - m) < Math.Abs(n*1.0 / 2 - a[i]) ? m : a[i];
            }


            Console.Write(n+" "+m);
        }
    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 20576
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque 

class Edge:
    def __init__(self, to, id):
        self.to = to
        self.id = id

def main():
    
    n = int(readline())
    g = [[] for _ in range(n)]

    for i in range(n-1):
        a, b = map(int, readline().split())
        g[a-1].append(Edge(b-1, i))
        g[b-1].append(Edge(a-1, i))

    dq = deque()    
    done = [0]*n
    dq.append(0)
    done[0] = 1
    edgecolor = [0]*(n-1)

    while len(dq) > 0: 
        v = dq.pop()
        c = -1
        for e in g[v]:
            nx = e.to
            edge_id = e.id
            if done[nx]:
                c = edgecolor[edge_id]
        k = 1
        for e in g[v]:
            nx = e.to
            edge_id = e.id
            if done[nx]:
                continue
            if k == c:
                k += 1
            edgecolor[edge_id] = k
            k += 1  
            done[nx] = 1
            dq.append(nx)

    mx = max(edgecolor) 
    print(mx)
    for ec in edgecolor:
        print(ec)

if __name__ == '__main__':
    main()


Measured memory_bytes: 60432
import java.util.*;

class Main {

	public static boolean search(int[] A, int n, int key) {
		A[n] = key;
		int i = 0;
		while(A[i] != key)i++;
		return i != n;
	}
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int[] arrayS = new int[10001];
		int[] arrayT = new int[501];
		int count = 0;
		int sNum = scan.nextInt();

		for (int i = 0; i < sNum; i++)
			arrayS[i] = scan.nextInt();

		int tNum = scan.nextInt();
		
		for (int j = 0; j < tNum; j++)
			arrayT[j] = scan.nextInt();

		
		for (int j = 0; j < tNum; j++)
			if(search(arrayS, sNum, arrayT[j])) count++;

		System.out.println(count);
	}
}

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

string solve(string s) {
	string ans = "";
	for(int i = 0; i < s.length(); i++) {
		if(i % 2 == 1) continue;
		ans += s[i];
	}
	return ans;
}

int main() {
	string s;
	cin >> s;
	cout << solve(s);
	return 0;
}


Measured memory_bytes: 640
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}
template<typename T> inline void in(T &e){cin>>e;}
template<typename T> inline void out(T e){cout<<e<<endl;}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

string s;
int k;

signed main(){
    io();
    in(s);
    in(k);
    if(k==1){
        out(s[0]);
    }else{
        rep(i,k){
            if(s[i]!='1'){
                out(s[i]);
                return 0;
            }
        }
        out(1);
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=100005;

int n,L,T,a[N],b[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();L=read();T=read();
	int s=1;
	for (int i=1;i<=n;i++)
	{
		int x=read(),w=read();
		if (w==1)
		{
			a[i]=(x+T)%L;
			if (T>=L-x) (s-=(T-L+x)/L+1)%=n;
		}
		else
		{
			a[i]=((x-T)%L+L)%L;
			if (T>=x+1) (s+=(T-x-1)/L+1)%=n;
		}
	}
	s=(s%n+n-1)%n+1;
	sort(a+1,a+n+1);
	for (int i=1;i<=n;i++) b[(s+i-2)%n+1]=a[i];
	for (int i=1;i<=n;i++) printf("%d\n",b[i]);
	return 0;
}

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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vi v(n);
	REP(i, n)cin >> v[i];
	vector<double> ans(n);
	REP(i, n) {
		double tmp = v[i];
		REP(j, i) {
			tmp = max(tmp, 2 * sqrt(v[i] * v[j])+ans[j]);
		}
		ans[i] = tmp;
	}
	double ret = 0;
	REP(i, n)ret = max(ret, ans[i] + v[i]);
	cout << fixed << setprecision(12) <<ret<< endl;
	return 0;
}

Measured memory_bytes: 3296
import java.io.*;
import java.util.*;

public class Main {
	
	static long div(long l,long r,long x) {
		return r/x-(l-1)/x;
	}
	static long lcm(long a,long b) {
		return a/gcd(a,b)*b;
	}
	static long gcd(long a,long b) {
		return b==0?a:gcd(b,a%b);
	}
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		long A=sc.nextLong(),B=sc.nextLong(),C=sc.nextLong(),D=sc.nextLong();
		long all=B-A+1;
		out.println(all-(div(A,B,C)+div(A,B,D)-div(A,B,lcm(C,D))));
		
		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

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

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int X, N;
  map<int,int> m;
  cin >> X >> N;
  rep(i,N){
    int a;
    cin >> a;
    m[a] = 1;
  }

  int ret = -1000;
  int diff = 1000000;
  for(int i=-1000; i<=1000; i++){
    if(m.count(i) > 0) continue;
    if(diff > abs(X-i)){
      diff = abs(X-i);
      ret = i;
    }
  }

  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main() {
    int h,n,s=0,x;
    cin>>h>>n;
    for(int i=1;i<=n;i++){
        cin>>x;
        s=s+x;
    }
    if(s<h){
        cout<<"No";
    }
    else{
        cout<<"Yes";
    }
    return 0;
}

Measured memory_bytes: 256
/*
 * written by Yaqi Zhang
 * University of Wisconsin-Madison
 * 2020
 */

#include<algorithm>
#include<cstring>
#include<iostream>
#include<map>
#include<set>
#include<stdio.h>
#include<vector>

#define INF 0x3f3f3f3f
typedef long long ll;

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<int>> A(h, vector<int>(w));
    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            char ch;
            cin >> ch;
            // A[i][j] = (ch == '0');
            A[i][j] = ch - '0';
        }
    }
    int mn = h * w;
    for(int state = 0; state < (1 << (h - 1)); ++state) {
        vector<int> cuts;
        int cnt = 0;
        cuts.push_back(0);
        for(int i = 0; i < h - 1; ++i) {
            if((state >> i) & 1){
                cuts.push_back(i + 1);
                ++cnt;
            }
        }
        cuts.push_back(h);
        int nrows = cnt + 1;
        vector<int> cur(nrows, 0);
        bool state_valid = true;
        //  cout << state << " " << nrows << endl;
        for(int j = 0; j < w; ++j) {
            if(!state_valid) break;
            // add
            bool valid = true;
            for(int i = 0; i < nrows; ++i) {
                int up = cuts[i], down = cuts[i + 1];
                // assert(up != down);
                for(int r = up; r < down; ++r) {
                    cur[i] += A[r][j];
                }
                if(cur[i] > k) valid = false;
            }
            if(!valid) {
                ++cnt;
                valid = true;
                for(int i = 0; i < nrows; ++i) {
                    int up = cuts[i], down = cuts[i + 1];
                    cur[i] = 0;
                    for(int r = up; r < down; ++r) {
                        cur[i] += A[r][j];
                    }
                    if(cur[i] > k) state_valid = false;
                }
            }
        }
        // cout << state << " " << cnt << endl;
        if(state_valid) mn = min(mn, cnt);
    }
    cout << mn << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define vi_a vector<int>a;
#define p_b push_back
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define fast_io cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define getfiles ifstream cin("input.txt");ofstream cout("output.txt");
#define closefiles cin.close();cout.close();
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)
#define sz(x) (int)x.size()
#define endl "\n"
using namespace std;

int main()
{
    ll n,k;
    cin>>n>>k;
    vector<ll>dp(n);
    vector<ll>a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    dp[0]=0;
    for(ll i=1;i<n;i++){
        dp[i]=LLONG_MAX;
        for(ll j=1;j<=min(i,k);j++){
            dp[i]=min(dp[i],(dp[i-j]+abs(a[i]-a[i-j])));
        }
//        cout<<dp[i]<<endl;
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1792
n,p = map(int,input().split())
a = list(map(int,input().split()))
even = 0
odd = 0
for i in range(n):
  if a[i]%2 == 0:
    even += 1
  else:
    odd += 1
if p == 1:
  if odd == 0:
    print(0)
  else:
    print((2**even)*(2**(odd-1)))
else:
  if odd == 0:
    print(2**even)
  else:
    print((2**even)*(2**(odd-1)))

Measured memory_bytes: 3064
n,l = map(int, input().split())

org=0
for i in range(n):
        org+=(l+i)

ans=0
mn=10**9
for i in range(n):
        sm=0
        for j in range(n):
                if i==j:
                        continue
                sm+=l+j
        dif = abs(org-sm)
        if mn > dif:
                ans=sm
                mn=dif
print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 200010

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    #endif
    ll dp[N], x;
    memset(dp, -1, sizeof dp);
    dp[0] = 0;
    ifr(i, 1, N) {
        x = i % (__builtin_popcount(i));
        if(dp[x]!=-1) dp[i] = dp[x] + 1;
    }
    // int T;cin>>T;while(T--) 
    {
        ll n;
        cin>>n;
        string s;
        cin>>s;
        x = 0;
        ifr(i, 0, n) x+=(s[i]=='1');

        ll mx1=0, mx0=0;
        if(x-1<=0) mx0=-1;
        ifr(i, 0, n) {
            mx1 = ((mx1*2)%(x+1) + (s[i]-'0'))%(x+1);
            if(mx0!=-1) mx0 = ((mx0*2)%(x-1) + (s[i]-'0'))%(x-1);
        }

        vll px1(n), px0(n);

        px1[n-1] = 1; px0[n-1] = 1;
        ifr(i, n-1, 0) {
            px1[i] = (px1[i+1]*2)%(x+1);
            if(mx0!=-1) px0[i] = (px0[i+1]*2)%(x-1);
        }

        // cout<<mx1<<" "<<mx0<<endl;

        ifr(i, 0, n) {
            if(s[i]=='0')
                cout<<dp[(mx1+px1[i])%(x+1)]+1<<endl;
            else {
                if(x-1 == 0) cout<<0<<endl;
                else {
                    ll t = (mx0-px0[i])%(x-1);
                    if(t<0) t+=x-1;
                    cout<<dp[t]+1<<endl;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 8320
def f(a):
    for x in ['o','x']:
        if a[0::4].count(x)==3 or a[2:7:2].count(x)==3:return x
        for i in range(3):
            if a[i*3:i*3+3].count(x)==3 or a[i::3].count(x)==3:return x
    return 'd'
 
while 1:
    try:print(f(input()))
    except:break

Measured memory_bytes: 7492
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N,M,X;
  cin>>N>>M>>X;
  int A[M];
  rep(i,M){
    cin>>A[i];
  }
  int cntlef=0;
  rep(i,M){
    if(A[i]<X)
      cntlef++;
  }
  cout<<min(cntlef,M-cntlef)<<endl;
  
 
}
  





Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<vector>
#include <algorithm>
int main(){
    int K, N, tmp;
    std::vector<int> vec, vec2;
    std::cin >> K >> N;
    for(int i=0; i<N; i++){
        std::cin >> tmp;
        vec.push_back(tmp);
    }
    //std::sort(vec.begin(), vec.end());
    for(int i=0; i<N; i++){
        if(i+1==N){
            vec2.push_back(K-(vec[N-1]-vec[0]));
        }else{
            vec2.push_back(vec[i+1]-vec[i]);
        }
    }
    std::vector<int>::iterator iter = std::max_element(vec2.begin(), vec2.end());
    size_t index = std::distance(vec2.begin(), iter);
    printf("%d\n", K-vec2[index]);
    
    return 0;
}

Measured memory_bytes: 2548
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n];
		int MAX = 0;
		for(int i = 0; i < n; i++) {
			h[i]  = sc.nextInt();
			MAX = Math.max(MAX, h[i]);
		}
		int ans = 0;
		for(int i = 0; i < MAX; i++) {
			int tmp = 1;
			int nzero = 0;
			if(h[0] == 0) {
				while(h[nzero] == 0) {
					nzero ++;
				}
			}
			for(int j = nzero; j < n-1; j++) {
				if(h[j] * h[j+1] == 0 && h[j+1] == 0) {
					if(h[j] + h[j+1] != 0) {
						tmp ++;
					}
					
				}
			}
			if(h[n-1] == 0 && h[nzero] != 0) {
				tmp --;
			}
			for(int j = 0; j < n; j++) {
				if(h[j] != 0) {
					h[j] --;
				}
			}
			
			ans += tmp;
			//System.out.println(ans);
		}
		System.out.println(ans);
		sc.close();
	}
	
}



Measured memory_bytes: 23124
#include <bits/stdc++.h> 
#define ll long long int
#define push_back pb

using namespace std; 

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

    if(s=="SUN") cout<<7<<endl;
    if(s=="MON") cout<<6<<endl;
    if(s=="TUE") cout<<5<<endl;
    if(s=="WED") cout<<4<<endl;
    if(s=="THU") cout<<3<<endl;
    if(s=="FRI") cout<<2<<endl;
    if(s=="SAT") cout<<1<<endl;
}

Measured memory_bytes: 764
def main():
    import sys
    input = sys.stdin.readline

    def PrimeDecomposition(N):
        ret = {}
        n = int(N ** 0.5)
        for d in range(2, n + 1):
            while N % d == 0:
                if d not in ret:
                    ret[d] = 1
                else:
                    ret[d] += 1
                N //= d
            if N == 1:
                break
        if N != 1:
            ret[N] = 1
        return ret

    N = int(input())
    n = int(N**0.5)

    ans = 0
    for k in range(2, n+1):
        M = N
        while M >= k:
            if M%k==0:
                M //= k
            else:
                M %= k
        if M == 1:
            ans += 1

    prime = PrimeDecomposition(N-1)
    ans2 = 1
    for p in prime:
        ans2 *= (prime[p] + 1)
    print(ans + ans2//2 + 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 40556
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

 /* Coding Space*/
int main(){
  const ll base = 40010;
  int n; cin >> n;
  vector<ll> ans_a;
  vector<ll> ans_b;
  rep(i,n){
    ans_a.pb(base*i+base);
    ans_b.pb(base*(n-i-1)+base);
  }

  rep(i,n){
    int in; cin >> in; in--;
    ans_a[in] -= (n-i);
  }
  rep(i,n) cout << ans_a[i] << ((i==n-1)?"\n":" ");
  rep(i,n) cout << ans_b[i] << ((i==n-1)?"\n":" ");
}

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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

int main() {
    string S;
    cin >> S;
    reverse(S.begin(), S.end());
    vector<int>  acc(S.size() + 1, 0);
    int base = 1;
    for (int i = 1; i <= S.size(); ++i) {
        acc[i] = (acc[i - 1] + (S[i - 1] - '0') * base) % 2019;
        base = (base * 10) % 2019;
    }
    int64_t cnt = 0;
    vector<int> ns(2019, 0);
    ns[0] = 1;
    for (int i = 0; i < S.size(); ++i) {
        cnt += ns[acc[i+1]];
        ns[acc[i+1]]++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 4388
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
using namespace std;
typedef long long LL;
const int MAXN = 200005;

template <typename T> inline void read(T &AKNOI) {
    T x = 0, flag = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') flag = -1;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    AKNOI = flag * x;
}

int n, m, col[MAXN], has[MAXN];
vector<int> e[MAXN];
int siz[MAXN], sum[MAXN];
LL ans[MAXN];

inline LL C2(int x) {
    return 1LL * x * (x + 1) / 2;
}

void DFS(int u, int fa) {
    siz[u] = 1;
    for (auto v : e[u]) {
        if (v == fa) continue;
        int cur = sum[col[u]];
        DFS(v, u);
        int blk = siz[v] - (sum[col[u]] - cur);
        ans[col[u]] += C2(blk);
        sum[col[u]] += blk;
        siz[u] += siz[v];
    }
    sum[col[u]] += 1;
}

void init() {
    read(n);
    for (int i = 1; i <= n; ++i) {
        read(col[i]);
        has[col[i]] = 1;
    }
    for (int i = 1, u, v; i < n; ++i) {
        read(u); read(v);
        e[u].push_back(v);
        e[v].push_back(u);
    }
}

void solve() {
    DFS(1, 0);
    for (int i = 1; i <= n; ++i) {
        if (i == col[1] || !has[i]) continue;
        ans[i] += C2(n - sum[i]);
    }
    for (int i = 1; i <= n; ++i) {
        printf("%lld\n", has[i]? C2(n) - ans[i] : 0);
    }
}

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


Measured memory_bytes: 34940
#include <bits/stdc++.h>
using namespace std;
 
using ld = long double;
 
constexpr ld eps = 1e-8;
constexpr ld INF = 1e18;
 
 
int main() {
    int n;
    while(cin >> n, n) {
        ld w, h, r, vx, vy;
        cin >> w >> h >> r >> vx >> vy;
        ld now_x, now_y;
        cin >> now_x >> now_y;
        n = n - 1;
        vector<ld> x(n), y(n);
        for(int i = 0; i < n; ++i) {
            cin >> x[i] >> y[i];
        }
 
        int res = -1;
        ld total = 0;
        while(res == -1 && total < 10000) {
            ld tx = INF, ty = INF;
            if(vy != 0) {
                if(vy > 0) {
                    ty = (h - now_y - r) / vy;
                } else {
                    ty = (now_y - r) / -vy;
                }
            }
            if(vx != 0) {
                if(vx > 0) {
                    tx = (w - now_x - r) / vx;
                } else {
                    tx = (now_x - r) / -vx;
                }
            }
             
            ld t = min(ty, tx);
            ld a = vx * vx + vy * vy;
            for(int i = 0; i < n; ++i) {
                ld b = 2 * ((now_x - x[i]) * vx + (now_y - y[i]) * vy);
                ld c = pow(now_x - x[i], 2) + pow(now_y - y[i], 2) - 4 * r * r;
                ld D = b * b - 4 * a * c;
                if(D < 0) {
                    continue;
                }
                ld tt = (-b - sqrt(D)) / (2 * a);
                if(tt < 0) {
                    tt = (-b + sqrt(D)) / (2 * a);
                }
                if(tt >= 0 && tt < t) {
                    res = i + 2;
                    t = tt;
                }
            }
            now_x += vx * t;
            now_y += vy * t;
            total += hypot(vx, vy) * t;
            if(abs(ty - tx) < eps) {
                vy = -vy;
                vx = -vx;
            } else if(ty > tx) {
                vx = -vx;
            } else {
                vy = -vy;
            }
        }
        if(total > 10000 + eps) {
            res = -1;
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	string s;
	cin >> s;
	
	if(s == "SAT")
		cout << 1 << endl;
	else if(s == "SUN")
		cout << 7 << endl;
	else if(s == "MON")
		cout << 6 << endl;
	else if(s == "TUE")
		cout << 5 << endl;
	else if(s == "WED")
		cout << 4 << endl;
	else if(s == "THU")
		cout << 3 << endl;
	else if(s == "FRI")
		cout << 2 << endl;
	
		

	return 0;
}


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

#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
#define DIV 1000000007
#define ll long long
using namespace std;

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

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

  int N;
  cin >> N;

  int result = false;
  int count = 0;
  loop(0, N, i) {
    int a, b;
    cin >> a >> b;
    if (a == b) {
      count++;
    } else {
      count = 0;
    }
    if (count == 3) {
      result = true;
    }
  }
  if (result) {
    print("Yes");
  } else {
    print("No");
  }

}


Measured memory_bytes: 3636
/*
Cerberus97
Hanit Banga
*/

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

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 1e5 + 10;

struct node {
	node* child[2];
};

ll check(node* cur, ll len, ll max_len);
ll grundy(ll x);
void trie_insert(node* root, string s);

int main() {
	node* root = new node();
	int n; ll l;
	cin >> n >> l;
	for (int i = 1; i <= n; ++i) {
		string s;
		cin >> s;
		trie_insert(root, s);
	}

	// grundy[0] = 0;
	// for (int i = 1; i <= 100; ++i) {
	// 	set <int> seen;
	// 	seen.insert(0);
	// 	for (int j = 1; j <= i - 1; ++j) {
	// 		int xr = 0;
	// 		for (int k = j; k < i; ++k) {
	// 			xr ^= grundy[k];
	// 		}
	// 		seen.insert(xr);
	// 	}

	// 	grundy[i] = 0;
	// 	while (seen.find(grundy[i]) != seen.end()) {
	// 		++grundy[i];
	// 	}

		// cout << i << ' ' << grundy(i) << endl;
	// }
	// return 0;

	if (check(root, 0, l)) {
		cout << "Alice\n";
	} else {
		cout << "Bob\n";
	}
}

ll check(node* cur, ll len, ll max_len) {
	node* l = cur -> child[0];
	node* r = cur -> child[1];
	if (l == NULL and r == NULL) {
		return 0;
	} else if (l != NULL and r != NULL) {
		return check(l, len + 1, max_len) xor check(r, len + 1, max_len);
	} else if (l != NULL) {
		return check(l, len + 1, max_len) xor grundy(max_len - len);
	} else {
		return check(r, len + 1, max_len) xor grundy(max_len - len);
	}
}

void trie_insert(node* root, string s) {
	for (auto &i : s) {
		if (root -> child[i - '0'] == NULL) {
			root -> child[i - '0'] = new node();
		}

		root = root -> child[i - '0'];
	}
}

ll grundy(ll x) {
	if (!x) {
		return 0;
	}

	ll ans = 1;
	while ((x & 1) == 0) {
		ans <<= 1;
		x >>= 1;
	}

	return ans;
}

Measured memory_bytes: 8320
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($A,$B,$C,$D) = explode(" ",trim(fgets(STDIN)));
//$A  = explode(" ",trim(fgets(STDIN)));

if ($N < 1000) {
  printf("ABC\n");
}
else {
  printf("ABD\n");
}


Measured memory_bytes: 3828
#pragma GCC optimize("Ofast")
  
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <tuple>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <cassert>
#include <numeric>
#include <math.h>
#include <bitset>
#include <random>
#include <regex>

using namespace std;
  
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,f,n) for(int i=f;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(14)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
constexpr int dy[] = {0,1,0,-1,1,-1,-1,1};
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class A, class B> inline A updiv(const A a,const B b){ return (a + b - 1) / b; }
template <class A, class B> inline A gcd(const A a,const B b){ return b ? gcd(b,a % b) : a; }
template <class A, class B> inline A lcm(const A a,const B b){ return a / gcd(a,b) * b; }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A,class B> using umap = unordered_map<A,B>;


signed main(void){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int N, K;
    cin >> N >> K;

    vector<int> x(N), y(N);

    rep(i,N){
        cin >> x[i] >> y[i];
    }

    int res = LINF;

    rep(i,N){
        rep(j,N){
            rep(k,N){
                rep(l,N){
                    int xl = min({x[i], x[j], x[k], x[l]});
                    int xh = max({x[i], x[j], x[k], x[l]});
                    int yl = min({y[i], y[j], y[k], y[l]});
                    int yh = max({y[i], y[j], y[k], y[l]});
                    int cnt = 0;
                    rep(m,N){
                        cnt += (xl <= x[m] && x[m] <= xh && yl <= y[m] && y[m] <= yh);
                    }
                    if(cnt >= K){
                        chmin(res, abs(xh-xl) * abs(yh-yl));
                    }
                }
            }
        }
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
void mainsolve(){
	ll n;
	cin >> n;
	vector<ll> a(n), b(n);
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];

	vector<vector<ll>> dp(1<<n, vector<ll>(55, INF));
	dp[0][0] = 0;
	rep(i,1<<n){
		ll cnt = __builtin_popcount(i);
      ll cnt2 = cnt;
		vector<P> ords;
		rep(k,n){
			if(!(i & (1<<k))){
				ords.push_back(P(k,cnt2++));
			}
		}

		rep(s,55){
			for(auto p : ords){
				ll t;
				if(abs(p.first-cnt) % 2 == 0) t = a[p.first];
				else t = b[p.first];
				if(t >= s){
					ll next = i | (1<<p.first);
					dp[next][t] = min(dp[next][t], dp[i][s] + abs(p.second-cnt));
				}
			}
		}
	}

	ll res = INF;
	rep(s,55){
		res = min(res, dp[(1<<n) - 1][s]);
	}
	if(res == INF) cout << -1 << endl;
	else cout << res << endl; // res = 全カードの移動距離
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}


Measured memory_bytes: 123136
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <queue>
 
#include <atcoder/dsu>
 
#define ll long long
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define PI 3.141592653589
#define MOD 1000000007
 
using namespace std;
 
template<typename T> T gcd(T a, T b){ return (a % b)? gcd(b, a%b) : b; }
template<typename T> T lcm(T a, T b){ return a * b / gcd(a, b); }
 
int main(void){
    int n, q;
    cin >> n >> q;
    
    atcoder::dsu uf(n);
    REP(i,q){
        int t, u, v;
        cin >> t >> u >> v;
        if(t == 0){
            uf.merge(u, v);
        } else{
            cout << uf.same(u, v) << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 4012
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
const double PI  = 3.1415926535897932384626433832795028841971;
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n, k;
vector<int> e[4000];
int dist[4000][4000];
bool saw[4000][4000];
template<typename Type>
void showContent1D(Type input)
{
	for(int i=0; i<=10; ++i)
	{
		cout<<input[i]<<", ";
	}
	return;
}
template<typename Type>
void showContent2D(Type input)
{
	for(int i=0; i<=7; ++i)
	{
		for(int j=0; j<=10; ++j)
		{
			cout<<input[i][j]<<", ";
		}
		cout<<endl;
	}
	return;
}
void dfs(int ro, int v, int d, int par){
	//rep(i,e[v].size())
  	for(int i=0; i<e[v].size(); ++i)
    {
		if(e[v][i] == par) continue;
		dist[ro][e[v][i]] = d+1;
		dfs(ro,e[v][i],d+1,v);
	}
}
int main(){
	cin >> n >> k;
	rep(i,n-1){
		int a, b;
		cin >> a >> b;
		//a--; b--;
		e[a].push_back(b);
		e[b].push_back(a);
	}
	//#define rep(i,n) for(int i = 0; i < n; i++)
	//rep(i,n) dfs(i,i,0,-1);
	for(int i=1; i<=n; ++i)
	{
		dfs(i, i, 0, -1);
	}
	int ans = 0;
	bool ok = false;
	//rep(i,n) for(int j = i+1; j < n; j++){
	for(int i=1; i<=n; ++i)
	{
		for(int j = i+1; j <= n; j++)
		{
			if(dist[i][j] != k || saw[i][j] == true) continue;
			ok = true;
			int cnt = 0;
			//rep(l,n)
			for(int l=1; l<=n; ++l)
			{
				if(dist[l][i] <= k && dist[l][j] <= k)
				{
					cnt++;
					saw[l][i] = true; saw[l][j] = true;
					saw[i][l] = true; saw[j][l] = true;
				}
			}
			ans = max(ans,cnt);
		}
	}
	if(!ok) cout << 0 << endl;
	else cout << n-ans << endl;
}


Measured memory_bytes: 35352
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int min = 100;
		int max = 10500000;
		int ans = 0;
		
		for(int i=0; i*100<=x; i++){
		    min = 100*i;
		    max = 105*i;
		}
		
		if(x >= min && x <= max){
		    ans = 1;
		}
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 35688
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <utility>

using namespace std;
typedef long long signed int ll;

constexpr int inf = INT32_MAX / 2;

int n, t[100],s[101], v[100],vmax[40001];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t[i];
		t[i] *= 2;
	}
	s[0] = 0;
	for (int i = 0; i < n; i++) s[i + 1] = s[i] + t[i];
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		v[i] *= 2;
	}
	for (int i = 0; i <= s[n]; i++) vmax[i] = min(i,s[n] - i);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < s[i]; j++) {
			vmax[j] = min(vmax[j], v[i] + (s[i] - j));
		}
		for (int j = s[i]; j < s[i+1]; j++) {
			vmax[j] = min(vmax[j], v[i]);
		}
		for (int j = s[i+1]; j <= s[n]; j++) {
			vmax[j] = min(vmax[j], v[i] + (j - s[i+1]));
		}
	}
	int res = 0;
	for (int i = 0; i <= s[n]; i++) {
		res += vmax[i];
	}
	cout << setprecision(20) <<((double)res)/((double)4) << endl;
}

Measured memory_bytes: 384
while line = gets
  hit,blow = 0,0
  a = line.split.map(&:to_i)
  b = gets.split.map(&:to_i)
  b.each_with_index do |elem,index|
    if a[index] == b[index]
      hit += 1
    elsif a.include?(elem)
      blow += 1
    end
  end
  puts "#{hit} #{blow}"
end

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

#define int long long
#define forn(i,a,n) for (int i=a; i<n; i++)

const int mod=1e9+7;

int n;
int x=1,y=1,z=1;

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

	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	
	cin>>n;
	forn(i,0,n){
		x*=10,y*=9,z*=8;
		x%=mod,y%=mod,z%=mod;
	}
	int res=x-y-y+z;
	res=(res+mod+mod)%mod;
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
ll lcm(ll a,ll b)
{
    return (a*b)/(ll)__gcd(a,b);
}
int main() {
//	cout<<"GfG!";
    ll a,b;
    cin>>a>>b;
    cout<<lcm(a,b)<<endl;
  //  cout<<__gcd(9,10);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin >> N;
  vector<int> l(N);
  for(int i=0;i<N;i++){
    cin >> l.at(i);
  }
  sort(l.begin(),l.end());
  cout << l.at(N-1)-l.at(0) << endl;
}

Measured memory_bytes: 256
/*

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

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

int n;
vvp G;
vi out;
void dfs(int a,int p){
	rep(i,G[a].size())if(G[a][i].first-p){
		out[G[a][i].first]=out[a]^(G[a][i].second%2);
		dfs(G[a][i].first,a);
	}
}


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

	cin>>n;
	G=vvp(n);
	rep(i,n-1){
		int a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		G[a].pb({b,c});
		G[b].pb({a,c});
	}
	out=vi(n);
	dfs(0,-1);
	rep(i,n)cout<<out[i]<<endl;
}


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

int main() {
	int n, sum, largest;
	largest = 0;

	cin >> n;
	while (true) {
		int l;
		cin >> l;

		if (cin.eof()) {
			if (largest < sum) cout << "Yes" << endl;
			else cout << "No" << endl;

			break;
		}

		if (l > largest) {
			sum += largest;
			largest = l;
		}
		else {
			sum += l;
		}
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>

typedef struct{
  char sub;
  int figure;
  int order;
}card;

int partition(card*,int,int);
void quicksort(card*,int,int);
void swap(card*,int,int);
bool stablenor(card*,int);
int main(){
  int n,i,temp,r,l,flag=0;
  int *stablejudge;
  card *list;
  scanf("%d",&n);
  list=(card*)malloc(n*sizeof(card));
for(i=0;i<n;i++){
  scanf("%*c%c%d",&((list+i)->sub),&((list+i)->figure));
  ((list+i)->order)=i;
}
  r=n-1;
  l=0;
quicksort(list,l,r);
printf("%s\n",(stablenor(list,n)!=true)?"Not stable":"Stable");
  for(i=0;i<n;i++)printf("%c %d\n",((list+i)->sub),((list+i)->figure));
  return 0;
}
int partition(card *l,int left,int right){
int i;
  for(i=left;i<right;i++){
    if((l+right)->figure>=(l+i)->figure){
      swap(l,i,left);
      left++;
    }
  }
  swap(l,left,right);
  return left;
}
void quicksort(card *l,int left,int right){
int q;
  if(left<right){
    q=partition(l,left,right);
    quicksort(l,left,q-1);
    quicksort(l,q+1,right);
  }
}
void swap(card *x,int a,int b){
  card c;
  c=*(x+a);
  *(x+a)=*(x+b);
  *(x+b)=c;
}
bool stablenor(card *l,int n){
  while(n-1){
    if(((l+(n-2))->figure)==((l+(n-1))->figure)&&((l+(n-2))->order)>((l+(n-1))->order))return false;
    n--;
  }
  return true;
}



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

using namespace std;

typedef long long ll;

const ll MOD = 998244353;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, k;
    cin >> n >> k;
    vector<int> l(k), p(k);
    for (int i = 0; i < k; ++i)
        cin >> l[i] >> p[i];
    vector<ll> dp(n);
    dp[0] = 1;
    for (int i = 1; i < n; ++i)
    {
        dp[i] = dp[i - 1];
        for (int j = 0; j < k; ++j)
        {
            int pocz = i - p[j];
            int kon = i - l[j];
            if (kon >= 0)
            {
                pocz = max(pocz, 0);
                ll pref = dp[kon];
                if (pocz != 0)
                    pref -= dp[pocz - 1];
                if (pref < 0)
                    pref += MOD;
                dp[i] = (dp[i] + pref) % MOD;
            }
        }
    }
    ll odp = dp[n - 1] - dp[n - 2];
    if (odp < 0)
        odp += MOD;
    cout << odp;
    return 0;
}


Measured memory_bytes: 4840
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
		System.out.println(a<=c&&c<=b?"Yes":"No");
		sc.close();
	}
}

Measured memory_bytes: 23124