akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision


#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

namespace Problem{
using namespace std;
class Writer{
static ostringstream oss;
public:template<class T> void appendln(const vector<vector<T>> &ans,string spl=" ", string el="\n"){for(int i=0; i<(int)ans.size(); ++i){for(int j=0; j<(int)ans[i].size(); ++j){oss << ans[i][j];oss << (j==(int)ans[i].size()-1?el:spl);}}}
    template<class T> void appendln(const vector<T>& ans, string spl=" "){for(int i=0; i<(int)ans.size(); ++i){oss << ans[i] << (i==(int)ans.size()-1?"\n":spl);}}
    template<class T> void appendln(const T& answer){oss << answer << "\n";}
    template<class T> void append(const T& answer){oss << answer;}
    void appends(const string spl){oss.seekp((int)oss.tellp()-1);oss<<"\n";}
    template<class F, class... R>void appends(const string spl,const F& fi, const R&... rest){oss << fi << spl; appends(spl, rest...);}
    static void write(){cout << oss.str();}
    Writer(){static bool is_single =true;assert(is_single);is_single=false;};
};ostringstream Writer::oss;


class Solver{
public:
    int n;
    vector<string> s;
    Solver(LL n):n(n),s(n){};

    void solve(){
        for(int i=0; i<n; ++i){
            cin >> s[i];
        }
        int ans = 0;
        if(check(0,0))ans+=n;
        for(int i=1; i<n; ++i){
            if(check(i,0)) ans += n-i;
            if(check(0,i)) ans += n-i;
        }
        cout <<ans <<"\n";
    }
    bool check(int a, int b){
        for(int i=0; i<n; ++i){
            for(int j=0; j<n; ++j){
                if(s[(i+a)%n][(j+b)%n]!=s[(j+a)%n][(i+b)%n])return false;
            }
        }
        return true;
    }
};
}

