akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>

#define PI 3.1415926535897932384626433832795
#define pii pair <int, int>
#define pb push_back
#define ll long long
#define ss second
#define ff first
#define N 100010

using namespace std;

int n, m, x;
int a, b, c;

int main()
{
	cin >> n >> m >> x;
	
	for(int i = 1; i <= m; i++) {
		cin >> c;
		
		if(c < x) a++;
		if(c > x) b++;
		if(x == c) a++, b++;
	}
	
	cout << min(a, b);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
using namespace std;
int main() {
	int N,M, X;
	int zero=0, las=0;
	cin >> N >> M >> X;
	vector<int> a(M);
	vector<int> b(N);
	for (int i = 0; i < M; i++)cin >> a.at(i);
	for (int i = 0; i < M; i++)b.at(a.at(i)) = 1;
	for (int i = X; i < N; i++)las += b.at(i);
	for (int i = 0; i < X; i++)zero += b.at(i);
	cout << min(zero, las) << endl;
	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	double t,x;cin>>t>>x;
	cout<<fixed<<setprecision(16)<<t/x;
}


Measured memory_bytes: 256
using System.Collections.Generic;
using System.Linq;
using static System.Math;
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var y1 = int.Parse(line[0]);
        var m1 = int.Parse(line[1]);
        var d1 = int.Parse(line[2]);
        line = Console.ReadLine().Trim().Split(' ');
        var y2 = int.Parse(line[0]);
        var m2 = int.Parse(line[1]);
        var d2 = int.Parse(line[2]);
        var a1 = getAge(y1, m1, d1);
        var b1 = getAge(y2, m2, d2);
        var ans = -1;
        for (int i = 0; i < a1.Count(); i++)
            ans = Max(ans, Abs(a1[i] - b1[i]));
        Console.WriteLine(ans);
    }
    public static List<int> getAge(int y, int m, int d)
    {
        var yyyy = 2008;
        var ans = new List<int>();
        var bd = new DateTime(y, m, d);
        var mo = new int[] { 1, 3, 5, 7, 8, 10, 12 };
        foreach (var x in mo)
        {
            for (int i = 1; i <= 31; i++)
            {
                var now = new DateTime(yyyy, x, i);
                var age = now.Year - bd.Year;
                if (bd > now.AddYears(-age)) age--;
                ans.Add(age);
            }
        }
        var mo2 = new int[] { 4, 6, 9, 11 };
        foreach (var x in mo2)
        {
            for (int i = 1; i <= 30; i++)
            {
                var now = new DateTime(yyyy, x, i);
                var age = now.Year - bd.Year;
                if (bd > now.AddYears(-age)) age--;
                ans.Add(age);
            }
        }
        for (int i = 1; i <= 29; i++)
        {
            var now = new DateTime(yyyy, 2, i);
            var age = now.Year - bd.Year;
            if (bd > now.AddYears(-age)) age--;
            ans.Add(age);
        }
        return ans;
    }
}




Measured memory_bytes: 18328
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 110
 
int H,W;
int bdg[MAX][MAX];
bool visited[MAX][MAX];
int dx[2][6] = {{-1,0,-1,1,-1,0},{0,1,-1,1,0,1}};
int dy[6] = {-1,-1,0,0,1,1};
 
bool inField(int x,int y){
    return 0 <= x && x <= W+1 && 0 <= y && y <= H+1;
}
 
int solve(int x,int y){
    visited[y][x] = true;
 
    int res = 0;
    for(int i = 0 ; i < 6 ; i++){
	int nx = x + dx[y%2][i];
	int ny = y + dy[i];
	if(!inField(nx,ny)) continue;
	if(bdg[ny][nx] == 1){
	    res++;
	}else if(!visited[ny][nx]){
	    res += solve(nx,ny);
	}
    }
    return res;
}
 
int main(){
    cin >> W >> H;
    memset(bdg,0,sizeof(bdg));
    for(int i = 1 ; i <= H ; i++){
	for(int j = 1 ; j <= W ; j++){
	    cin >> bdg[i][j];
	}
    }
    memset(visited,false,sizeof(visited));
    cout << solve(0,0) << endl;
    return 0;
}

Measured memory_bytes: 3468
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = 0;
		
		int max = Math.max(a, b);
		int min = Math.min(a, b);
		//System.out.println("max="+max);
		//System.out.println("min="+min);
		ans += max;
		ans += Math.max(max-1, min);
		System.out.println(ans);
	}

}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin>>n;
  int q = sqrt(n);
  for(long long i=q; i>0; i--) {
  	if(n%i == 0) {
      cout<<(i-1+(n/i-1));
      break;
    }
  }
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	string s;
	cin>>s;
	if(s.size()==2){
		cout<<s<<endl;
	}else{
		cout<<s[2]<<s[1]<<s[0]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i =(b)-1;i>=(a);--i)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
