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

int main(){
    string t;
    cin >> t;
    for(int i = 0; i < (int)t.size(); i++)
        if(t[i] == '?') t[i] = 'D';
    cout << t << endl;
}

Measured memory_bytes: 3752
#pragma GCC optimize("unroll-loops,Ofast")
#pragma GCC target("avx,sse,sse2,ssse3,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
const int maxn = 1<<18, mod = 1e9 + 7;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	ll a, b;
	cin >> a >> b;
	ll t = 0;
	while((a<<t) <= b) t++;
	cout << t;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    vector<int64_t> A(N);
    rep(n,0,N) cin>>A.at(n);

    uint64_t ans=0;
    for(auto a:A){
        while(a%2==0){
            a/=2;
            ans++;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 384
void main() {
  problem();
}

void problem() {
  auto N = scan;

  void solve() {
    writeln(N.canFind('7') ? "Yes" : "No");
  }

  solve();
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

// -----------------------------------------------


Measured memory_bytes: 2736
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

ll sum[100010];
ll inv(ll x) {
	ll res = 1;
	ll k = N - 2;
	ll y = x%N;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N)*(y%N) % N;
		k /= 2;
	}
	return res;
}

ll power(ll x,ll p){
    ll res = 1;
	ll k = p;
	ll y = x%N;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N)*(y%N) % N;
		k /= 2;
	}
	return res;
}

int main(void){
    ll n,K;
    cin>>n>>K;
    ll ans = 0;
    for(ll i=K;i>=1;i--){
        ll num = K/i;
        sum[i]=power(num,n);
        ll tmp=0;
        for(ll j=2;i*j<=K;j++){
            tmp =(tmp+sum[i*j])%N;
            tmp =(tmp+N)%N;
        }
        sum[i]=(sum[i]-tmp)%N;
        sum[i]=(sum[i]+N)%N;
        tmp = (i*sum[i])%N;
        ans = (ans+tmp)%N;
    }
    cout<<(ans+N)%N<<endl;
    return 0;
}

Measured memory_bytes: 4412
#include<iostream>
#include<algorithm>
using namespace std;
int main(void){
  int n, ma, mi, sum, k;
  while(cin >> n, n){
    sum = ma = 0; mi = 9999;
    for(int i = 0;i < n; i++){
      cin >> k;
      sum += k;
      ma = max(ma, k); mi = min(mi, k);
    }
    sum = sum - ma - mi;
    cout << sum / (n - 2) << endl;
  }
}


Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<cstdio>
#define ll long long
#define mset(a,x) memset(a,x,sizeof(a))
 
