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

struct obj{
	long long a, b;
};

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long N, K;
	cin >> N >> K;

	int l = 0;
	long long aux = K;
	while(aux) {
		l++;
		aux >>= 1;
	}

	vector<obj> v;
	long long ans = 0;
	for(int i = 0; i < N; ++i){
		long long a,b;
		cin >> a >> b;
		v.push_back({a,b});
		if((K | a) == K) ans += b;
	}
	for(int i = 0; i < 30; ++i){
		if((1<<i) & K) {
			int auxK = (K ^ (1<<i)) | ((1<<i) - 1);
			long long t = 0;
			for(int j = 0; j < N; ++j){
				if((auxK | v[j].a) == auxK) t += v[j].b;
			}
			ans = max(t, ans);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int n;
const int mod=1e9+7;
vector<int>vec[100001];
ll memo[100001][3];
void dfs(int node,int parent=-1){
    memo[node][0]=1;
    memo[node][1]=1;
    for(int i=0;i<vec[node].size();i++){
        if(parent!=vec[node][i]){
            dfs(vec[node][i],node);
            memo[node][0]*=memo[vec[node][i]][0]+memo[vec[node][i]][1];
            memo[node][0]%=mod;
            memo[node][1]*=memo[vec[node][i]][0];
            memo[node][1]%=mod;
        }
    }

}
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    memset(memo,-1,sizeof(memo));
    cin>>n;
    for(int i=0;i<n-1;i++){
        int x,y;
        cin>>x>>y;
        vec[x].push_back(y);
        vec[y].push_back(x);
    }
    dfs(1);
    cout<<(memo[1][0]+memo[1][1])%mod;
}

Measured memory_bytes: 13696
import java.util.*;
public class Main {
	private static Scanner sc;
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		byte a = sc.nextByte();
		for (int l=0; l<a; l++){
			byte gx=sc.nextByte();
			byte gy=sc.nextByte();
			byte No [][] = new byte [gx+1][gy+1];
			byte b = sc.nextByte();
			for (int k=0; k<b; k++){
				byte x1=sc.nextByte();
				byte y1=sc.nextByte();
				byte x2=sc.nextByte();
				byte y2=sc.nextByte();
				
				if (x1 == x2) {
					No [x1][(Math.max(y1, y2))]+=1;
				}
				else {No[(Math.max(x1,x2))][y1]+=2;}			
			}
			int Total[][] = new int [gx+1][gy+1];
			Total[0][0] = 1;
			for (int i=0; i<=gx; i++){
				for (int j=0; j<=gy; j++){
					if (No[i][j] == 0){
						if (i>0 & j>0){
							Total[i][j]=Total[i-1][j]+Total[i][j-1];
						}
						else if (i>0){
							Total[i][j]=Total[i-1][j];
						}
						else if (j>0){
							Total[i][j]=Total[i][j-1];
						}
						else;
					}
					else if(No[i][j] == 1){
						if (i>0){
							Total[i][j]=Total[i-1][j];
							}
						else Total[i][j]=0;
					}
					else if(No[i][j] == 2){
						if (j>0){
						Total[i][j]=Total[i][j-1];
						}
						else Total[i][j]=0;
					}
					else {
						Total[i][j]=0;
					}
				}
			}
			if (Total[gx][gy]==0){
				System.out.println("Miserable Hokusai!");
			}
			else {System.out.println(Total[gx][gy]);
			}
		}
	}
}

Measured memory_bytes: 33144
#include <iostream>

int main(){
    int time;
    int h,m,s;
    std::cin >> time;
    h = time/3600;
    m = time % 3600 / 60;
    s = time % 60;
    std::cout << h << ":" << m << ":" << s << std::endl;
    return 0;
}


Measured memory_bytes: 3092
# include <iostream>
using namespace std;
int main(){char d;
	string s1,s2,s3;
	cin>>s1>>s2>>s3;
	d= s1[0]-32;
	cout<<d;
		d= s2[0]-32;
	cout<<d;
	d=s3[0]-32;
	cout<<d;
	return 0;
	
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int A,B,C,X;
		Scanner scan = new Scanner(System.in);
		A = scan.nextInt();
		B = scan.nextInt();
		C = scan.nextInt();
		X = scan.nextInt();
		int n = 0;
 
		for(int a = 0; a <= A; a++) {
			for(int b = 0; b <= B; b++) {
				for(int c = 0; c <= C; c++) {
					if((500 * a + 100 * b + 50 * c) == X) {
						n++;
					}
				}
			}
		}
 
		System.out.println(n);
	}
}


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