typedef vector<int> vi;
const int mod = 1e9 + 7;
const int maxn = 2e6 + 10;
int f1[maxn],f2[maxn];
int x[maxn],y[maxn],z[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b,m;
	cin >> a >> b >> m;
	rep(i,0,a)cin >> f1[i];
	rep(i,0,b)cin >> f2[i];
	rep(i,0,m)cin >> x[i] >> y[i] >> z[i];
	int ans = *min_element(f1,f1+a) + *min_element(f2,f2+b);
	rep(i,0,m)ans = min(ans,f1[x[i]-1]+f2[y[i]-1] - z[i]);
	cout << ans; 
	return 0;
}


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

using namespace std;

int main() {
    int x, y;
    cin >> x >> y;
    if (y & 1) {
        cout << "No" << endl;
        return 0;
    }
    int a = y / 2 - x;
    int b = 2 * x - y / 2;
    if (a >= 0 && b >= 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n);++i)
using namespace std;
template <class _t> inline bool chmax (_t& a,_t b){if(a<b){a=b;return true;}return false;} template <class _t> inline bool chmin (_t& a,_t b){if(a>b){a=b;return true;}return false;}

const long long inf = 1ll << 60;
const long long mod = 1000000007;

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

int main() {
    int n;cin >> n;
    vector<int> p(n+1,0);
    for(int i=0;i<n;i++){
	cin >> p[i] >> p[i+1];
	//p[0] M1の行 p[1] M１の列
    }
    vector<vector<int> > dp(n+1,vector<int>(n+1,(1<<21)));
    rep(i,n+1) dp[i][i] = 0;
    for(int t = 2;t<=n;t++){
	for(int i=1;i<=n-t+1;i++){
	    int j=i+t-1;
	    for(int k=i;k<=j-1;k++){
		chmin(dp[i][j],dp[i][k]+dp[k+1][j]+p[i-1]*p[k]*p[j]);
	    }
	}
    }
    /*
    for(int i=0;i<=n;i++){
	for(int j=0;j<=n;j++){
	    cout << dp[i][j] << " ";
	}
	cout << endl;
    }
    */
    cout << dp[1][n] << endl;
    return 0;
}



Measured memory_bytes: 3148
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'

void solve(){
  ll x, y;
  cin >> x >> y;
  ll ans = 1;
  ll cur = x;
  while (cur * 2ll <= y){
    cur *= 2ll;
    ans++;
  }
  cout << ans;
}

int main() {
  ios::sync_with_stdio(false); 
  cin.tie(0); cout.tie(0);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1
1000000000000000000


*/

Measured memory_bytes: 3628
//設定言語check
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <queue>
using namespace std;

int root(int x, int par[]){
  if(par[x] == x) return x ;
  return par[x] = root(par[x], par) ;
}

int main(){
  int N, M, ans = 0, count = 0, Af = 0, Bf = 0, bet = 0 ;
  cin >> N >> M ;
  int A[M], B[M], group[N+1] = {}, par[N+1] ;
  for(int i=0;i<M;i++){
    cin >> A[i] >> B[i] ;
  }
  for(int i=0;i<N;i++){
    group[i+1] = 1 ;
    par[i+1] = i+1 ;
  }
  for(int i=0;i<M;i++){
    Af = root(A[i],par) ;
    Bf = root(B[i],par) ;
    if(Af == Bf ){
      continue ;
    }
    else{
      par[Af] = Bf ;
      group[Bf] += group[Af] ;
    }  
  }
  for(int i=1;i<(N+1);i++){
    ans = max(ans,group[i]) ;
  }
  cout << ans << endl ;
  return 0 ;
}  

Measured memory_bytes: 6680
#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define INT_MAX_VALUE 2147483647
#define LONG_LONG_MAX_VALUE 9223372036854775807
#define ll long long

template <class T>
T mymax(T a,T b){
    if(a>=b) return a;
    return b;
}
template <class T>
T mymin(T a,T b){
    if(a<=b) return a;
    return b;
}

ll gcd(ll a, ll b){
    if(a<b){
        swap(a,b);
    }
    while(b){
        ll r = a%b;
        a=b;
        b=r;
    }
    return a;
}

ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}

struct XX{
    int a;
    int b;
    int z;
    int i;
};

class xxGreater {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第2条件
        if((riLeft.b) == (riRight.b)){
            return riLeft.i < riRight.i;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
            //プライオリティキューの場合は > で、top()すると値の小さいものがとれる
        }
        //第1条件
        return (riLeft.b) > (riRight.b);
    }
};

//map<long long,long long> prime_f(long long n){
//    map<long long,long long>res;
//    for(int i=2;i*i<=n;i++){
//        while(n%i==0){
//            ++res[i];
//            n/=i;
//        }
//    }
//    if(n!=1)res[n]=1;
//    return res;
//}


int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //sscanf(tmp.c_str(),"%dd%d%d",&time[i], &dice[i], &z[i]);
    //getline(cin, target);
    //cin >> x >> y;
    //テスト用
    //ifstream ifs( "1_06.txt" );
    //ifs >> a;
    //ここから
    
    //入力高速化
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N;
    cin >> N;
    ll a[10000];
    ll b[10000];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    for(int i=0;i<N;i++){
        cin >> b[i];
    }

    ll chokin=0;
    ll shakkin=0;
    for(int i=0;i<N;i++){
        if(a[i]<=b[i]){
            ll tmp=(b[i]-a[i])/2;
            chokin+=tmp;
            continue;
        }else{
            shakkin+=a[i]-b[i];
        }
    }
    if(chokin>=shakkin){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    //ここまで
    //cout << "debug" << endl;
    //cout << "ans" << endl;改行含む
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}



