akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
    int n,k;
    cin >> n >> k;
    vector<double> z(n);
    double ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> z.at(i);
    }
    for (int i = 0; i < k; i++) {
        ans += (z.at(i) + 1.0) / 2.0;
    }
    double zans = ans;
    for (int i = k; i < n; i++) {
        zans += (z.at(i) + 1.0) / 2.0;
        zans -= (z.at(i-k) + 1.0) / 2.0;
        ans = max(ans, zans);
    }
    cout << fixed << setprecision(15) << ans << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

/**
 *
 * @author lenovo
 */
    public class Main {

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

        while (true) {

            int a = scanner.nextInt();
            String op = scanner.next();
            char ch = op.charAt(0);
            int b = scanner.nextInt();
            switch (ch) {
                case '+':
                    System.out.println(a + b);
                    break;
                case '-':
                    System.out.println(a - b);
                    break;
                case '*':
                    System.out.println(a * b);
                    break;
                case '/':
                    if (b == 0) {
                        //  System.out.println("?¢??????°?????¶??????????????????!");
                        break;
                    } else {
                        System.out.println(a / b);
                        break;
                    }
                 default:
                    return;
            }
        }
    }
}

Measured memory_bytes: 26252
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}

int main() {
    int n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n) cin >> a[i];
    vector<ll>b(n);
    rep(i,n) {
        b[i] = a[i]-(i+1);
    }
    sort(b.begin(),b.end());
    ll med = b[n/2];
    ll ans = 0;
    rep(i,n) {
        ans += abs(a[i] - (med+i+1));
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
N, M = map(int, input().split())
H = list(map(int, input().split()))
flag = [True]*N
for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    if H[A] <= H[B]:
        flag[A] = False
    if H[B] <= H[A]:
        flag[B] = False
ans = 0
for i in range(N):
    if flag[i]:
        ans += 1
print(ans)

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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) for(auto&& x : v){cout << x << " ";} cout << endl
#define printVV(vv) for(auto&& v : vv){for(auto&& x : v){cout << x << " ";}cout << endl;}
#define printP(p) cout << p.first << " " << p.second << endl
#define printVP(vp) for(auto&& p : vp) printP(p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
// const int inf = 1e9;
const int inf = 2e18;
const int mod = 1e9 + 7;
template<typename T> using Graph = vector<vector<T>>;

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

    int A, B, N;
    cin >> A >> B >> N;

    int ans = inf;
    rep2(a, 1, N + 1) {
        rep2(b, 1, N + 1) {
            if (B % b == 0) {
                ans = min(ans, abs(A - a * (B / b)));                
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std;

int h, w, a, b;

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

	cin >> h >> w >> a >> b;

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (( j< a && i < b) || (j >= a && i >= b)) cout << "1";
			else cout << "0";
		}
		cout << "\n";
	}


	return 0;
}

Measured memory_bytes: 1280
A,B = [],[]
d = 0
n,m,l = map(int,input().split())
for i in range(n):
    A.append(list(map(int,input().split())))
for j in range(m):
    B.append(list(map(int,input().split())))    
C = [[0 for k in range(l)]for i in range(n)]
for k in range(1,l+1):
    for i in range(1,n+1):
        for j in range(1,m+1):
            d = A[i-1][j-1]*B[j-1][k-1]
            C[i-1][k-1] += d
            d = 0
            
for i in range(n):
    for k in range(l):
        if k == l-1:
            print(f"{C[i][k]}",end ="")
        else:
            print(f"{C[i][k]}",end =" ")
    print()


Measured memory_bytes: 7084
// #include "bits/stdc++.h"
#include<iostream>
#include<algorithm>
#include<bitset>
#include<string>
#include<vector>
#include<string.h>

using namespace std;

#ifdef LOCAL
        #include "debug.h"
        #define input freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
        #else
        #define debug(...) 4
        #define input ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#endif

using ll = long long;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;