int main(){
  int N;
  cin >> N;
  int64_t A,B;
  vector< pair<int64_t,int64_t> > BA(N);
  for(int i=0;i<N;i++){
    cin >> A >> B;
    BA.at(i)=make_pair(B,A);
  }
  int64_t time=0;
  sort(BA.begin(),BA.end());
  bool flag=true;
  for(int i=0;i<N;i++){
    time+=BA.at(i).second;
    if(time>BA.at(i).first){
      flag=false;
      break;
    }
  }
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3328
#include <limits>
#include <initializer_list>
#include <utility>
#include <bitset>
#include <tuple>
#include <type_traits>
#include <functional>
#include <string>
#include <array>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <complex>
#include <random>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <regex>
#include <cassert>
#include <cstddef>
// #include <variant>

// Yay!!
#define endl codeforces

// macros for iterator
#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)

// alias
using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;

// variadic min/max
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }

// variadic chmin/chmax
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

// multi demension array
template <typename T, std::size_t Head, std::size_t... Tail> struct multi_dim_array { using type = std::array<typename multi_dim_array<T, Tail...>::type, Head>; };
template <typename T, std::size_t Head> struct multi_dim_array<T, Head> { using type = std::array<T, Head>; };
template <typename T, std::size_t... Args> using mdarray = typename multi_dim_array<T, Args...>::type;

// fill container
// template <typename T, typename F, typename... Args> 
// void fill_seq(T &t, F f, Args... args) { if constexpr (std::is_invocable<F, Args...>::value) { t = f(args...); } else { for (ssize_t i = 0; i < t.size(); i++) fill_seq(t[i], f, args..., i); } }

// make multi dimension vector
template <typename T> vec<T> make_v(ssize_t sz) { return vec<T>(sz); }
template <typename T, typename... Tail> auto make_v(ssize_t hs, Tail&&... ts) { auto v = std::move(make_v<T>(std::forward<Tail>(ts)...)); return vec<decltype(v)>(hs, v); }

// init
namespace init__ { 
struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; 
}


int main() {
    ll n;
    std::cin >> n;
    ll ans = n;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i) continue;
        ll a = i, b = n / i;
        ll al = std::to_string(a).size();
        ll bl = std::to_string(b).size();
        chmin(ans, std::max(al, bl));
    }
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
var
a:array [1..255] of char;
b:string;
h,i:longint;
begin
read(b);
for i:=1 to length(b) do
begin
if length(b)<4 then h:=1
else a[i]:=b[i];
end;
if h<>1 then
if (a[1]='Y') and (a[2]='A') and  (a[3]='K') and (a[4]='I') then
write('Yes')
else write('No')
else write('No');
end.


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

using namespace std;

#define pb push_back
#define mp make_pair
#define lli long long int
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define mii map<lli,lli>
#define msi map<string,lli>
#define pii pair<lli,lli> 
#define vi vector<lli> 
#define vvi vector< vector<lli> >
#define sz(x) (lli)x.size()
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX1 998244353
#define MAX2 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define input(data,n,command) for(lli i=0;i<n;i++){lli tmp;cin>>tmp;data.pb(tmp);command}
#define sort_asc(a) sort(a.begin(),a.end());
//#define sort_desc(a) sort(a.begin(),a.end(),greater<lli>());
#define display(a) for(lli i = 0 ;i<a.size();i++){cout<<a[i]<<" ";} cout<<endl;
#define rep(i,a,b) for(lli i = a;i < b;i++)
#define endl "\n"

//Written By MUDIT BHARDWAJ...
/*--------------------------------------------------------------------*/
//vector<pair<lli,lli>>adj[300010];
lli n,k;
std::vector<lli> v;

lli calc(lli num)
{
	lli count = 0;
	rep(i,0,n)
	{
		lli x = v[i];
		if(x > num)
		{
			lli times = x/num;
			if(x%num)
			{
				count += times;
			}
			else
			{
				count += times-1;
			}
		}
	}
	if(count > k)
	{
		return 0;
	}
	else
	{
		return 1;
	}
}