Measured memory_bytes: 512
package main
 
import("fmt")
 
func main(){
  var a,b,k int
  fmt.Scanf("%d %d %d",&a,&b,&k)
  
  if k<=a {
    a=a-k
  }else if a<k && k<=a+b {
    b=b-k+a
    a=0
  }else {
    a=0
    b=0
  }
  
  fmt.Printf("%d %d",a,b)
}

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

namespace AtCoderExamCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string tmp = Console.ReadLine();
            int N = int.Parse(tmp);
            N -= (N / 100) * 100;
            N -= (N / 10) * 10;
            if (N == 3)
            {
                Console.WriteLine("bon");
            }
            else if (N == 0 || N == 1 || N == 6 || N == 8)
            {
                Console.WriteLine("pon");
            }
            else
            {
                Console.WriteLine("hon");
            }
        }
    }
}


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

int main(){
  int i,n,a,ans=0,c=0;
  cin>>n;
  for(i=0;i<n;i++){
    cin>>a;
  	if(a>c) ans+=a-c;
    c=a;
  }
  cout<<ans;
}


Measured memory_bytes: 256
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);

        int n = in.nextInt();
        int m = in.nextInt();
        int [] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = in.nextInt();
        }
        double sum = 0;
        for(int i : a) sum+=i;
        Arrays.sort(a);
        double percent = sum/(4*m);
        int j = n - 1;
        boolean possible = true;
        for (int i = 0; i < m; i++) {
            if((double)a[j--] < percent) {
                possible = false;
                break;
            }
        }
        out.println(possible ? "Yes" : "No");
        out.flush();
    }
}

class Interval {
    int start;
    int end;

    public int getStart() {
        return start;
    }

    public int getEnd() {
        return end;
    }

    public Interval(int start, int end) {
        this.start = start;
        this.end = end;
    }

    @Override
    public String toString() {
        return
                "start=" + start +
                ", end=" + end +
                '}';
    }
}


class InputReader extends BufferedReader {
    StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        super(new InputStreamReader(inputStream), 32768);
    }

    public InputReader(String filename) {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    }

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

    public Integer nextInt(){
        return Integer.valueOf(next());
    }
    public Long nextLong() {
        return  Long.valueOf(next());
    }
    public Double nextDouble() {
        return Double.valueOf(next());
    }
    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void close() {
            super.close();
        }
    }
}


Measured memory_bytes: 20948
#include <bits/stdc++.h>
#pragma warning (disable:4996)

using namespace std;
using ll = long long;
using LL = ll;
using ull = unsigned long long;
using uLL = ull;
#define clean_0(A) memset((A),0,sizeof(A))
#define clean_1(A) memset((A),-1,sizeof(A))
#define For(i,a,b) for(int (i)=(a);(i)<=b;++(i))
#define Max_(a,b) ((a)>=(b)?(a):(b))
#define Min_(a,b) ((a)<=(b)?(a):(b))
template<typename T>
inline T Max(T a, T b) { return a >= b ? a : b; }
template<typename T>
inline T Min(T a, T b) { return a <= b ? a : b; }

constexpr int INF = 0x7F7F7F7F;
constexpr double eps = 1e-9;

constexpr ll mod1 = 197;
constexpr ll mod2 = 19260817;
constexpr ll mod3 = ll(1e8) + 7;
constexpr ll mod4 = ll(1e9) + 7;;
constexpr ll mod5 = 998244353;
constexpr int mod = mod4;

constexpr int maxn = int(3e5) + 1;
constexpr int MAXN = maxn;
namespace io {

#define in(a) (a=read())
#define out(a) write(a)
#define outn(a) (out(a),putchar('\n'))

#define I_int  int
	inline I_int read() {
		I_int x = 0, f = 1; char c = getchar();
		while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); }
		while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
		return x * f;
	}
	template<typename T>
	bool scan_d(T& ret)
	{
#define p(x) ((x)>='0'&&(x)<='9')
		int c; int sgn;
		if (c = getchar(), c == EOF)return false;
		while (c != '-' && !p(c))c = getchar();
		sgn = (c == '-') ? -1 : 1;
		ret = (c == '-') ? 0 : c - '0';
		while (c = getchar(), p(c))ret = ret * 10 + c - '0';
		ret *= sgn;
		return true;
#undef p
	}
	char F[200];
	template<typename T>
	inline void write(T x) {
		if (x == 0) { putchar('0'); return; }
		auto tmp = x > 0 ? x : -x;
		if (x < 0) putchar('-');
		int cnt = 0;
		while (tmp > 0) {
			F[cnt++] = tmp % 10 + '0';
			tmp /= 10;
		}
		while (cnt > 0) putchar(F[--cnt]);
	}
	void read(char* s, int Arr[], size_t n)
	{
		for (size_t i = 0; i < n; ++i)Arr[i] = strtoll(s, &s, 10);
	}
#undef I_int

}
using namespace io;