using namespace std;
const double PI=acos(-1);
const int inf=0x3f3f3f3f;
const double esp=1e-6;
const int maxn=1e6+5;
const int mod=1e9+7;
int dir[4][2]={0,1,1,0,0,-1,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll inv(ll b){if(b==1)return 1; return (mod-mod/b)*inv(mod%b)%mod;}
ll fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n%mod;n=n*n%mod;}return r;}
ll Fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n;n=n*n;}return r;}
ll upd(ll x,ll v){x=x+v>=mod?x+v-mod:x+v;return x;}
ll a[maxn],dp[2005][2005];
int main()
{
	ll n,x,i,j,k;
	scanf("%lld%lld",&n,&x);
	for(i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		dp[i][0]=a[i];
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<n;j++)
		{
			int t=i-j;
			if(t<=0)
			t=n+t;
			dp[i][j]=min(dp[i][j-1],a[t]);
		}
	}
	ll ans=1e18;
	for(i=0;i<n;i++)
	{
		ll sum=0;
		for(j=1;j<=n;j++)
		{
			sum+=dp[j][i];
		}
		ans=min(ans,sum+i*x);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 33024
#include <bits/stdc++.h>
using namespace std;
string s;
int ans;
int main(){
	cin >> s ;
	ans=700;
	if(s[0] == 'o') ans += 100;
	if(s[1] == 'o') ans += 100;
	if(s[2] == 'o') ans += 100;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<map>
#include<numeric>
#include<regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9

int distance(int x1, int x2, int y1, int y2) {
	return abs(x1 - x2) + abs(y1 - y2);
}

int main() {
	int N; cin >> N;
	int t[N+1], x[N+1], y[N+1];
	t[0] = 0; x[0] = 0; y[0] = 0;
	for (int i = 1; i <= N; i++) cin >> t[i] >> x[i] >> y[i];

	bool check = true;
	int i = 0;
	while (i < N && check == true) {
		int dis = distance(x[i], x[i + 1], y[i], y[i + 1]);
		int t_dif = t[i + 1] - t[i];

		if (dis > t_dif) check = false;
		else {
			if ((t_dif - dis) % 2 == 1) check = false;
		}

		i++;
	}

	if (check) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

int main(){
	int n, a; cin>>n;
	vector< int > adj[n+1];

	for(int i = 1; i<n; i++){
		cin>>a;
		adj[a].push_back(i);
	}

	for(int i = 1; i<=n; i++){
		cout<<adj[i].size()<<endl;
	}
	return 0;
}


Measured memory_bytes: 14540
import sys
d=sys.stdin
while 1:
 n=int(d.readline())
 if n==0:break
 a=1;s='123456'
 for _ in[0]*n:
  s=[s[int(e)]for e in{'N':"152304",'E':"310542",'W':"215043",'S':"402351",'R':"024135",'L':"031425"}[d.readline()[0]]]
  a+=int(s[0])
 print(a)


Measured memory_bytes: 5660
#include <bits/stdc++.h>
using namespace std;
int main(){
  std::vector<long> a(87);
  a[0]=2;a[1]=1;
  for (int i = 2; i < 87; i++) {
    /* code */
    a[i]=a[i-1]+a[i-2];
  }
  int n;
  std::cin >> n;
  std::cout << a[n] << std::endl;
}

Measured memory_bytes: 256
n,q = map(int,input().split())
s = input()
left = []
right = []
ans = [0]*(n+1)
for i in range(q):
  l,r = map(int,input().split())
  left.append(l)
  right.append(r)
for j in range(n):
  ans[j+1] = ans[j]+(1 if s[j:j+2]=="AC" else 0) 
for k in range(q):
  print(ans[right[k]-1]-ans[left[k]-1])

Measured memory_bytes: 15796
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

int n, x;

const int MAXN = 100005;
int a[MAXN];

int main() {
    GI(n); GI(x);

    LL res = 0;

    FOR1(i, n) {
        GI(a[i]);

        if (i == 1 && a[i] > x) {
            res += a[i] - x;
            a[i] = x;
        }

        if (i > 1 && a[i] + a[i-1] > x) {
            res += a[i] + a[i-1] - x;
            a[i] -= a[i] + a[i-1] - x;
        }
    }

    cout << res << "\n";
    return 0;
}

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

int gcd(int a, int b){
    if (b==0) return a;
    return gcd(b, a%b);
}

int main(){
    int n; cin >> n;
    int a[n+1];
    for (int i=0; i<n; i++) cin >> a[i];
    int c;
    if (n==2) c = gcd(a[0], a[1]);
    else c = gcd(a[0], gcd(a[1], a[2]));

    int j;
    for (int i=1; i<=c; i++){
        for (j=0; j<n; j++){
            if (a[j]%i != 0) break;
        }
        if (j==n) cout << i << endl; 
    }
}


Measured memory_bytes: 3112
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int K;
int A, B;
// vector<int> A;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> K >> A >> B;
  // A.resize(N);
  // for (int i = 0; i < N; i++) {
  //   int tmp;
  //   cin >> tmp;
  //   A[i] = tmp;
  // }

  int k = K;
  int i = 1;
  bool ok = false;
  while (k <= B) {
    if (A <= k && k <= B) {
      ok = true;
      break;
    }
    k = K * i;
    i++;
  }

  if (ok) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }
  return 0;
}


Measured memory_bytes: 3132
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using ld = long double;
 
const ll MOD = 1000000007;
 
#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " (" << x.first << " : " << x.second << ")" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "["; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "(" << obj.first << ", " << obj.second << ")"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print_sim_py(void) {cout << endl;}
template <class Head> void print_sim_py(Head&& head) {cout << head;print_sim_py();}
template <class Head, class... Tail> void print_sim_py(Head&& head, Tail&&... tail) {cout << head << " ";print_sim_py(forward<Tail>(tail)...);}
 
#define print(...) print_sim_py(__VA_ARGS__);
#else
#define print(...);
#endif


int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    ll n,k,ans,last_max;

    ans = 1000;
    
    cin >> n;
    vector<ll> a(n);

    for(ll i=0; i<n; i++){
        cin>>a[i];
    }
    
    last_max = n-1;
    for(ll i=n-1; i>=0; i--){
        if(a[i-1] >= a[i]){
            last_max = i-1;
        }else if(a[i-1] < a[i]){
            break;
        }
    }
    print(last_max)

    k=0;
    for(ll i=1; i<=last_max; i++){
        if(a[i-1]<a[i]){
            if(ans < a[i-1]){
                continue;
            }
            k += ans/a[i-1];
            ans -= a[i-1]*k;
        }
        if(a[i-1]>a[i]){
            ans += a[i-1]*k;
            k = 0;
        }
        print(i,ans,k);
    }

    ans += a[last_max]*k;

    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 3612
from collections import Counter
def main():
    N = int( input())
    C = list(input())
    CC = Counter(C)
    ans = min(CC["R"], CC["W"])
    r = CC["R"]
    count = 0
    for c in C[:r]:
        if c == "W":
            count += 1
    ans = min(ans, count)
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 12164
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
// ============ template finished ============

int main()
{
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    int start = H1 * 60 + M1;
    int end = H2 * 60 + M2;
    int diff = end - start;
    if (diff < K) {
        cout << 0 << endl;
    }
    else {
        cout << diff - K << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main(void){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    
    if((x-r)<0||(x+r)>W||(y-r)<0||(y+r)>H){
        printf("No\n");
    }
    else{
        printf("Yes\n");
    }
    return 0;
}


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

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

		if( x % 3 == 0 ) {
			cout << " " << i;
			continue;
		}

		do {
			if( x % 10 == 3 ) {
				cout << " " << i;
				break;
			}

			x /= 10;
		}
		while( x );
	}

	cout << endl;
}

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

	call( n );
}