int dp[19][1 << 18];

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

    for(int i = 0; i < n; i++) {
        cin >> b[i];
        
    }
    
    for(int i = 0; i < n; i++)
        for(int j = 0; j < (1 << n); j++)
            dp[i][j] = 1e9;
    
    for(int i = 0; i < n; i++) {
        dp[i][1 << i] = 0;
    }

    // dp[i][j] = last element place at position i and now the mask is j

    for(int mask = 0; mask < (1 << n); mask++) {
        int pop = __builtin_popcount(mask);
        for (int i = 0; i < n; ++i) {
            int val;
            if(i % 2 == (pop - 1) % 2)
                val = a[i];
            else
                val = b[i];
            for(int j = 0; j < n; j++) {
                if((1 << j) & mask)
                    continue;
                int x;
                if(j % 2 == pop % 2)
                    x = a[j];
                else
                    x = b[j];
                if(x < val)
                    continue;
                int inv = __builtin_popcount(mask >> j);
                dp[j][mask | (1 << j)] = min(dp[j][mask | (1 << j)], dp[i][mask] + inv);
            }
        }

    }
    int ans = 1e9;
    for(int i = 0; i < n; i++) {
        ans = min(ans, dp[i][(1 << n) - 1]);
    }
    cout << (ans == 1e9 ? -1 : ans);

}   

Measured memory_bytes: 18688
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, s, e) for(int i=s; i<e; i++)
#define REF(i, s, e) for(int i=s; i>e; i--)
typedef long long ll;


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

    int x,y;
	cin >> x >> y;
	
    cout << int(x+y/2) << endl;
	

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
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 stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline 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);

  vector<ll> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(all(a));

  ll ans = 0;
  while(1){
    if(a[0] == a[1] && a[1] == a[2]) break;

    //cout << a[0] << ' ' << a[1] << ' ' << a[2] << endl;
    ans++;
    sort(all(a));
    if(a[0]+2 <= a[2]) a[0] += 2;
    else a[0]++, a[1]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int k=sc.nextInt();
        int s=sc.nextInt();
		int ans=0;
		
		for(int x=k;x>=0;x--){
          for(int y=Math.min(s-x,k);y>=0;y--){
            int z=s-x-y;
    		if(z<=k){
            ans++;
            }else{
            break;
            }
          }
    	}
    

    	System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	cout << n / 3 << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n, res = 0;
	cin >> n;
	int x, y, arr[n + 1];
	int dp[n + 1];
	
	for(int i = 0; i < n; i++)
		cin >> arr[i];
	
//	dp[0] = 0;
	dp[1] = abs(arr[1] - arr[0]);
	dp[2] = min(abs(arr[2] - arr[1]) + dp[1], abs(arr[2] - arr[0]));
	for(int i = 3; i < n; i++)
	{
		dp[i] = min(abs(arr[i] - arr[i - 1]) + dp[i - 1], abs(arr[i] - arr[i - 2]) + dp[i - 2]);
	}
	
//	for(int i = 0; i < n; i++)
//	{
//		cout << dp[i] << " ";
//	}
	
	cout << dp[n - 1] << "\n";
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

vector<int> odd(100000 + 10);
vector<int> even(100000 + 10);

int main(void){
    int n;
    vector <int> v;
    int sub;
    int odd_cnt, even_cnt;
    int ans;
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> sub;
        v.push_back(sub);
    }
    
    bool flug = false;
    for(int i = 1; i < n; i++){
        if(v[i] != v[0])        flug = true;
        
        if(flug)        break;
    }
    if(!flug){
        ans = n / 2;
        cout << ans << "\n";
        return 0;
    }
    
    for(int i = 0; i < n; i += 2){
        odd[v[i]]++;
    }
    odd_cnt = *max_element(odd.begin(), odd.end());
    vector<int>::iterator odd_ite = max_element(odd.begin(), odd.end());
    size_t odd_index = distance(odd.begin(), odd_ite);
    
    for(int i = 1; i < n; i += 2){
        even[v[i]]++;
    }
    even_cnt = *max_element(even.begin(), even.end());
    vector<int>::iterator even_ite = max_element(even.begin(), even.end());
    size_t even_index = distance(even.begin(), even_ite);
    
    bool judge = false;
    if(odd_index != even_index)         judge = true;

    if(judge){
        ans = n - odd_cnt - even_cnt;
        cout << ans << "\n";
    }
    
    else{
        ans = n - odd_cnt;
        
        odd[odd_index] = 0;
        even[even_index] = 0;
        
        odd_cnt = *max_element(odd.begin(), odd.end());
        even_cnt = *max_element(even.begin(), even.end());
        int draw = max(odd_cnt, even_cnt);
        ans -= draw;
        
        cout << ans << "\n";
    }
}