lli solve()
{
    //start from here
    cin>>n>>k;
    rep(i,0,n)
    {
    	lli a;
    	cin>>a;
    	v.pb(a);
    }
    sort_asc(v);
    lli low = 1;
    lli high = 1000000000;
    lli mid;
    lli ans = MAX2;
    while(low + 1 < high)
    {
    	mid = (low + high)/2;
    	lli poss = calc(mid);
    	if(poss == 0)
    	{
    		low = mid + 1;
    	}
    	else
    	{
    		high = mid;
    		ans = min(ans,mid);
    	}
    }
    if(calc(low) == 1)
    {
    	ans = min(ans,low);
    }
    if(calc(high) == 1)
    {
    	ans = min(ans,high);
    }
    cout<<ans;
    return 0;
}

int main()
{
    ios
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    lli T=1;
    //cin>>T;
    while(T--)
    {
        solve();
    }
    return 0;
}
/*-----------------------------------------------------------------------*/

Measured memory_bytes: 5320
// finish date: 2018/01/30
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;


int main() {
    string s;
    cin >> s;
    int point = 0;
    rep(i, s.length()) point += (s[i] == 'g') ? 1 : -1;
    point += s.length() / 2;
    point -= (s.length() + 1) / 2;
    point/=2;
    cout<<point<<endl;

    return 0;
}



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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll n;
    string s;
    cin>>n>>s;
    ll r=0,b=0;
    rep(i,n){
        r += s[i]=='R';
        b += s[i]=='B';
    }
    if(r>b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end(), greater<>());
    ll ans = 0;
    for (ll i = k; i < n; ++i) {
        ans += a[i];
    }
    cout << ans;
    return 0;
}

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

int main(){
  int N, K;
  string S;
  cin >> N >> S >> K;
  char c=S[K-1];
  for(int i=0; i<N; i++){
    if(S[i]!=c) S[i]='*';
  }
  cout << S << endl;
  return 0;
}

Measured memory_bytes: 256
function main(input: string) {
  const args: string[] = input.split("\n");
  const N: number = parseInt(args[0]);
  const arr: number[] = args[1].split(" ").map(v => parseInt(v));
  if (arr.findIndex((v, i) => v > i + 1) > -1) {
    // -1出して終了
    console.log(-1);
    return;
  }
  let result:string = null
  for (let i = 0; i < N; i++) {
    const h = next(arr);
    if (h === -1) {
      console.log(-1);
      return;
    } else {
      result ? result = `${h}\n${result}` : result = `${h}`;
      arr.splice(h - 1, 1);
    }
  }
  console.log(result);
}

function next(arr: number[]):number {
  let hit = -1;
  for (let i = arr.length - 1; i >= 0; i--) {
    if (arr[i] === i + 1) { 
      hit = arr[i];
      break;
    }
  }
  return hit;
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
int a[maxn*4];
int vis[maxn*4];
int b[maxn*4];
int main()
{
   int a,b;
   cin>>a>>b;
   if(a+b==15) cout<<"+"<<endl;
   else if(a*b==15) cout<<"*"<<endl;
   else cout<<"x"<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);

        long k = scanner.nextLong();
        long n = scanner.nextLong();

        long max = 0;
        long sum = 0;
        long first = 0;
        long previous = 0;

        for (long i = 0; i < n; i++) {
            long a = scanner.nextLong();
            if (i == 0) {
                max = a;
                sum = a;
                first = a;
                previous = a;

            } else {
                long aida = a - previous;
                previous = a;
                sum = sum + aida;

                if (aida > max) {
                    max = aida;
                }
            }
        }
        long saigo = k - sum + first;

        if (saigo > max) {
            max = saigo;
        }

        System.out.println(k - max);
    }
}


Measured memory_bytes: 64936
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>

using namespace std;

