akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

vector< int > z_algorithm(const string &s) {
  vector< int > prefix(s.size());
  for(int i = 1, j = 0; i < s.size(); i++) {
    if(i + prefix[i - j] < j + prefix[j]) {
      prefix[i] = prefix[i - j];
    } else {
      int k = max(0, j + prefix[j] - i);
      while(i + k < s.size() && s[k] == s[i + k]) ++k;
      prefix[i] = k;
      j = i;
    }
  }
  prefix[0] = (int) s.size();
  return prefix;
}

vector<int> z;
vl rec(505050,-1);
ll n,m;

ll dfs(ll now, ll start, bool st){
    if(rec[now] != -1) return rec[now];
    ll res = 0;
    if(!st && now == start){
        return rec[now] = inf;
    }
    if(z[now+m+1]==m){
        res = dfs((now+m)%n,start,false) + 1;
    }
    return rec[now] = res;
}

int main(){
    string s,t; cin >> s >> t;
    n = s.size();
    m = t.size();
    string u = s;
    while(s.size() < 2*m) s += u;
    s += s;
    u = t;
    u.push_back('#');
    u += s;
    z = z_algorithm(u);
    ll ans = 0;
    rep(i,n){
        chmax(ans,dfs(i,i,true));
    }
    if(ans < inf) cout << ans << endl;
    else cout << -1 << endl;
}

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

int main() {
  
  int A,B;
  string op;
  
  cin >> A >> op >> B;
  
  if(op=="+")
    cout << A+B << endl;
  else
    cout << A-B << endl;
}
  //for(int i=0;i<3;i++){

Measured memory_bytes: 3580
n = int(input())
P = []

for i in range(n):
    A = int(input())
    p = []
    for j in range(A):
        x,y = map(int, input().split())
        p.append([x,y])
    P.append(p)

d = len(str(bin(2**n))[2:])-1

for i in range(2**n)[::-1]:
    S = str(bin(i))[2:].zfill(d)
    for j,s in enumerate(S):
        if s == '1':
            for q in P[j]:
                x,y = q
                if S[x-1] != str(y):
                    break
            else:
                continue
            break
    else:
        print(S.count('1'))
        exit()



Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdlib.h>
#include<stdio.h>
#include<vector>
#include<utility>
#include<stdbool.h>
using namespace std;
typedef long long ll;
#define N (1000000000+7)

int main(void) {
	ll a, b, x;
	cin >> a >> b >> x;
	if (a != 0)cout << b / x - (a - 1) / x << endl;
	else cout << b / x + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

struct Data{
	int n;
	double t;
	bool operator <(const Data &a)const{
		return t<a.t;
	}
	void output(){
		printf("%d %.2lf\n",n,t);
	}
};

int main(){
	Data a[3][8];
	vector<Data> sonota;
	for(int i=0;i<3;i++)for(int j=0;j<8;j++) cin>>a[i][j].n>>a[i][j].t;
	for(int i=0;i<3;i++){
		sort(a[i],a[i]+8);
		a[i][0].output(); a[i][1].output();
		sonota.push_back(a[i][2]); sonota.push_back(a[i][3]);
	}
	sort(sonota.begin(),sonota.end());
	sonota[0].output(); sonota[1].output();
	return 0;
}

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

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var a = sc.nextLong();
        var b = sc.nextLong();
        var x = sc.nextLong();
        if (a == 0) {
            WriteLine((b / x) + 1);
        } else {
            
            WriteLine((b / x) - ((a - 1) / x));
        }

    }
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 13140
N = int(input())
tree = [[] for _ in range(N)]

