akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0) u += m;
    //cout << u << endl;
    return u;
}

ll paty_counter(ll level, ll x){
    ll size = pow(2, level+2) - 3;
    ll pmi = pow(2, level) - 1;
    if(x == 0){
        return 0;
    }else if(level == 0){    
        return 1;
    }else{
        if(x <= (size - 1)/2){
            return paty_counter(level-1, x-1);
        }else{
            return pmi + 1 + paty_counter(level-1, x - pow(2, level+1) + 3 - 2);
        }
    }

}
 
using namespace std;
using Graph = vector<vector<int>>;

// 深さ優先探索
vector<bool> seen;
static ll x;
void dfs(const Graph &G, int v) {
    seen[v] = true;
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue;
        dfs(G, next_v); // 再帰的に探索
        x ++;
    }
}

ll fr(ll n){
    ll ans = 1;
    REP(i, n){
        ans *= i+1;
        ans %= MOD;
    }
    return ans;
}

ll conb(ll n, ll k){
    return fr(n)% MOD * modinv(fr(k) * fr(n-k) % MOD, MOD) % MOD;
}

int main() {
    ll n, d;
    cin >> n >> d;
    ll ans = 0;
    REP(i, n){
        ll x,y;
        cin >> x >> y;
        if(x*x + y*y <= d*d){
            ans += 1;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3576
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 1000005;
vector<int>ff[1000005];
void getprim(){
    for(int i=2;i<=1000000;i++){
        if(!ff[i].size())
        for(int j=i;j<=1000000;j+=i)
            ff[j].push_back(i);
    }
}
int a[maxn];
int visit[maxn]={0};
int main()
{
    getprim();
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >>a[i];
    }
    int prim = a[0];
    for(int i=0;i<n;i++){
        prim = __gcd(prim,a[i]);
        if(prim==1)
            break;
    }
    int flag = 1;
    for(int i=0;i<n;i++){
        for(auto v:ff[a[i]]){
        //cout <<v <<endl;
        visit[v]++;
        if(visit[v]>1)
            flag =  0 ;
        }
        if(!flag)
            break;
    }
    //cout << prim << " "<< flag << endl;
    if(prim==1&&flag){
        cout <<"pairwise coprime\n";
    }
    else if(prim==1){
        cout << "setwise coprime\n";
    }
    else
        cout <<"not coprime\n";
    return 0;
}


Measured memory_bytes: 63172
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000

typedef long long ll;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int main(void) {
    int N;
    while (1) {
        cin >> N;
        if (N == 0) break;
        int ans = 0;
        for (int i = 1; i <= N/2; i++) {
            int sum = i, plus = i;
            while (sum < N) {
                plus++;
                sum += plus;
            }
            if (sum == N) ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

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

int n;
vector<int> d;
long long  ans;

int main(){
	cin >> n ;
	vector<int> d(n);
	for (int i = 0; i < n;i++) cin >> d[i];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(i!=j){
				ans += d[i] * d[j];
			}
		}
	}
	cout << ans/2 << endl;
	return 0;
}

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

constexpr ll INF = ll(1e+18) + 1;

bool check(string str, int idx_start, int idx_end) {
    bool ret = true;
    int mark_start = idx_start, mark_end = idx_end;

    while(mark_end > mark_start) {
        if (str[mark_start] != str[mark_end]) {
            ret = false;
            break;
        }
        mark_start++;
        mark_end--;
    }

    return ret;
}

int main() {
    int maxidx;
    string str, ans = "No";

    cin >> str;
    maxidx = str.size() - 1;

    if (check(str, 0, maxidx) == true) {
        if (check(str, 0, maxidx/2 - 1) == true) {
            if (check(str, maxidx/2 + 1, maxidx) == true) {
                ans = "Yes";
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n, k;
ll a[MAXN];

bool check(ll m){
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        ll bef = ans;
        if(a[i] == 0){
            ans += (m > 0 ? n - 1 : 0);
        }else if(a[i] < 0){
            ll ind = upper_bound(a, a + n, (m < 0 ? m : (m - a[i] - 1)) / a[i]) - a;
            if(i >= ind) ans--;
            ans += n - ind;
        }else{
            ll ind = lower_bound(a, a + n, (m + (m < 0 ? 0 : a[i] - 1))/a[i]) - a;
            if(i < ind) ans--;
            ans += ind;
        }
        /*if(m == -6){
            cout<<a[i]<<" "<<ans - bef<<" "<<ans<<endl;
        }*/
        
    }
    //cout<<m<<" "<<ans<<endl;
    //if(ans % 2) cout<<"a: "<<m<<" "<<ans<<endl;
    ans /= 2;
    //if(m == -6) cout<<ans<<endl;
    return ans <= k - 1;
}




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

    #ifdef Local
        freopen("../IO/int.txt","r",stdin);
        freopen("../IO/out.txt","w",stdout);
    #endif

    cin>>n>>k; 

    for(int i = 0; i < n; i++){
        cin>>a[i];
    }
    sort(a, a + n);
    ll l = -1e18, r = 1e18;
    while(l < r){
        ll m = l + (r - l + 1) / 2;
        if(check(m)){
            l = m;
        }else{
            r = m - 1;
        }
        //cout<<m<<endl;
    }
    cout<<l<<endl;


    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

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

const double PI = acos(-1);
const double EPS = 1e-15;
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
const ll MOD1 = 998244353;
//typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

int h,w,n,sh,sw;
string s,t;
string d = "LURD";
int dh[4] = {0,-1,0,1};
int dw[4] = {-1,0,1,0};
map<char,int> mp;

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

  cin >> h >> w >> n >> sh >> sw >> s >> t;

  int w1 = 1, h1 = 1, w2 = w, h2 = h;
  for (int i = n - 1; i >= 0; i--) {

    if (t[i] == 'L') {
      w2 = min(w, w2+1);
    } else if (t[i] == 'R') {
      w1 = max(1, w1-1);
    } else if (t[i] == 'U') {
      h2 = min(h, h2+1);
    } else {
      h1 = max(1, h1-1);
    }

    if (s[i] == 'L') {
      w1++;
    } else if (s[i] == 'R') {
      w2--;
    } else if (s[i] == 'U') {
      h1++;
    } else {
      h2--;
    }

    if (w1 > w2 || h1 > h2) {
      cout << "NO" << endl;
      return 0;
    }

  }

  if (w1 <= sw && sw <= w2 && h1 <= sh && sh <= h2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 920
#include <stdio.h>
int main(){
  char s[200000];
  int i,j;
  scanf("%s",s);
  for(i=0;s[i]!='A';i++);
  for(j=strlen(s);s[j-1]!='Z';j--);
  printf("%d\n",j-i);
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()
#define INF (1e15)

using namespace std;

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

const int MAX_N = 1000;
const int MAX_M = 2000;

int a[MAX_M], b[MAX_M];
ll c[MAX_M];
ll dist[MAX_N];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, M; cin >> N >> M;

	rep (i, M){
		cin >> a[i] >> b[i] >> c[i];
		--a[i], --b[i];
	} // end rep

	rep (i, N){
		dist[i] = -INF;
	} // end rep

	dist[0] = 0LL;
	rep (update, 5 * MAX_N){
		rep (i, M){
			if (dist[b[i]] < dist[a[i]] + c[i]){
				dist[b[i]] = dist[a[i]] + c[i];
			} // end if
		} // end rep
	} // end rep

	ll ans = dist[N - 1];

	rep (update, 5 * MAX_N){
		rep (i, M){
			if (dist[b[i]] < dist[a[i]] + c[i]){
				dist[b[i]] = dist[a[i]] + c[i];
			} // end if
		} // end rep
	} // end rep

	if (ans != dist[N - 1]){
		cout << "inf" << endl;
	}else{
		cout << ans << endl;
	} // end if

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();

        int n = (cin >> n, n);
        vector<int> a(n);
        rep(i, 0, n) cin >> a[i];

        vector<int> color(9);

        for (auto rate : a) {
            int c = rate / 400;
            if (c < 8) {
                color[c]++;
            } else {
                color[8]++;
            }
        }

        if (color[8] == n) {
            cout << 1 << " " << n;
        }else{
            int min_v = 0;
            for(int i = 0; i < 8; ++i){
                if(color[i]) min_v++;
            }
            int max_v = min_v + color[8];
            cout << min_v << " " << max_v << endl;
        }



    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <iomanip>
#include <tuple>

template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(std::min<int>(l_, r_)), r(r_) {}
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr revrange(int l_, int r_): r(std::max<int>(l_, r_) - 1), l(l_ - 1) {}
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

template <class T>
inline T scan() {
  T res;
  std::cin >> res;
  return res;
}

int main() {
  int N, K;
  std::cin >> N >> K;
  std::vector<double> P(N);
  for (double &x: P) {
    std::cin >> x;
  }
  double sum = 0;
  for (int i: range(0, K)) {
    sum += (P[i] + 1) / 2;
  }
  double ans = sum;
  for (int i: range(K, N)) {
    sum -= (P[i - K] + 1) / 2;
    sum += (P[i] + 1) / 2;
    chmax(ans, sum);
  }
  std::cout << std::fixed << std::setprecision(20) << ans << '\n';
  return 0;
}


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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> l(m);
  vector<int> r(m);
  for(int i=0;i<m;i++){
    cin >> l.at(i) >> r.at(i);
  }
  
  sort(l.begin(), l.end());
  sort(r.begin(), r.end());
  
  int ans = r.at(0) - l.at(m-1) +1;
  if(ans >0){
    cout << ans << endl;
  }
  else {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;

typedef long long       ll;
typedef long double     ld;

typedef vector<int>     vi;
typedef vector<bool>    vb;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vll>     vvll;
typedef vector<string>  vs;

typedef pair<int, int>  pii;
typedef pair<ll, int>   pli;
typedef pair<ll, ll>    pll;
typedef vector< pii >   vpi;
typedef vector< pll >   vpll;

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

#define pb           push_back
#define mod          1000000007
#define INF          1e17
#define mini         INT_MIN
#define maxo         INT_MAX
#define eb           emplace_back
#define ff           first
#define ss           second
#define re           return 
#define endl         "\n" 

#define all(c)       c.begin(),c.end()
#define be           begin()
#define en           end()
#define sz(x)        (ll)x.size()
#define mem(a,val)   memset(a,val,sizeof(a))
#define mk(x,y)      make_pair(x,y)
#define mid(l,r)     ((l)+((r)-(l))/2) 

#define fo(i,a,b)    for(ll i = (ll)(a); i <= (ll)(b); i++)
#define rf(i,a,b)    for(ll i = (ll)(a); i >= (ll)(b); i--)
#define read(a,n)    for(int i=0;i<n;i++)cin>>a[i];
#define show(a,n)    for(int i=0;i<n;i++)cout<<a[i]<<' ';cout<<endl;
#define p2(n)        (1LL << (n))
#define deb(x) cout <<#x << " = " << x << " | " << "LINE: "<<__LINE__<< endl;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void add(ll &x, ll y){ x += y; if(x>=mod) x %= mod; if(x<0) x = x%mod + mod; }

//============== *** START OF CODE ***




void solve()
{
    int n;rd(n);
    int b[n];read(b,n-1);
    ll a[n];
    ll ans = 0;
    fo(i,0,n-1)a[i]=1e5+5;
    a[0]=b[0];
    a[1]=b[0];
    fo(i,1,n-2){
        if(b[i]>a[i]){
            a[i+1]=b[i];
        }
        else{
            a[i]=b[i];
            a[i+1]=b[i];
        }
    }   
    fo(i,0,n-1)ans+=a[i];
    cout<<ans<<endl;

}


void prep(){}

//=============== *** END OF CODE ***

int main(){
    speedio; cout<<fixed<<setprecision(12);

// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif

    prep();
    int t = 1;
    // cin >> t;
    while(t--)
        solve();

    return 0;
}

Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double eps = 1e-8;

int path[26][26];
int visited[26];
bool isConnect;

int dfs(int src,int* visited){
	visited[src] = 1;
	int res = 1;
	for(int i=0;i<26;i++){
		if(path[src][i] && visited[i] == 0){
			res += dfs(i,visited);
		}
	}
	return res;
}

int main(){
	int n;
	
	while(~scanf("%d",&n)){
		if(n==0) break;
		memset(path,0,sizeof(path));
		memset(visited,0,sizeof(visited));
		set<int> src;
		for(int i=0;i<n;i++){
			string str;
			cin >> str;
			path[*str.begin()-'a'][*(str.end()-1)-'a']++;

			src.insert(*(str.end()-1)-'a');
			src.insert(*str.begin()-'a');
		}
				

		if(src.size() != dfs(*src.begin(),visited)){
			printf("NG\n");
			continue;
		}

		bool isok=true;

		//for(set<int>::iterator it = src.begin(); it != src.end(); it++){
		for(int it = 0;it < 26; it++){
			int out=0;
			for(int j=0;j<26;j++){
				out += path[it][j];
			}

			int in=0;
			for(int j=0;j<26;j++){
				in += path[j][it];
			}

			if(out != in) isok = false;
		}

		printf("%s\n",isok ? "OK" : "NG");
	}
}

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

int main(){ 
  int N, W;
  vector<int> v(110, 0), w(110, 0);

  cin >> N >> W;
  for(int i=1; i<=N; i++) cin >> v[i] >> w[i];

  //dp[i][j]: i番目の品物まで，重さj以内での最大価値
  vector<vector<int>> dp(110, vector<int>(100010, 0));

  for(int i=0; i<N; i++){
    for(int j=0; j<=W; j++){
      if(j-w[i+1] >= 0){
        dp[i+1][j] = max(dp[i][j], dp[i][j-w[i+1]]+v[i+1]);
      } else {
        dp[i+1][j] = dp[i][j];
      }
    }
  }
  cout << dp[N][W] << endl;
}


Measured memory_bytes: 46436
Ns=int(input())
S=list(map(int,input().split()))
Nt=int(input())
T=list(map(int,input().split()))

answer=0

for i in range(0,len(T)):
    a=0
    b=len(S)-1
    
    while b-a>=2:
        x=(a+b)//2
        
        if T[i]>=S[x]:
            a=x
        else:
            b=x
            
    if T[i]==S[a] or T[i]==S[b]:
        answer+=1
    
print(answer)  


Measured memory_bytes: 16708
#include <iostream>
using namespace std;
/*
	???????????´??°??????????????????
	???????????????????°??????????????????????????????????????????°??????
*/

int Change(int *numA, int *numB);



int main(){
    int a, b, c;
    cin >> a >> b >> c;
    
    if(a > b)
    {
    	Change(&a, &b);

    }
    if(a > c)
    {
        Change(&a, &c);

    }
    if(b > c)
    {
    	Change(&b, &c);

    }


    cout << a << " " << b << " " << c << endl;
    
    return 0;
}

int Change(int *numA, int *numB){
	int a;
		a	=	*numA;
    	*numA	=	*numB;
    	*numB	=	a;

    	return *numA, *numB;
};
/*
    8 3 1
    8 3
    3 8

*/

Measured memory_bytes: 1164
S = list(input())
before = S[:len(S) // 2]
after = S[len(S) // 2:]
for i in range(len(S) // 2):
    tmp = before.pop(-1)
    after.insert(0 , tmp)
    after.pop(-1)
    after.pop(-1)
    if before == after:
        break
print(len(before) * 2)

Measured memory_bytes: 3060
#include<stdio.h>
int main(){
  int x[26]={0},a,i;
  char ch;
  while(scanf("%c",&ch)!=EOF){
    if('a'<=ch&&ch<='z'){
      a=ch-'a';
      x[a]++;
    }
      if('A'<=ch&&ch<='Z'){
      a=ch-'A';
      x[a]++;
    }
  }
  for(i=0;i<26;i++){
    printf("%c : %d\n",'a'+i,x[i]);
  }
  return 0; 
}




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

using ll = long long;

int main(){
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);

	if((a[0]==a[1] && a[1]!=a[2])|| (a[0]!=a[1] && a[1]==a[2])){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define ll long long int
using namespace std;
ll n, mCap;
ll b[110], v[110];
ll memo[110][110000];
ll totposs = 0;
ll dp(){
	for(ll i = 0;i<=n;i++){
		for(ll j = 1;j<=totposs;j++){
			memo[i][j] = 1e15;
		}
	}
	
	for(ll i = 1;i<=n;i++){
		for(ll j = 1;j<=totposs;j++){
			if(j - v[i-1] >= 0){
//				cout<<"in\n";
				memo[i][j] = 
					min(memo[i-1][j],
						memo[i-1][j-v[i-1]] + b[i-1]
					);
			}else{
				memo[i][j] = memo[i-1][j];
			}
		}
	}
	ll ans = 0;
	for(ll i = 1;i<=n;i++){
		for(ll j = 1;j<=totposs;j++){
			if(memo[i][j]<=mCap){
				ans = max(ans, j);
			}
//			cout<<memo[i][j]<<" ";
		}//cout<<"\n";
	}
	
	return ans;
}

int main(){
	cin>>n>>mCap;
	
	for(ll i = 0;i<n;i++){
		cin>>b[i]>>v[i];
		totposs+=v[i];
	}
	cout<<dp()<<"\n";
	return 0;
}

Measured memory_bytes: 88192
n, t = map(int, input().split())
c = [input().split() for _ in range(n)]
c_sorted = sorted(c, key=lambda i:int(i[0]))
for i in range(n):
    if int(c_sorted[i][1]) <= t:
        print(c_sorted[i][0])
        exit()
    else:
        pass
print('TLE')

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int main(){
  char str[1001];

  while(1){
    scanf( "%s", str );
    if ( str[0] == '0' ) break;
    int sum = 0;
    for ( int i = 0; i < strlen(str); i++ ){
      sum += ( str[i] - '0') ;
    }

    printf("%d\n", sum);
  }

  return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7;
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

ll N;
ll A[200005];
ll B[200005];
ll dp[200005];

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>N;

rep1(i,N+1){
	cin>>A[i];
	B[i]=A[i]-i;
}
sort(B+1,B+1+N);

rep1(i,N+1){
	dp[1]+=abs(B[i]-B[1]);
} 

rep1(i,N){
	dp[i+1]=dp[i]+i*(B[i+1]-B[i])-(N-i)*(B[i+1]-B[i]);
}

ll ans=9223372036854775807;
rep1(i,N+1){
	ans=min(ans,dp[i]);
}

cout<<ans<<endl;

}
	


Measured memory_bytes: 4992
//

#include <iostream>
#include <utility>
#include <queue>
using namespace std;
typedef pair<int,int> P;
P a;
priority_queue< P,vector<P> > pq;
int n,m,d,p,sum;
int main(){
	while(1){
		cin >>n>>m;
		if(!(n||m))break;
		for(int i=0;i<n;i++){
			cin>> d>>p;
			a=make_pair(p, d);
			pq.push(a);
		}
		sum=0;
		//while(!pq.empty()){
		//	d=pq.top().first;
		//	p=pq.top().second;
		//	cout<<d <<" " << p<<endl;
		//	pq.pop();
		//}
		while(!pq.empty()){
			p=pq.top().first;
			d=pq.top().second;
			pq.pop();
			if(m>d){
				m-=d;
			}else{
				sum+=(d-m)*p;
				break;
			}
		}
		while(!pq.empty()){
			sum+=pq.top().first*pq.top().second;
			pq.pop();
		}
		cout << sum<<endl;
	}
}

Measured memory_bytes: 3208
#include <bits/stdc++.h>
#include<stdio.h>
#include<vector>
#pragma GCC optimize(2)
typedef long long ll;
typedef unsigned long long ull;
const int mod=1000;
const int maxn=1e5+5;
const ll INF=100000000000005;
using namespace std;
ll n,m,p;
ll qpow(ll a,ll b){ll ans=1;while(b){if(b&1) ans=(ans*a)%mod;b/=2;a=(a*a)%mod;}return ans;}
struct node{
    ll a,b,c;
}save[maxn];
ll dp[maxn][4];
int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++) scanf("%lld%lld%lld",&save[i].a,&save[i].b,&save[i].c);
    for(int i=1;i<=n;i++)
    {
        dp[i][1]=max(dp[i-1][2],dp[i-1][3])+save[i].a;
        dp[i][2]=max(dp[i-1][1],dp[i-1][3])+save[i].b;
        dp[i][3]=max(dp[i-1][2],dp[i-1][1])+save[i].c;
    }
    ll res=0;
    for(int i=1;i<=3;i++) res=max(dp[n][i],res);
    printf("%lld\n",res);
    return 0;
}
/***
10 4
40 10 20 70 80 10 20 70 80 60
***/


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int k;
    cin>>k;
    while(k--)
    {
        if(b<c && b>a)
        {
            c=c*2;
        }
        else if(b>=c)
        {
            c=c*2;
        }
        else if(b<=a)
        {
            b=b*2;
        }
    }
    if(c>b && b>a)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3612
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;// ;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
constexpr long long DINF = 1000000000000;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<Edge>>g;
vector<edge>ed;
vector<Pll>pv;
map<LL, LL>ma;
set<LL>st;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
LL n, m, k, p, q, w, h, ans, cnt,sum, a[310000], b[310000];
string str[10000];
bool f;
char c[1100][1100];
int main() {
	cin >> n >> m;
	rep(i, m) {
		LL x;
		cin >> x;
		rep(j, x) {
			LL y;
			cin >> y;
			y--;
			a[y] |= (1 << i);
		}
	}
	rep(i, m) {
		LL x;
		cin >> x;
		if(x)
		sum |= (1 << i);
	}
	for (int mask = 0; mask < 1 << n; mask++) {
		LL cur = 0;
		rep(i, n) {
			if (mask&(1 << i))
				cur ^= a[i];
		}
		if (sum == cur)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	// your code goes here
	char a[100000],b[100000];
	cin >> a >> b;
	ll n = strlen(a);
	ll m = strlen(b);
	ll dp[n+1][m+1];
	for(ll i=0;i<n+1;i++)
	{
		dp[i][0]=0;
	}
	for(ll i=0;i<m+1;i++)
	{
		dp[0][i]=0;
	}
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=m;j++)
		{
			if(a[i-1]==b[j-1])
			{
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else
			{
				dp[i][j]=max(dp[i-1][j] , dp[i][j-1]);
			}
		}
	}
	
	// to print
	char rev[10000];
	ll cnt=0 , i=n , j=m;
	while(dp[i][j]!=0)
	{
		if(dp[i][j]!=dp[i-1][j]&&dp[i][j]!=dp[i][j-1])
		{
			rev[cnt++]=a[i-1];
			i--;
			j--;
		}
		else if(dp[i][j]==dp[i-1][j])
		{
			i--;
		}
		else
		{
			j--;
		}
	}
	
	for(ll i=cnt-1;i>=0;i--)
	{
		cout<<rev[i];
	}
	return 0;
}

Measured memory_bytes: 70656
import math
A,B,C = map(int,input().split())
k = [A,B,C]
k.sort()
k.reverse()
ans = 0
ans += k[0]-k[1]
now = k[2]
now += ans
if (k[0]-now)%2 == 0:
    ans += math.ceil((k[0]-now)/2)
    print(ans)
else:
    ans += math.ceil((k[0]-now)/2)
    ans += 1
    print(ans)

Measured memory_bytes: 3064
def calc(n)
  e=["0", "1", "2", "3", "5", "7", "8", "9"]
  sprintf("%o",n).split(//).map{|x| e[x.to_i]}.join
end

if true then
  fh=STDIN
else
  fh=open("in0208.txt")
end
n=0
while fh.gets do
  n=$_.chomp.to_i
  break if n==0
  puts calc(n)
end
abort ("data strange") if n!=0

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

int main() {
	int n;
	cin >> n;
	set<int> mult;
	for(int i = 1; i < 10; i++){
        for(int j = 1; j < 10; ++j){
            if(i*j == n){
                cout << "Yes\n";
                return 0;
            }
        }
	}
	cout << "No\n";

}




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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		double x1, y1, s = 0;
		ArrayList<Double> xs, ys;
		xs = new ArrayList<Double>();
		ys = new ArrayList<Double>();

		while ((line = br.readLine()) != null) {
			double x = Double.parseDouble(line.substring(0, line.indexOf(',')));
			double y = Double
					.parseDouble(line.substring(line.indexOf(',') + 1));
			xs.add(Double.valueOf(x));
			ys.add(Double.valueOf(y));
		}

		// 原点に移動
		x1 = xs.get(0);
		y1 = ys.get(0);
		for (int i = 0; i < xs.size(); i++) {
			xs.set(i, xs.get(i) - x1);
			ys.set(i, ys.get(i) - y1);
		}
		// 面積計算
		for (int i = 1; i < xs.size() - 1; i++) {
			s += area(xs.get(i), ys.get(i), xs.get(i + 1), ys.get(i + 1));
		}
		System.out.println(s);
	}

	static double area(double... ds) {
		double x1, y1, x2, y2, l1, l2, l3, z;
		x1 = ds[0];
		y1 = ds[1];
		x2 = ds[2];
		y2 = ds[3];
		l1 = Math.sqrt(Math.pow(x1, 2) + Math.pow(y1, 2));
		l2 = Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2));
		l3 = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
		z = (l1 + l2 + l3) / 2;
		return Math.sqrt(z * (z - l1) * (z - l2) * (z - l3));
	}
}

Measured memory_bytes: 16928
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
typedef long long ll;
int ceil(int a,int b){// a以上でｂの倍数の最小値を出力//
    return (a+b-1)/b*b;
}
int stoii(string s){//stoi関数の代用 文字列を数値として読み取りint型に変換//
    return atoi(s.c_str());
}
int main (){
    long long sum=0,n;
    cin>>n;
    vector<int> v(n,0);
    rep(i,n) cin>>v[i];
    sum+=abs(v[0])+abs(v[n-1]);
    rep(i,n){
        if(i<n-1) sum+=abs(v[i]-v[i+1]);
    }
    int sum1=sum;
    rep(i,n){
        sum=sum1;
        if(i==0) sum=sum-abs(v[1]-v[0])-abs(v[0])+abs(v[1]);
        else if(i==n-1) sum=sum-abs(v[n-1]-v[n-2])-abs(v[n-1])+abs(v[n-2]);
        else{
            sum=sum-abs(v[i]-v[i+1])-abs(v[i-1]-v[i])+abs(v[i-1]-v[i+1]);
        }
        cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 1664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class ABC
{
    //          long[] sp = Console.ReadLine().Split().Select(long .Parse).ToArray();
    //          int[] sp = Console.ReadLine().Split().Select(int.Parse).ToArray();
    //          int N =  int.Parse(Console.ReadLine());
    //CompLib.Collections.PriorityQueue<?>
    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int kisuu = (N+1) / 2;
        double answer = 1.0 * kisuu / N;
        Console.WriteLine(answer);

    }




}


Measured memory_bytes: 13140
from collections import defaultdict
ans = 0
d = int(input())
c = list(map(int,input().split()))
s = []
for i in range(d):
    s.append(list(map(int,input().split())))
dic = defaultdict(int)
for i in range(1,d+1):
    t = int(input())
    ans += s[i-1][t-1]
    dic[t-1] = i
    for j in range(26):
        ans -= c[j]*(i-dic[j])
    print(ans)

Measured memory_bytes: 74440
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(l);i<(r);++i)
//-------
int n, c[3];
int get(int x) {
	if (x % 4 == 0) return 2;
	if (x % 2 == 0) return 1;
	return 0;
}
bool solve() {
	if (!c[1]) {
		if (c[2] >= c[0] - 1) return true;
		return false;
	} else {
		return c[2] >= c[0];	
	}
}
int main() {
	scanf("%d", &n);
	rep(i, 0, n) {
		int x;
		scanf("%d", &x);
		++c[get(x)];
	}	
	puts(solve() ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
n,a,b = map(int,input().split())
ans = 0
p = 1
r = 0

while p <= n:
    str_p = str(p)
    for q in str_p:
        r += int(q)
    if r >= a and r <= b:
        ans += p
    p += 1
    r = 0

print(ans)

Measured memory_bytes: 2940
use std::io::*;

const MOD : i64 = 1e9 as i64 + 7;

fn main(){
    let mut c : Vec<Vec<i64>> = vec![vec![0; 2001]; 2001];
    for i in 0..2001{
        c[i][0] = 1;
        for j in 1..(i + 1){
            c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
            c[i][j] %= MOD;
        }
    }
    let n : usize = input();
    let k : usize = input();
    for i in 1..(k + 1){
        println!("{}", (c[n - k + 1][i] * c[k - 1][k - i]) % MOD);
    }
}

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

Measured memory_bytes: 45308
n = int(input())
field = [list(map(int, input().split())) for _ in range(2)]
ans = []
field_0 = 0
field_1 = 0

for i in range(n):
    field_0 += field[0][i]

    for j in range(i, n):
        field_1 += field[1][j]
    
    ans.append(field_0 + field_1)
    field_1 = 0
print(max(ans))


Measured memory_bytes: 9132
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vi D;

void input() {
  cin >> N >> K;
  D.resize(K);
  rep(i, 0, K - 1) { cin >> D[i]; }
}
int dp[6][2];
void solve() {
  set<int> sd;
  for (auto x : D) {
    sd.insert(x);
  }

  int ans;
  rep(m, N, 100000) {
    int k = m;
    bool isok = true;
    while (k) {
      if (sd.find(k % 10) != sd.end()) {
        isok = false;
        break;
      } else {
        k /= 10;
      }
    }
    if (isok) {
      ans = m;
      break;
    }
  }
  cout << ans << endl;
}
signed main() {
  input();
  solve();
  return 0;
}

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

int main() {
  int n, temp;
  vector<int> v, c,diffs;
  cin >> n;
  for (int i=0; i<n; i++) {
    cin >> temp;
    v.push_back(temp);
  }
  for (int i=0; i<n; i++) {
    cin >> temp;
    c.push_back(temp);
  }
  for (int i=0; i<n; i++) {
    diffs.push_back(v[i]-c[i]);
  }
  int result = 0;
  for (auto i : diffs) if (i>0) result+=i;
  cout << result;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int a,b,c;
    
    scanf("%d %d %d",&a,&b,&c);
    
    if( (0<=a&&a<=100) && (0<=b&&b<=100) && (0<=c&&c<=100) ){
        if( (a<b) && (b<c) ){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }
    else{
        printf("error\n");
    }
    
    return 0;
}


Measured memory_bytes: 2048
[N,X,Y] = list(map(int,input().split()))
out = [0]*(N-1)
for i in range(1,N+1):
    for j in range(i+1,N+1):
        L = min(j-i,1+abs(X-i)+abs(Y-j),1+abs(X-j)+abs(Y-i))
        out[L-1]+=1
for i in range(N-1):
    print(out[i])


Measured memory_bytes: 48988
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const LL INF = 1e18;

LL sum[5001];
int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		sum[0]=0;
		LL res=-INF;
		REP(i,n){
			int a;
			cin>>a;
			sum[i+1]=sum[i]+a;
		}
		
		REP(i,n+1)FOR(j,i+1,n+1){
			res=max(res,sum[j]-sum[i]);
		}
		cout<<res<<endl;
	}
	
	return 0;
}
/*

*/

Measured memory_bytes: 1180
import math

n = int(input())
ps = list(map(int, input().split(' ')))
qs = list(map(int, input().split(' ')))

def func(array):
    sort_array = sorted(array)
    head = array[0]
    index = sort_array.index(head)
    num_pattern = math.factorial(len(array) - 1)
    return index * num_pattern

p_cnt = 1
for i in range(len(ps)):
    array = ps[i:]
    p_cnt += func(array)

q_cnt = 1
for i in range(len(qs)):
    array = qs[i:]
    q_cnt += func(array)
print(abs(p_cnt - q_cnt))

Measured memory_bytes: 3064
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

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

    int a,b;
    cin>>a>>b;
    if(a>b) swap(a,b);
    string s(b,a+'0');
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
N=input()
A=map(int, sys.stdin.readline().split())
B=map(int, sys.stdin.readline().split())
before=sum(B)

for i in range(N):
    if B[i]!=0:
        k=min(A[i],B[i])
        A[i]-=k
        B[i]-=k
    if B[i]!=0:
        k=min(A[i+1],B[i])
        A[i+1]-=k
        B[i]-=k
after=sum(B)
print before-after


Measured memory_bytes: 48920
#include <cstdio>
int gcd(int a,int b) {
	return b?gcd(b,a%b):a;
}
int lcm(int a,int b,int gcd) {
	return a/gcd*b;
}
int main() {
	int a,b,g;
	while(scanf("%d %d",&a,&b)!=EOF) {
		g=gcd(a,b);
		printf("%d %d\n",g,lcm(a,b,g));
	}
}

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

#ifndef DEBUG
#define endl '\n'
#define debug(...)
#else
#define debug(...) __VA_ARGS__
#endif
#define debugf(...) debug(printf(__VA_ARGS__);)

const int N = 1e5 + 5;

int h[N];
vector<int> g[N];



int (((((main)))))() <%
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int n, m;
    cin >> n >> m;

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

    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        g[u].emplace_back(v);
        g[v].emplace_back(u);
    }

    int ans = 0;
    for (int u = 1; u <= n; u++) {
        bool good = true;
        for (int v : g[u]) {
            if (h[u] <= h[v])
                good = false;
        }

        if (good)
            ans++;
    }

    cout << ans << endl;

    return 0;
%>

Measured memory_bytes: 9168
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>


#define fs first
#define sc second

using namespace std;

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

ll mypow(int k, int n){
    ll res = 1;
    while(n > 0){
        res *= k;
        n--;
    }
    return res;
}

ll a[1000000];
pair<P, P> res[1000000];

int main(){
    int N;
    cin >> N;
    for(int i = 0; i < mypow(2, N); i++){
        cin >> a[i];
    }

    res[1] = pair<P, P>(P(a[0], 0), P(a[1], 1));
    res[2] = pair<P, P>(P(a[0], 0), P(a[2], 2));
    for(int k = 3; k < mypow(2, N); k++){
        set<P, greater<P> > s;
        s.insert(P(a[k], k));
        s.insert(P(a[0], 0));
        for(int i = 0; i < 18; i++){
            if(((1 << i) & k) > 0){
                int bef = k^(1<<i);
                s.insert(res[bef].first);
                s.insert(res[bef].second);
            }
        }
        P x1, x2;
        auto itr = s.begin();
        x1 = *itr; itr++;
        x2 = *itr;
        res[k] = pair<P, P>(x1, x2);
    }

    /*for(int k = 1; k < mypow(2, N); k++){
        cout << k << " " << res[k].first.first << " " << res[k].second.first << endl;
    }*/

    ll res2[1000000];
    res2[1] = a[0] + a[1];
    for(int k = 2; k < mypow(2, N); k++){
        ll res_tmp = res[k].first.first + res[k].second.first;
        res2[k] = max(res_tmp, res2[k-1]);
    }
    for(int k = 1; k < mypow(2, N); k++){
        cout << res2[k] << endl;
    }


    return 0;

}


Measured memory_bytes: 21376
import java.util.*;


public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int [n];
		long sum = 0;
		for (int i = 0; i < n; i++) {
		    a[i] = sc.nextInt();
		    sum = sum + a[i];
		}
		Arrays.sort(a);
		
		System.out.println(a[0] + " " + a[a.length - 1] + " " + sum);
    }
}


Measured memory_bytes: 41900
def main():
    n = int(input())
    p = [True] * 55556
    p[0] = False
    p[1] = False
    curr = 2
    while curr * curr <= 55555:
        if p[curr]:
            for i in range(curr * curr, 55556, curr):
                p[i] = False
        curr += 1
    fives = []
    for i in range(2, 55556):
        if p[i] and i % 5 == 1:
            fives.append(i)
    print(*fives[:n])
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 65212
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#define ALL(a) (a).begin(),(a).end()

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;
 
	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
 
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}
 
	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい]
	}
 
	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}
 
		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);
 
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;
 
		return true;
	}
};