/*template<typename T>
constexpr T _gcd(T a, T b)
{
	return b ? _gcd(b, a % b) : a;
}
template<typename T>
constexpr T combinator(T n, T m, T Mod = mod - 1)
{
	m = min(m, n - m);
	T ret = 1;
	for (T i = 1; i <= m; ++i)
	{
		ret = ret * (n - m + i) / i % Mod;
	}
	return ret;
}
template<typename T>
constexpr T poww(T a, T b, T Mod = mod)
{
	T ret = 1;
	a %= Mod;
	b %= Mod - 1;
	if (b < 0)b += Mod - 1;
	while (b)
	{
		if (b & 1)ret = ret * a % Mod;
		a = a * a % Mod;
		b >>= 1;
	}
	return ret;
}

struct Combinator
{
	static constexpr int Mod = ::mod;
	static constexpr int Maxn = ::maxn;
	int dp[Maxn][Maxn];//this is C(n,m)%(mod-1)
	constexpr Combinator() :dp()
	{
		for (int i = 0; i < Maxn; ++i)
		{
			for (int j = 0; j <= i; ++j)
			{
				if (j == 0) dp[i][j] = 1;
				else if (i == j) dp[i][j] = 1;
				else dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % (Mod - 1);
			}
		}
	}
};*/