for i in range(N-1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    tree[a].append((b, c))
    tree[b].append((a, c))

Q, K = map(int, input().split())
K -= 1

depth = [0 for _ in range(N)]

def dfs(v, p = -1, d = 0):
    St = []
    St.append([v, p, d])
    # 空のシーケンスは偽になる
    while St:
        cur = St.pop()
        depth[cur[0]] = cur[2]
        for i, j in tree[cur[0]]:
            if i == cur[1]:
                continue
            St.append([i, cur[0], cur[2] + j])

dfs(K)

for i in range(Q):
    x, y = map(int, input().split())
    x -= 1; y -= 1
    print (depth[x] + depth[y])


Measured memory_bytes: 48792
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	int k,q;
	cin>>k>>q;
	vector<int> d(k);
	for(int i=0;i<k;i++){
		cin>>d[i];
	}
	for(int i=0;i<q;i++){
		int n,x,m;
		cin>>n>>x>>m;
		vector<int> nd(k);
		int sum = 0, zc = 0;
		for(int j=0;j<k;j++){
			nd[j] = d[j] % m;
			sum += nd[j];
			if( nd[j] == 0 ) zc ++;
		}
		int last = 0;
		last = x + sum * ( (n-1) / k );
		int minu = zc * ( (n-1)/k );
		for(int j=0; j<((n-1)%k); j++ ){
			last += nd[j];
			if( nd[j] == 0 ) minu++;
		}
		cout<< (n-1) - ( last/m - x/m ) - minu << endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1000000007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }


int main(){
    int N, X, Y;
    cin >> N >> X >> Y;
    vector<int> cnt(N);
    for(int i=1; i<=N; i++){
        for(int j=i+1; j<=N; j++){
            int dist = j - i;
            dist = min(dist, abs(i-X)+abs(j-Y)+1);
            dist = min(dist, abs(i-Y)+abs(j-X)+1);
            cnt[dist]++;
        }
    }
    for(int i=1; i<N; i++)
        cout << cnt[i] << endl;
    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define che
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long LL;
const int MAXN=20;

int f[MAXN][2], len;
char num[MAXN];
void upmax(int &a, int b){ if ( b>a ) a=b;}
int main(){
	scanf("%s", &num); len= strlen(num);
	for (int i=0; i<len; i++) num[i]-='0';
	for (int i=0; i<=len ; i++) f[i][0]= f[i][1] = -(1e6);
	f[0][1] = 0;
	for (int i=0; i<len; i++){
		for (int j=0; j<10; j++){
			if ( j<=num[i])	upmax(f[i+1][ j==num[i]], f[i][1]+j);
			upmax(f[i+1][0], f[i][0]+j);
		}
	}
	printf("%d\n", max(f[len][0], f[len][1]));
	return 0;
}


Measured memory_bytes: 256
print(*[2,7,17,37,47,67,97,107,127,137,157,167,197,227,257,277,307,317,337,347,367,397,457,467,487,547,557,577,587,607,617,647,677,727,757,787,797,827,857,877,887,907,937,947,967,977,997,1087,1097,1117,1187,1217,1237,1277,1297][:int(input())])

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int main() {
	int a, b, c, x, y, z;
	scanf("%d%d%d", &a, &b, &c);
	int cnt = 0;
	while (a != b || b != c) {
		if ((a & 1) || (b & 1) || (c & 1)) {
			printf("%d\n", cnt);
			return 0;
		}
		cnt++;
		a /= 2; b /= 2; c /= 2;
		x = b + c; y = a + c; z = a + b;
		a = x; b = y; c = z;
	}
	if ((a & 1) || (b & 1) || (c & 1)) puts("0");
	else puts("-1");
	return 0;
}


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

int main()
{
    char C[2][3];
    for( int i = 0; i < 2; ++i )
        for( int j = 0; j < 3; ++j )
            cin >> C[i][j];

    for( int i = 0, j = 2; i < 3; ++i, --j )
        if( C[0][i] != C[1][j] ){
            cout << "NO" << endl;
            return 0;
        }

    cout << "YES" << endl;

    return 0;
}


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

#define int long long
#define inf (int)(1e18)

int min(int a, int b){
	if(a < b){
		return a;
	}
	else{
		return b;
	}
}

int ABS(int a){
	if(a >= 0){
		return a;
	}
	else{
		return -a;
	}
}

signed main(){
	int N, i;
	scanf("%lld", &N);
	int *a = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%lld", &a[i]);
	}
	int *sum = (int *)malloc(sizeof(int) * N);
	sum[0] = a[0];
	for(i = 1; i < N; i++){
		sum[i] = sum[i - 1] + a[i];
	}
	int ans = inf;
	for(i = 0; i < N - 1; i++){
		ans = min(ans, ABS(2 * sum[i] - sum[N - 1]));
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main()
{
    int n, i, x;
    cin >> n;

	for(i = 1; i <= n; i++){
		if(i % 3 == 0){
            cout << " " << i;
		}else{
            x = i;
			do{
				if(x % 10 == 3){
                    cout << " " << i;
					break;
				}
                x = x / 10;
			}while(x);
		}
	}
    cout << endl;

    return 0;
}

Measured memory_bytes: 1164
class Ans
    attr_accessor :H,:N
    attr_accessor :A
    def initialize(hp: ,num: ,ans: )
        @H = hp
        @N = num
        @A = ans
    end

    def solve
        cou = 0
        for num in @A do
            cou += num
        end
        if cou >= @H
            "Yes"
        else
            "No"
        end
    end
end

H,N = gets.chomp.split.map(&:to_i)
A = gets.chomp.split.map(&:to_i)

ans = Ans.new(hp: H,num: N,ans: A)
puts ans.solve

Measured memory_bytes: 8708
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

long long MOD = 1000000007;

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

    int tempCount = 0;
    int maxCount = 0;

    for (size_t i = 1; i < n; i++)
    {
        if (h[i] <= h[i - 1]) {
            tempCount++;
            if (maxCount <= tempCount) {
                maxCount = tempCount;
            }
        }
        else {
            tempCount = 0;
        }
    }

    std::cout << maxCount << std::endl;
    return 0;
}




Measured memory_bytes: 1024
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int main(){
    int a, b, k;
    cin >> a >> b >> k;
    set<int> s;
    REP(i, k){
        if(a + i <= b){
            s.insert(a + i);
        }
        if(b - i >= a){
            s.insert(b - i);
        }
    }
    VE v;
    for(auto itr = s.begin(); itr != s.end(); ++itr){
        v.push_back(*itr);
    }
    REP(i, v.size()){
        print(v[i]);
    }
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        N: usize,
        A: [i64; N],
    }
    let mut Ans = 999999999;
    for i in -100..101{
        let mut ans = 0;
        for j in 0..N{
            ans += (A[j] - i as i64).pow(2);
        }
        Ans = min(Ans,ans);
    }
    println!("{}",Ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;

int gcd(int x,int y)
{
    return y==0?x:gcd(y,x%y);
}
int main()
{
    int n,X,x[100020];
    scanf("%d%d",&n,&X);
    for(int i=1;i<=n;i++)
        scanf("%d",&x[i]),x[i]=abs(x[i]-X);
    int ans=x[1];
    for(int i=2;i<=n;i++)
        ans=gcd(ans,x[i]);
    printf("%d\n",ans);

    return 0;
}


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

using namespace std;

using uint = unsigned int;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
 
template<typename T1, typename T2>
ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
	out << '(' << item.first << ", " << item.second << ')';
	return out;
}
 
template <typename T>
ostream& operator <<(ostream &out, const vector<T>& v) {
	for(const auto &item : v) out << item << ' ';
	return out;
}

int a, b, c;
set<int> S;

int main()
{
	ios_base::sync_with_stdio(false);

	cin>>a>>b>>c;
	S.insert(a);
	S.insert(b);
	S.insert(c);
	if (S.size() == 2)
		cout<<"Yes\n";
	else
		cout<<"No\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int E,Y;
    cin>>E>>Y;
    switch (E)
    {
    case 0:
        if(1868<=Y&&Y<=1911)
        {
            cout<<'M'<<Y-1867<<endl;
        }
        else  if(1912<=Y&&Y<=1925)
        {
            cout<<'T'<<Y-1911<<endl;
        }
        else  if(1926<=Y&&Y<=1988)
        {
            cout<<'S'<<Y-1925<<endl;
        }
        else  if(1989<=Y&&Y<=2016)
        {
            cout<<'H'<<Y-1988<<endl;
        }
        break;
    
    case 1:
        cout<<Y+1867<<endl;
        break;
    case 2:
        cout<<Y+1911<<endl;
        break;
    case 3:
        cout<<Y+1925<<endl;
        break;
    case 4:
        cout<<Y+1988<<endl;
        break;
    }
    return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N,X;
  cin >> N >> X;
  vector<int> vec(N);
  int P=0,ans=1;
  for(int i=0;i<N;i++){
    cin >> vec[i];
    P += vec[i];
    if(P <= X) ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}


ll ten(ll n) {
  ll res=1;
  ll x=10;
  while(n>0) {
    if(n&1) res=res*x%13;
    x=x*x%13;
    n>>=1;
  }
  return res;
}

ll dp[MAX][13]={};
int main(void) {
  string s;
  cin >> s;
  ll i, j, k;
  ll N=s.size();
  
  dp[0][0]=1;
  for(i=0; i<N; i++) {
    for(j=0; j<13; j++) {
      if(s[i]=='?') {
        for(k=0; k<10; k++) {
          moC(dp[i+1][(j+k*ten(N-i-1))%13], +, dp[i][j]);
        }
      }else {
        moC(dp[i+1][(j+(s[i]-'0')*ten(N-i-1))%13], +, dp[i][j]);
      }
    }
  }
  
  pt(dp[N][5]);
}


Measured memory_bytes: 10624
#include <iostream>
#include <string>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <set>
#include <climits>
#include <map>

using namespace std;

int matched_status(string S){
  int open_bracket_count = 0;
  for(int i = 0; i < S.size(); i++){
    if(S[i] == '('){
      open_bracket_count ++;
    }
    if(S[i] == ')'){
      if(open_bracket_count == 0){
        return -1;
      }
      open_bracket_count --;
    }
  }
  
  if(open_bracket_count != 0){
    return 1;
  }
  return 0;
}

int main(){
  string S;
  int N;
  cin >> N;
  cin >> S;
  while(matched_status(S) < 0){
    S.insert(0, 1, '(');
  }
  while(matched_status(S) > 0){
    S.push_back(')');
  }

  cout << S << endl;
  
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  bool x = false;
  for (int i=0; i<3; i++) {
    if (n%10 == 7) {
      x = true;
      break;
    }
    n /= 10;
  }
  cout << (x ? "Yes": "No");
  return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; 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 pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;


int main() {
  int a,b;
  cin >> a >> b;
  if(a<b){
    swap(a,b);
  }
  if((a+b)%2==0){
    cout << (a+b)/2 <<endl;
  }
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}

Measured memory_bytes: 256
<?php
  
  $abcx = array();

for($i=0;$i<4;$i++){
  $abcx[] = trim(fgets(STDIN));
}

$c=0;

for($i=0;$i<=$abcx[0];$i++){
  for($j=0;$j<=$abcx[1];$j++){
    for($k=0;$k<=$abcx[2];$k++){
      if(500*$i+100*$j+50*$k == $abcx[3]){
        $c++;
      }
    }
  }
}

echo $c."\n";

Measured memory_bytes: 4728
#include<iostream>
using namespace std;
static const int MAX=100;
static const int INF=(1<<21);
static const int WH=0;
static const int GRY=1;
static const int BL=2;

int n, MA[MAX][MAX];

void DijkStra(){
  int minV;
  int d[MAX], color[MAX];

  for(int i=0; i<n; i++)
  {
    d[i]=INF;
    color[i]=WH;
  }

  d[0]=0;
  color[0]=GRY;

  while(1)
  {
    minV=INF;
    int u = -1;
    for(int i=0; i<n; i++)
    {
      if(minV > d[i] && color[i] != BL)
      {
        u=i;
        minV=d[i];
      }
    }
    if(u == -1) break;
    color[u]=BL;
    for(int v=0; v<n; v++)
    {
      if(color[v] != BL && MA[u][v] != INF)
      {
        if(d[v] > d[u] + MA[u][v])
        {
          d[v]=d[u]+MA[u][v];
          color[v]=GRY;
        }
      }
    }
  }

  for(int i=0; i<n; i++)
  {
    cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
  }
}

int main(){
  cin >> n;
  for(int i=0; i<n; i++)
  {
    for(int j=0; j<n; j++)
    {
      MA[i][j]=INF;
    }
  }

  int k, c, u, v;
  for(int i=0; i<n; i++)
  {
    cin >> u >> k;
    for(int j=0; j<k; j++)
    {
      cin >> v >> c;
      MA[u][v]=c;
    }
  }

  DijkStra();

  return 0;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main(){
double m;
int n;
cin>>n>>m;
double A[n];
double ctr=0;
for(int i=0;i<n;i++){
cin>>A[i];
ctr+=A[i];
}
double x=ctr/(4*m);
int a=0;
for(int i=0;i<n;i++){
   if(A[i]>=x) a++;
}
if(a>=m) cout<<"Yes";
else cout<<"No";
return 0;
}

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

fn main() {
    input! {q:usize}
    let mut med = 0;
    let mut lower = BinaryHeap::new();
    let mut upper = BinaryHeap::new();
    let mut lower_sum = 0;
    let mut upper_sum = 0;
    let mut bsm = 0i64;
    for _ in 0..q {
        input! {t:usize}
        // median median
        match t {
            1 => {
                input! {a:i64,b:i64}
                bsm += b;
                if lower.is_empty() {
                    lower.push(a);
                } else {
                    if a < med {
                        lower.push(a);
                        lower_sum += med - a;
                    } else {
                        upper.push(-a);
                        upper_sum += a - med;
                    }
                }

                while lower.len() < upper.len() || lower.len() > upper.len() + 1 {
                    if lower.len() < upper.len() {
                        let upper_min = -upper.peek().unwrap();
                        let diff = upper_min - med;
                        lower_sum += lower.len() as i64 * diff;
                        upper_sum -= upper.len() as i64 * diff;
                        upper.pop();
                        lower.push(upper_min);
                    } else {
                        let lower_max = lower.pop().unwrap();
                        let diff = med - lower.peek().unwrap();
                        upper.push(-lower_max);
                        lower_sum -= lower.len() as i64 * diff;
                        upper_sum += upper.len() as i64 * diff;
                    }
                    med = *lower.peek().unwrap();
                }
                med = *lower.peek().unwrap();
            }
            _ => {
                //query
                println!("{} {}", med, bsm + lower_sum + upper_sum);
            }
        }
    }
}

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


Measured memory_bytes: 8864
/* デックを使った実装方法 */
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

int ans, cnt;

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

	string S;
	cin >> S;

	deque<char> deq;
	rep(i, S.size()) {
		deq.push_back(S[i]);
	}


	int Q;
	cin >> Q;

	bool revflg = true; // true:普通 false:逆方向

	rep(i, Q) {
		int t;
		cin >> t;
		if (t == 1) {
			revflg = !revflg;
		}
		else {
			int f;
			cin >> f;

			char c;
			cin >> c;

			if (f == 1) {
				if (revflg) {
					deq.push_front(c);
				}
				else {
					deq.push_back(c);
				}

			}
			else {
				if (revflg) {
					deq.push_back(c);
				}
				else {
					deq.push_front(c);
				}

			}
		}
	}

	if (revflg) {
		while (!deq.empty()) {
			cout << deq.front();
			deq.pop_front();
		}
	}
	else {
		while (!deq.empty()) {
			cout << deq.back();
			deq.pop_back();
		}
	}

	cout << "\n";

	return 0;
}

Measured memory_bytes: 976
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define int ll
#define pb push_back
#define sz(i) (int)(i.size())
#define fi first
#define se second
#define ld long double
#define pii pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = 1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << std::endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 22;
// make sure N size is correctttt!!!!!!!!!

int a[N][N], dp[N][(1<<N)+10], n;
std::vector<int> v[N];
int total;

int solve(int idx, int mask){
   if(idx >= n){
      return mask == total;
   }
   int &ans = dp[idx][mask];
   if(ans != -1)
      return ans;
   ans = 0;
   for(auto it: v[idx]){
      if((mask&(1LL<<it)) == 0){
         ans += solve(idx+1, mask|(1LL<<it));
         if(ans >= mod)ans -= mod;
      }
   }
   return ans;
}

int32_t main(){_

   cin>>n;

   for (int i = 0; i < n; ++i)
   {
      for (int j = 0; j < n; ++j)
      {
         cin>>a[i][j];
         if(a[i][j])v[i].pb(j);
      }
   }

   total = (1<<n) - 1;

   memset(dp, -1, sizeof dp);
   cout<<solve(0,0);

   //make sure N size is correct!!!!!!!!!
   return 0;
}

Measured memory_bytes: 721280
#include <cstdio>
#include <algorithm>
using namespace std;

char s[30], o = 'C';
int n;
int main() {
	for ( int i = 0; i < 26; i ++) s[i] = o + i;
	scanf("%d", &n);
	n /= 1000;
	printf("AB%c\n", s[n]);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long s=0;
    int i,j;
    long p[n][2] = {0};
    for(i=0;i<n;i++){
        cin >> p[i][0] >> p[i][1];
        s=s+p[i][1]-p[i][0]+1;
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int N, K;
ll x[50], y[50], nx[50], ny[50];
vector<int> cx, cy;
int sum[52][52];

int main() {
	cin >> N >> K;
	REP(i, N) scanf("%lld %lld", x + i, y + i);
	
	REP(i, N) {
		cx.push_back(x[i]);
		cy.push_back(y[i]);
	}
	sort(ALL(cx)); sort(ALL(cy));
	REP(i, N) {
		x[i] = lower_bound(ALL(cx), x[i]) - cx.begin();
		y[i] = lower_bound(ALL(cy), y[i]) - cy.begin();
		
		sum[y[i] + 1][x[i] + 1]++;
	}
	REP(i, N) REP(j, N) {
		sum[i + 1][j + 1] += sum[i][j + 1] + sum[i + 1][j] - sum[i][j];
	}
		
	ll ans = 1ll<<62;

	REP(i, N) {
		REP(j, N) {
			FOR(k, i + 1, N) {
				FOR(l, j + 1, N) {
					if (sum[k + 1][l + 1] - sum[i][l + 1] - sum[k + 1][j] + sum[i][j] >= K) {
						chmin(ans, (ll)(cx[l] - cx[j]) * (cy[k] - cy[i]));
					}
				}
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    ll A, B, N; cin >> A >> B >> N;
    ll K = (B - 1);
    if(N < B - 1) K = N;
    printf("%lld\n", K*A/B - A*(K/B));
    return 0;
}


Measured memory_bytes: 3764
#include <iostream>
using namespace std;
int main() {
    string s;
    cin>>s;
    int sum = 0;
    for (int i = 0; i < s.length(); i++){
        int x = s[i] - 48;
        sum += x;
    }
    if (sum % 9 == 0)
        cout<<"Yes";
    else
        cout<<"No";
}

Measured memory_bytes: 3312
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

vector<vector<ll> >dp;
vector<set<ll> >v;
set<ll>st;

void dfs(ll now,ll par){
  dp[now][0]=1;
  dp[now][1]=1;
  st.insert(now);
  for(ll i : v[now]){
    if(st.count(i)==0)dfs(i,now);
  }
  if(par>=0){
    dp[par][0]=(((dp[now][0]+dp[now][1])%MOD)*dp[par][0])%MOD;
    dp[par][1]=(dp[now][0]*dp[par][1])%MOD;
  }
}

int main(){
  ll n,ans=0;
  cin>>n;
  if(n==1){
    cout<<2<<endl;
    return 0;
  }
  dp.assign(n,vector<ll>(2,0));
  v.assign(n,set<ll>());
   ll aa,bb;
  for(ll i=0;i<n-1;i++){
    cin>>aa>>bb;
    aa--;
    bb--;
    v[aa].insert(bb);
    v[bb].insert(aa);
  }
  dfs(0,-1);
  ans=(dp[0][0]+dp[0][1])%MOD;
  cout<<ans<<endl;
}


Measured memory_bytes: 28672
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException, InterruptedException {
        Scanner sc = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        int x = sc.nextInt();
        long ans = 1000l*(x/500);
        x%=500;
        ans += 5l*(x/5);
        out.println(ans);
        out.flush();
        out.close();
    }


    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        boolean ready() throws IOException {
            return br.ready();
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        Scanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        int nextChar() throws IOException {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) throws IOException {
            int[] ans = new int[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextInt();
            return ans;
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

    }
}


Measured memory_bytes: 22996
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) < (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[8] = { //移動
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL

struct Edge {
	ll from, to;
	ll w;
};
signed main(void) {

	int n, d;

	cin >> n >> d;

	vector<int> ar(n);

	REP(i, n) {
		cin >> ar[i];
	}


	int ans = 0;

	REP(i, n) {
		ans ^= (ar[i]-1) % (d + 1);
	}
	
	cout << (ans != 0 ? "First" : "Second") << endl;
	return 0;
}


Measured memory_bytes: 3864
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	string S;
	cin >> S;
	int ans = 0;
	REP(i, S.size() / 2) {
		ans += S[i] != S[S.size() - i - 1];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int n,i;
    cin >> n;
    string a,b,ans="";
    cin >> a >> b;
    for(i=0;i<n;i++){
        ans+= a.substr(i,1)+b.substr(i,1);
    }
    cout << ans;
}

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


int main(void)
{
	//変数の宣言
	int n,k;
	char c;
	
	//よく使う変数
	int i,j,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp,temp1,temp2;
	//データの読み込み
	//scanf("%d %d",&n,&k);
	
	for(i=0;i<4;i++){
		scanf("%c",&c);
		if(c=='+'){
			ans=ans+1;
		}else{
			ans=ans-1;
		}
	}
	
//	for(j=0;j<=sz;j++){
//		printf("%ld\n",heap[j].atai);
//	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	
//	printf("計算部分終了\n");
	//出力
	
	printf("%d",ans);
	
//	printf("結果の出力終了\n");
	
	return 0;
	
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
#define PI (acos(-1))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;

}
LL exp(int a, int b){
    LL res = 1;
    LL sum = a;
    while(b){
        if(b&1)res = (res * sum) % MOD;
        sum = (sum * sum) % MOD;
        b>>=1;
    }
    return res;
}

double dot(complex<double> a, complex<double> b){
    return a.real() * b.real() + a.imag() * b.imag();
}

int main(){
    vector<PII> N1;
    vector<PII> N2;
    N1.push_back(PII(0, 0));
    N2.push_back(PII(0, 1000));
    int N;
    cin >> N;
    REP(i, N){
        PII d;
        cin >> d.first >> d.second;
        N1.push_back(d);
    }
    cin >> N;
    REP(i, N){
        PII d;
        cin >> d.first >> d.second;
        N2.push_back(d);
    }
    N1.push_back(PII(1000, 0));
    N2.push_back(PII(1000, 1000));
    double ans = INF;
    REP(i, N1.size()){
        REP(j, N2.size()){
            complex<double> p(N1[i].first - N2[j].first, N1[i].second - N2[j].second);
            ans = min(ans, abs(p));
        }
    }
    REP(i, N1.size()-1){
        REP(j, N2.size()){
            complex<double> arrow(N1[i+1].first - N1[i].first, N1[i+1].second - N1[i].second);
            complex<double> n = arrow / abs(arrow);
            complex<double> p(N2[j].first - N1[i].first, N2[j].second - N1[i].second);
            if(dot(n, p) < 0 || dot(n, p) > abs(arrow))continue;
            n *= complex<double>(0, 1);
            if(dot(n, p)<0)continue;
            ans = min(ans, dot(n, p));
        }
    }
    REP(i, N2.size()-1){
        REP(j, N1.size()){
            complex<double> arrow(N2[i+1].first - N2[i].first, N2[i+1].second - N2[i].second);
            complex<double> n = arrow / abs(arrow);
            complex<double> p(N1[j].first - N2[i].first, N1[j].second - N2[i].second);
            if(dot(n, p) < 0 || dot(n, p) > abs(arrow))continue;
            n *= complex<double>(0, -1);
            if(dot(n, p)<0)continue;
            ans = min(ans, dot(n, p));
        }
    }
    printf("%.10f\n", ans);
    return 0;
}



Measured memory_bytes: 3280
//
// Created by kuroneko on 2019-07-06.
//

using namespace std;

#include <iostream>
#include <vector>
#include <cmath>
#include <string>

typedef long long ll;
int INF = 1000000007;

int main() {
    int N, A, B; cin >> N >> A >> B;
    int ans = N * A;
    if (ans > B) ans = B;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll n,t; cin>>n>>t;
	ll ans=MOD;
	rep(i,0,n){
		ll a,b; cin>>a>>b;
		if(b<=t){
			chmin(ans,a);
		}
	}
	if(ans==MOD)cout<<"TLE"<<endl;
	else cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3584
#include<stdio.h>

int main(void)
{
	long long int a, b;
	char c;
	char sum[100];
	int i = 0, j;

	scanf("%lld", &a);

	while (a > 0) {
		c = 'a' + (a - 1) % 26;
		if ((a - 1) % 26 == 25) {
			a--;
		}
		sum[i] = c;
		i++;
		a = a / 26;
	}

	for (j = i; j > 0; j--) {
		printf("%c", sum[j - 1]);
	}

	return 0;
}

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

using namespace std;

int in(){ int a; cin >> a; return a; }
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main(){
  ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0); cerr.tie(0);
  int n = in();
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());
  if(n == 2){
    cout << a[0] << endl;
    return 0;
  }
  long long ans = 0;
  int ind = 0;
  for(int i = 0; i < n - 1; ){
    if(i == 0) ans += a[ind], i++;
    else ans += a[ind] * 2, i += 2;
    debug() << imie(i);
    ind++;
  }
  if(n & 1) ans -= a[ind - 1];
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3952
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        int i=1;
        while(i<10) {
            for(int b =1;b<10;b++){
            System.out.println(i+"x"+b+"="+(i*b));
                           
        }
         i++;
    }
}
}


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

int main (){
    int N;
    cin >> N;
    int i;
    vector<int> A(N);
    int Ai;
    for(i=0;i <N;i++){
        cin >> Ai;
        A[Ai - 1] = i + 1;
    }
    for(i=0;i <N;i++){
        cout << A[i] << " ";
    }
    return 0;
}

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

using namespace std;

#define int long long

const int N = (int)3e5, MOD = (int)1e9 + 7, INF = (int)3e18;

int a[N];

main() {
    ios :: sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    map <int, int> cnt;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        ++cnt[a[i]];
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        ans += (cnt[i] * (cnt[i] - 1)) / 2;
    }
    for (int i = 1; i <= n; ++i) {
        ans -= (cnt[a[i]] * (cnt[a[i]] - 1)) / 2;
        cnt[a[i]]--;
        ans += (cnt[a[i]] * (cnt[a[i]] - 1)) / 2;
        cout << ans << '\n';    
        ans -= (cnt[a[i]] * (cnt[a[i]] - 1)) / 2;
        ++cnt[a[i]];
        ans += (cnt[a[i]] * (cnt[a[i]] - 1)) / 2;
    }
    return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  char c[8][8];
  rep(i,8){
    rep(j,8){
      cin >> c[j][i];
    }
  }
  cout << 90 <<endl;
  rep(i,8){
    rep(j,8){
      cout << c[i][7-j];
    }
    cout << endl;
  }
  cout << 180 <<endl;
  rep(i,8){
    rep(j,8){
      cout << c[7-j][7-i];
    }
    cout << endl;
  }
  cout << 270 <<endl;
  rep(i,8){
    rep(j,8){
      cout << c[7-i][j];
    }
    cout << endl;
  }
  return 0;
}

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

long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int calc_order(long long N, long long L) {
    auto pf = prime_factorize(L);
    long long euler = L;
    for (auto pa : pf) {
        int p = pa.first;
        euler /= p, euler *= p-1;
    }
    
    long long res = euler;
    auto pfeuler = prime_factorize(euler);
    for (auto pa : pfeuler) {
        int p = pa.first;
        while (res % p == 0 && modpow(N, res/p, L) == 1) res /= p;
    }
    return res;
}

long long solve(long long N) {
    auto pf = prime_factorize(N);
    
    bool ok = true;
    long long L = 1;
    for (auto p : pf) {
        if (p.second > 1) ok = false;
        long long g = GCD(L, p.first - 1);
        L = L / g * (p.first - 1);
    }
    if (!ok) return -1;
    if (GCD(N, L) > 1) return -1;
    if (L == 1) return 1; // 例外処理

    // mod L での N の位数を求める
    return calc_order(N, L);
}

int main() {
    long long N; cin >> N;
    cout << solve(N) << endl;
}



Measured memory_bytes: 3100
#include <stdio.h>

int main(void){
	int h,w,i,j;
	char c[128];

	scanf("%d %d ",&h,&w);

	for(i=0;i<h;i++){
		fgets(c,128,stdin);
		printf("%s\n",c);
		printf("%s\n",c);
	}


	

	return 0;
}

Measured memory_bytes: 128