akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll int64_t 
#define f(i,s,e) for(i=s;i<e;++i)
#define endl << "\n"
#define sp << " "
#define INF INFINITY
#define mset(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define crap ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846264338327950288419716939937510
#define pb(a) push_back(a)
#define pf(a) push_front(a)

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

int main()
{
	crap;
	ll i,j,k,n,t;
	cin >> n;
	vector <ll> arr(10000+1,0) ;
	for(i=1;i<=100;++i)
	{
		for(j=1;j<=100;++j)
		{
			for(k=1;k<=100;++k)
			{
				t = (i*i) + (j*j) + (k*k) + (i*j) + (j*k) + (i*k) ;
				if(t<=10000)
					arr[t]++ ;
			}
		}
	}
	for(i=1;i<=n;++i)
		cout << arr[i] endl ;
	return 0;
}

/*
If u haven't come up with an approach yet ,skip this one
  Try this when feeling stuck -
  1. Int overflow, array bounds
  2. Special cases (n=1?)
  3. Prove your approach to yourself(mathematical induction,counter-intuitive or stronger test cases)
  4. Calm down and don't look at standings and stop thinking about rating and think about the question
  5. Just do it! 
*/ 

//Benq's advice - 
/* 
	And following advices are must for me -
	* do something instead of nothing and stay organized
	* WRITE STUFF DOWN 
*/

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;
int n;
long long dp[100010][3];
long long h[100010][3];
int main() {
   cin >>n;
   for(int i = 0;i<n;i++) for(int j =0;j<3;j++) cin >> h[i][j];
  
   for(int i = 0;i<n;i++){
     for(int j = 0;j<3;j++){
      for(int g = 0;g<3;g++){
        if(j == g) continue;
     	chmax(dp[i+1][g],dp[i][j]+h[i][j]);
       }
     }
   }
   long long res;
   for(int i = 0;i<3;i++) chmax(res,dp[n][i]);
   cout << res;
    return 0;
}

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

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#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__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);
	
	string s, t;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	string u;
	cin >> u;

	cout << (a - (u == s)) << " " << (b - (u == t)) << endl;


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int A,B,i;

    scanf("%d %d",&A,&B);

    for(i=1; i<=1001; i++){
        if(( (int)(i*0.08) == A )&& ( (int)(i*0.1) == B)){
            printf("%d\n",i);
            return 0;
        }
    }

    printf("-1\n");
    
    return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)



void read_problem(vector<int>& ary)
{
    int n;
    scanf("%d\n", &n);

    ary.resize(n);
    REP(i, n) {
        scanf("%d", &ary[i]);
    }
}

int part(vector<int>& ary, int p, int r)
{
    int pivot = ary[r];

    int i = p; // pivot ??\??????????´?????????\??????
    FOR(j, p, r) {
        if(ary[j] <= pivot) {
            swap(ary[i], ary[j]);
            ++i;
        }
    }
    swap(ary[i], ary[r]);

    return i;
}

int main()
{
    vector<int> ary;
    read_problem(ary);
    int n = ary.size();

    int q = part(ary, 0, n-1);
    REP(i, n) {
        if(i == q) putchar('[');
        printf("%d", ary[i]);
        if(i == q) putchar(']');
        putchar(i == n-1 ? '\n' : ' ');
    }

    return 0;
}

Measured memory_bytes: 2732
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N, L; cin >> N >> L;
	vi a(N);
	REP(i, N) cin >> a[i];
	int cent = -1;
	REP(i, N - 1) {
		if (a[i] + a[i + 1] >= L) {
			cent = i;
			break;
		} 
	}
	if (cent == -1) {
		cout << "Impossible" << endl;
		return;
	}
	cout << "Possible" << endl;
	FOR(i, 1, cent + 1) {
		cout << i << endl;
	}
	for (int i = N - 1; i > cent + 1; --i) {
		cout << i << endl;
	}
	cout << cent + 1 << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF = (1LL<<60)-1;