int main(){
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    long long n=0;
    std::cin >> n;
    Problem::Solver sol(n);
    sol.solve();
    Problem::Writer::write();
    return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

using namespace std;

int count(char s[])
{
    int i = 0;
    while (s[i]){
        i++;
    }
    return i;
}

int main()
{
    int n;
    char s[100];
    int c = 1;
    
    cin>> n;
    cin >> s;
    
    if (n%2 == 1){
        cout << "No" << endl;
        c = 0;
    }
    
    else {
        for (int i = 0;i < count(s)/2;i++){
            if (s[i] != s[i+count(s)/2]){
                cout << "No" << endl;
                c = 0;
                break;
            }
        }
    }
    
    if (c == 1){
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 256
var a:array[0..100000]of longint;
    b:array[0..100000]of boolean;
    n,i,j:longint;
begin
  readln(n);
  for i:=1 to n do
    read(a[i]);
  i:=1;
  while true do
  begin
    inc(j);
    if a[i]=2 then
    begin
      writeln(j);
      halt;
    end;
    if b[i] then
    begin
      writeln(-1);
      halt;
    end;
    b[i]:=true;
    i:=a[i];
  end;
end.

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdlib>

using namespace std;

int comp(const void *left, const void *right){
    char *a = (char*)left;
    char *b = (char*)right;
    int len_a = strlen(a);
    int len_b = strlen(b);
    int len = (len_a > len_b)? len_b : len_a;
    int i;
    for (i=0; i<len; i++){
        if (a[i] != b[i]) {
            return a[i] - b[i];
        }
    }
    return len_a - len_b;
}

int main(){
    
    char s[100][101];
    int n, l;
    int i;
    
    cin >> n >> l;
    for (i=0; i<n; i++){
        cin >> s[i];
    }
    
    qsort(s, n, sizeof(char)*101, comp);
    
    for (i=0; i<n; i++){
        cout << s[i];
    }
    cout << '\n';
    
    return 0;
}


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

int main()
{
  float r;
  cin >> r;
  cout << (float)2.000000000 * r * (float)3.14159265358979 << endl;
  return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int h, w;
char s[500][505];
char t[500][505];

void init() {
    forn(i, h) forn(j, w) {
        t[i][j] = 'o';
    }
    forn(i, h) {
        t[i][w - 1] = 'x';
        t[i][w] = '\0';
    }
    for (int i = 1; i < h; i += 2) {
        for (int j = 1; j < w; ++j) {
            t[i][j] = 'x';
        }
    }
    //forn(i, h) cerr << t[i] << endl;
}

int main() {
    //freopen("input.txt", "r", stdin);
    scanf("%d%d", &h, &w);
    init();
    forn(i, h) scanf("%s", s[i]);
    forn(i, h) {
        forn(j, w) {
            if (s[i][j] == '#' || t[i][j] == 'o') {
                printf("#");
            } else {
                printf(".");
            }
        }
        printf("\n");
    }
    printf("\n");
    forn(i, h) {
        forn(j, w) {
            if (s[i][j] == '#' || t[i][j] == 'x') {
                printf("#");
            } else {
                printf(".");
            }
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
  ll int n;
  cin >> n;
  ll int sum = 0;
  // ll int c;
  for (int i = 0; i <= 41; i++) {
    sum = sum + pow(2, i);
    // c = pow(2, i);
    if (sum >= n) {
      cout << sum;
      break;
    }
    // c = 0;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a = 0;
  for(int i=1;i<=9;i++){
    for(int j =1;j<=9;j++){
      if(N==i*j){
        a++;
      }
    }
  }
  
  if(a>=1){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int inf = 1<<29;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

int main () {
  int N; cin >> N;
  vi H(N); rep(i,N) cin >> H[i];

  rep(i,N) {
    if (i == 0) continue;

    if (H[i-1] > H[i]) {
      puts("No");
      return 0;
    }

    if (H[i-1] <= H[i]-1) {
      H[i] = H[i]-1;
    }
  }
  puts("Yes");
  return 0;
}

Measured memory_bytes: 640
/// IN THE NAME OF GUITAR
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef pair<ll, ll> pll;

#define sz(x)                       (ll) x.size()
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
 
ll Pow(ll a, ll b, ll md, ll ans = 1) {
    for (; b; b >>= 1, a = a * a % md)
        if (b & 1)
            ans = ans * a % md;
    return ans % md;
}
 
const ll MAXN = 1e3 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
bitset<MAXN> dp; vector<ll> comp[3][MAXN], adj[MAXN];
ll mark[MAXN][MAXN], col[MAXN], n, m, t = 0, ridi = 0;

void DFS(ll v, ll c, ll cp) {
	comp[c][cp].push_back(v);
	col[v] = c;
	for (ll u : adj[v]) {
		if (col[v] == col[u]) ridi = 1;
		if (col[u]) continue;
		DFS(u, 3 - c, cp);
	}
}

int main() {
	scanf("%lld%lld", &n, &m);
	for (ll i = 1; i <= m; i++) {
		ll u, v; scanf("%lld%lld", &u, &v);
		mark[u][v] = mark[v][u] = 1;
	}
	for (ll i = 1; i <= n; i++) {
		for (ll j = i + 1; j <= n; j++) {
			if (mark[i][j] == 0) {
				adj[i].push_back(j);
				adj[j].push_back(i);
			}
		}
	}
	for (ll i = 1; i <= n; i++) {
		if (col[i] == 0) {
			DFS(i, 1, ++t);
		}
	}
	if (ridi) return !printf("-1\n");
	dp[0] = 1;
	for (ll i = 1; i <= t; i++) {
		dp = (dp << sz(comp[2][i])) | (dp << sz(comp[1][i]));
	}
	ll ans = INF;
	for (ll i = n / 2; i >= 0; i--) {
		if (dp[i]) {
			ans = min(ans, (i * (i - 1) / 2) + ((n - i) * (n - i - 1) / 2));
		}
	}
	printf("%lld\n", ans);
    return 0;
}
 

Measured memory_bytes: 10764
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; i++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	int A[3][3];
	rep(i, 3)rep(j, 3)cin >> A[i][j];
	int N; cin >> N;
	vector<int> b(N); rep(i, N)cin >> b[i];

	bool C[3][3] = {};
	rep(i, N) {
		rep(j, 3) {
			rep(k, 3) {
				if (A[j][k] == b[i]) C[j][k] = 1;
			}
		}
	}

	rep(i, 3) {
		if (C[i][0] == 1 && C[i][1] == 1 && C[i][2] == 1) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	rep(i, 3) {
		if (C[0][i] == 1 && C[1][i] == 1 && C[2][i] == 1) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	if (C[0][0] == 1 && C[1][1] == 1 && C[2][2] == 1) {
		cout << "Yes" << endl; return 0;
	}
	if (C[0][2] == 1 && C[1][1] == 1 && C[2][0] == 1) {
		cout << "Yes" << endl; return 0;
	}

	cout << "No" << endl;
}

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

int main() {
	int h, w;
	cin >> h >> w;
	vector<string>a(h);
	for (int i = 0;i < h;++i) {
		cin >> a[i];
	}
	vector<bool>row(h, false);
	vector<bool>col(w, false);
	for (int i = 0;i < h;++i) {
		for (int j = 0;j < w;++j) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}
	for (int i = 0;i < h;++i) {
		if (row[i]) {
			for (int j = 0;j < w;++j) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    vector<ll> a(N);
    vector<ll> accum(N, 0);
    map<ll, ll> mp;

    for(int i=0; i<N; i++){
        cin >> a[i];
        if(i == 0) accum[0] = a[0];
        else accum[i] = accum[i-1] + a[i];

        mp[accum[i]]++;
    }
    mp[0]++;

    ll ans = 0;
    for(auto itr=mp.begin(); itr!=mp.end(); itr++) ans += ((itr->second)*(itr->second-1))/2;

    cout << ans << endl;
}

Measured memory_bytes: 15872
#include <cstdio>
#define rg register
using namespace std;
typedef long long ll;
template <typename Tp> inline int getmin(Tp &x,Tp y){return y<x?x=y,1:0;}
template <typename Tp> inline int getmax(Tp &x,Tp y){return y>x?x=y,1:0;}
template <typename Tp> inline void read(Tp &x)
{
    x=0;int f=0;char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') f=1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    if(f) x=-x;
}
ll n,x,d;
ll calc(ll n,ll x)
{
	if(n%x==0) return n/x*x*2-x;
	return calc(x,n%x)+n/x*x*2;
}
int main()
{
	read(n);read(x);
	printf("%lld\n",n+calc(n-x,x));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
    int a[10], b[10];
    a[0] = 1;
    for (int i = 1; i < 10; ++i) a[i] = 2 * a[i-1];

    int n;
    while (cin >> n) {
        for (int i = 9; i >= 0; --i) b[i] = 0;
        for (int i = 9; i >= 0; --i) if (n >= a[i]) {
            n -= a[i];
            b[i]++;
        }
        ostringstream os;
        for (int i = 0; i < 10; ++i) if (b[i])
            os << " " << a[i];
        cout << os.str().substr(1) << endl;
    }
    return 0;
}

Measured memory_bytes: 0
require "matrix"

$<.map {|a| a.split.map(&:to_i)}.each do |a|
  Matrix[[a[0], a[1]], [a[3], a[4]]]
    .lup
    .solve([a[2], a[5]])
    .map{|b| b.to_f.round(3)}
    .tap{|c| print format("%.3f %.3f\n", c[0], c[1])}
end

Measured memory_bytes: 9468
#include <bits/stdc++.h>
using namespace std;
#define double long double
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define rsort(a) sort(all(a),greater<>())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> V;
const long long MOD=1000000007;
const long long INF = 1e18;
vector <ll> dp;


void solve(long long N, std::vector<std::vector<long long>> A){
    ll sum=0;
    V A1(N,0);
    V A2(N,0);
    A1[0] = A[0][0];
    A2[0] = A[1][0];
    for (ll i = 1; i < N; i++) {
        A1[i] = A[0][i] + A1[i-1];
        A2[i] = A[1][i] + A2[i-1];
    }
    sum = A1[0] + A2[N-1];
    for (ll i = 0; i < N; i++) {
        sum = max(sum, A1[i] + A2[N-1] - A2[i-1]);
        // sum = A1[i] + A2[N-1] - A2[i-1];
    }
    cout << sum << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::vector<long long>> A(2, std::vector<long long>(N));
    for(int i = 0 ; i < 2 ; i++){
        for(int j = 0 ; j < N ; j++){
            scanf("%lld",&A[i][j]);
        }
    }
    solve(N, std::move(A));
    return 0;
}


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

int main(){

	int n, answer, a;
	std::cin >> n;
	std::vector<int> number(n-1); //足し算に使う数を入れる
	std::vector<long int> move(21,0),moving(21,0); //０から２０までの箱

	for(int i=0;i<n-1;++i){
		std::cin >> number[i];
	}
	std::cin >> answer;

	move[number[0]]=1;

	/*
	０から２０までの箱を用意し、加算減算によって出た答えの箱に１票入れる。
	最後、求める答えの箱に入っていた票数が何通りかを表す。
	*/
	for(int i=1;i<n-1;i++){
		for(int j=0;j<21;j++){
			if(move[j]!=0){
				if((a=j+number[i])<=20){
					moving[a]+=move[j];
				}
				if((a=j-number[i])>=0){
					moving[a]+=move[j];
				}
				move[j]=0;
			}
		}
		for(int j=0;j<21;j++){
			move[j] = moving[j];
			moving[j]=0;
		}
	}
	std::cout << move[answer] << std::endl;

	return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <functional>
#include <cmath>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define P(r) do{for(auto i:r){cout<<i<<' ';}cout<<'\n';}while(0)
int main()
{
    string s; cin >> s;
    string ans;
    for (char c : s) {
        if (c == '0') ans += '0';
        if (c == '1') ans += '1';
        if (c == 'B' && ans.size() > 0) ans.erase(ans.end()-1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>

using namespace std;

class AChangingACharacter {
public:
    void solve(std::istream& in, std::ostream& out) {
        int N, K;
        in >> N >> K;
        string S;

        in >> S;
        S[K - 1] += 'a' - 'A';
        out << S << endl;
    }
};


int main() {
    AChangingACharacter solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = Long.parseLong(sc.next());
        long b = Long.parseLong(sc.next());
        long x = Long.parseLong(sc.next());
        long ans = (b / x) - (a / x);
        if (a % x == 0) {
            ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;

int main(int argc, char *argv[])
{
	int X;
	int p;
	int s;
	cin >> X;
	
	while (true) {
		if (X % 2 == 0) {
			s = 1;
		} else {
			s = 2;
		}
		int a = int(sqrt(X));
		int i;
		for (i = 2; i < a + 1; i++) {
			if (X % i == 0) {
				break;
			}
		}
		if (i == a + 1) {
			break;
		}
		X += s;
	};
	cout << X << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

int main() {
	string s; cin >> s;
	int K; cin >> K;
	set<string> se;

	rep(i, 0, s.size()) {
		repe(j, 1, 5) {
			se.insert(s.substr(i, j));
		}
	}

	int i = 0;
	for (set<string>::iterator it = se.begin(); it != se.end(); it++) {
		i++;
		if (i == K) {
			cout << *it << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 1664
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
int p[110];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	int tot=0;
	for(int i=0;i<a;i++)tot+=p[i];
	int val=mod;
	int at=0;
	for(int i=0;i<a;i++){
		int tmp=ABS(tot-p[i]*a);
		if(val>tmp){
			at=i;val=tmp;
		}
	}
	printf("%d\n",at);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
int main(){
	long long n;cin>>n;
	long long ans=0;
	for(long long i=0;i<=n;i++){
		if(i*i<=n){
			ans=i*i;
		}else{
			break;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,mon=10000,k[105],l[105];
  cin>>a>>b;
  for(int i=0;i<a;++i){
    cin>>k[i]>>l[i];
    if(l[i]<=b) mon=min(mon,k[i]);
  }
  if(mon==10000) cout<<"TLE"<<endl;
  else cout<<mon<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
vector<int>g[110000];
int bfs[110000];
int pr[110000];
int in[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a+b-1;i++){
		int p,q;
		scanf("%d%d",&p,&q);p--;q--;
		g[p].push_back(q);
		in[q]++;
	}
	queue<int> Q;
	for(int i=0;i<a;i++){
		if(in[i]==0){
			pr[i]=-1;
			Q.push(i);
		}
	}
	while(Q.size()){
		int at=Q.front();Q.pop();
		for(int i=0;i<g[at].size();i++){
			in[g[at][i]]--;
			if(in[g[at][i]]==0){
				pr[g[at][i]]=at;
				Q.push(g[at][i]);
			}
		}
	}
	for(int i=0;i<a;i++)printf("%d\n",pr[i]+1);
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


int N;
int C[202];
int D[202];
int A[202];
string S="";
int numask;

int ask(vector<int> V) {
	numask++;
	string S;
	assert(V.size()==N);
	cout<<"?";
	FORR(c,V) cout<<" "<<(c+1);
	cout<<endl;
	
	
	if(A[0]>=0) {
		int num=0;
		FORR(c,V) num+=A[c];
		//cout<<num<<endl;
		return num>N/2;
	}
	
	cin>>S;
	return S=="Red";
}


void ans() {
	
	cout<<"! ";
	int i;
	FOR(i,2*N) {
		if(C[i]) cout<<"R";
		else cout<<"B";
	}
	cout<<endl;
	
	if(A[0]>=0) {
		int ok=0;
		FOR(i,2*N) ok+=A[i]==C[i];
		cout<<ok<<endl;
	}
	exit(0);
	return;
}




void solve() {
	int i,j,k,l,r,x,y; string s;
	
	if(S.size()) {
		N=S.size()/2;
	}
	else {
		cin>>N;
	}
	
	vector<int> V;
	MINUS(A);
	FOR(i,S.size()) A[i]=S[i]=='R';
	
	FOR(i,2*N) C[i]=2;
	/*
	FOR(i,2*N) V.push_back(i);
	random_shuffle(ALL(V));
	ZERO(A);
	FOR(i,N) A[V[i]]=1;
	FOR(i,2*N) cout<<A[i];
	cout<<endl;
	*/
	
	vector<int> B;
	FOR(i,N) B.push_back(i);
	int L=0;
	int R=N;
	int RS=ask(B);
	int LS=RS^1;
	while(L+1<R) {
		int M=(L+R)/2;
		B.clear();
		FOR(x,M) B.push_back(x);
		FOR(x,N-M) B.push_back(2*N-1-x);
		sort(ALL(B));
		y=ask(B);
		if(y==RS) R=M;
		else L=M;
	}
	
	
	int pov=L,a,b;
	C[pov]=RS;
	C[N+pov]=RS^1;
	
	if(A[0]>=0) {
		cout<<L<<" "<<R<<endl;
		FOR(i,2*N) cout<<A[i];
		cout<<endl;
		FOR(i,2*N) cout<<C[i];
		cout<<endl;
	}
	
	for(i=pov+1;i<N+pov;i++) {
		B.clear();
		for(x=0;x<pov;x++) B.push_back(x);
		for(x=N+pov+1;x<2*N;x++) B.push_back(x);
		B.push_back(i);
		sort(ALL(B));
		y=ask(B);
		if(y==RS) C[i]=C[pov];
		else C[i]=C[N+pov];
		
		
	}
	if(A[0]>=0) {
		FOR(i,2*N) cout<<A[i];
		cout<<endl;
		FOR(i,2*N) cout<<C[i];
		cout<<endl;
	}
	vector<int> NC;
	a=0,b=0;
	for(i=pov;i<=N+pov;i++) {
		if(C[i]==1) {
			if(a<N/2) {
				a++;
				NC.push_back(i);
			}
		}
		else {
			if(b<N/2) {
				b++;
				NC.push_back(i);
			}
		}
	}
	assert(NC.size()==N-1);
	FOR(i,2*N) {
		if(i>=pov && i<=N+pov) continue;
		B=NC;
		B.push_back(i);
		sort(ALL(B));
		C[i]=ask(B);
	}
	
	if(A[0]>=0) {
		FOR(i,2*N) cout<<A[i];
		cout<<endl;
		FOR(i,2*N) cout<<C[i];
		cout<<endl;
	}
	ans();
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 724
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 15;
const int INF = 1000000009;
const ll INFl = 1000000009000000009;

int n;
int x[N], y[N], p[N];

pair<int, int> xx[N], yy[N];

ll fans[N];
int ans[N];

void solv()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
    {
        scanf("%d%d%d", &x[i], &y[i], &p[i]);
        xx[i] = m_p(x[i], i);
        yy[i] = m_p(y[i], i);
    }
    sort(xx, xx + n);
    sort(yy, yy + n);
    for (int i = 0; i < n; ++i)
        fans[i] = INFl;
    for (int x = 0; x < (1 << n); ++x)
    {
        int q = 0;
        for (int i = 0; i < n; ++i)
        {
            if ((x & (1 << i)))
                ++q;
        }
        for (int y = x; ; y = ((y - 1) & x))
        {
            for (int i = 0; i < n; ++i)
                ans[i] = min(abs(::x[i]), abs(::y[i]));
            int u = -INF;
            for (int i = 0; i < n; ++i)
            {
                if ((x & (1 << xx[i].se)))
                {
                    if (!(y & (1 << xx[i].se)))
                    {
                        u = xx[i].fi;
                    }
                }
                ans[xx[i].se] = min(ans[xx[i].se], xx[i].fi - u);
            }
            u = INF;
            for (int i = n - 1; i >= 0; --i)
            {
                if ((x & (1 << xx[i].se)))
                {
                    if (!(y & (1 << xx[i].se)))
                    {
                        u = xx[i].fi;
                    }
                }
                ans[xx[i].se] = min(ans[xx[i].se], u - xx[i].fi);
            }

            u = -INF;
            for (int i = 0; i < n; ++i)
            {
                if ((x & (1 << yy[i].se)))
                {
                    if ((y & (1 << yy[i].se)))
                    {
                        u = yy[i].fi;
                    }
                }
                ans[yy[i].se] = min(ans[yy[i].se], yy[i].fi - u);
            }
            u = INF;
            for (int i = n - 1; i >= 0; --i)
            {
                if ((x & (1 << yy[i].se)))
                {
                    if ((y & (1 << yy[i].se)))
                    {
                        u = yy[i].fi;
                    }
                }
                ans[yy[i].se] = min(ans[yy[i].se], u - yy[i].fi);
            }
            ll yans = 0;
            for (int i = 0; i < n; ++i)
                yans += p[i] * 1LL * ans[i];
            fans[q] = min(fans[q], yans);
            if (y == 0)
                break;
        }
    }
    for (int i = 0; i <= n; ++i)
        printf("%lld\n", fans[i]);
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


Measured memory_bytes: 3832
import java.util.Scanner;


public class Main {


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

        // N A B
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        int train = N * A;

        int taxi = B;

        if(train >= taxi){
            System.out.println(taxi);
            return;
        }
        if(train <= taxi){
            System.out.println(train);
            return;
        }




    }



}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
//}}}
const ll maxn=3005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;
const ll mod=1000000007;
const double pi=acos(-1);

int n,m;
string s[55];

string ans[55];

bool check(int x,int y){
	if(x<0||x>=n) return 0;
	if(y<0||y>=m) return 0;
	
	return s[x][y]=='#';
}

int main()
{
	cin>>n>>m;
	REP(i,n) cin>>s[i];
	
	REP(i,n) REP(j,m){
		if(s[i][j]=='#') ans[i].pb('#');
		else{
			int cnt=0;
			REP(I,3) REP(J,3){
				if(check(i+I-1,j+J-1)) cnt++;
			}
			ans[i].pb('0'+cnt);
		}
	}
	REP(i,n) REP(j,m){
		cout<<ans[i][j];
		if(j==m-1) cout<<'\n';
	}
	return 0;
}












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

int main() {
  string s;
  cin >> s;
  int i, j;
  for (i = 0; i < (1 << 3); i++) {
    bitset<3> a(i);
    int sum = s.at(0) - '0';
    for (j = 0; j < 3; j++) {
      if (a.test(j) == 1) { sum += s.at(j + 1) - '0'; }
      else { sum -= s.at(j + 1) - '0'; }
    }
    if (sum == 7) { break; }
  }
  bitset<3> a(i);
  cout << s.at(0);
  for (j = 0; j < 3; j++) {
    if (a.test(j) == 1) { cout << "+"; }
    else { cout << "-"; }
    cout << s.at(j + 1);
  }
  cout << "=7" << endl;
}


Measured memory_bytes: 3632
using System;
class Program {
  static int sumDigits(int n) {
    int sum = 0;
    while (n > 0) {
      sum += n % 10;
      n = n / 10;
    }
    return sum;
  }
  static void Main(string[] args) {
    int N = int.Parse(Console.ReadLine());

    if (N % sumDigits(N) == 0) {
      Console.WriteLine("Yes");
    } else {
      Console.WriteLine("No");
    }
  }
}


Measured memory_bytes: 13140
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	int P[3] = { 0 }, Q[3] = { 0 };

	for (int i = 0; i < 3; i++)
	{
		cin >> P[i];
	}
	Q[0] = P[0] + P[1];
	Q[1] = P[1] + P[2];
	Q[2] = P[0] + P[2];
	P[0] = min(Q[0], Q[1]);
	P[0] = min(P[0], Q[2]);
	cout << P[0];
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  for(int i=0; 4*i<=n; i++){
    if((n-4*i)%7==0){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

typedef long long ll;

ll N, K, A[200005];

bool kaya(ll m) {
  ll cuts = 0;
  for (int i = 0; i < N; ++i)
    cuts += (A[i] - 1) / m;
  return cuts <= K;
}

int main() {
  std::cin >> N >> K;
  ll maxa = 0;
  for (int i = 0; i < N; ++i) {
    std::cin >> A[i];
    maxa = std::max(maxa, A[i]);
  }

  ll ans = maxa;
  for (ll jump = maxa; jump >= 1; jump >>= 1)
    while (ans - jump >= 1 and kaya(ans - jump))
      ans -= jump;

  std::cout << ans << "\n";

  return 0;
}


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

using namespace std;

int N;
pair<int, int> arr[200005];
vector<int> cmp;
long long pow2[200005];
long long MOD = 998244353;
int BIT[2][200005];

void upd(int t, int p, int v){
    for(int i = p; i<=N; i+=i&-i){
        BIT[t][i] += v;
    }
}

int query(int t, int p){
    int s = 0;
    for(int i = p; i>0; i-=i&-i){
        s += BIT[t][i];
    }
    return s;
}

int getidx(int p){
    return lower_bound(cmp.begin(), cmp.end(), p) - cmp.begin() + 1;
}

long long add(long long a, long long b){
    return (a+b)%MOD;
}

long long sub(long long a, long long b){
    a = add(a, -b);
    if(a < 0){
        a += MOD;
    }
    return a;
}

long long mult(long long a, long long b){
    return a*b%MOD;
}

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> N;
    pow2[0] = 1;
    for(int i = 1; i<=N; i++){
        cin >> arr[i].first >> arr[i].second;
        cmp.push_back(arr[i].second);
        pow2[i] = mult(pow2[i-1], 2);
    }
    sort(cmp.begin(), cmp.end());
    sort(arr+1, arr+1+N);
    for(int i = 1; i<=N; i++){
        arr[i].second = getidx(arr[i].second);
        upd(1, arr[i].second, 1);
    }
    long long ans = 0;
    for(int i = 1; i<=N; i++){
        upd(1, arr[i].second, -1);
        ans = add(ans, pow2[N]-1);
        int sumlfttop = query(0, arr[i].second), sumrhttop = query(1, arr[i].second);
        int sumlftbot = i - sumlfttop - 1, sumrhtbot = N - i - sumrhttop;
        //cout << "1: " << ans << endl;
        ans = sub(ans, pow2[sumlfttop+sumrhttop]);
        ans = sub(ans, pow2[sumlfttop+sumlftbot]);
        ans = sub(ans, pow2[sumrhttop+sumrhtbot]);
        ans = sub(ans, pow2[sumlftbot+sumrhtbot]);
        //cout << "2: " << ans << endl;
        ans = add(ans, pow2[sumlfttop]);
        ans = add(ans, pow2[sumrhttop]);
        ans = add(ans, pow2[sumlftbot]);
        ans = add(ans, pow2[sumrhtbot]);
        //cout << "3: " << ans << endl;
        upd(0, arr[i].second, 1);
    }
    cout << ans << endl;
}


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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		String s = nextString();


		System.out.println(s.length()-s.replaceAll("9", "").length()==0?"No":"Yes");

	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 23380
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

A,P=get_i
puts (A*3+P)/2

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

using namespace std;

int in(){ int a; cin >> a; return a; }
#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__) << "] "

int main(){
  ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0); cerr.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<long long> a(n + 1), b(m + 1), pa(n + 1), pb(m + 1);
  for(int i = 1; i <= n; i++){
  	cin >> a[i];
  	pa[i] = pa[i - 1] + a[i];
  }
  for(int i = 1; i <= m; i++){
  	cin >> b[i];
  	pb[i] = pb[i - 1] + b[i];
  }
  long long ans = 0, sum = 0;
  int j = m;
  for(int i = 0; i <= n; i++){
  	if(pa[i] > k) break;
  	while(pa[i] + pb[j] > k) j--;
  	ans = max(ans, (long long)i + j);
  }
  cout << ans << endl;
  return 0;
}


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

int X, Y, Z;
#define MAX_N 100000
long long A[MAX_N], B[MAX_N], C[MAX_N];
pair<long long, int> AB[MAX_N];
long long AC[MAX_N], BC[MAX_N];
long long RA[MAX_N], RB[MAX_N];
long long R;

void go(pair<long long, int> ab[MAX_N], long long a[MAX_N], int x, int z,
  long long ac[MAX_N], long long c[MAX_N], long long ra[MAX_N]) {
  priority_queue<pair<long long, int>> pool;
  for(int i = 0; i < x; ++i) {
    int k = ab[i].second; ra[0] += a[k]; pool.push(make_pair(ac[k], k));
  }
  for(int i = 1; i <= z; ++i) {
    int k = ab[x - 1 + i].second; pair<long long, int> p = make_pair(ac[k], k);
    if(p > pool.top()) ra[i] = ra[i - 1] + c[k];
    else {
      int l = pool.top().second; pool.pop(); pool.push(p);
      ra[i] = ra[i - 1] - a[l] + c[l] + a[k];
    }
  }
}

int main() {
  cin >> X >> Y >> Z;
  for(int i = 0; i < X + Y + Z; ++i) {
    cin >> A[i] >> B[i] >> C[i];
    AB[i] = make_pair(B[i] - A[i], i);
    AC[i] = C[i] - A[i]; BC[i] = C[i] - B[i];
  }
  sort(AB, AB + X + Y + Z); go(AB, A, X, Z, AC, C, RA);
  reverse(AB, AB + X + Y + Z); go(AB, B, Y, Z, BC, C, RB);
  for(int i = 0; i <= Z; ++i) R = max(R, RA[i] + RB[Z - i]);
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 9076
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long x = sc.nextLong();
		long res=0;
		
		
			res = (b/x) - (a/x);
			if (a%x==0) {
				res++;}
			
		
		System.out.println(res);
	}

}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    string s;
    cin >> s;

    MSG("ABC" + s)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll,ll> P;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
ll c,d,e,f,p,t,x,y,ans=0;


ll n,m;
priority_queue<ll> a;

void input(void){
    cin>>n>>m;
    rep(i,n){
        cin>>c;
        ans+=c;
        a.push(c);
    }
}

ll solve(void){
    rep(i,m){
        c=a.top();
        a.pop();
        a.push(c/2);
        ans-=c-c/2;
    }

    return ans;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    cout<<solve()<<endl;
}

Measured memory_bytes: 1400
X, n = map(int, input().split())
P = list(map(int, input().split()))

ls = [0]*(102)
for p in P:
    ls[p] = 1
# xとのさがi
for i in range(101):
    L, R = X-i, X+i
    if ls[L] == 0:
        print(L)
        break

    if ls[R] == 0:
        print(R)
        break


Measured memory_bytes: 9180
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if (s.charAt(2)==s.charAt(3) && s.charAt(4)==s.charAt(5)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 23764
// Garg's Code
#include <bits/stdc++.h>
#include <string.h>
using namespace std;

#define ll long long
#define vec vector < ll >
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++)
#define rf(i,x,n) for(ll i = x; i >= x; i--)
#define all(c) c.begin(),c.end()
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const ll MAX = LLONG_MAX, MOD = 1000000007, MODA = 1e9 - 1;
const ll MIN = LLONG_MIN;
const long double PI = 3.1415926535;
const ll N = 100009;

vector<vector<ll> > mul(vector<vector<ll> > mat1, vector<vector<ll> > mat2, int row)
    {
        vector< vector<ll> > result(row, vector<ll>(5, 0));
        for(ll i = 0; i < row; i++)
            for(ll j = 0; j < 5; j++) {
                for(ll k = 0; k < 5; k++) {
                    result[i][j] = ((result[i][j]%MOD) + (mat1[i][k]%MOD) * (mat2[k][j]%MOD)) % MOD;
                }
            }
        return result;
    }
int main()
{
  fast();

  ll t=1;
  //cin >> t;
  while(t--)
  {
    string s;
    cin >> s;
    string a = "";
    f(i,0,s.length())
    {
      a += 'x';
    }
    cout << a;
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long ll;

int main() {
  int n, k;
  cin >> n >> k;
  ll x = k;
  REP(i,1,n) {
    x *= k - 1;
  }
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];

    sort(h.begin(),h.end());

    int ans = 1e9;
    for(int i = 0; i < n-k+1; i++){
        if(h[k+i-1] - h[i] < ans){
            ans = h[k+i-1] - h[i];
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'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','z'};
char moji2[26]={'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','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)


signed main(){
    int n,m;
    cin >> n >> m;
    string S[n + 2];
    S[0] = '#';
    S[n+1] = '#';
    REP(i,m+1){
        S[0] += '#';
        S[n+1] += '#';
    }
    FOR(i,1,n+1){
        S[i] = '#';
        string s;
        cin >> s;
        S[i] += s;
        S[i] += '#';
    }

    int tate[n+2][m+2];
    int yoko[n+2][m+2];
    REP(i,n+2){
        REP(j,m+2){
            tate[i][j] = 0;
            yoko[i][j] = 0;
        }
    }

    //横方向
    FOR(i,1,n + 1){
        int tmp = 0;
        FOR(j,1,m+2){
            if(S[i][j] == '.') tmp ++;
            else {
                REP(k,tmp) yoko[i][j-k-1] = tmp;
                tmp = 0;
            }

        }
    }
    /*
    FOR(i,1,n+1){
        FOR(j,1,m+1){
            cout << yoko[i][j]<< " ";
        }
        cout << endl;
    }
    */

   FOR(j,1,m+1){
       int tmp = 0;
       FOR(i,1,n+2){
           if(S[i][j] == '.') tmp ++;
           else{
               REP(k,tmp) tate[i-1-k][j] = tmp;
               tmp = 0;
           }
       }
   }
   int res = 0;
   FOR(i,1,n+1){
       FOR(j,1,m+1){
           if(tate[i][j] !=0){
               res = max(res,tate[i][j] + yoko[i][j]);
           }
       }
   }
   cout << res -1<< endl;

    
}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }

int main(){
    int n,m,x,y; cin >> n >> m >> x >> y;
    vector<int> a,b;
    rep(i,n){
        int x; cin >> x;
        a.push_back(x);
    }
    a.push_back(x);
    rep(i,m){
        int x; cin >> x;
        b.push_back(x);
    }
    b.push_back(y);
    sort(a.rbegin(), a.rend());
    sort(b.begin(), b.end());
    if(a[0] < b[0]) cout << "No War" << endl;
    else cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <algorithm> 
using namespace std;
using vi = vector<long>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

const int limit = 100050;
vvvi strLunlun(10, vvi (2));
int numLunlun = 0;
vi lunlun;

void appendTo(int num, int len) {
	strLunlun[num].push_back(vi (0));
	for (int j = num-1; j <= num+1; j++) {
		if(j >= 0 && j <= 9){
			for (int i = 0; i < strLunlun[j][len-1].size(); i++) {
				strLunlun[num][len].push_back(num*pow(10,len-1) + strLunlun[j][len-1][i]);
				if(j != 0) numLunlun++;
			}
		}
	}
}

void genRound(int len) {
	for (int i = 0; i <= 9; i++) {
		appendTo(i, len);
	}
}

void genLunlun() {
	int i = 2;
	// Initialize structured lunluns
	for (int i = 0; i <= 9; i++) strLunlun[i][1].push_back(i); 
	numLunlun = 10;
	while(numLunlun < limit) {
		genRound(i);
		i++;
	}
	for (int i = 1; i < strLunlun.size(); i++) {
		for (int j = 0; j < strLunlun[i].size(); j++) {
			for (int k = 0; k < strLunlun[i][j].size(); k++) {
				lunlun.push_back(strLunlun[i][j][k]);
			}
		}
	}
	sort(lunlun.begin(), lunlun.end());
}

int main() {
	int K; cin >> K;
	genLunlun();
	cout << lunlun[K-1] << '\n';
	return 0;
}

Measured memory_bytes: 4340
#include <stdio.h>

int main(void)
{
	int i;
	int x, y, temp, remainder;

	scanf("%d %d", &x, &y);

	if(x < y){
		temp = x;
		x = y;
		y = temp;
	}

	while(x % y != 0){
		remainder = x % y;
		x = y;
		y = remainder;
	}

	printf("%d\n", y);

	return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>
#include <bits/stdc++.h>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//typedef vector<ll> vec;
//typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

ll len;
string s;
string low="abcdefghijklmnopqrstuvwxyz";
int main(){
  cin>>s;
  len=s.length();

  ll cct=0,cpos=0;
  for(ll i=2;i<len-1;i++){
    if(s[i]=='C'){
      cct++;
      cpos=i;
    }
  }
  bool fl=true;
  if(cct!=0){
    for(ll i=1;i<len;i++){
      bool lowc=false;
      for(ll j=0;j<26;j++){
        if(i!=cpos){
          if(s[i]==low[j])lowc=true;
        }
        else lowc=true;
      }
      if(!lowc)fl=false;
    }
  }
//  cout<<cpos<<" "<<fl<<endl;
  if(s[0]=='A'&&cct==1&&fl)cout<<"AC"<<endl;
  else cout<<"WA"<<endl;
  return 0;
}


Measured memory_bytes: 256