Measured memory_bytes: 3108
n, t = map(int, input().split())
li_t = list(map(int, input().split()))

counter = 0

for i in range(len(li_t)):
    if i == (len(li_t) - 1):
        counter += t
    else:
        if li_t[i + 1] - li_t[i] >= t:
            counter += t
        else:
            counter += li_t[i + 1] - li_t[i]


print(counter)


Measured memory_bytes: 25200
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n,m;
    // if(n)
    cin>>n>>m;
    if(n<=1&&m<=1)
    {
        cout<<"0"<<endl;
    }
    else if(m<=1)
    {
        int ans=(n*(n-1))/2;
        cout<<ans<<endl;
    }
    else if(n<=1)
    {
        int ans=(m*(m-1))/2;
        cout<<ans<<endl;

    }
    else
    {
        int ans=(m*(m-1))/2;
        ans=ans+(n*(n-1))/2;
        cout<<ans<<endl;

    }
    // int t;
    // cin>>t;
    // while(t--)
    // {

    // }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
string S;
cin>>N;
for(int i=0;i<N;i++){

cin>>S;
if(S=="Y"){
cout<<"Four"<<endl;
break;
}
if(i==N-1 &&S!="Y"){
cout<<"Three"<<endl;
}
}
}







Measured memory_bytes: 256
//MAXの制限が小さい。O( MAX/Q logN )
#include<iostream>
#include<algorithm>
#include<vector>
#define rep(i,n) for(i = 0;i < n;i++)
using namespace std;

int N,Q;
vector<int> num;
vector<int>::iterator index;