int main()
{
	int x[3];
	while (cin >> x[0] >> x[1] >> x[2])
	{
		sort(x, x + 3);
		puts((x[0] == 5 && x[1] == 5 && x[2] == 7) ? "YES" : "NO");
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int c=0;
    while(a>0){
        a-=b;
        c++;
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;
import java.math.*;
public class Main 
{ 
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader()
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next()
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine();
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
   public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        int t=1;//sc.nextInt();
        while(t-->0)
        {
            int n=sc.nextInt(),k=sc.nextInt(),a[]=new int[n];
            for(int i=0;i<n;i++) a[i]=sc.nextInt();
            Arrays.sort(a);int sum=0;
            for(int i=0;i<k;i++) sum+=a[i];
            pw.println(sum);
        }
           pw.close();
    }
}
  

Measured memory_bytes: 39204
ls_t = [input().rstrip() for _ in range(int(input()))]
ls_s = [input().rstrip() for _ in range(int(input()))]
ls_marged = list(set(ls_t+ls_s))

result = 0

for word in ls_marged:
    t = ls_t.count(word)
    s = ls_s.count(word)
    result = max(result, t-s)

print(result)

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }



void func(std::string T){

    REP(i,0,T.size()){
        if(T.at(i)=='?')cout<<'D';
        else cout<<T.at(i);
    }
    cout<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    std::string T;
    std::cin >> T;
    func(T);
    return 0;
}


Measured memory_bytes: 3928
n = int(input())
lis = []
while n != 0:
    if n%26 == 0:
        lis.append(int(0))
        n -= 26
        n /= 26
    else:
        lis.append(int(n%26))
        n -= n%26
        n /= 26
alp = ["z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y"]
st = ""
for i in range(len(lis),0,-1):
    st += alp[lis[i-1]]
print(st)

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n)cin >> a[i];
	int count = 0;
	int k = 0;
	rep(i, n) {
		if (a[i] % 2 == 0) {
			count++;
			if (a[i] % 3 == 0 || a[i] % 5 == 0) {
				k++;
			}
		}
		
	}
	if (k == count) {
		cout << "APPROVED" << endl;
	}
	else {
		cout << "DENIED" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 250

int parent(int);
int left(int);
int right(int);

int main(){

  int heap[N],i,j,n;

  scanf("%d",&n);

  for(i=1;i<=n;i++) scanf("%d",&heap[i]);

  for(i=1;i<=n;i++){

    printf("node %d: ",i);
    printf("key = %d, ",heap[i]);
    if((i/2)>0) printf("parent key = %d, ",heap[i/2]);
    if((i*2)<=n) printf("left key = %d, ",heap[i*2]);
    if(((i*2)+1)<=n) printf("right key = %d, ",heap[i*2+1]);
    printf("\n");

}

  return 0;
} 

Measured memory_bytes: 600
/*created by tanishk gupta*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define repl(i,a,n) for(long long int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef vector<int> VI;
typedef long long int ll;
typedef unsigned long long ull;
//typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll MOD=1e9+7;
const ll mod=1e9+7;
//const llint MOD;
const ll N=(ll)(1e6+1);
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll add(ll a,ll b){return ((a%MOD)+(b%MOD))%MOD;}
ll mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
ll sub(ll a,ll b){return ((a%MOD)-(b%MOD)+MOD)%MOD;}
ll binpow(ll x, ll y){ll z = 1;while(y){if(y & 1) z = mul(z, x);x = mul(x, x);y >>= 1;}return z;}
ll inv(int x){return binpow(x, MOD - 2);}
ll divide(ll x, ll y){return mul(x, inv(y));}
ll fact[N];
void precalc(){fact[0] = 1;for(ll i = 1; i < N; i++)fact[i] = mul(fact[i - 1], i);}
ll C(ll n, ll k){return divide(fact[n], mul(fact[k], fact[n - k]));}
//bool prime[N];
//void sieve() {for(int i=2;i<N;i++) {prime[i]=true;}for (int p=2; p*p<=N; p++){if (prime[p] == true){for (int i=p*p; i<=N; i += p)prime[i] = false;}}}
ll legendpow(ll n, ll p){ll total = 0;while (n){n /= p;total += n;}return total;}

//head==================================================================================
/*I adj[200005];
int vis[200005];
int tot=0;
void dfs(int node)
{
    tot++;
    vis[node]=1;
    for (auto x : adj[node])
    {
        if (vis[x]==0)
        {
            dfs(x);
        }
    }
}*/


int main()
{

    int n;
    cin>>n;
    ll a[n];
    ll sum=0;
    rep(i,0,n){cin>>a[i];
    sum+=a[i];}
    ll p=mul(sum,sum);
    rep(i,0,n)
    {
        p=sub(p,mul(a[i],a[i]));
    }
    p=divide(p,2);
    cout<<p;
}


Measured memory_bytes: 5144
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
l=len(X)
cnt=0
for i in range(l):
 for j in range(i+1,l):
  t=sum((X[i][d]-X[j][d])**2for d in range(D))**0.5
  if t==int(t):cnt+=1
print(cnt)

Measured memory_bytes: 9396
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


int f(int y, int a, int b)
{	return (a * y + b) % 26;	}

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

	rep(i, n)
	{
		string str;
		getline(cin, str);

		int len = str.size();

		for(int a = 0; ; a++)
		{
			if(a % 2 != 0 && a % 13 != 0)
			{
				rep(b, 26)
				{
					// Ï·Îe[u
					int v[26];
					rep(y, 26)
						v[f(y, a, b)] = y;
					

					// Ï·
					string con = str;
					rep(in, len)
						if('a' <= con[in] && con[in] <= 'z')
							con[in] = v[con[in] - 'a'] + 'a';


					// Î`FbN
					rep(in, len - 3)
					{
						if(con.substr(in, 4) == "that" || con.substr(in, 4) == "this")
						{
							cout << con << endl;
							goto ng;
						}
					}
				}
			}
		}
ng:
		;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll mod=INF;

void Add(int &a, int b) {
  a += b;
  while (a >= MOD) a -= MOD;
  while (a < 0) a += MOD;
}
 
void Mul(int &a, int b) {
  a = 1LL * a * b % MOD;
}
 
int Pow(int b, int e) {
  if (e < 0) e += MOD - 1;
  int ret = 1;
  while (e) {
    if (e & 1) ret = 1LL * ret * b % MOD;
    b = 1LL * b * b % MOD;
    e >>= 1;
  }
  return ret;
}
 
namespace Math {
  const int NMAX = (int)1e5;
  int pow2[1 + NMAX];
  int fact[1 + NMAX], tcaf[1 + NMAX];
  void Precalc() {
    fact[0] = pow2[0] = 1;
    for (int i = 1; i <= NMAX; ++i) {
      pow2[i] = pow2[i - 1];
      Add(pow2[i], pow2[i]);
 
      fact[i] = fact[i - 1];
      Mul(fact[i], i);
    }
    tcaf[NMAX] = Pow(fact[NMAX], -1);
    for (int i = NMAX - 1; i >= 0; --i) {
      tcaf[i] = tcaf[i + 1];
      Mul(tcaf[i], i + 1);
      assert(1LL * fact[i] * tcaf[i] % MOD == 1);
    }
  }
  int Choose(int n, int k) {
    if (k > n || n < 0) return 0;
    return 1LL * fact[n] * tcaf[n - k] % MOD * tcaf[k] % MOD;
  }
};

int main() {
    string s;
    int k;
    cin >> s >> k;
    vector<ll> a(0);
    ll c=0,su=0;
    rep(i,s.size()){
        if (s[i]=='0'){
            a.push_back(c);
            c=0;
        }
        else {c++;su++;}
    }
        if (k>su) k=su;
        int t=(k+c+1)*2+4;
        vector<vector<ll>> w(k+c+1,vector<ll>(k+1));
        rep(j,k+c+1){
                rep(ww,k+1) w[j][ww]=0;
            }
        vector<vector<ll>> we(k+c+1,vector<ll>(k+1));
        we=w;
        w[0][0]=1;
        rep(i,a.size()){
            vector<vector<ll>> wt(k+c+1,vector<ll>(k+1));
            wt=we;
            rep(j,t){
                if (j<=k+c+1){
                    int r=k+c+1-j;
                    if (a[i]-r<0) continue;
                    rep(ii,k+c+1){
                        rep(jj,k+1){
                            if (ii<jj+r) continue;
                            if (jj+r>=k+1) break;
                            (wt[ii][jj+r]+=w[ii][jj])%=MOD;
                        }
                    }
                }
                else {
                    int r=j-k-c-1;
                    rep(ii,k+c+1){
                        rep(jj,k+1){
                            if (ii+r<jj) continue;
                            if (ii+r>=k+c+1) break;
                            (wt[ii+r][jj]+=w[ii][jj])%=MOD;
                        }
                    }
                }
            }
            w=wt;
        }
        ll ans=0;
        rep(j,c+1){
            rep(i,k-j+1){
                ans=(ans+w[i+j][i])%MOD;
            }
        }
        cout << ans << endl;
}


Measured memory_bytes: 5572
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	string s;
	double u;
	double ans=0.0;
	for (size_t i = 0; i < N; ++i) {
		cin >> u >> s;
		if (s == "JPY") ans += u;
		else ans += u * 380000.0;
	}
	cout << (double)ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, k, n, ans = 0, min;
  scanf("%lld", &n);
  ll a[n];
  for(i = 0; i < n; ++i) {
    scanf("%lld", &a[i]);
    a[i] -= i + 1;
  }
  sort(a, a + n);
  for(i = 0; i < n; ++i) {
    ans += a[i] - a[0];
  }
  min = ans;
  for(i = 1; i < n; ++i) {
    ll tmp = ans;
    ll t = a[i] - a[i - 1];
    tmp += i * t;
    tmp -= (n - i) * t;
    ans = tmp;
    if(min > ans) min = ans;
  }
  printf("%lld", min);
  return 0;
}

Measured memory_bytes: 1664
import java.util.Scanner;

public class Main {
	static int max(int x, int y) {
		if (x>y) {
			return x;
		} else {
			return y;
		}
	}
	public static int LCS(char[] x, char[] y) {
		int m = x.length;
		int n = y.length;
		int[][] compArray = new int[m+1][n+1];
		for (int i=0; i<=m; i++ ) {
			for (int j=0; j<=n; j++) {
				compArray[i][j] = 0;
			}
		}
		for (int i=0; i<=m; i++) {
			for (int j=0; j<=n; j++) {
				if (i==0 || j==0) {
					continue;
				}
				else if (x[i-1]!=y[j-1]) {
					compArray[i][j] = max(compArray[i-1][j], compArray[i][j-1]);
					
				} else {
					compArray[i][j] = compArray[i-1][j-1] + 1;
				}
			}
		}
		return compArray[m][n];
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int numCalls = in.nextInt();
		in.nextLine();
		for (int i=0; i<numCalls; i++) {
			String sample1text = in.nextLine();
			char[] sample1 = sample1text.toCharArray();
			String sample2text = in.nextLine();
			char[] sample2 = sample2text.toCharArray();
			System.out.println(LCS(sample1, sample2));
		}
	}

}



Measured memory_bytes: 64000
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top=0, s[1000];

void push(int x)
{
	s[++top]=x;
}

int pop()
{
	return s[top--];
}

int main()
{
	int a,b;
	char S[101];
	while( scanf("%s", S) != EOF )
	{
		if ( S[0]=='+')
		{
			/* code */
			a=pop();
			b=pop();
			push(a+b);			
		}
		else if ( S[0]=='*')
		{
			/* code */
			a=pop();
			b=pop();
			push(a*b);
		}
		else if ( S[0]=='-')
		{
			/* code */
			a=pop();
			b=pop();
			push(b-a);
		}
		else
		{
			push(atoi(S));
		}
		
	}
	//printf("%d\n", pop());
	printf("%d\n",s[1]);
}


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

int main() {
	int n,k;
	int ara[200000];
	cin>>n>>k;
	for (int i=0;i<n;i++){
		cin>>ara[i];
	}
	for (int i=k;i<n;i++){
		if (ara[i]>ara[i-k]){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 4412
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE BangPatterns          #-}
{-# LANGUAGE CPP                   #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE RecordWildCards       #-}
{-# LANGUAGE TupleSections         #-}
{-# LANGUAGE TypeFamilies          #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import qualified Data.Foldable               as F
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    [a, b, q] <- map read.words <$> getLine :: IO [Int]
    sstsxs <- U.unfoldrN (a + b + q) (B.readInt.B.dropWhile isSpace) <$> B.getContents
    let (ss, tsxs) = U.splitAt a sstsxs
    let (ts, xs) = U.splitAt b tsxs
    putStr.unlines.map show $ solve ss ts xs

inf :: Int
inf = 0x3f3f3f3f3f3f3f3f

solve :: U.Vector Int -> U.Vector Int -> U.Vector Int -> [Int]
solve ss ts xs = map f $ U.toList xs
  where
    f x = minimum
        [ abs (sl - x) + abs (tl - sl) `min` abs (tr - sl)
        , abs (sr - x) + abs (tl - sr) `min` abs (tr - sr)
        , abs (tl - x) + abs (sl - tl) `min` abs (sr - tl)
        , abs (tr - x) + abs (sl - tr) `min` abs (sr - tr)
        ]
      where
        (!sl, !sr) = neighbor x ss
        (!tl, !tr) = neighbor x ts

neighbor :: Int -> U.Vector Int -> (Int, Int)
neighbor x vec
    | x < U.head vec = (inf, U.head vec)
    | i + 1 < U.length vec = (U.unsafeIndex vec i, U.unsafeIndex vec (i + 1))
    | otherwise = (U.last vec, inf)
  where
    i = upperBound 0 (U.length vec - 1) (\i -> U.unsafeIndex vec i <= x)

-------------------------------------------------------------------------------

lowerBound :: (Integral i) => i -> i -> (i -> Bool) -> i
lowerBound low high p = go low high
  where
    go !low !high
        | high <= low = high
        | p mid       = go low       mid
        | otherwise   = go (mid + 1) high
      where
        h = toInteger high
        l = toInteger low
        mid = fromIntegral $ l + div (h - l) 2
{-# INLINE lowerBound #-}

upperBound :: (Integral i) => i -> i -> (i -> Bool) -> i
upperBound low high p
    | p high = high
    | otherwise = lowerBound low high (not.p) - 1
{-# INLINE upperBound #-}


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

int main()
{
	int n, k, u, v;
	cin >> n;
	// N * N matrix filled with 0
	vector< vector<int> > mat(n, vector<int>(n, 0));

	for(int i=0; i<n; i++){
		cin >> u >> k;
		// adjust 0 origen
		u--;
		for(int j=0; j<k; j++){
			cin >> v;
			//cout << "vertex: " << v << '\n';
			// adjust 0 origen
			v--;
			mat[u][v] += 1;
		}
		//cout << '\n';
	}

	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(j==0) printf("%d", mat[i][j]);
			else printf(" %d", mat[i][j]);
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3312
import sys,itertools
input = sys.stdin.readline

n,m,q = map(int,input().split())
seq = list(range(n+m-1))
p = list(itertools.combinations(seq,n))

a = [0]*q
b = [0]*q
c = [0]*q
d = [0]*q

for i in range(q):
    a[i],b[i],c[i],d[i] = map(int,input().split())

res = 0
for i in range(len(p)):
    t = [0]*n
    pp = sorted(p[i])
    idx = 0
    for e in pp:
        t[idx] = 1+e-idx
        idx += 1
    
    tmp = 0
    for j in range(q):
        if t[b[j]-1] - t[a[j]-1] == c[j]:
            tmp += d[j]
    
    res = max(res,tmp)

print(res)


Measured memory_bytes: 21480
#include <stdio.h>

int main(void){
	int a,b,c,d,e,f;
	int g;
	
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	
	
	
	g = 1*a+5*b+10*c+50*d+100*e+500*f;
	
	if(1000<=g){
		printf("%d\n",1);
	}else{
		printf("%d\n",0);
	}
	
	return 0;
}

Measured memory_bytes: 1032
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var p = Input();
		var x = p[0].ToLong();
		var y = p[1].ToLong();
		var start = x;
		int i = 0;
		for(; start <= y; i++)
		{
			start = start * 2;
		}
		Console.WriteLine(i);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}



Measured memory_bytes: 13140
import itertools
import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]

for i in range(N):
    x[i], y[i] = map(int, input().split())
def fact(N):
    if N == 0:
        return 1
    return N * fact(N - 1)

total = 0
for p in itertools.permutations(range(N)):
    dis = 0
    for i in range(len(p) -1):
        dis += math.sqrt((x[p[i + 1]] - x[p[i]]) ** 2 + (y[p[i + 1]] - y[p[i]]) ** 2)
    total += dis
print(total / fact(N))

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <array>
#include <climits>

using namespace std;

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

const ll MOD = 10e9 + 7;
const ll INF = LLONG_MAX;
const ll MAX_V = 10e3;
const double EPS = 10e-6;
const double PI = 3.14159265359;

//int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int d[] = {0,1,0,-1};
//int nx = x + d[i];
//int ny = y + d[(i+1)%4]


int cave[1000][1000]{},n,m;
P pos[1000000], dp[1000][1000];
bool isprime[1001000];

void prime(int n) {
	for (int i = 0; i <= n; i++)isprime[i] = true;
	isprime[0] = false;
	isprime[1] = false;
	for (int i = 2; i*i <= n; i++) {
		if (isprime[i]) {
			for (int j = 2; i*j <= n; j++) {
				isprime[i*j] = false;
			}
		}
	}
}

P rec(int y, int x) {
	if (y < 0 || y >= 1000 || x<0 || x >= 1000 || cave[y][x]>m)return { 0,0 };
	if (dp[y][x].second != -1)return dp[y][x];
	vector<P> ls;
	for (int i = -1; i <= 1; i++) {
		ls.push_back(rec(y + 1, x + i));
	}
	sort(ls.begin(), ls.end());
	P res = ls[2];
	if (isprime[cave[y][x]]) {
		if (res.second <= 0)res.second = cave[y][x];
		res.first++;
	}
	dp[y][x] = res;
	return res;
}



int main() {
	int num = 1000000, ti = 0, tj = 0, tk = 0;
	while (num > 0) {
		cave[ti][tj] = num;
		pos[num] = { ti,tj };
		int pi = ti + d[tk], pj = tj + d[(tk+1)%4];
		if (pi < 0 || pi >= 1000 || pj < 0 || pj >= 1000 || cave[pi][pj]>0) {
			tk = (tk + 1) % 4;
		}
		ti += d[tk];
		tj += d[(tk + 1) % 4];
		num--;
	}
	prime(1000000);

	while (1) {
		cin >> m >> n;
		if (n == 0)break;
		for (int i = 0; i < 1000; i++) {
			for (int j = 0; j < 1000; j++) {
				dp[i][j] = { -1,-1 };
			}
		}
		P ans = rec(pos[n].first, pos[n].second);
		cout << ans.first << " " << ans.second << endl;
	}
	return 0;
}


Measured memory_bytes: 39300
"use strict"
 
const f = (A, B) => {
  return Math.max(String(A).length, String(B).length);
}
 
function Main(input) {
  input = parseInt(input.trim(), 10);
  const max = Math.floor(Math.sqrt(input));
 
  let ret = 1e10;
  for(let i=1; i<=max; i++){
    if(input%i === 0){
      let A = input / i;
      let k = f(A, i);
      if(k < ret) ret = k;
    }
  }
 
  console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 8396
import java.util.*;

// 
// 

public class Main {

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

		int N = in.nextInt();
		int T = in.nextInt();
		
		int answer = Integer.MAX_VALUE;
		
		for (int i = 0; i < N; i++) {
			int cost = in.nextInt();
			int time = in.nextInt();
			
			if (time <= T && cost < answer) {
				answer = cost;
			}
			
		}
		
		
		if (answer == Integer.MAX_VALUE) {
			System.out.println("TLE");
		} else {
			System.out.println(answer);
		}
	}
}

class TreeNode {
	int val;
	TreeNode left;
	TreeNode right;

	TreeNode(int x) {
		val = x;
	}
}

class TreeDrawer {
	public static String treeNodeToString(TreeNode root) {
		if (root == null) {
			return "[]";
		}

		String output = "";
		Queue<TreeNode> nodeQueue = new LinkedList<>();
		nodeQueue.add(root);
		while (!nodeQueue.isEmpty()) {
			TreeNode node = nodeQueue.remove();

			if (node == null) {
				output += "null, ";
				continue;
			}

			output += String.valueOf(node.val) + ", ";
			nodeQueue.add(node.left);
			nodeQueue.add(node.right);
		}
		return "[" + output.substring(0, output.length() - 2) + "]";
	}

	public static TreeNode stringToTreeNode(String input) {
		input = input.trim();
		input = input.substring(1, input.length() - 1);
		if (input.length() == 0) {
			return null;
		}

		String[] parts = input.split(",");
		String item = parts[0];
		TreeNode root = new TreeNode(Integer.parseInt(item));
		Queue<TreeNode> nodeQueue = new LinkedList<>();
		nodeQueue.add(root);

		int index = 1;
		while (!nodeQueue.isEmpty()) {
			TreeNode node = nodeQueue.remove();

			if (index == parts.length) {
				break;
			}

			item = parts[index++];
			item = item.trim();
			if (!item.equals("null")) {
				int leftNumber = Integer.parseInt(item);
				node.left = new TreeNode(leftNumber);
				nodeQueue.add(node.left);
			}

			if (index == parts.length) {
				break;
			}

			item = parts[index++];
			item = item.trim();
			if (!item.equals("null")) {
				int rightNumber = Integer.parseInt(item);
				node.right = new TreeNode(rightNumber);
				nodeQueue.add(node.right);
			}
		}
		return root;
	}

	public static void prettyPrintTree(TreeNode node, String prefix, boolean isLeft) {
		if (node == null) {
			System.out.println("Empty tree");
			return;
		}

		if (node.right != null) {
			prettyPrintTree(node.right, prefix + (isLeft ? "│   " : "    "), false);
		}

		System.out.println(prefix + (isLeft ? "└── " : "┌── ") + node.val);

		if (node.left != null) {
			prettyPrintTree(node.left, prefix + (isLeft ? "    " : "│   "), true);
		}
	}

	public static void draw(TreeNode node) {
		prettyPrintTree(node, "", true);
	}
}

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

int main()
{

    char a[3];
    cin >> a[0]>>a[1]>>a[2];
    for (int i = 0; i < 3; i++)
    {
        if(a[i]=='7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

int main(){
	int w, h;
	string s[1005];
	set<string> st;
	char c;
	
	cin >> w >> h;
	for(int i = 0;i < h;st.insert(s[i++])){
		for(int j = 0;j < w;++j){
			cin >> c;
			s[i] += c;
		}
	}
	
	sort(s, s + h);
	
	bool ans = true;
	int cnt = 0;
	
	for(int i = 0;i < w;++i){
		if(s[0][i] == '1'){
			++cnt;
		}
		if(s[h /  2 - 1][i] == s[(h + 1) / 2][i]){
			ans = false;
		}
	}
	
	if((cnt != w / 2 && cnt != (w + 1) / 2) || st.size() != 2) ans = 0;
	cout << (ans?"yes":"no") << endl;
	
	return 0;
}



Measured memory_bytes: 3980
#include<bits/stdc++.h>
using namespace std;
string a;
int l,i,j,f=0,m;
int main() {
	cin>>a;
	l=a.size();
	for(i=0; i<l; i++) {
		if(a[i]=='C') {
			m=i;
			for(i=m; i<l; i++) {
				if(a[i]=='F') {
					f=1;
				}
			}
		} 
	}
	if(f==1) {
		cout<<"Yes"<<endl;
		return 0;
	} else {
		cout<<"No"<<endl;
		return 0;
	}
}

Measured memory_bytes: 256