Measured memory_bytes: 1660
#include <iostream>
#include <cstring>
#include <cstdio>
#include<cstdint>
#include<utility>
#include<algorithm>
#include<queue>
#include<set>
#include<list>
#include<vector>
#include<deque>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define rep(i, n) for (int i = 0; i < n; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define MAX 100100
#define MAX_N 200100
#define SENTINEL 2000000000
const int MOD = 1e9+7;
#define NIL -1
const int INF = 1 << 29;
int main(){
    deque<char>L;
    string S;
    int Q,a,b;
    char s;
    bool re=false;
    cin>>S>>Q;
    rep(i,(int)S.length())L.push_back(S[i]);
    rep(i,Q){
        cin>>a;
        if(a==1){
            if(!re)re=true;
            else re=false;
        }
        else if(a==2){
            cin>>b>>s;
            if((b==1 && re==false) || (b==2 && re==true))L.push_front(s);
            else if((b==2 && re==false) || (b==1 && re==true))L.push_back(s);
        }

    }
    if(!re){
       while(L.size()){
            cout<<L.front();L.pop_front();
        }
        cout<<endl;
        exit(0);
    }
    else {while(L.size()){
        cout<<L.back();L.pop_back();
    }
    cout<<endl;
}
}

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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bit(n) (1LL<<(n))
#define F first
#define S second
// functions
template <typename T> void unique(T& c){c.erase(std::unique(c.begin(), c.end()), c.end());}
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 60;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  char c; cin >> c;
  if('a' <= c && c <= 'z')cout << 'a' << endl;
  else cout << 'A' << endl;
  return 0;
}


Measured memory_bytes: 3596
// C - Cat Snuke and a Voyage
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, n, m, w, ans = 0, count = 0;
  string s, t;
  vector<pair<lli, lli>> pr;
  vector<pair<lli, lli>> pr2;
  cin >> n >> m;
  vvli d(n);
  rep(i, 0, m)
  {
    cin >> a >> b;
    a--;
    b--;
    d[a].pb(b);
    d[b].pb(a);
  }

  rep(j, 0, d[0].size())
  {
    c = d[0][j];
    rep(k, 0, d[c].size())
    {
      if (d[c][k] == n - 1)
      {
        // cout << d[i][j] << endl;
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }

  cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 15716
from collections import defaultdict
d = defaultdict(int)
n = int(input())
for _ in range(n):
  a = input()
  g = [0]*26
  for i in a:
    g[ord(i)-97]+=1
  b = ''
  for i in g:
    b+=str(i)
  d[b]+=1
cnt = 0
for k,v in d.items():
  if v > 1:
    cnt += v*(v-1)//2
print(cnt)

Measured memory_bytes: 23992
n, t = [ int(v) for v in input().split() ]
min_cost = 1001

for i in range(n):
	a, b = [ int(v) for v in input().split() ]
	if b <= t:
		min_cost = min(min_cost,a)
if min_cost == 1001:
	print("TLE")
else:
	print(min_cost)


Measured memory_bytes: 2940
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
ll y;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>y;
    y=y/1000;
    for(int i=0;i<=y/5;i++){
        for(int j=0;j<=y/10;j++){
            if(n==y-4*i-9*j&&y-5*i-10*j>=0){
                cout<<j<<" "<<i<<" "<<y-5*i-10*j<<"\n";
                return 0;
            }
        }
    }
     cout<<-1<<" "<<-1<<" "<<-1<<"\n";
}

Measured memory_bytes: 384
import numpy as np
import sys
c = np.array([list(map(int, input().split())) for _ in range(3)])
for i in range(-1, 2):
    if len(set(c[i] - c[i+1])) == 1:
        pass
    else:
        print("No")
        sys.exit()

for i in range(-1, 2):
    if len(set(c[:, i] - c[:, i+1])) == 1:
        pass
    else:
        print("No")
        sys.exit()
print("Yes")


Measured memory_bytes: 12500
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
template <class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return 1;
	}
	return 0;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