int main(){
	int i;
	cin >> N >> Q;
	num.resize( N );
	rep(i,N)
		cin >> num[i];
	sort( num.begin(),num.end() );
	rep(i,Q)
	{
		int q,ans = 0;
		cin >> q;
		for( int j = q;j <= 300000;j+=q ){
			index = lower_bound( num.begin(),num.end(),j );
			if( index == num.begin() )
				continue;
			index--;
			ans = max( ans,*index - (j-q) );
		}
		cout << ans << endl;
	}
	return 0;
}

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

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

    if(s.size() != t.size()) {
        cout << "No" << endl;
        return 0;
    }

    int n = s.size();
    rep(i, n) {
        string u = t.substr(i, n-i) + t.substr(0, i);
        if(s == u) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3540
#include<bits/stdc++.h>
using namespace std; 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define length size()
#define int long long
#define ll long long
const int MOD = 1000000007;
const int MAX = 510000;
template<typename T> string join(vector<T> &vec ,const string &sp){
    int si = vec.length;
    if(si==0){
        return "";
    }else{
        stringstream ss;
        rep(i,si-1){
            ss << vec[i] << sp;
        }
        ss << vec[si - 1];
        return ss.str();
    }
}
signed main(void){
  int n;
  cin >> n;
  vector<int> vec(n);
  rep(i,n){
  cin >> vec[i];
  }
  int sum = 0;
  for(int i=0;i<n-2;i++){
    for(int j = i+1;j<n-1;j++){
      for(int k = j+1;k<n;k++){
      int a,b,c;
        a = vec[i];
        b = vec[j];
        c = vec[k];
        if(a+b>c&&a+c>b&&c+b>a&&a!=b&&b!=c&&c!=a){
          sum++;
          //cout << a << " " << b << " " << c << endl;
        }
      }
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
#define REP(i,f,n) for(int i=f; i<(n); i++)
int main()
{
  ll ans = 0;
  ll n;
  cin >> n;
  vector<ll> a;
  ll b = 0, imamade = 0;

  REP(i,0,n){
    int d;
    cin >> d;
    d%=mod;
    a.push_back(d);
    b+=d;
    b%=mod;
  } 

  REP(i,0,n-1){
    imamade += a[i];
    imamade %= mod;
    //cout << (b- imamade)<< ", " <<a[i] << endl;
    ans += (a[i]*(b+mod- imamade)%mod)%mod;
    ans%=mod;
  }

  cout << ans%mod << endl;

  //--debug : end_stoper
  //string end_stoper; cin >> end_stoper;

  return 0;
}

Measured memory_bytes: 5372
n = int(input())
s = [int(x) for x in input().split()]

swap_cnt = 0

for i in range(n) :
    cmin = i
    for j in range(i + 1, n) :
        if s[j] < s[cmin] :
            cmin = j
            
    if i != cmin :
        s[i], s[cmin] = s[cmin], s[i]
        swap_cnt += 1
                
print(" ".join(map(str, s)))
print(swap_cnt)



Measured memory_bytes: 5604
n = gets.chomp.to_i
a = readlines.map(&:chomp).map(&:to_i)

a_max = a.sort.reverse[0]
a_second = a.sort.reverse[1]

n.times do |i|
    if a[i] == a_max
        puts(a_second) 
        next
    end
    puts(a_max)
end

Measured memory_bytes: 37608
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順

int main()
{
  string S;
  cin >> S;
  set<char> B;
  for (char c = 'a'; c <= 'z'; c++)
    B.insert(c);
  rep(i, S.size())
  {
    if (B.count(S.at(i)) > 0) {
      B.erase(S.at(i));
    }
  }
  if (B.empty()) {
    cout << "None" << endl;
  } else {
    cout << *B.cbegin() << endl;
  }
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=1000 +117;
const int MM= +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
struct node{
	LL x,y;
	node(LL x_=0,LL y_=0){
		x=x_,y=y_;
	}
}a[NN]={};
LL ab(LL x){
	return x>0?x:-x;
}
LL dis(node a,node b){
	return ab(a.x-b.x)+ab(a.y-b.y);
}
int c[2];
int pre[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
char op[4]={'L','R','D','U'};
void solve(node tar){
	node now=node(0,0);
	int range=0x7fffffff;
	for(int i=30;i>=0;--i){
		int st=1<<i;
		range-=st;
		for(int j=0;j<4;++j){
			node xt=node(now.x+st*pre[j][0],now.y+st*pre[j][1]);
			if(dis(xt,tar)<=range){
				putchar(op[j]);
				now=xt;
				break;
			}
		}
	}
	putchar('\n');
}
int main(){
	//open();
	n=read();
	for(int i=1;i<=n;++i){
		a[i].x=read();
		a[i].y=read();
		c[(a[i].x^a[i].y)&1]=1;
	}
	if(c[0]&&c[1]){
		printf("-1\n");
		return 0;
	}
	if(c[0]){
		m=32;
	}
	else m=31;
	printf("%d\n",m);
	if(c[0]){
		printf("%d ",1);
	}
	for(int i=30;i>=0;--i){
		printf("%d ",1<<i);
	}
	putchar('\n');
	for(int i=1;i<=n;++i){
		if(c[0]){
			putchar('L');
			a[i].x+=1;
		}
		solve(a[i]);
	}
	close();
	return 0;
}

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

struct edge { int to, cost; };
struct node {
  int id, distance;
  node(int id, int distance) {
    this->id = id;
    this->distance = distance;
  }
  bool operator <(const node &theOther) const { return distance < theOther.distance; }
  bool operator >(const node &theOther) const { return distance > theOther.distance; }
};
int prim(vector<vector<edge>> &G) {
  int total = 0;
  int V = G.size();
  bool used[V];
  priority_queue<node, vector<node>, greater<node> > que;

  que.push(node(0, 0));
  for(int i = 0; i < V; i++) used[i] = false;

  while(!que.empty()) {
    node n = que.top(); que.pop();
    if(used[n.id]) continue;
    used[n.id] = true;
    total += n.distance;
    for(edge e : G[n.id]) {
      if(!used[e.to]) que.push(node(e.to, e.cost));
    }
  }
  return total;
}

int main () {
  int n;
  scanf("%d", &n);

  vector<pair<int, int>> x(n);
  vector<pair<int, int>> y(n);

  rep(i,n) {
    int a, b ;
    scanf("%d %d", &a, &b);
    x[i] = make_pair(a, i);
    y[i] = make_pair(b, i);
  }

  vector<vector<edge>> G(n);
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());

  rep(i,n-1) {
    G[x[i].second].push_back(edge {x[i+1].second, x[i+1].first - x[i].first});
    G[x[i+1].second].push_back(edge {x[i].second, x[i+1].first - x[i].first});
    G[y[i].second].push_back(edge {y[i+1].second, y[i+1].first - y[i].first});
    G[y[i+1].second].push_back(edge {y[i].second, y[i+1].first - y[i].first});
  }

  printf("%d\n", prim(G));
  return 0;
}


Measured memory_bytes: 10616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
int main(){
  ll N; cin >> N;
  vector<ll> a(N); for(ll i = 0; i < N; i++) cin >> a.at(i);
  ll sunuke = 0;
  ll kuma = a.at(N-1);
  for(ll i = 0; i < N-1; i++) sunuke += a.at(i);
  ll ans = abs(sunuke-kuma);
  for(ll i = N-2; i >= 1; i--){
    ans = min(ans, abs(sunuke-kuma));
    sunuke -= a.at(i);
    kuma += a.at(i);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4744
#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <vector>
#include <map>
#include <unordered_map>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <limits.h>
#include <tgmath.h>

using namespace std;

typedef uint16_t ui16;
typedef uint32_t ui32;
typedef uint64_t ui64;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef long double ld;
typedef pair<int, int> pr;

//template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) {for (int i = 0; i < v.size(); ++i) cout << v[i] << " "; cout << endl; return cout; }
void print() { cout << endl; }
template<typename T, typename... Ts> void print(T x, Ts... xs) { cout << x << " "; print(xs...); };
template<typename T> void read(vector<T>& v) { for (int i = 0; i < v.size(); ++i) cin >> v[i]; };

int main() {
    ui32 N;
    cin >> N;
    vector<int> h(N + 1, 0);
    for (int i = 1; i <= N; ++i) {
        cin >> h[i];
    }

    vector<int> dp(N + 1);
    dp[0] = 0;
    dp[1] = 0;

    for (int i = 2; i <= N; ++i) {
        dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
        if (i > 2) {
            dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        }
    }

    cout << dp[N];

    return 0;
}


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


void solve(long long N){
    double x=0;
    x=(double)N/1.08;
    ll i=x,j=i+1;
    ll a=1.08*i,b=1.08*j;
    ll ans=0;
    if(a==N) ans=i;
    else if(b==N)ans=j;
    else {
        cout<<":("<<endl;
        return;
    }
    cout<<ans<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::cout<<std::fixed<<std::setprecision(10);//誤差小数10桁まで
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
  ll A=0,B=0;
  char op='\0';

  cin >> A >> op >> B;
  cout << (op=='+'?A+B:A-B) << endl;

  return 0;
}

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

int main() {
    int n;
    cin>>n;
    queue<pair<string,int>> q;
    q.push(make_pair("a",1));
    int len=1;
    while (1)
    {
        if(q.size()==0)break;
        len=q.front().first.size();
        if(len==n){
            cout<<q.front().first<<endl;
            q.pop();
        }else{
            int kinds=q.front().second;
            string s=q.front().first;
            char c='a';
            for (int i = 0; i < kinds;i++){
                q.push(make_pair(s+c,kinds));
                c=(char)((int)c+1);
            }
            q.push(make_pair(s+c,kinds+1));
            q.pop();
        }
    }
    
}

Measured memory_bytes: 8832
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <type_traits>
#include <cmath>
#include <cassert>
#include <cstdio>

using namespace std;
using namespace placeholders;

using LL = long long;
using ULL = unsigned long long;
using VI = vector< int >;
using VVI = vector< vector< int > >;
using VS = vector< string >;
using ISS = istringstream;
using OSS = ostringstream;
using PII = pair< int, int >;
using VPII = vector< pair< int, int > >;
template < typename T = int > using VT = vector< T >;
template < typename T = int > using VVT = vector< vector< T > >;
template < typename T = int > using LIM = numeric_limits< T >;

template < typename T > inline istream& operator>>( istream &s, vector< T > &v ){ for ( T &t : v ) { s >> t; } return s; }
template < typename T > inline ostream& operator<<( ostream &s, const vector< T > &v ){ for ( int i = 0; i < int( v.size() ); ++i ){ s << ( " " + !i ) << v[i]; } return s; }
template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define NUMBERED( name, number ) NUMBERED2( name, number )
#define NUMBERED2( name, number ) name ## _ ## number
#define REP1( n ) REP2( NUMBERED( REP_COUNTER, __LINE__ ), n )
#define REP2( i, n ) REP3( i, 0, n )
#define REP3( i, m, n ) for ( int i = ( int )( m ); i < ( int )( n ); ++i )
#define GET_REP( a, b, c, F, ... ) F
#define REP( ... ) GET_REP( __VA_ARGS__, REP3, REP2, REP1 )( __VA_ARGS__ )
#define FOR( e, c ) for ( auto &&e : c )
#define ALL( c ) begin( c ), end( c )
#define AALL( a ) ( remove_all_extents< decltype( a ) >::type * )a, ( remove_all_extents< decltype( a ) >::type * )a + sizeof( a ) / sizeof( remove_all_extents< decltype( a ) >::type )
#define DRANGE( c, p ) begin( c ), begin( c ) + ( p ), end( c )

#define SZ( v ) ( (int)( v ).size() )
#define EXIST( c, e ) ( ( c ).find( e ) != ( c ).end() )

template < typename T > inline bool chmin( T &a, const T &b ){ if ( b < a ) { a = b; return true; } return false; }
template < typename T > inline bool chmax( T &a, const T &b ){ if ( a < b ) { a = b; return true; } return false; }

#define PB push_back
#define EM emplace
#define EB emplace_back
#define BI back_inserter

#define MP make_pair
#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );
	cout << setprecision( 12 ) << fixed;

	int N, X;
	cin >> N >> X;

	VI A( N );
	cin >> A;

	LL res = 0;
	res += max< LL >( 0, A[0] - X );
	chmin( A[0], X );

	REP( i, 1, N )
	{
		const LL s = A[ i - 1 ] + A[i];
		const LL d = max< LL >( 0, s - X );

		res += d;
		A[i] -= d;
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 640
n = int(input())
if 1 <= n <= 9:
    print(n)
elif 10 <= n <= 99:
    print(9)
elif 100 <= n <= 999:
    print(n-100+10)
elif 1000 <= n <= 9999:
    print(909)
elif 10000 <= n <= 99999:
    print(n-10000+910)
else:
    print(90909)

Measured memory_bytes: 2940
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "limits.h"
#include "bitset"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define ll long long int
#define sp ' '
using namespace std;

ll n, t, a;
ll anst, ansa;

int main(){
	anst = ansa = 1;
	cin >> n;
	lp(n) {
		cin >> t >> a;
		anst = anst - 1 - (anst - 1) % t + t;
		ansa = max(ansa,anst/t*a);
		ansa = ansa - 1 - (ansa - 1) % a + a;
		anst = ansa / a*t;
	}

	cout << anst+ansa << endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
x=0
y=0
tmp=0
for a in A:
    if tmp==a:
        if not(x):
            x=a
            tmp=0
        else:
            y=a
            tmp=0
    else:
        tmp=a
    if x and y:
        break
print(x*y)


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

typedef struct _Node {
  int key;
  struct _Node *next, *prev;
} Node;

Node *nil;

Node* listSearch(int key) {
  Node *cur = nil->next;
  while(cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}

void init(void) {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(void) {
  Node *cur = nil->next;
  int isf = 0;
  while(1) {
    if(cur == nil) break;
    if(isf++>0) printf(" ");
    printf("%d",cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t) {
  if(t==nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(void) {
  deleteNode(nil->next);
}

void deleteLast(void) {
  deleteNode(nil->prev);
}

void deleteKey(int key) {
  deleteNode(listSearch(key));
}

void insert(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(void) {
  int key, n, i;
  int size = 0;
  int np = 0, nd = 0;
  char com[20];
  scanf("%d", &n);
  init();
  for(i=0;i<n;i++) {
    scanf("%s%d",com, &key);
    if (com[0] == 'i') {
      insert(key);
      np++;
      size++;
    } else if(com[0] == 'd') {
      if(strlen(com) > 6) {
        if(com[6] == 'F')
          deleteFirst();
        else if(com[6] == 'L')
          deleteLast();
      } else {
        deleteKey(key);
        nd++;
      }
      size--;
    }
  }
  printList();
  return 0;
}


Measured memory_bytes: 33028
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, K): (usize, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let h: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let ans = h.iter().filter(|&&x| x >= K).count();

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a;
    scanf("%d",&a);
    int t=0,i;
    //long int b[a],k=0;
    long int b[200000],k=0;
    //int b[1500000],k=0;
    for(i=0;i<a;i++){
        scanf("%ld",&b[i]);
        if(t<b[i]) t=b[i];
        else k+=t-b[i];
    }
    printf("%ld",k);
    return 0;
}


Measured memory_bytes: 3300
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
#include<iostream>
#include<cmath>
#include<queue>
#include<cctype>
#include<string>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF 2100000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define sz(x) ((int)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).begin(), (x).end(), greater<int>() )
#define clr(a,b) memset((a),(b),sizeof(a))
int dp[4545][4545],a[4545],b[4545];
int main(void)
{
	int n,t,s,time,mx=-1;
	cin>>n>>t>>s;
	rep(i,0,n) cin>>a[i]>>b[i];
	rep(i,0,n) rep(j,0,t+1) dp[i][j]=-1;
	dp[0][0]=0;
	rep(i,0,n) {
		rep(j,0,t+1) {
			if(dp[i][j]!=-1) {
				if(j<s && j+b[i]>s) time=((s-j)+(j+b[i]))-j;
				else time=b[i];
				if(i+1<=n)dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
				if(i+1<=n&&j+time<=t)dp[i+1][j+time]=max(dp[i][j]+a[i],dp[i+1][j+time]);
			}
		}
	}
	/*rep(i,0,n) {
		rep(j,0,t) {
			printf("%5d",dp[i][j]);
		}
		cout<<endl;
	}*/
	rep(i,0,t+1) {
		mx=max(mx,dp[n][i]);
	}
	cout<<mx<<endl;
	return 0;
}
	
	

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

int main(){
    string s,t;
    int a,b;
    string u;
    cin >> s >> t;
    cin >>a >>b;
    cin >> u;
    if(s==u)
    cout << a-1 << " " << b << endl;
    if(t==u)
    cout << a <<" "<< b-1 << endl;
    return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n;
  cin >> n;
  cout << (n - 2) * 180 << endl;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

next_dict = {}

for i in range(1,n*3 + 1):
    next_dict[i] = []

for i in range(m):
    u,v = uv[i]
    for j in range(3):
        next_dict[u + (j * n)].append((v + ((j+1)%3 * n )))

from collections import deque
d = deque()
d.append(s)

length = [-1] * (3*n + 1)
length[s] = 0

while(True):
    if(len(d) == 0):
        break

    num = d.popleft()
    for i in next_dict[num]:
        if( length[i] == -1 ):
            d.append(i)
            length[i] = length[num] + 1

    if(length[t] != -1):
        break

print(length[t] // 3)

Measured memory_bytes: 99320
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

typedef unsigned long long BigInt;

BigInt get_index(BigInt x) {
  BigInt index = 0;
  int d = 1;
  BigInt b = 1;
  while (10 * b <= x) {
    index += d * 9 * b;
    index += ((10 * b - 1) / 3 - (b - 1) / 3) * (4 - d);
    index += ((10 * b - 1) / 5 - (b - 1) / 5) * (4 - d);
    index += ((10 * b - 1) / 15 - (b - 1) / 15) * d;
    ++d;
    b *= 10;
  }
  index += d * (x - b);
  index += ((x - 1) / 3 - (b - 1) / 3) * (4 - d);
  index += ((x - 1) / 5 - (b - 1) / 5) * (4 - d);
  index += ((x - 1) / 15 - (b - 1) / 15) * d;
  return index;
}

string solve(BigInt s) {
  BigInt a, b;
  stringstream fizzbuzz;
  a = 1;
  b = s;
  while (b - a > 1) {
    BigInt c = (a + b) / 2;
    if (get_index(c) <= s - 1) {
      a = c;
    } else {
      b = c;
    }
  }
  for (BigInt n = a; n < a + 20; ++n) {
    if (n % 3 == 0) {
      fizzbuzz << "Fizz";
    }
    if (n % 5 == 0) {
      fizzbuzz << "Buzz";
    }
    if ((n % 3) * (n % 5) > 0) {
      fizzbuzz << n;
    }
  }
  return fizzbuzz.str().substr(s - 1 - get_index(a), 20);
}

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

Measured memory_bytes: 1208
def func(a):
  if a in (1,3,5,7,8,10,12):
    return "a"
  elif a in (4,6,9,11):
    return "b"
  else:
    return "c"

x, y = [int(i) for i in input().split()]

x_group = func(x)
y_group = func(y)

if x_group == y_group:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S,T;
  cin>>S>>T;
  bool K=true;
  for(int X=0;X<S.size();X++){
    if(S[X]!=T[X]){
      K=false;
    }
  }
  if(K==true){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

int main(){
  int N;cin >> N;
  long long  ans=1LL;
  for(int i=1;i<N+1;i++){
    ans*=i;
    ans%=1000000000+7;
  }
  cout << ans << endl;
}

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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);


  int a,b;cin>>a>>b;
  if(a>b)swap(a,b);
  for(int i=0;i<b;i++)cout<<a;
  cout<<endl;
  
  return 0;
}


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

int main() {
    int n, b=1;
    cin >> n;
    vector<int>a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    int counter = 0;
    while(1){
        if(b==2){
            cout << counter << "\n";
            break;
        }else if(counter == n){
            cout << "-1" << "\n";
            break;
        }
        b = a[b-1];
        ++counter; 
    }return 0;
}


Measured memory_bytes: 640
N = int(input())
 
num_set = []
seven_count = 0
 
while seven_count * 7 <= N:
    total = 7 * seven_count
    while total <= N:
        num_set.append(total)
        total += 4
    seven_count += 1
 
num_set = set(num_set)
 
if N in num_set:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
vector<int>ss; 
int main()
{
	string s,ans;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='1')
		ss.emplace_back(1); 
		else if(s[i]=='0')
		ss.emplace_back(0); 
		else
		{
			if(ss.empty()) ;
			else 
			{
				 ss.pop_back();
			}
		}
	}
	for(int i=0;i<ss.size();i++)
		cout<<ss[i];
	return 0; 
	} 
 

Measured memory_bytes: 256
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
#include<limits>
#include<iomanip>
#include<set>
using namespace std;
//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;

//define
#define INF 100000000
#define NUM 1000000007
int main() {
	int n, t;
	cin >> n >> t;
	VI c(n), time(n);
	int memo = 10000;
	for (int i = 0; i < n; i++) cin >> c[i] >> time[i];

	for (int i = 0; i < n; i++) {
		if (time[i] <= t) {
			if (min(memo, c[i]) == c[i]) {
				memo = c[i];
			}
		}
	}
	if (memo == 10000) {
		cout << "TLE" << endl;
	}else{ 
		cout << memo << endl;
	}

	return 0;
}

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

int main(){
    string s,t;
    cin >> s >> t;
  
    int max = 0;
    int k=0;
    int len = s.length()-t.length();
    for(int i=0;i<=len;i++){
        int count = 0;
        k = i;
        for(int j=0;j<t.length();j++){
            if(s[k]==t[j]) count++;
            k++;
        }
        if(count>max){
            max = count;
        }
    }

    cout <<t.length()-max<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>

int main() {
   int a,b;
   scanf("%d", &a);
   scanf("%d", &b);
   if(a>5 && a<13){
       printf("%d", b/2);
   }
   else if(a>=12){
       printf("%d", b);
   }
   else{
       printf("0");
   }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
//const ll mod = 1000000007;
//const ll mod = 998244353;
const ll mod = 1e9;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  ll s;
  cin >> s;

  vector<ll> ans(6, 0);
  ans[0] = mod;
  ans[1] = 1;
  if (s % mod != 0) {
    ans[2] = mod - s % mod;
    ans[3] = s / mod + 1;
  }
  else ans[3] = s / mod;
  rep(i, 6) cout << ans[i] << ' ';
  cout << '\n';






  
  return 0;
}


Measured memory_bytes: 256
open Printf
open Scanf

let (++) = Int64.add
let (--) = Int64.sub
let ( ** ) = Int64.mul
let (//) = Int64.div
let (%%) = Int64.rem
let landl = Int64.logand
let lorl = Int64.logor
let lnotl = Int64.lognot
let lxorl = Int64.logxor
let lsll = Int64.shift_left
let lsrl = Int64.shift_right_logical
let long = Int64.of_int
let succl = Int64.succ
let predl = Int64.pred

let read_int _ = scanf " %d " (fun x -> x)
let read_long _ = scanf " %Ld " (fun x -> x)
let read_str _ = scanf " %s " (fun x -> x)
let read_double _ = scanf " %f " (fun x -> x)

let m = 1_000_000_007L

let rec gcd a b = if b = 0L then a else gcd b (a %% b)

let rec mod_pow a = function
  | 0L -> 1L
  | b -> (if b %% 2L = 0L then 1L else a) ** mod_pow (a ** a %% m) (b//2L) %% m


let () =
  let n = read_int () in
  let p = Array.init n read_int in
  Array.sort compare p;
  p.(n-1) <- p.(n-1) / 2;
  let total = Array.fold_left ( + ) 0 p in
  printf "%d\n" total


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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<long long> vll;

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

const ll inf = 1LL<<58;
const int iinf = 1<<30;

int takasa[101][101];
int t[3];

int main(){
    int n;
    cin >> n;
    vector<int> x(n), y(n), h(n);
    rep(i,n){
        cin >> x[i] >> y[i] >> h[i];
        if(h[i]>0){
            t[0]=x[i];t[1]=y[i];t[2]=h[i];
        }
    }
    int xza, yza;
    int tmp=0;

    rep(i,101){
        rep(j,101){
            takasa[i][j]=t[2]+abs(t[0]-i)+abs(t[1]-j);
            int flag=0;
            rep(k,n){
                int a = max(takasa[i][j]-abs(x[k]-i)-abs(y[k]-j),0);
                if(h[k]!=a){
                    flag=1;
                }
            }
            if(flag==0){
                xza=i;yza=j;
            }
        }
    }

    cout << xza << " " << yza << " " << takasa[xza][yza] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdint>
using namespace std;
const int MOD = 1e9 + 7;

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

  vector<int> A(n);
  vector<long long> S(n + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    S[i+1] = S[i] + A[i];
  }

  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long sum = (S[n] - S[i+1]) % MOD;
    ans += A[i] * sum;
    ans %= MOD;
    //cout << "---- i == " << i << " ----\n";
    //cout << "A[i] == " << A[i] << "\n";
    //cout << "S[n] - S[i+1] == " << S[n] - S[i+1] << "\n";
    //cout << "to be added:" << A[i] * (S[n] - S[i]) << "\n";
    //cout << "ans:" << ans << "\n";
  }

  cout << ans << "\n";
}

Measured memory_bytes: 5636
#include <bits/stdc++.h>
#include <string>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
const int INF = 1001001001;


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

    if (A == B) {
        if(B == C) {
            cout << "No" << endl;
        } else
        {
            cout << "Yes" << endl;
        }
    } else {
        if (A == C || B == C) {
            cout << "Yes" << endl;
        } else
        {
            cout << "No" << endl;
        }
        
    }
    return 0;
  
}


Measured memory_bytes: 256
//AtCoder ABC058 C - Digits in Multiplication
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

void PrimeFactorization(ll n, vector<ll>& x){
    ll num=n;
	//for(int i = 2; i <= n; i++) {
    for(int i = 2; i <= num; i++) {
		while(num % i == 0) { //素数で割り切れなくなるまで割っていく
			x.push_back(i); //割った個数を配列に足す
			num /= i;
		}
	}
}

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N;
    cin>>N;
    vector<ll> pf = divisor(N);
    //PrimeFactorization(N,pf);
    //sort(pf.begin(),pf.end(), greater<ll>());
    //sort(pf.begin(),pf.end());
    ll A=1,B=1;
    // for(int i=0;i<pf.size();++i){ //大きい方にかける
    //     if(A>B) B*=pf[i];
    //     else A*=pf[i];
    // }
    auto f=[](ll a,ll b){
        return max<int>(log10(a)+1,log10(b)+1); //桁数を求める
    };
    //int ans=f(A,B);
    int ans=INT32_MAX;
    for(const auto& p:pf){
        A=p;
        B=N/A;
        if(A>B){break;}
        ans=min(f(A,B),ans);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define X first
#define Y second
#define LL long long
#define MP make_pair
#define PB push_back
#define SZ(a) (int)(a.size())
const int INF = 1000 * 1000 * 1000 + 47;
using namespace std;
LL n;
int main() 
{
	cin >> n;
	cout << ((n) * (n - 1) )/ 2;
}


Measured memory_bytes: 256
n=int(input())

def make_divisors(n):
    l_d,u_d=[],[]
    i=1
    while i**2<=n:
        if n%i==0:
            l_d.append(i)
            if i!=n//i:
                u_d.append(n//i)
        i+=1
    return l_d

l_d=make_divisors(n)
ans=10**9
for j in l_d:
    ans=min(ans,max(len(str(j)),len(str(n//j))))
print(ans)

Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))

import collections
dic=dict(collections.Counter(A))
li=list(dic.values())

ans='No'

if len(li)==3:
    if N%3 == 0:
        x,y,z = dic.keys()
        if li[0]== N//3 and li[1]==N//3 and x^y^z == 0:
            ans='Yes'           
elif len(li)==2:
    if N%3 == 0:
        if li[0]== 2*N//3 or li[1]==2*N//3:
            ans='Yes'
elif len(li)==1:
        if list(dic.keys())[0]==0:
            ans='Yes'

print(ans)

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

using namespace std;
#define INF 100000000

int main(void){

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

    vector<int> disp(n,0);
    for(int i = 0;i < n-1;i++){
        if(i == 0) disp[i] += a[i+1] - a[i];
        else disp[i] += a[i+1] - a[i] + disp[i-1];
    }
    disp[n-1] = k + (a[0] - a[n-1]) + disp[n-2];

    int ans = INF;
    for(int i = 0;i < n;i++){
        int temp;
        if(i == 0) temp = disp[n+i-2];
        else {
            if(n+i-2 < n) temp = abs(disp[n+i-2] - disp[i-1]);
            else temp = abs(disp[(n+i-2)%n]+k - disp[i-1]);
        }

        ans = min(ans, temp);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1920