long long fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>que;

int main() {
  // 前処理
  //COMinit();

	ll a,b,c,d,e,k;
  cin>>a>>b>>c>>d>>e>>k;
  if((e-a)<=k){
    cout<<"Yay!"<<endl;
  }else{
    cout<<":("<<endl;
  }


  return 0;
 
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
   
   int a,b;
 scanf("%d %d", &a,&b);
 if (a<b)
   printf ("a < b\n");
else if (a>b)
   printf ("a > b\n");
else if (a==b)
   printf ("a == b\n");
else
   printf ("none\n");
return 0;
 

}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
  LL n,ans=1001001001001; cin>>n;
  LL rn=sqrt(n);
  for(LL i=1;i<=rn;i++){
    if(n%i) continue;
    LL j=n/(double)i;
    ans=min(ans,i+j-2);
  }
  cout<<ans;
}

Measured memory_bytes: 3676
#include<algorithm>
#include<cmath>
#include<iostream>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<ll(n); i++)

int moge(ll a, ll b, ll c){
    if(a==b){return 0;}
    if(b==c){return 0;}
    if(c==a){return 0;}
    if(a+b <= c){return 0;}
    if(b+c <= a){return 0;}
    if(c+a <= b){return 0;}
    return 1;
}

int main(){
    int N;
    int i, j, k;
    int flag;

    cin >> N;
    vector<long long int> L;
    for(i=0;i<N;i++){
        int li;
        cin >> li;
        L.push_back(li);
    }

    int count;
    count = 0;
    for(i=0;i<N-2;i++){
     for(j=i+1;j<N-1;j++){
      for(k=j+1;k<N  ;k++){
       flag = moge(L[i],L[j],L[k]);
       if(flag == 1){
           count += 1;
       }
    }}}
    cout << count << endl;




    return 0;
}


Measured memory_bytes: 3152