//二部探索
//評価関数が小さい者が最初、大きくなるのは最後,求めたい値と評価関数とを入れる
// first:lower,second;upper
pair<pair<long long, long long>, pair<long long, long long> > BScearch(
    long long start, long long stop, long long terget,
    function<long long(long long)> det) {
	pair<pair<long long, long long>, pair<long long, long long> > tmp = {
	    make_pair(start, 0LL), make_pair(stop, INFLL)};
	pair<long long, long long> mid;
	while (abs(tmp.first.first - tmp.second.first) > 1) {
		mid.first  = tmp.first.first + (tmp.second.first - tmp.first.first) / 2;
		mid.second = det(mid.first);
		if (mid.second > terget) {
			tmp.second = mid;
		} else {
			tmp.first = mid;
		}
	}
	return tmp;
}
int main() {
	int n;
	ll k;

	cin >> n >> k;
	// a.assign(n, 0LL);
	V a(n);
	ll up = 0LL;
	rep(i, n) {
		cin >> a[i];
		chmax(up, a[i]);
	}
	function<ll(ll)> func = [=](ll ter) {
		ll res = 0LL;
		repi(itr, a) { res += ((*itr) + ter - 1) / ter - 1; }
		return res;
	};

	pair<P, P> ans = BScearch(up, 0LL, k, func);
	clog << ans.F.F << " " << ans.S.S << endl;
	clog << ans.S.F << " " << ans.S.S << endl;
	cout << ans.F.F << endl;
}

Measured memory_bytes: 7996
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline
    from bisect import bisect_left, bisect_right

    INF = 10**18

    n, m = map(int, input().split())
    a = [list(map(int, input().split())) for i in range(n)]
    b = [list(map(int, input().split())) for i in range(m)]

    X = {-INF, INF}
    Y = {-INF, INF}
    for i in a:
        Y.add(i[2])
    for i in b:
        X.add(i[0])

    X = list(sorted(X))
    Y = list(sorted(Y))
    n = len(X) - 1
    m = len(Y) - 1
    wallx = [[False] * m for i in range(n)]
    wally = [[False] * m for i in range(n)]

    for x1, x2, y1 in a:
        x1 = bisect_left(X, x1)
        y1 = bisect_left(Y, y1)
        x2 = bisect_right(X, x2) - 1
        for i in range(x1, x2):
            wally[i][y1] = True

    for x1, y1, y2 in b:
        x1 = bisect_left(X, x1)
        y1 = bisect_left(Y, y1)
        y2 = bisect_right(Y, y2) - 1
        for i in range(y1, y2):
            wallx[x1][i] = True

    cow = [[False] * m for i in range(n)]
    cx = bisect_right(X, 0) - 1
    cy = bisect_right(Y, 0) - 1
    cow[cx][cy] = True
    q = [(cx, cy)]
    ans = 0

    while q:
        x, y = q.pop()
        if not x or not y:
            print("INF")
            sys.exit()
        ans += (X[x + 1] - X[x]) * (Y[y + 1] - Y[y])
        if x and not wallx[x][y] and not cow[x - 1][y]:
            cow[x - 1][y] = True
            q.append((x - 1, y))
        if y and not wally[x][y] and not cow[x][y - 1]:
            cow[x][y - 1] = True
            q.append((x, y - 1))
        if x + 1 < n and not wallx[x + 1][y] and not cow[x + 1][y]:
            cow[x + 1][y] = True
            q.append((x + 1, y))
        if y + 1 < m and not wally[x][y + 1] and not cow[x][y + 1]:
            cow[x][y + 1] = True
            q.append((x, y + 1))

    print(ans)

main()





Measured memory_bytes: 47020
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        sc.close();
        boolean ans = false;
        for(int i = A; i < B+1; i++){
        	if(i % K == 0){
        		ans = true;
        		break;
        	}
        }
        System.out.println(ans?"OK":"NG");
    }
}

Measured memory_bytes: 35776
A,B,C,K = input().split()
a = int(A)
b = int(B)
c = int(C)
k = int(K)

B_number = 0
C_number = 0

A_number = min(a,k)
k1 = k - a
if k1 > 0:
    B_number = min(b,k1)
    k2 = k1 - b
    if k2 > 0:
        C_number = min(c,k2)

print(A_number-C_number)

Measured memory_bytes: 9092
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  string s, t; cin >> s >> t;
  int ans = 0;
  REP(i, s.length()) ans += s[i] != t[i];
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3840
n=int(input())
a=list(map(int, input().split()))
k=0
j=False
for i in range(1, n):
    if(j):
        if a[i]==a[i-1]:
            j=False
        else:
            j=False
    elif a[i]==a[i-1]:
        k+=1
        j=True
    else:
        j=False