struct Union_find{
    vector<int> par;
    vector<int> rank;
    Union_find(int p){
        par = vector<int>(p + 1);
        rank = vector<int>(p + 1);
        for(int i = 1; i <= p; i++){
            par[i] = i;
        }
    }
    int find(int x){
        if(par[x] == x)
            return x;
        else{
            return par[x] = find(par[x]);
        }
    }
    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(rank[x] < rank[y]){
            par[x] = y;
        } else{
            par[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
        }
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

int main(){
    int n;
    long long ans = 0;
    cin >> n;
    vector<pair<int, int>> x(n), y(n);
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        x[i] = {a, i};
        y[i] = {b, i};
    }
    sort(begin(x), end(x));
    sort(begin(y), end(y));
    vector<tuple<int, int, int>> z(2 * n - 2);
    for(int i = 0; i < n - 1; i++){
        z[i] = make_tuple(x[i + 1].first - x[i].first, x[i].second, x[i + 1].second);
    }
    for(int i = 0; i < n - 1; i++){
        z[i + n - 1] = make_tuple(y[i + 1].first - y[i].first, y[i].second, y[i + 1].second);
    }
    sort(begin(z), end(z));
    Union_find uf(n);
    for(auto&& i : z){
        int a, b, c;
        tie(a, b, c) = i;
        if(!uf.same(b, c)){
            uf.unite(b, c);
            ans += a;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define REP(i,j) for(int i=0;i<j;i++)
using namespace std;
typedef struct{
	string name;
	int time;
}Procces;
int main(void){

	queue<Procces> qu;
	Procces a;
	int num,temp;
	cin >> num;
	cin >> temp;
	REP(i,num){
		cin >> a.name >> a.time;
		//scanf("%s %d",a.name,&a.time);
		qu.push( ( Procces ){a.name,a.time});
		}
	int sum = 0;	
	while(!qu.empty()){
		Procces temp1;
		temp1 = qu.front();
		qu.pop();
		if(temp1.time > temp){
			qu.push((Procces){temp1.name,temp1.time-temp});
			sum+= temp;
			}
		else{
			sum+=temp1.time;
			cout << temp1.name <<" " << sum << endl;
		}
	
	}	
			
	return 0;
}

Measured memory_bytes: 4404
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };


signed main() {
	int h, w;
	vector<string>list;
	int maxn = 0;
	int a, p;

	cin >> a >> p;

	cout << (a * 3 + p) / 2 << endl;







	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
S = list(input())
N = int(input())

'''
ordの位置
#z = 122
#a = 97
左の文字からNで'a'に出来るかを確認
aに出来るならaにして使った分をNから引く
繰り返して行き一番最後にあまりをすべて使う
'''
  
for i, s in enumerate(S):
  if ord(s) - 97 > 0  and 122 - ord(s) < N:
    S[i] = "a"
    N -= 123 - ord(s)
else:
  S[i] = chr(N % 26 + ord(S[i])) # ここのWAは反省する
       
print("".join(S))

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

using namespace std;
using ll = long long;

int main() {
    string S;
    cin >> S;
    vector<int> A(3, 0);

    for(int i = 0; i < S.size(); i++) {
        A.at(S.at(i) - 'a')++;
    }
    sort(A.begin(),A.end());

    if(abs(A.at(0) - A.at(2)) <= 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

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

int main()
{
   long long int a, b;
   cin>>a>>b;

   if(a == 1 || b == 1)
   {
       cout<<"1"<<endl;
   }
   else
   {
       long long int ans = (a * b + 1) / 2;
       cout<<ans<<endl;
   }
}


Measured memory_bytes: 256
N,M=map(int,input().split())
ks=[list(map(int,input().split()))[1:] for _ in range(M)]
p=list(map(int,input().split()))

ans=0

for i in range(2**N):
  lamp=[0]*M
  for j in range(len(bin(i))-2):
    if (i>>j)&1==1:
      for k in range(M):
        if j+1 in ks[k]:
          lamp[k]+=1
  ja=0
  for j in range(M):
    if lamp[j]%2!=p[j]:
      ja+=1
  if ja==0:
    ans+=1
    
    
print(ans)

Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#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 <memory>
#include <regex>
using namespace std;

bool solve(vector<int> a)
{
    int n = a.size();
    sort(a.begin(), a.end());

    vector<int> b(n);
    b[0] = a.front();
    b[1] = a.back();
    for(int i=2; i<n; ++i)
        b[i] = b[i-1] ^ b[i-2];
    if((b[n-2] ^ b[n-1]) != b[0])
        return false;

    sort(b.begin(), b.end());
    return a == b;
}

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

    if(solve(a))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>
#include<complex>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define scan(x) scanf("%lld",&x);
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
typedef double D;
const ll inf = 5555555555555555555;
const ll mod = 1000000007;
const D pi = acos(-1);
const D EPS = 1e-10;

ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool ok, flag;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111

ll dist[MAX];
int main(void) {
  deque<ll> dq;
  dq.push_front(0);
  rep(i, MAX) dist[i] = inf;
  dist[0] = 0;
  cin >> n;

  while (!dq.empty()) {
	m = dq.front();
	dq.pop_front();
	tmp = 1;
	while (m + tmp < MAX) {
	  if (dist[m + tmp] == inf) {
		dist[m + tmp] = dist[m] + 1;
		dq.push_back(m + tmp);
	  }
	  tmp *= 9;
	}
	tmp = 1;
	while (m + tmp < MAX) {
	  if (dist[m + tmp] == inf) {
		dist[m + tmp] = dist[m] + 1;
		dq.push_back(m + tmp);
	  }
	  tmp *= 6;
	}
  }
  cout << dist[n] << endl;
}


Measured memory_bytes: 1280
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		
		for (int i=0; i<n; i++) {
			int mode = sc.nextInt();
			if (mode == 0) {
				list.add(sc.nextInt());
			}
			else if (mode == 1) {
				System.out.println(list.get(sc.nextInt()));
			}
			else if (mode == 2) {
				list.remove(list.size()-1);
			}
		}
		
	}
}



Measured memory_bytes: 141124
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;
//入力
int n;
int k;
long long h[110000];

//DPテーブル
long long dp[110000];

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

  for(int j=0;j<110000;j++){
    dp[j]=INF;
  }
  dp[0]=0;

  for (int i=0;i<n;i++){
    for (int j=1;j<=k;j++){
      chmin(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
    }
  }

  cout << dp[n-1] << endl;
  
}



Measured memory_bytes: 1920
// R I S E
/* Dedication has no limitation 
                   - Ulisses Jr.
*/
// 16 MAY  2019
#include <bits/stdc++.h>
using namespace std;

int main()
{char b;
 cin >> b;
 if(b=='A')
   cout << "T" << endl;
 if(b=='T')
   cout << "A" << endl;
 if(b=='C')
   cout << "G" << endl;
 if(b=='G')
   cout << "C" << endl;
 
return 0;

}




 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
int N, ans = 0;

bool emp(vint a)
{
    int n = a.size();
    rep(i, n)
    {
        if (a[i] != 0)
            return false;
    }
    return true;
}

void solve(vint a)
{
    int n = a.size();
    int Min = 101;
    rep(i, n)
    {
        Min = min(Min, a[i]);
    }
    vint b[n];
    int count = 0;

    rep(i, n)
    {
        a[i] -= Min;
    }
    ans += Min;
    //    bool positive = true;
    rep(i, n)
    {
        if (a[i] == 0)
        {
            count++;
        }
        else
        {
            b[count].push_back(a[i]);
        }
    }
    rep(i, n)
    {
        if (!emp(b[i]))
            solve(b[i]);
    }
}

int main()
{

    cin >> N;
    vint h(N);

    rep(i, N)
    {
        cin >> h[i];
    }
    solve(h);
    cout << ans;
    return 0;
}

Measured memory_bytes: 384
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            if isCLKWISE(phU) : break
            else :
                del phU[-2]
                if len(phU) == 2 : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            if isCLKWISE(phL) : break
            else :
                del phL[-2]
                if len(phL) == 2 : break
    ph = phU + phL[1:-1]
    return ph
  
n = range(int(input()))
P = [[int(x) for x in input().split()] for _ in n]
Q = ConvexHullScan(P)
Q.reverse()
print(len(Q))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(Q)])[2]
R = Q[idx:] + Q[:idx]
for r in R : print(r[0],r[1])

Measured memory_bytes: 33828
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	string S;

	while (true)
	{
		cin >> S;

		if (S == "0000") { break; }

		if (S[0] == S[1] && S[1] == S[2] && S[2] == S[3])
		{
			cout << "NA" << endl;
		}
		else
		{
			int count_ = 0;

			while (S != "6174")
			{
				string S1 = S, S2 = S;

				sort(S1.begin(), S1.end(), greater<char>());
				sort(S2.begin(), S2.end());

				S = to_string(stoi(S1) - stoi(S2));

				while (S.size() < 4)
				{
					S = '0' + S;
				}

				count_++;
			}

			cout << count_ << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3292
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

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

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 1e6 + 12; //check the limits, dummy

ll bit[62];

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

    ll a, b, c;
    cin >> a >> b >> c;
    a = a + b + c;
    if (a >= 22) cout << "bust\n";
    else cout << "win\n";

    return  0;
}


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

int main(){
  string s,t;
  cin >> s >> t;
  int ans=100000;
  
  for(int i=0;i<=s.size()-t.size();i++){
    int p=0;
    for(int j=0;j<t.size();j++){
      if(s[i+j]!=t[j]) p++;
    }
    ans=min(ans,p);
  }
  
  cout << ans << endl;
}

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

using namespace std;

void sol()
{
	long long int n;
	cin >> n;
	
	long long int i=1;
	
	vector<long long int>v;
	
	while(i<=n)
	{
		if(i%3!=0 && i%5!=0)
		{
			v.push_back(i);
		}
		
		++i;
	}
	
	long long int sum=0;
	
	for(int i=0;i<v.size();++i)
	{
		sum+=v[i];
	}
	
	cout << sum << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	sol();
}

Measured memory_bytes: 11620
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
 
    float ans,k,n,l;
    cin>>n>>k;
    ans=1;
    for(int i=0;i<n;i++)
    cin>>l;
    ans+=ceil((n-k)/(k-1));
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
N=int(input())
M=[0]*5
for i in range(N):
  S=input()
  if S[0]=="M":
    M[0]+=1
  elif S[0]=="A":
    M[1]+=1
  elif S[0]=="R":
    M[2]+=1
  elif S[0]=="C":
    M[3]+=1
  elif S[0]=="H":
    M[4]+=1

ans=0
for i in range(5):
  for j in range(i+1,5):
    for k in range(j+1,5):
      ans+=M[i]*M[j]*M[k]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<pair<int,int> > v;
    for(int i = 2;i <= n;i++)
    {
        bool flag = true;
        for(int j = 2;j <= sqrt(i);j++)
        {
            if(i % j == 0)
            {
                flag = false;
                break;
            }
        }
        if(flag)
        {
            v.push_back(make_pair(i,0));
        }
    }
    for(int i = 1;i <= n;i++)
    {
        int x = i;
        for(int j = 0;j < v.size();j++)
        {
            while(x % v[j].first == 0)
            {
                v[j].second++;
                x /= v[j].first;
            }
        }
    }
    long long int ans = 1;
    for(int i = 0;i < v.size();i++)
    {
        ans *= (v[i].second + 1);
        ans %= MOD;
    }
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる


//—————————————UnionFind木   UF uf(n);——————————————————————

struct UF {
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    UF(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void reset(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

//—————————————————————————————————————————————————

int main(){
  int h,w;
  cin>>h>>w;

  vector<string> p(h);
  rep(i,h){
    cin>>p[i];
  }

  UF uf(h*w);

  rep(i,h){
    rep(j,w-1){
      if(p[i][j]!=p[i][j+1]) uf.unite(i*w+j,i*w+j+1);
    }
  }

  rep(j,w){
    rep(i,h-1){
      if(p[i][j]!=p[i+1][j]) uf.unite(i*w+j,(i+1)*w+j);
    }
  }

  map<ll,pair<ll,ll>> ans;
  rep(i,h){
    rep(j,w){
      ll x=uf.root(i*w+j);
      bool b=false;
      if(p[i][j]=='#') b=true;
      if(ans.count(x)){
        if(b) ans.at(x).fi++;
        else ans.at(x).se++;
      }
      else {
        if(b) ans[x]={1,0};
        else ans[x]={0,1};
      }
    }
  }

  ll answer=0;
  for(auto x : ans){
    answer+=x.se.fi*x.se.se;
  }


  cout << answer << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long MOD = 998244353;

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

    ll n, m, v, p;
    cin >> n >> m >> v >> p;
    vector<ll> a(n);

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

    sort(a.rbegin(), a.rend());

    ll sum = a[p - 1];

    int ans = p;
    for (int i = p; i < n; i++) {
        if (a[i] + m >= a[p - 1]) {
            if ((p - 1 + n - i >= v) || (sum + m * (v - p + 1 - n + i) <= (a[i] + m) * (i - p + 1))) ans++;
        }
        sum += a[i];
    }
    cout << ans;
}

Measured memory_bytes: 1024
def countChange(inputNum, divNum):
    tmp = inputNum // divNum
    if inputNum % divNum != 0:
        tmp += 1

    return tmp

height = int(input())
width = int(input())
goal = int(input())

if height > width:
    divNum = height
else:
    divNum = width

ans = countChange(goal, divNum)
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

map<ll,int> Pfact(ll num) {
    map<ll,int> res;
    for (ll i = 2; i * i <= num; i++) {
        int cnt = 0;
        while (num % i == 0) {
            cnt++;
            num /= i;
        }
        if (cnt) res[i] = cnt;
    }
    if (num != 1) res[num] = 1;
    return res;
}
  
int main() {
  ll A,B;
  cin >> A >> B;
  map<ll,int> mp = Pfact(__gcd(A,B));
  cout << sz(mp)+1 << endl;
  return 0;
}

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

int main(){
  ll i,j,k,n,m;
  cin>>n>>m;
  if(m-n+1>=2019) cout<<"0\n";
  else {
   ll ans=2020;
    for(i=n;i<=m;i++)
    {
      for(j=i+1;j<=m;j++) ans=min(ans,(i*j)%2019); 
    }
    cout<<ans<<"\n";
  }
  
}

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

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i) {
        ll x;
        cin >> x;
        a[i] = x * 2;
    }
    ll sum = accumulate(a.begin(), a.end(), 0ll) / 2;
    ll part = 0;
    for (int j = 0; j < n; ++j) {
        if (j % 2 == 1) {
            part += a[j];
        }
    }
    vector<ll> ans(n);
    ans[0] = sum - part;
    for (int i = 1; i < n; ++i) {
        ans[i] = a[i - 1] - ans[i - 1];
    }
    for (ll i : ans) cout << i << endl;
}


Measured memory_bytes: 2944
#include <iostream>
#include <string.h>

using namespace std;

int main() {

	int a, b;

	while (cin >> a >> b, a != 0 && b != 0) {

		int dp[17][17] = { 0 };

		memset(dp, 0, sizeof dp);

		int n;

		cin >> n;

		dp[1][1] = 1;

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

			int x, y;

			cin >> x >> y;
			dp[x][y] = -1;
		}

		for (int i = 1; i <= a; i++) {
			for (int j = 1; j <= b; j++) {

				if (dp[i][j] != -1) {
					if (j != 1 && dp[i][j - 1] != -1) {
						dp[i][j] += dp[i][j - 1];
					}

					if (i != 1 && dp[i - 1][j] != -1) {
						dp[i][j] += dp[i - 1][j];
					}
				}
			}
		}

		cout << dp[a][b] << endl;

	}

	return 0;

}


Measured memory_bytes: 3080
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cctype>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;
//必要な宣言

int main() {
  int A, B;
  cin >> A >> B;

  if(A+B >= 10) cout << "error" << endl;
  else cout << A+B << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	lint N;
	cin >> N;
	lint div = 1;

	for (int i = 2; i <= sqrt(N); i++)
	{
		if (N % i == 0)
		{
			//cout << i << endl;
			div = i;
		}
	}

	cout << (int)log10(N / div) + 1 << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 512
nq = list(map(int,input().split()))
n = nq[0]
q = nq[1]
s = input()
lr = [map(int, input().split()) for _ in range(q)]
l, r = [list(i) for i in zip(*lr)]
sam = [0]*n
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        sam[i+1] = sam[i] + 1
    else:
        sam[i+1] = sam[i]
for i in range(q):
    ans = sam[r[i]-1] - sam[l[i]-1]
    print(ans)


Measured memory_bytes: 91480
import java.util.*;
import java.lang.*;

import static java.lang.StrictMath.abs;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n+2];
        int count =0;
        //格納
        for(int i=0; i < n; i++){
            p[i] = sc.nextInt();
        }
        p[n] = p[n-2];
        p[n+1]= p[n-1];

        //判定
        for(int k = 0; k < n;k++){
            if((p[k]>p[k+1] && p[k+1]>= p[k+2] )|| (p[k]<=p[k+1] && p[k+1]< p[k+2])){
                count++;
            }
        }
        //出力
        System.out.println(count);
    }
}



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

int main(){
  string s, t;
  cin >> s >> t;
  bool ans = true;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) != t.at(i)) {
      ans = false;
    }
  }
  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3564