const int maxN = 1000001;
int32_t main()
{
    SPEED;
    int n,d,x;
    cin>>n>>d>>x;
    int arr[n];
    for(int i=0;i<n;i++)
    {
    	cin>>arr[i];
    }  
    int count=0;
    for(int i=0;i<n;i++)
    {
    	for(int j=1;j<=d;j++)
    	{
    		int k=j*arr[i]+1;
    		if(k>d)
    		{
    			break;
    		}
    		else{
    			x++;
    		}
    	}
    }
    x=x+n;
    cout<<x<<endl;
}

Measured memory_bytes: 3624
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

#define int long long
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数定義や変数宣言







//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



string s;
int k;

cin>>k>>s;

if(s.size()<=k){
	cout<<s<<endl;
}
else {
	REP(i,k){cout<<s[i]; } 

	cout<<"..."<<endl;
}













return 0;

}

Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

int gcd(int a, int b) {
  if (a < b) {
    int tmp = a;
    a = b;
    b = tmp;
  }
  return a % b == 0 ? b : gcd(b, a % b);
}

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

  int ans = gcd(a[0], a[1]);
  for (int i = 2; i < n; i++) {
    ans = gcd(ans, a[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
use std::cmp::min;


fn main() {
    let (h, n) = read_tuple();
    let mut damage_costs = Vec::with_capacity(n);
    for _ in 0..n {
        damage_costs.push(read_tuple());
    }

    let damage_max = damage_costs.iter().max_by_key(|x| x.0).unwrap().0;

    let mut dp = vec![None; h + 1 + damage_max];
    dp[0] = Some(0);

    for &(ai, bi) in damage_costs.iter() {
        for i in 0..(dp.len()) {
            if i >= ai {
                dp[i] = match dp[i] {
                    Some(x) => match dp[i - ai] {
                        Some(y) => Some(min(x, y + bi)),
                        None => Some(x),
                    },
                    None => match dp[i - ai] {
                        Some(y) => Some(y + bi),
                        None => None,
                    },
                }
            }
        }
    }
    let ans: usize = {
        let (_, last) = dp.split_at(h);
        let last = Vec::from(last);
        last.iter().filter(|x| x.is_some()).map(|x| x.unwrap()).min().unwrap()
    };
    println!("{:?}", ans);
}


fn read_tuple<T: std::str::FromStr + Copy>() -> (T, T) {
    let temp = read_vec();
    (temp[0], temp[1])
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
//using P = pair<int,int>;
//pow(x,n)
//cout << fixed << setprecision(桁数);
//string = to_string(数値)
//int = stoi(文字列)
//(int)(char-'0')
//string = itoa(int)
//円周率: M_PI

int main() {
    int64_t a,b,n; cin >> a >> b >> n;


    int64_t x;
    if(n>=b){
        x=((n+1)/b)*b-1;
    }
    else{
        x=n;
    }


    int64_t ans = round(a*x/b)-a*(x/b);
    cout << ans << endl;

}





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


int main() {

    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    int sum = 0;
    sort(l.rbegin(), l.rend());
    for (int i = 0; i < k; ++i) {
        sum += l[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
using namespace std;
int n;
int total[200] = {0};
char campus[50][50];
bool ans = 0;
bool black[50][50];
void search(int x, int y){
    if(campus[x+1][y] == '.' and campus[x-1][y] == '.' and campus[x][y+1] == '.' and campus[x][y-1] == '.'){
        ans = 1;
    }

}
int main(){
    int h, w;
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> campus[j][i];
            if(campus[j][i] == '#') black[j][i] = 1;
            else black[j][i] = 0;
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(black[j][i] == 1) search(j, i);
        }
    }
    

    if(ans == 1) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 256
import math
N, H = map(int, input().split())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = map(int, input().split())
    
B = sorted(B, reverse=True)
maxa = max(A)
ans = 0
for b in B:
    if b < maxa:
        break
    ans += 1
    H -= b
    if H <= 0:
        break
H = max(0, H)
ans += math.ceil(H/maxa)
print(ans)




Measured memory_bytes: 12080
let () =
  let (r, g, b) = Scanf.scanf "%d %d %d\n" (fun x y z -> (x, y, z)) in
  let ans = if (r * 100 + g * 10 + b) mod 4 = 0
            then "YES"
            else "NO" in
  Printf.printf "%s\n" ans



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


void solve(long long A, long long B){
    if((A >= 1 && A <= 9) && (B >= 1 && B <= 9)) cout << A * B << endl;
    else cout << -1 << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N , M , K;
	cin>>N>>M>>K;
	char tab[N][M];
	int sol[N][M];
	for (int i = 0 ; i < N ; i++)
	{
		for (int j = 0 ; j < M ; j++)
		{
			cin>>tab[i][j];
		}
	}
	int iP = 0;
	for (int i = 0 ; i < N ; i++)
	{
		bool ok = false;
		for (int j = 0 ; j < M ; j++)
		{
			if (tab[i][j] == '#')
			{
				ok = true;
				break;
			}
		}
		if (!ok) iP++;
		else break;
	}
	int actu = 1;
	for (int i = iP ; i < N ; i++)
	{
		int vide = true;
		for (int j = 0 ; j < M ; j++)
		{
			if (tab[i][j] == '#') vide = false;
		}
		if (vide)
		{
			for (int j = 0 ; j < M ; j++)
			{
				sol[i][j] = sol[i - 1][j];
			}
		}
		else
		{
			bool dej = false;
			for (int j = 0 ; j < M ; j++)
			{
				if (tab[i][j] == '#') 
				{
					if (dej) actu++;
					dej = true;
				}

				sol[i][j] = actu;
			}
			actu++;
		}
	}
	for (int i = iP - 1 ; i>= 0 ; i--)
	{
		for (int j = 0 ; j < M ; j++)
		{
			sol[i][j] = sol[i + 1][j];
		}
	}
	for (int i = 0 ; i < N ; i++)
	{
		for (int j = 0 ; j < M ; j++)
		{
			cout<<sol[i][j]<<" ";
		}
		cout<<endl;
	}
}

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

#define MAX_V 15
#define INF (INT_MAX/MAX_V)

struct edge { int to, cost; };

int V, E;
vector<edge> G[MAX_V];

int dist[MAX_V][MAX_V];

int dp[1 << MAX_V][MAX_V];

int tsp( int mask,int pos, int s )
{
	if( mask == (1 << V) - 1 ) {
		return dist[pos][s];
	}
	if( dp[mask][pos] != -1 ) {
	   return dp[mask][pos];
	}

	int ans = INT_MAX;

	for( int city = 0; city < V; city++ ) {
		if( (mask & (1 << city) ) == 0 ) {
			int nans = dist[pos][city] + tsp( mask | (1 << city), city, s );
			ans = min( ans, nans );
		}
	}

	return dp[mask][pos] = ans;
}

int main()
{
	cin >> V >> E;
	for( int i = 0; i < E; i++ ) {
		int s, t, d;
		cin >> s >> t >> d;
		edge e;
		e.to = t;
		e.cost = d;
		G[s].push_back( e );
	}

	for( int i = 0; i < V; i++ ) {
		for( int j = 0; j < V; j++ ) {
			dist[i][j] = INF;
		}
	}
	for( int i = 0; i < V; i++ ) {
		for( int j = 0; j < G[i].size(); j++ ) {
			dist[ i ][ G[i][j].to ] = G[i][j].cost;
		}
	}

	int min_ans = INT_MAX;
	for( int i = 0; i < V; i++ ) {
		if( G[i].empty() ) {
			continue;
		}

		for(int i = 0; i < (1 << V); i++ ) {
			for(int j = 0; j < V; j++ ) {
				dp[i][j] = -1;
			}
		}
		int ans = tsp( 1 << i, i, i );
		min_ans = min( min_ans, ans );
	}

	if( min_ans >= INF ) {
		cout << -1 << endl;
	}
	else {
		cout << min_ans << endl;
	}

	return 0;
}



Measured memory_bytes: 5028
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    vector<int> A(3);
    cin >> A[0] >> A[1] >> A[2];

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

    cout << A[0]+A[1]+A[2]*10 << endl;
    return 0;
}

Measured memory_bytes: 256
// D - Recording
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;

int main(){
	int N,C; cin>>N>>C;
	vector<vi> tv(100000, vi(C, 0));
	while(N--){
		int s,t,c; cin>>s>>t>>c; --c;
		for(int i=s-1; i<t; ++i) tv[i][c] = 1;
	}
	int ans = 0;
	for(auto z:tv){
		int s = 0; for(auto c:z) s += c;
		ans = max(ans, s);
	}
	cout<< ans <<endl;
}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  const int N = 1000000;
  vector<int> a(N, 1);
  a[0] = a[1] = 0;
  for (int i = 2; i < N; i++) if (a[i])
  for (int j = i * 2; j < N; j += i) a[j] = 0;
  int n; cin >> n;
  while (!a[n]) n++;
  cout << n << '\n';
}


Measured memory_bytes: 11056
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
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; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b;cin >> n >> a >> b;
    vector<ll> x(n);
    REP(i,n){
        cin >> x[i];
    }
    ll ans=0;
    REP(i,n-1){
        ans+=min(b,(x[i+1]-x[i])*a);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3960
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int K = scan.nextInt();
        int Q = scan.nextInt();
        int winTime[] = new int[N];
        Arrays.fill(winTime, 0);

        for(int i = 0; i < Q; i++) {
            int j = scan.nextInt();
            winTime[j-1]++;
        }

        for(int win : winTime) {
            if(K - (Q - win) > 0) {
                os.println("Yes");
            } else {
                os.println("No");
            }
        }

    }
}

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

int main() {
	ll N;
	cin >> N;
	ll len = 1;
	ll keta = 26;
	ll pow = 26;
	while (N > keta) {
		pow *= 26;
		keta = keta + pow;
		len++;
	}
	char str[len];
	rep(i, len) {
		N -= 1;
		str[i] = N%26 + 'a';
		N /= 26;
	}
	for (int i = len-1; i >= 0; i--) {
		cout << str[i];
	}
	cout << endl;
}

Measured memory_bytes: 3640
N,M,Q=map(int,input().split())
x=[[0]*(N+1) for i in range(N+1)]
for i in range(M):
    L,R=map(int,input().split())
    x[L][R]+=1
for i in range(N+1):
    for j in range(N):
        x[i][j+1]+=x[i][j]
for j in range(N+1):
    for i in range(N):
        x[i+1][j]+=x[i][j]
for i in range(Q):
    p,q=map(int,input().split())
    print(x[q][q]-x[p-1][q]-x[q][p-1]+x[p-1][p-1])

Measured memory_bytes: 14708
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt, sum int

func main() {
	reader.Split(bufio.ScanWords)
	A, _ := strconv.Atoi(read())
	B, _ := strconv.Atoi(read())
	C, _ := strconv.Atoi(read())
	if B+C <= A {
		fmt.Println(0)
	} else {
		fmt.Println(C - (A - B))
	}
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; i++ {
		fac[i] = fac[i-1] * i % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		finv[i] = finv[i-1] * inv[i] % mod
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return abs(a[i]) < abs(a[j]) }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e2+5;
int a[MAXN],b[MAXN],c[MAXN],biaoji[MAXN];

int main()
{
	int n;
	cin >> n;
	for(int i = 0;i < n;i++)	scanf("%d",&a[i]);
	for(int i = 0;i < n;i++)	scanf("%d",&b[i]);
	for(int i = 0;i < n - 1;i++)	scanf("%d",&c[i]);
	long long sum = 0;
//	memset(biaoji,0,sizeof(biaoji));
//	for(int i = 0;i < n;i++){
//		sum += b[a[i] - 1];
//		biaoji[a[i] - 1] = 1;
//		if(biaoji[a[i] - 2] == 1)
//			sum += c[a[i] - 2];
//	}
	sum += b[a[0] - 1];
	for(int i = 1;i < n;i++){
		if(a[i] - 1 == a[i - 1])
			sum += c[a[i - 1] -  1];
		sum += b[a[i] - 1];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int mx = Math.max(n, m);
        int mn = Math.min(n, m);

        if (mx == 1) {
            System.out.println(1);
        } else if (mn == 1) {
            System.out.println(mx - 2);
        } else {
            long ans = mx - 2;
            ans *= (mn - 2);
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 35652
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		sc.close();

		BigInteger MOD = BigInteger.valueOf(1000000007L);
		if ( (X + Y) % 3 != 0 ) {
			System.out.println(0);
		} else {
			int N = (X + Y) / 3;
			int x = X - N;
			int y = Y - N;
			
			if ( x < 0 || y < 0 ) {
				System.out.println(0);
			} else {
				BigInteger ans = BigInteger.ONE;
				for ( int i = 0 ; i < x ; i++ ) {
					ans = ans.multiply(BigInteger.valueOf(N - i)).mod(MOD);
				}
				for ( int i = 1 ; i <= x ; i++ ) {
					ans = ans.multiply(BigInteger.valueOf(i).modInverse(MOD)).mod(MOD);
				}
				System.out.println(ans.toString());
			}
		}
	}
}


Measured memory_bytes: 155704
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;
 
#define N  100005
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int a,b;
		cin>>a>>b;
		cout<<max(a-2*b,0ll);
	}
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    string S, result;
    cin >> S;
    result += S[0];
    for (int i = 1; i < N; i++) {
        if (result.back() != S[i]) {
            result += S[i];
        }
    }
    cout << result.length() << endl;
}

Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
#define N 100010
using namespace std;
int a[N];
int main()
{
	int n,x,d;
	scanf("%d%d",&n,&x);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	a[++n]=x;
	sort(a+1,a+n+1);
	for(int i=1;i<n;i++)
	{
		int c=a[i+1]-a[i];
		if(i==1) {d=c;continue;};
		d=__gcd(c,d);
	}
	printf("%d",d);
	return 0;
}


Measured memory_bytes: 512
#include<cstdio>

const int MAX_N = 100;
int N, flag=0;
int D[MAX_N][2];

void solve();

int main(){

    scanf("%d", &N);
    for(int i=0; i<N; i++){
        scanf("%d %d", &D[i][0], &D[i][1]);
    }

    solve();

    return 0;
}


void solve(){

    for(int i=0; i<N-2; i++){
        flag = 0;
        if(D[i][0] == D[i][1]){
            if(D[i+1][0] == D[i+1][1]){
                if(D[i+2][0] == D[i+2][1]){
                    flag = 1;
                    break;
                }
            }
        }
    }

    if(flag == 1){
        printf("Yes\n");
    } else{
        printf("No\n");
    }
}

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

int main() {
	int x;
	cin >> x;
	int ans = 0;
	ans = (x/500)*1000;
	x %= 500;
	ans += (x/5)*5;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3596
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 61
#define MAX 1LL << 30
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
struct edge
{
    ll to, cost, val;
};
template <class T, class U>
bool chmin(T &a, const U &b)
{
    if (a <= b)
        return false;
    a = b;
    return true;
}
template <class T, class U>
bool chmax(T &a, const U &b)
{
    if (a >= b)
        return false;
    a = b;
    return true;
}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll

ll f(ll as,ll bs,ll num){
    if(num==0) return 0;
    if(as>=bs){
        return as*bs;
    }else if(as+num-1>=bs-num+1){
        ll x=(bs-as)/2;
        return (as+x)*(bs-x);
    }else{
        return (as+num-1)*(bs-num+1);
    }
}

bool check(ll A,ll B,ll mid){
    ll t=0;
    if(mid<A){
        ll x=mid/2;
        if((1+x)*(mid-x)>=A*B) return false;
        else return true;
    }else if(A<=mid && mid<B){
        chmax(t,f(1,mid,A-1));
        chmax(t,f(A+1,mid-A+1,mid-A+1));
    }else if(A-1<mid-B+1){
        chmax(t,f(1,mid+1,A-1));
        chmax(t,f(A+1,mid-A+2,mid-A-B+2) );
        chmax(t,f(mid-B+3,B-1,B-1));
    }else{
        chmax(t,f(1,mid+1,mid-B+1));
        chmax(t,f(mid-B+2,B-1,A+B-mid-2));
        chmax(t,f(A+1,mid-A+1,mid-A+1));
    }
    if(t>=A*B) return false;
    else return true;
}

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

    int Q;
    cin>>Q;
    while(Q--){
        ll A,B;
        cin>>A>>B;
        if(A>B) swap(A,B);
        ll ng=11000000000,ok=0;
        while(ng-ok!=1){
            ll mid=(ng+ok)/2;
            if(check(A,B,mid)) ok=mid;
            else ng=mid;
        }
        cout<<ok<<endl;
    }

}


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

int binarySearch(int* array, int array_size, int target) {
    int left = 0;
    int right = array_size - 1;
    int middle = (array_size - 1) / 2;

    while (left < right) {
        //printf("BEF %d %d %d\n", left, middle, right);
        if (array[middle] == target) {
            //printf("Found\n");
            return 1;
        } else if (array[middle] > target) {
            right = middle;
        } else {
            left = middle + 1;
        }
        middle = (left + right) / 2;
        //printf("AFT %d %d %d\n", left, middle, right);
    }
    if (left == right) {
        if (array[middle] == target) {
            //printf("Found\n");
            return 1;
        }
    }
    //printf("Not Found\n");
    return 0;
}

int main(void) {
    int n;
    scanf("%d", &n);
    int* s = (int*) malloc(sizeof(int) * n);
    int i;
    for (i = 0; i < n; i++) {
        scanf("%d", &s[i]);
    }
    int m;
    scanf("%d", &m);
    int* t = (int*) malloc(sizeof(int) * m);
    int count = 0;
    for (i = 0; i < m; i++) {
        scanf("%d", &t[i]);
        count += binarySearch(s, n, t[i]);
    }
    printf("%d\n", count);

}



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

#define   ll      long long
#define   pb      push_back
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;

bool vis[100001];
vector<int> v[100001];
int dp[100001] = {0};


void dfs(int s)
{

	vis[s] = true;
	//cout << s << endl;

	for (int i = 0; i < v[s].size(); i++)
	{
		if (vis[v[s][i]] == false)
			dfs(v[s][i]);

		dp[s] = max(dp[s], 1 + dp[v[s][i]]);

	}

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll t;
	t = 1;
	//cin>>t;

	while (t--)
	{
		int n, m;
		cin >> n >> m;
		while (m--)
		{
			int x, y;
			cin >> x >> y;
			v[x].pb(y);
		}

		for (int i = 1; i <= n; i++)
		{
			if (vis[i] == 0)
				dfs(i);
		}

		cout << *max_element(dp, dp + n + 1) << endl;


	}

	return 0;
}




Measured memory_bytes: 8320
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int n, m;
    cin >> n >> m;
    REP(i,m){
        n -= in();
    }
    if (n < 0) n = -1;
    cout << n << endl;
    return 0;
}


Measured memory_bytes: 3656
'use strict';
process.stdin.on('data', function(chunk) {
  var inputs = chunk.toString().trim().split(' ');
  var a = Number(inputs[0]);
  var b =Number(inputs[1]);

  console.log(a*b,(a+b)*2);
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15564
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int[] B = new int[N-1];
		for(int i = 0;i < N-1;i++){
			B[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		int Asum = B[0];
		if(N >= 3){
			for(int i = 1;i < N-1;i++){
				Asum += Math.min(B[i-1], B[i]);
			}
		}
		Asum += B[N-2];
		System.out.println(Asum);
	}
}

Measured memory_bytes: 21844
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    #divisors.sort()
    return divisors

n = int(input())
lis = make_divisors(n)
print(lis[-1]+n//lis[-1]-2)

Measured memory_bytes: 3268
#include <bits/stdc++.h>
#define int long long
using namespace std;
  int ans=0;
  char s[25][25];
  int h,w;
  
  vector<int>vi{1,0,0,-1};
  vector<int>vj{0,1,-1,0};
  void bfs(int x,int y)
  {
      vector<vector<bool>>vis(h,vector<bool>(w));
      queue<pair<int,pair<int,int>>>q;
      q.push({0,{x,y}});
      vis[x][y]=true;
      while(!q.empty())
      {
          int dist=q.front().first;
          x=q.front().second.first;
          y=q.front().second.second;
          q.pop();
          for (int i=0;i<4;i++)
          {
              int x1=x+vi[i];
              int x2=y+vj[i];
              if ((x1>=0) && (x2>=0) && (x1<h) && (x2<w) && (s[x1][x2]!='#') && (!vis[x1][x2]) )
              {
                  vis[x1][x2]=true;
                  q.push({dist+1,{x1,x2}});
                  ans=max(ans,dist+1);
              }
          }
      }
  }
signed main() {
    //int h,w;
    cin>>h>>w;
    //char s[h][w];
    for (int i=0;i<h;i++)
    {
        for (int j=0;j<w;j++)
        {
            cin>>s[i][j];
        }
    }
    for (int i=0;i<h;i++)
    {
        for (int j=0;j<w;j++)
        {
            if (s[i][j]!='#')
            {
                bfs(i,j);
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n= stdIn.nextInt();
		int[] h = new int[n];
	    for(int i=0 ; i<n ; i++){
	        h[i] = stdIn.nextInt();
	    }
	    int i;
	    for(i=0 ; i<n ; i++){
	        if(h[i] %2 ==0){
	            if((h[i]%3==0||h[i]%5==0)){
	            }else{
	                break;
	            }
	        }
	    }
	    if(i==n)    System.out.println("APPROVED");
	    else    System.out.println("DENIED");
	}
}


Measured memory_bytes: 23764
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 200010;
using namespace std;
vector<int> x(10),y(10);
double dis(int i,int j)
{
  double dx = x[i]-x[j];
  double dy = y[i]-y[j];
  return pow((dx*dx+dy*dy),0.5);

}
int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  double sum =0.0;
  vector<int>v(n);
  for (int i = 1; i <= n; ++i)
  {
    cin >>x[i] >> y[i];
  }
  for (int i = 0; i < n; ++i)
  {
    v[i] = i+1; 
  }
  do
  {
    for(int i = 0;i < n-1;i++)
    {
      
      sum += dis(v[i],v[i+1]); 
    }
  }while(next_permutation(v.begin(),v.end()));
  int c = 1;
  for (int i = 1; i <= n; ++i)
  {
    c *= i; 
  }
  cout << fixed << setprecision(10) << sum/c;
  return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<vector<pair<int, int>>> xy(N);
    int A, x, y;
    for (int i = 0; i < N; i++)
    {
        cin >> A;
        for (int j = 0; j < A; j++)
        {
            cin >> x >> y;
            x--;
            xy[i].push_back(make_pair(x, y));
        }
    }
    int ans = 0;
    for (int i = 0; i < (1 << N); i++)
    {
        bitset<16> b(i);
        bool flag = true;
        for (int j = 0; j < N; j++)
        {
            if (b[j])
            {
                for (pair<int, int> p : xy[j])
                {
                    if ((int)b[p.first] != p.second)
                    {
                        flag = false;
                    }
                }
            }
        }
        if (flag)
        {
            ans = max(ans, (int)b.count());
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define lf long double
#define vi vector<int>
#define vl vector<long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define MOD 1000000007
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define in insert
#define all(x) x.begin(),x.end()
#define zapp ios::sync_with_stdio(false);cin.tie(0)
ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll power(ll x, ll y) {if (y < 0) return 1; ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
//const bool is_in = container.find(element) != container.end();
const int mx = 1e5 + 5;
int rh[mx],h[mx];
int main()
{
	zapp;
	int n,m,i;
	cin>>n>>m;
	for(i=1;i<=n;i++)
	{
		cin>>h[i];
		rh[i] = 0;
	}
	while(m--)
	{
		int a,b;
		cin>>a>>b;
		rh[a] = max(rh[a],h[b]);
		rh[b] = max(rh[b],h[a]);
	}
	int ans = 0;
	for(i=1;i<=n;i++)
	{
		ans+=h[i]>rh[i];
	}
	cout<<ans<<"\n";
	
}



Measured memory_bytes: 4432
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	N, T := nextInt(), nextInt()
	minC := 1001
	for i := 0; i < N; i++ {
		c, t := nextInt(), nextInt()
		if t <= T && c <= minC {
			minC = c
		}
	}
	if minC <= 1000 {
		fmt.Println(minC)
	} else {
		fmt.Println("TLE")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

pair<int, int> f(string s) {
    int x = 0;
    int res = 0;
    for (char c : s) {
        if (c == '(') x++;
        if (c == ')') x--;
        res = min(res, x);
    }
    return make_pair(res, x);
}

int main() {
    int N; cin >> N;
    vector<string> S(N); rep(i, N) cin >> S[i];
    vector<int> F(N), G(N);
    rep(i, N) {
        auto tmp = f(S[i]);
        F[i] = tmp.first;
        G[i] = tmp.second;
    }
    vector<int> ord(N); rep(i, N) ord[i] = i;
    sort(range(ord), [&](int i, int j) {
        int ij = min(F[i], G[i] + F[j]);
        int ji = min(F[j], G[j] + F[i]);
        if (ij != ji) return ij > ji;
        return G[i] > G[j];
    });
    string ans;
    for (int i : ord) ans += S[i];
    auto tmp = f(ans);    
    cout << (tmp.first == 0 and tmp.second == 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 48248
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;

void fastIO() {
	std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
}

#define FOR(i,f,t) for(int i=f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=f; i>(int)t; i--)
#define FORE(i,c) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

template<typename T, typename U> inline void mnze(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void mxze(T &x, U y) { if(x < y) x = y; }

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(_i, (x)) cerr <<*_i <<", "; cerr <<"\n"; }}
#define debuga(x, sz) {{cerr <<#x <<" = "; FOR(_i, 0, sz) cerr << x[_i] <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

const int MAXN = 2e5+5;

int n;
ll k, a[MAXN];
ordered_set<pair<ll, int> > s;


int main(){
	scan(n, k);
	FOR(i,0,n) scan(a[i]);
	int p=0;
	ll ans=0, cur=0;
	while(p<n){
		ans += s.order_of_key(make_pair(cur - p*k, MAXN));
		s.insert(make_pair(cur- p*k, p));
		cur += a[p++];
	}
	ans += s.order_of_key(make_pair(cur - p*k, MAXN));
	printf("%lld\n",ans);
}

Measured memory_bytes: 14336
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars
    }
    let mut res = 700;
    for c in s {
        res += if c == 'o' {100} else {0}
    }
    println!("{}", res);
}


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

#define SENTINEL 2000000000

long long merge(vector<int>& array, int left, int mid, int right) {
    long long cnt = 0;          // 転倒数を数える
    // 分割した配列LとRを生成
    int n1 = mid - left;        // Lの大きさ
    int n2 = right - mid;       // Rの大きさ
    vector<int> L(n1 + 1);
    vector<int> R(n2 + 1);
    for (int i = 0; i < n1; ++i) {
        L[i] = array[left + i];
    }
    for (int i = 0; i < n2; ++i) {
        R[i] = array[mid + i];
    }
    L[n1] = SENTINEL;
    R[n2] = SENTINEL;

    // LとRを比べて，もとの配列へソート
    int i = 0, j = 0;
    for (int k = left; k < right; ++k) {
        if (L[i] <= R[j]) {
            array[k] = L[i++];
        } else {
            array[k] = R[j++];
            cnt += n1 - i;
        }
    }

    return cnt;
}

long long mergeSort(vector<int>& array, int left, int right) {
    int mid;
    long long cnt1, cnt2, cnt3;
    if (left + 1 < right) {
        mid = (left + right) / 2;
        cnt1 = mergeSort(array, left, mid);
        cnt2 = mergeSort(array, mid, right);
        cnt3 = merge(array, left, mid, right);
        return cnt1 + cnt2 + cnt3;
    } else {
        return 0;
    }
}

int main() {
    int n;
    cin >> n;
    vector<int> array(n);
    for (int i = 0; i < n; ++i) {
        cin >> array[i];
    }
    
    long long ans = mergeSort(array, 0, n);

    cout << ans << endl;

    return 0;
}


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

int main() {
	int N;
	cin >> N;
	bool ans = true;
	int before = 0;
	for (int i = 0; i < N; i++) {
		int H;
		cin >> H;
		if (before-1 > H) ans = false;
		before = H + (before-1==H ? 1 : 0);
	}
	cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256