print(k)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define mo 1000000007
using namespace std;
long long n;
long long ksm(long long u,long long v){
	long long o=1;
	while(v){
		if(v&1)
			o=o*u%mo;
		u=u*u%mo;
		v>>=1;
	}
	return o;
}
int main(){
	long long x,a;
	cin>>x>>a;
	if(x<a)
		cout<<0<<endl;
	else
		cout<<10<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    string ans;
    for(;N;N/=-2)
    {
        if(N%2==0) ans='0'+ans;
        else ans='1'+ans,N--;
    }
    if(ans=="") ans="0";
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, K, N;
  cin >> A >> B >> K;
  vector<int> Div (0);
  
  for(int i = 1;i <= max(A, B);i++){
    if(A % i == 0 && B % i == 0){
    Div.push_back(i);
    N++;
    }
  }  
  cout << Div.at(N - K) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#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()
typedef long long ll;

using namespace std;



int main() {
    int n,m,k;
    cin>>n>>m>>k;
    vector<int>a(n);
    vector<int>b(m);
    rep(i,n)cin>>a[i];
    rep(i,m)cin>>b[i];

    ll t = 0;
    int i = 0;
    while(t + a[i] <= k && i < n){
        t += a[i];
        i++;
    }
    --i; // この後の while 文の中で、i には最後に使った本(A)の添え字が入っててほしいので
    int ans = i + 1, tmp = i + 1;
    rep(j, m + 1){
        if(j != 0){
            t += b[j - 1];
            tmp++;
        }
        while(t > k && i >= 0){
            t -= a[i];
            i--;
            tmp--;
        }
        if(t <= k) ans = max(ans, tmp);
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 4840
input_list = [int(data) for data in list(input())]
for i in [1, -1]:
    op1 = ''
    if i == 1:
        op1 = '+'
    else:
        op1 = '-'
    for j in [1, -1]:
        op2 = ''
        if j == 1:
            op2 = '+'
        else:
            op2 = '-'
        for k in [1, -1]:
            op3 = ''
            if k == 1:
                op3 = '+'
            else:
                op3 = '-'
            if input_list[0] + i * input_list[1] + j * input_list[2] + k * input_list[3] == 7:
                print(str(input_list[0]) + op1 + str(input_list[1]) + op2 + str(input_list[2]) + op3 + str(input_list[3]) + '=7')
                exit()


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<int> vi;

const int INF = 1e9;
const int MOD = 1e9+7;

int main(void){
  int n = 100;
  int a, b;
  int f = 1;
  cin >> a >> b;
  vector<vi> d(a, vi(b));
  vector<vi> finished(a, vi(b, 0));
  REP(i, a) REP(j, b) cin >> d[i][j];
  vector<vector<pii> > g(2 * n + 2);
  REP(i, n + 1) {
    REP(j, n + 1) {
      int min_cost = 0;
      REP(k, a) {
        REP(l, b) {
          int x = (k + 1) * i + (l + 1) * j;
          int y = x - d[k][l];
          if(y < 0) min_cost = max(min_cost, -y);
        }
      }
      g[i+10].push_back(pii(220 - j, min_cost));
      REP(k, a) {
        REP(l, b){
          if((k + 1) * i + (l + 1) * j + min_cost == d[k][l]) finished[k][l] = 1;
        }
      }
    }
  }
  REP(i, a) REP(j, b) if(!finished[i][j]) f = 0;

  if(!f) {
    cout << "Impossible" << endl;
    return 0;
  }
  cout << "Possible" << endl;
  int m = 2 * n + 2;
  REP(i, g.size()) m += g[i].size();
  cout << "300 " << m << endl;
  cout << "1 10 0" << endl;
  cout << "220 2 0" << endl;
  REP(i, 100) {
    cout << i + 10 << " " << i + 11 << " X" << endl;
    cout << i + 120 << " " << i + 121 << " Y" << endl;
  }
  REP(i, g.size()) {
    REP(j, g[i].size()) {
      cout << i << " " << g[i][j].first << " " << g[i][j].second << endl;
    }
  }
  cout << "1 2" << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


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

    vll ls(1e7+1, 1);
    for (int i = 2; i <= 1e7; ++i) {
        ll num = i;
        while (num <= 1e7) {
            ls[num]++;
            num += i;
        }
    } 
    ll ans = 0;
    srep(i, 1, n+1) ans += i*ls[i];

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

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

dp=[];dn=[]
for i in range(N):
    if A[i]>B[i]:
        dp.append(A[i]-B[i])
    elif A[i]<B[i]:
        dn.append(B[i]-A[i])

if sum(dn)>sum(dp):
    ans=-1
elif len(dn)==0:
    ans=0
else:
    dnsum=sum(dn)
    dp.sort(reverse=True)
    ans=len(dn)
    for dpi in dp:
        dnsum-=dpi
        ans+=1
        if dnsum<=0:
            break

print(ans)

Measured memory_bytes: 82992
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

VI g[150010];
signed main(void)
{
  int n;
  cin >> n;
  REP(i, n-1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].PB(b);
    g[b].PB(a);
  }

  vector<double> prob(n);
  function<double(int,int)> dfs1 = [&](int v, int p) -> double {
    if(p != -1 && g[v].size() == 1) return 0;
    int cnt = 0;
    double ret = 0;
    for(int &i: g[v]) {
      if(i == p) continue;
      cnt++;
      ret += dfs1(i, v) + 1;
    }
    ret /= cnt;
    return prob[v] = ret;
  };

  dfs1(0, -1);
  // cout << prob << endl;

  vector<double> ans(n);
  function<void(int,double,int)> dfs2 = [&](int v, double d_par, int p) {
    // cout << v << " " << d_par << " " << p << endl;
    // vector<PII> d_child;
    // d_child.emplace_back(0, -1);
    double ret = 0;
    for(int &e : g[v]) {
      if(e == p) {
        ret += d_par + 1;
      } else {
        ret += prob[e] + 1;
      }
    }
    // sort(d_child.rbegin(), d_child.rend());
    ans[v] = ret / g[v].size();
    for(int &e : g[v]) {
      if(e == p) continue;
      double nxt = g[v].size() == 1 ? 0 : (ret - prob[e] - 1) / (g[v].size() - 1);
      dfs2(e, nxt, v);
    }
  };

  dfs2(0, 0, -1);
  REP(i, n) {
    cout << fixed << setprecision(9) << ans[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 21888
package main

import (
	"fmt"
	"sort"
)

type Restaurant struct {
	id    int
	score int
	city  string
}

type guideBook []Restaurant

func (g guideBook) Len() int {
	return len(g)
}

func (g guideBook) Less(i, j int) bool {
	if g[i].city == g[j].city {
		return g[i].score > g[j].score
	} else {
		return g[i].city < g[j].city
	}
}

func (g guideBook) Swap(i, j int) {
	g[i], g[j] = g[j], g[i]
}

func main() {
	var n int
	fmt.Scan(&n)

	list := make(guideBook, n)
	for i := 0; i < n; i++ {
		list[i].id = i + 1
		fmt.Scan(&list[i].city, &list[i].score)
	}
	sort.Sort(list)

	for _, e := range list {
		fmt.Println(e.id)
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
vector<int>v[200005];
bool vis[200005];
int k=0;
int cnt[200005];
void DFS(int x)
{
    vis[x]=1;cnt[k]++;
    for(int i=0;i<v[x].size();i++)
    {
        int z=v[x][i];
        if(vis[z]==0)
        {
            DFS(z);
        }
    }
}
main()
{
    int n,m,i,x,y,ans=0;
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);v[y].push_back(x);
    }
    for(i=1;i<=n;i++)
    {
        if(vis[i]==0)
        {
            DFS(i);
            k++;
        }
    }
    for(i=0;i<k;i++)
    {
        ans=max(ans,cnt[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 20912
from math import gcd
n, x = map(int, input().split())
m = [x]+list(map(int, input().split()))


m.sort()

if n==1:
  print(m[1]-m[0])
else:
  res = gcd(m[1]-m[0], m[2]-m[1])
  for i in range(1, n-1):
    a = m[i+1]-m[i]
    b = m[i+2]-m[i+1]
    if res >= gcd(a,b):
      if res%gcd(a,b)==0:
        res = gcd(a,b)
      else:
        res = gcd(res, gcd(a, b))
    else:
      if gcd(a,b)%res!=0:
        res = gcd(res, gcd(a, b))
  print(res)

Measured memory_bytes: 20516
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int cnt = 0;
vector<ll> tmp;

void dfs(string s){
    if(s.size() > 11) return;
    tmp.push_back(stoll(s));
    int tail = s[s.size()-1] - '0';
    if(tail - 1 >= 0){
        cnt++;
        string n = to_string(tail - 1);
        dfs(s+n);
    }
    if(tail + 1 < 10){
        cnt++;
        string n = to_string(tail + 1);
        dfs(s+n);
    }
    cnt++;
    string n = to_string(tail);
    dfs(s+n);
}

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

    for(int i=1; i<=9; i++){
        cnt = 0;
        string n = to_string(i);
        dfs(n);
    }

    sort(all(tmp));
    cout << tmp[k-1] << endl;
}

Measured memory_bytes: 10608
#include<iostream>
using namespace std;
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a + b < c + d)
		cout << "Right" << endl;
	else if (a + b > c + d)
		cout << "Left" << endl;
	else
		cout << "Balanced" << endl;
	return 0;
}

Measured memory_bytes: 256
import math

P = [0 for k in range(100000)]
P[1] = 1
for k in range(3,100000,2):
    f = 1
    for l in range(2,int(math.sqrt(k))+1):
        if k % l == 0:
            f = 0
            break
    if f==1:
        P[k] = 1

R = [0 for k in range(100000)]
R[3] = 1
for k in range(3,100000,2):
    if P[k] and P[(k+1)//2]:
        R[k] = 1

for k in range(1,100000):
    R[k] += R[k-1]

for k in range(int(input())):
    l, r = map(int, input().split())
    print(R[r]-R[l-1])


Measured memory_bytes: 54640
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

K, N = i_l()
A = i_l()
A = A + [x + K for x in A]

ans = []
for i in range(N):
    tmp = A[N+i-1] - A[i]
    ans.append(tmp)

print(min(ans))


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

char s[3][110];
int now[3] = {0, 0, 0};

int rec(int i){
    if(now[i] == strlen(s[i])) return i;
    char next = s[i][now[i]];
    now[i]++;
    return rec(next - 'a');
}

int main(){
    for(int i = 0; i < 3; i++) scanf("%s", s[i]);
    printf("%c\n", rec(0) + 'A');
    return 0;
}

Measured memory_bytes: 1696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define OK { cout << "OK" << endl; return 0; }
#define NG { cout << "NG" << endl; return 0; }
#define sz(v) ((int)(v).size())
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
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; }
template<class T>void out(T a){cout << a << endl;}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

#define SIZE 200005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}
ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}



ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}

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

  int A,B,C,K; cin>>A>>B>>C>>K;


    while(B <= A) { B *= 2; K--;}
    while(C <= B) { C *= 2; K--; }

    if(K < 0) No;

    Yes;
}

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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	ll n,k;
	cin>>n>>k;

	ll sqrt_n = ll(sqrt(n));


	vector<ll> num;
	ll cnt = 0;
	for(ll i=1;;i++){
		num.push_back(n/i - n/(i+1));
		cnt += n/i - n/(i+1);
		if(n/(i+1)<=sqrt_n)break;
	}
	rep(i,n-cnt)num.push_back(1);

	int m = num.size();
	reverse(all(num));

	vector<vector<ll>> dp(m,vector<ll>(k,0LL));

	rep(i,m) dp[i][0] = num[i];

	rep(i,k-1){
		vector<ll> sum(m);
		sum[0] = dp[0][i];
		repi(j,1,m)sum[j] = sum[j-1]+dp[j][i], sum[j]%=mod;
		rep(j,m)dp[j][i+1] = sum[m-1-j]*num[j], dp[j][i+1]%=mod;
	}

	ll ans=0;
	rep(i,m){ans+=dp[i][k-1],ans%=mod;}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 53128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define N 100009
int a[N] , b[N];
vector< int >v[N];
int seive[1000009];
int main()
{
   	string s;
  	cin >> s;
  	int cnt1 = 0 , cnt2 = 0;
  	for(int i = 0 ; i < s.size() ; i++){
		if(i % 2 && s[i] != '1')
          cnt1++;
      	else if(i % 2 == 0 && s[i] != '0')
          cnt1++;
      if(i % 2 && s[i] != '0')
          cnt2++;
      	else if(i % 2 == 0 && s[i] != '1')
          cnt2++;
    }
  	cout << min(cnt1 , cnt2) << endl;
  	return 0;
}

Measured memory_bytes: 4736