private fun readInts() = readLine()!!.split(" ").map { it.toInt() }.toList()

fun main(args: Array<String>) {
    val (N, T) = readInts()
    val st = (0 until N).map { readInts() }

    println(st.asSequence().map { it[0] to it[1] }.filter { it.second <= T }.minBy { it.first }?.first ?: "TLE")
}

Measured memory_bytes: 37992
// Bismillahir Rahmanir Rahim .Ya Allah...
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef pair<int,int> PII;
const int mod = 1e9+7,INF = 1e9;
const int mx = 1e5+5;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    if(n>=30)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 3640
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<lint, lint> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	if (!b)return T(1);
	if (b & 1)return mypow(a, b - 1) * a;
	T memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main(){
	std::string s;
	std::cin>>s;
	std::cout<<s.substr(0,3)<<std::endl;
	return 0;
}


Measured memory_bytes: 3632
#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() {
  long long n, count, m;
  cin >> n;
  count = 0;
  m = 300000;
  rep(i,n){
    long long a;
    cin >> a;
    if(m > a){
      count++;
      m = a;
    }
  }
  cout << count;
  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);
        while (true) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if (H == 0 && W == 0) {
                break;
            }
            for (int i = 0; i < H; i++) {
                if (i == 0 || i == H-1) {
                    for (int j = 0; j < W; j++) {
                        System.out.print("#");
                    }
                } else {
                    for (int j = 0; j < W; j++) {
                        if (j == 0 || j == W-1) {
                            System.out.print("#");
                        } else {
                            System.out.print(".");
                        }
                    }
                }
                System.out.println("");
            }
            System.out.println("");
        }
        sc.close();
    }
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int n; string s,t;
  cin>>n>>s>>t;
  for (int i=0; i<n; i++) {
    	cout<<s[i]<<t[i];
  }
  cout<<endl;
  

  return 0;
}


Measured memory_bytes: 256
num=[i for i in range(-100,201)]
X,N=list(map(int,input().split()))
p=list(map(int,input().split()))
for i in p:
    if i in num:
        num.remove(i)
min=[1000,0]
for i in num:
    if abs(i-X)<min[0]:
        min=[abs(i-X),i]
print(min[1])

Measured memory_bytes: 9200
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0; i<n; i++)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define reprs(i, s, e) for(int i=e-1; i>=s; i--)

int main(){

    int n, c; cin >> n >> c;
    int d[c][c];
    rep(i, c){
        rep(j, c){
            cin >> d[i][j];
        }
    }

    int cmat[n][n];
    rep(i, n){
        rep(j, n){
            cin >> cmat[i][j];
            cmat[i][j]--;
        }
    }

    int cstripe[3][c];
    memset(cstripe, 0, sizeof(cstripe));

    rep(i, n){
        rep(j, n){
            int ijmod3 = (i + j) % 3;
            cstripe[ijmod3][cmat[i][j]]++;
        }
    }

    // rep(i, 3){
    //     rep(j, c){
    //         cout << cstripe[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    ll ans = 1e18;
    rep(c1, c){
        rep(c2, c){
            if(c1 == c2) continue;

            rep(c3, c){
                if(c1 == c3 || c2 == c3) continue;

                int cset[] = {c1, c2, c3};
                ll anstemp = 0;
                rep(i, 3){
                    rep(j, c){
                        ll cost = cstripe[i][j] * d[j][cset[i]];
                        anstemp += cost;
                        // cout << c1 << " " << c2 << " " << c3 << endl;
                        // cout << " " << i << " " << j << " "  << cost << endl;
                    }
                }

                // cout << c1 << " " << c2 << " " << c3 << " " << anstemp << endl;

                ans = min(ans, anstemp);
            }
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
using namespace std;

int main() {
	string s[3];
	cin >> s[0] >> s[1] >> s[2];
	cout << "A" << s[1].at(0) << "C" << endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

int main() {
    int x, a,b;
    cin >> x >> a >> b;
    x -= a;
    cout << x% b << endl;


    return 0;
}


Measured memory_bytes: 256
#include <complex>
#include <iostream>
using namespace std;
typedef long long ll;
ll pattern(ll n){
  if(n==0) return 0;
  ll odd = 1 + (n-1)/2;
  ll even = n/2;
  return odd*odd*odd + even*even*even;
}
int main(){
  ll N, K,ans;
  cin >> N >> K;

  if(K%2!=0){
    ll num = N/K;
    ans = num*num*num;
  }else{
    K /= 2;
    ll num = N/K;
    ans = pattern(num);
  }
  cout << ans <<endl;

  return 0;
}

Measured memory_bytes: 256