akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define F(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define FD(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define pii pair<int,int>
#define reset(x,y) memset(x, y,sizeof(x))
#define MIN(x,y) if (x > (y)) x = (y)
#define MAX(x,y) if (x < (y)) x = (y)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define EL putchar('\n');
#define mod 1000000007
#define oo 1000006
typedef pair<int, int> ii;
const int N = 1005;
const int M = 2e4 + 5;
const int inf = 1e15;
int n, dp[N][M], s[N], w[N], v[N];
vector<pair<ii, ii> > vec;
int read()
{
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') {x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
void write(int x)
{
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

void ReadInPut()
{
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n;
    for(int i = 1; i <= n; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        vec.pb({{y + x, x}, {y, z}});
    }
    sort(vec.begin(), vec.end());
}
void Solve()
{
    for(int i = 0; i < vec.size(); i++) {
        s[i + 1] = vec[i].se.fi;
        w[i + 1] = vec[i].fi.se;
        v[i + 1] = vec[i].se.se;
    }
    for(int i=1;i<=n;i++) {
        for(int j=0;j<M;j++)
            dp[i][j] = -inf;
    }
    dp[0][0] = 0;
    for(int i=0;i<n;i++) {
        for(int j=0;j<M;j++) {
            if(j <= s[i+1])
                dp[i + 1][j + w[i + 1]] = max(dp[i + 1][j + w[i + 1]], dp[i][j] + v[i + 1]);
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
        }
    }
    int ans=0;
    for(int j=0;j<M;j++)ans=max(ans,dp[n][j]);
    cout << ans;
}
main()
{
//    freopen("t.INP","r",stdin);
  //  freopen(".OUT","w",stdout);
    int sotest=1;
    //cin>>sotest;
    for(int i=1;i<=sotest;i++)
    {
        ReadInPut();
        Solve();
    }
}


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

#define vec              vector<int>
#define vecll            vector<ll>
#define vecd             vector<double>
#define vecst            vector<string>
#define vecb             vector<bool>
#define v2(v,n,m,init)   vector<vector<int> >  v(n, vector<int>(m, init))
#define vb2(v,n,m,init)  vector<vector<bool> > v(n, vector<bool>(m, init))
#define vll2(v,n,m,init) vector<vector<ll> >   v(n, vector<ll>(m, init))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
template <typename T>
bool chmax(T &a, const T& b){if(a<b){a=b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a>b){a=b; return true;} return false;}
//----------------------------------------------------------------

int main(void) {
  int R, C, K;
  cin >> R >> C >> K;
  vll2(item, R+1, C+1, -1);
  rep(i,K){
    int a, b;
    ll v;
    cin >> a >> b >> v;
    item[a][b] = v;
  }

  vector<vector<vector<ll> > > dp(R+1, vector<vector<ll> >(C+1, vector<ll>(4, 0)));

  REP(i,1,R+1){
    REP(j,1,C+1){
      ll tmp=0;
      rep(k,4){chmax(tmp, dp[i-1][j][k]);}
      chmax(dp[i][j][0], tmp);
      if(item[i][j]>0) chmax(dp[i][j][1], tmp+item[i][j]);

      rep(k,4){
        chmax(dp[i][j][k], dp[i][j-1][k]);
        if(k!=0 && item[i][j]>0){
          chmax(dp[i][j][k], dp[i][j-1][k-1]+item[i][j]);
        }
      }
    }
  }

  ll ans=0;
  rep(i,4){
    chmax(ans, dp[R][C][i]);
  }
  prt(ans);
}


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



int main() {
string S;
cin >> S;
sort(S.begin(),S.end());
int lon = S.size();
lon -= 1;
bool check = 1;
for(int i = 0; i < lon; i++){
if(S[i] == S[i+1])check = 0;
}
if(check == 0) cout << "no" << endl;
else cout << "yes" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from itertools import accumulate

T = 86400


def sec(a):
    return 3600 * a[0] + 60 * a[1] + a[2]


while True:
    n = int(input())
    if n == 0:
        exit()
    imos = [0] * T
    for _ in range(n):
        s, t = map(lambda x: list(map(int, x.split(':'))), input().split())
        imos[sec(s)] += 1
        imos[sec(t)] -= 1
    imos = list(accumulate(imos))
    print(max(imos))



Measured memory_bytes: 9624
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
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();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  int N,ans=0;
  cin>>N;
  vector<pair<int,int>> AB(N),CD(N);
  REP(i,N) cin>>AB[i].first>>AB[i].second;
  REP(i,N) cin>>CD[i].first>>CD[i].second;
  AB.PB(MP(-1,500));
  AB.PB(MP(501,-2));
  CD.PB(MP(500,-1));
  CD.PB(MP(-2,499));
  SORT(AB);
  SORT(CD);
  
  for(int i=1; i<=N; ++i){
    ll mx=-1,it=0;
    for(int j=1; j<=N; ++j){
      if(AB[j].first<CD[i].first && AB[j].second<CD[i].second && mx<AB[j].second){
        mx=AB[j].second;
        it=j;
      }
    }
    if(it>0){
      ans++;
      AB[it].second=500;
    }
  }
  
  cout<<ans<<endl;
  return 0;
}

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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

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

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;

int main()
{
    ll X;
    cin >> X;
    if (X >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

int main(){
   int n,m,k;
   cin >> n >> m >> k;
   vector<ll> a(n+1),b(m+1);
   ll A=0,B=0;
   a[0] = 0;
   b[0] = 0;
   rep(i,n){
      ll s;
      cin >> s;
      A += s;
      a[i+1] = A;
   } 
   rep(i,m){
      ll s;
      cin >> s;
      B += s;
      b[i+1] = B;
   } 
   ll ans=0;
   int j=m;
   rep(i,n+1){
      if(a[i]>k) break;
      while(a[i]+b[j]>k && j>0){
         j--;
      }

      ans = max(ans,(ll)(i+j));
   }

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

Measured memory_bytes: 6360
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

void solve() {
    cini(n);
    map<string,int> m;
    for(int i=0; i<n; i++) {
        cins(s);
        m[s]++;
    }

    cout<<"AC x "<<m["AC"]<<endl;
    cout<<"WA x "<<m["WA"]<<endl;
    cout<<"TLE x "<<m["TLE"]<<endl;
    cout<<"RE x "<<m["RE"]<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


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

int main() {
    int H, W;
    while (cin >> H >> W) {
        if (H == 0 && W == 0) {
            return 0;
        }

        for (int i = 1; i <= W; i++) {
            cout << "#";
        }
        cout << endl;
        
        for (int j = 1; j <= H - 2; j++) {
            cout << "#";
            for (int k = 1; k <= W - 2; k++) {
                cout << ".";
            }
            cout << "#" << endl;
        }
        for (int l = 1; l <= W; l++) {
            cout << "#";
        }
        cout << endl;
        cout << endl;
    }
}


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

int main() {

  int n;
  cin >> n;
  int outcnt = 0;
  int game = 0;
  int base = 0;
  int score = 0;
  while(1) {
    if(game == n) break;
    string str;
    cin >> str;
    if(str == "OUT") outcnt++;
    if(outcnt == 3) {
      cout << score <<endl;
      game++;
      outcnt = base = score = 0;
      continue;
    }
    if(str == "HIT") {
      base++;
      if(base == 4) score++,base--;
    }
    if(str == "HOMERUN") {
      score += base+1;
      base = 0;
    }

  }

  return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
#define int                 long long
#define FF(i,a,b)           for(int i=a;i<b;i++)
#define BF(i,a,b)           for(int i=a;i>=b;i--)
#define vi                  vector<int>
#define MAP                 map<int,int>
#define pb                  push_back
#define MP                  make_pair
#define F                   first
#define S                   second
#define pi                  pair<int,int>
#define all(v)              v.begin(),v.end()
#define PIE                 3.1415926535897932384626433832795
#define print0(a)           cout<<a<<"\n"
#define print1(a)           cout<<a<<' '
#define print2(a,b)         cout<<a<<" "<<b<<" ";
#define print3(a,b,c)       cout<<a<<" "<<b<<" "<<c<<" ";
#define print4(a,b,c,d)     cout<<a<<" "<<b<<" "<<c<<" "<<d<<" ";
#define FastIO              ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
/**************************************************************************************/
                       /*Global Variables*/
const int mod = 1e9+7;
const int N = 2e5+10;
const int inf = 1e18;
vector<int> g[N];
int h,w;
/**************************************************************************************/
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
int Power(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)res*=a;
        a*=a;
        b>>=1;
    }
    return res;
}
signed main()
{
    
    // string s1,s2;
    // cin>>s1>>s2;
    // freopen(s1,"r",stdin);
    // freopen(s2,"w",stdout);
    
    FastIO;
    int T=1;
   // cin>>T;
    while(T--)
    {
       int a,b,c;
       cin>>a>>b>>c;
       for(int i=1;i<=b;i++)
       {
           if((a*i)%b==c%b)
           {
               cout<<"YES\n";
               return 0;
           }
       }
       cout<<"NO\n";
       return 0;
       

      
     


       
    }

}
/*
|| Do what you can with all you have,wherever you are. ||

|| Knowing is not enough, we must apply. Wishing is not enough, we must do. ||

|| A goal is a dream with deadline. ||

|| Whether you think you can or you think you can't, you're right. ||
*/



Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll; 
int main() {
  ll n; cin>>n;
  string s; cin>>s;
  bool ans=true;
  if(n%2==1) ans=false;
  else { 
    rep(i, n/2) {
      if(s.at(i)!=s.at(n/2+i)) ans=false;
    }
  }
  if(ans==true) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    while(true){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            break;
        }

        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            break;
        }
        
    }
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
    int a, b, c, k, cnt = 0;

    scanf("%d %d %d %d", &a, &b, &c, &k);

    while(b <= a)
    {
        cnt++;
        b <<= 1;
    }

    while(c <= b)
    {
        cnt++;
        c <<= 1;
    }

    if(cnt <= k)
        printf("Yes");
    else
        printf("No");

    return 0;
}


Measured memory_bytes: 1616
#include <stdio.h>

int main(void)
{
	int i;
	int n;
	int sum;
	
	sum = 0;
	for (i = 0; i < 5; i++){
		scanf("%d", &n);
		
		if (n < 40){
			sum += 40;
		}
		else {
			sum += n;
		}
	}
	
	printf("%d\n", sum / 5);
	
	return (0);
}

Measured memory_bytes: 1768
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string.h>
#include<cmath>
#include<algorithm>
using namespace std;
typedef unsigned long long ull;
#define ll long long
#define INF  0x7fffffff
#define M 200000
#define N 100000
#define legal(x) ((1<=(x))&&((x)<=M))
const ll  mod=1e9 + 7;
ll n,k,ans[M],p[M],t,l,r,f[M],sum;
int main(void){
	p[1] = 1;
	for(ll i = 2;i <= N;i++){
		if(!p[i])
		ans[++sum] = i;
		for(ll j = 1;j <=sum&&i*ans[j]<=N;j++){
			p[ans[j]*i] = 1;
			if(i %ans[j]==0)
			break;
		}
	}
	p[2] = 0;
	for(ll i = 1;i <= N;i++){
		if(p[i]==0&&p[(i+1)/2]==0&&i!=2){
			f[i] =f[i-1]+1;
		}
		else
		f[i] = f[i-1];
	}
	cin>>t;
	while(t--){
		cin>>l>>r;
		cout<<f[r] -f[l-1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3968
a=[input() for i in range(2)]
a1=int(a[0])
a2=[int(i) for i in a[1].split()]

n=0

for i in range(len(a2)-1):
	sa=a2[i]-a2[i+1]
	if sa>0:
		a2[i+1]+=sa
		n+=sa

print(n)

Measured memory_bytes: 33480
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> mvec(size_t a){return vector<T>(a);}template<class T, class... Ts>auto mvec(size_t a, Ts... ts){return vector<decltype(mvec<T>(ts...))>(a, mvec<T>(ts...));}/* 多次元デック */template<class T>deque<T> mdeq(size_t a){return deque<T>(a);}template<class T, class... Ts>auto mdeq(size_t a, Ts... ts){return deque<decltype(mdeq<T>(ts...))>(a, mdeq<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  string S;
  cin >> S;
  S.push_back('R');
  ll R{}, L{}, c{};
  auto ans = mdeq<ll>(S.size()-1);
  rep(i, 0, S.size()){
    if(S[i] == 'R' && L != 0){
      if((L+R)%2==0){
        ans[c-1] = (L+R)/2;
        ans[c] = (L+R)/2;
      }
      else{
        if(R%2==0){
          ans[c-1] = (L+R)/2;
          ans[c] = (L+R)/2+1;
        }
        else{
          ans[c-1] = (L+R)/2+1;
          ans[c] = (L+R)/2;
        }
      }
      R = 1;
      L = 0;
    }
    else if(S[i] == 'R'){
      R++;
    }
    else if(S[i] == 'L'){
      if(L == 0) c = i;
      L++;
    }
  }
  rep(i, 0, S.size()-2){
    cout << ans[i] << sp;
  }
  cout << ans[S.size()-2] << rt;
}

Measured memory_bytes: 1408
#!/usr/bin/env python3
N = int(input().rstrip())

S = []
P = []
for _ in range(N):
    s, p = input().rstrip().split()
    S.append(s)
    P.append(int(p))

Index = sorted(range(N), key=lambda i: P[i], reverse=True)
Last_Index = sorted(Index, key=lambda i: S[i])

for i in Last_Index:
    print(i + 1)


Measured memory_bytes: 3060
n, q = [int(_) for _ in input().split(' ')]
s = input()

c = [0] * (n + 1)
for i in range(1, n):
    if s[i - 1] == 'A' and s[i] == 'C':
        c[i + 1] = c[i] + 1
    else:
        c[i + 1] = c[i]

for _ in range(q):
    l, r = [int(_) for _ in input().split(' ')]
    print(c[r] - c[l])


Measured memory_bytes: 6188
n, d = map(int, list(input().split()))
zahyou = []
for i in range(n):
    zahyou.append(list(map(int, list(input().split()))))

count = 0

for i in range(n):
    for j in range(n):
        nijou_dist = 0
        for k in range(d):
            nijou_dist = nijou_dist + (zahyou[i][k] - zahyou[j][k]) ** 2
        if (nijou_dist ** (1 / 2)).is_integer():
            count = count + 1

print((count - n) // 2)


Measured memory_bytes: 3188
#include<iostream>
#include<fstream>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <random>
#include <unordered_set>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a==c){
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }
}


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

using namespace std;

int main() {
	int N;
	vector<int> d(100);
	cin>>N;
	for(int i = 0;i < N;++i) {
		cin>>d[i];
	}

	long sum = 0;
	for (int i = 0;i < N;++i) {
		for (int j = i+1;j < N;++j) {
			sum += d[i]*d[j];
		}
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    Scanner sc = new Scanner(System.in);

    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    if(a<b){
        if(b<c){
            System.out.printf("%d %d %d\n", a, b, c);
        }else if(a<c){
            System.out.printf("%d %d %d\n", a, c, b); 
        }else{
            System.out.printf("%d %d %d\n", c, a, b); 
        }                 
    }else{
        if(a<c){
            System.out.printf("%d %d %d\n", b, a, c);
        }else if(b<c){
            System.out.printf("%d %d %d\n", b, c, a);  
        }else{
            System.out.printf("%d %d %d\n", c, b, a); 
        }
    }
 }
}


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

int main() {
 int N;
 cin>>N;
 vector<int>a(N);
 int count=0;
 for(int i=0;i<N;i++){
     cin>>a[i];a[i]--;
 }
 int k=0;
 for(int i=0;i<N;i++){
     if(k==1){cout<<count<<endl;return 0;}
     k=a[k];
     count++;
 }
 cout<<-1<<endl;
 return 0;}

Measured memory_bytes: 640
#include<stdio.h>

/* 再帰関数による最大公約数 */
int gcd(int x, int y) {
  return y ? gcd(y, x % y) : x;
}

int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  printf("%d\n", gcd(a, b));

  return 0;
}


Measured memory_bytes: 2040
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    a,b=map(int,input().split())
    if b>1:
        if b<=a:
            print(1)
        else:
            b-=a
            print((b-1)//(a-1)+2)
    else:
        print(0)
if __name__ == '__main__':
    main()


Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c, d, e, f,i,j,k,l,ans1,ans2;
  cin >> a >> b >> c >> d >> e >> f;
  ans1=0;
  ans2=0;
  double co=-5;
  for (i=0;i*a*100<=f;i++){
    for(j=0;i*a*100+j*b*100<=f;j++){
      int w=i*a*100+j*b*100;
      for(k=0;c*k<=e*w/100&&w+c*k<=f;k++){
        int s=c*k;
        for (l=0;s+d<=e*w/100&&w+s+d<=f;l++){
          s+=d;
        }
        if(w!=0){
          double res=1000000*s/(w+s);
          if(co<res){
            co=res;
            ans1=w+s;
            ans2=s;
          }
        }
      }
    }
  }
  cout << ans1 << ' ' << ans2 << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  bool num[1000000]={true,true};
  for(int i=2; i<1000; i++)
    if(!num[i])
      for(int j=i*i; j<1000000; j+=i)
	num[j] = true;
  int n;
  while(cin >>n){
    for(int i=n-1;;i--){
      if(!num[i]){cout <<i<<" ";break;}
    }
    for(int i=n+1;;i++){
      if(!num[i]){cout <<i<<endl;break;}
    }
  }
  return 0;
}

Measured memory_bytes: 2140
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
#include <deque>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    string s;
    cin >> s;
    int n;
    cin >> n;
    int tmpa,tmpb;
    char tmpc;
    deque<char> deq;
    for(auto c:s){
        deq.push_back(c);
    }
    int pal = 0;
    REP(i,n){
        cin >> tmpa;

        if(tmpa==1){
            pal++;
            pal %= 2;
        }else{
            cin>> tmpb >> tmpc;
            if((tmpb+pal)%2==0){
                deq.push_back(tmpc);
            }else{
                deq.push_front(tmpc);
            }
        }
    }
    if(pal){
        while(!deq.empty()){
            cout << deq.back();
            deq.pop_back();
        }
        cout << endl;
    }else{
        
        while(!deq.empty()){
            cout << deq.front();
            deq.pop_front();
        }
    }

    return 0;
}


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

int main() {
  int N;  //団体の数
  cin >> N;  //入力
  
  int sum = 0;  //合計人数
  
  for (int i = 0; i < N; i++){
    int a, b;
  	cin >> a >> b;  //liからriまでの席の番号
    
    sum += (b - a + 1);
  }
  
  //出力
  cout << sum << endl;
}


Measured memory_bytes: 256
from collections import deque

N = int(input())
A = list(map(int, input().split()))

answer = deque([])
for i, a in enumerate(A):
  if i % 2 == 0:
    answer.appendleft(a)
  else:
    answer.append(a)
    
answer = list(answer)
answer = answer if N % 2 else answer[::-1]

print(*answer)

Measured memory_bytes: 25412
#include <iostream>
#include <vector>

using namespace::std;

int main() {
	vector<int> antenna(5); int k;
	cin >> antenna[0];
	cin >> antenna[1];
	cin >> antenna[2];
	cin >> antenna[3];
	cin >> antenna[4];
	cin >> k;

	vector<int> dist;
	for (int i = 0; i < antenna.size()-1; i++) {
		for (int j = i + 1; j < antenna.size(); j++) {
			dist.push_back(abs(antenna[i] - antenna[j]));
		}
	}

	for (int i = 0; i < dist.size(); i++) {
		if (dist[i] > k) {
			cout << ":(" << endl;
			return 0;
		}
	}

	cout << "Yay!" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <list>

using namespace std;

int main(int argc, char *argv[]) {
	list<int> nums;
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int n;
		cin >> n;
		nums.push_back(n);
	}
	nums.sort();
	nums.unique();
	cout << nums.size() << endl;
	return 0;
}

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

struct  NUM {
        int     val;
        int     tip;
};

struct  DIGIT {
        int     val=-1;
        string  S="";
        int     len=0;
};

bool cmp_tip_val(NUM &A, NUM &B){
        if (A.tip == B.tip) return (A.val>B.val);
        else return (A.tip<B.tip);
};

bool cmp_val(NUM &A, NUM &B){
        return (A.val>B.val);
};

vector<int> B={8, 2, 5, 5, 4, 5, 6, 3, 7, 6};

int     main() {

        int N;
        int M;
        cin >>N >>M;

        vector<NUM> A(M);
        for (int i=0; i<M; i++) {
                cin >>A.at(i).val;
                A.at(i).tip=B.at(A.at(i).val);
        }
        sort(A.begin(), A.end(), cmp_tip_val);
        for (int i=1; i<A.size();) {
                if (A.at(i-1).tip==A.at(i).tip) A.erase(A.begin() + i);
                else i++;
        }
        sort(A.begin(), A.end(), cmp_val);

        vector<DIGIT> D(N+1);
        D.at(0).val=0;
        //D.at(0).S="";
        //D.at(0).len=0;
        D.at(1).val=-1;
        //D.at(1).S="";
        //D.at(1).len=0;
        for (int i=2; i<=N; i++) { // for each tip
                D.at(i).val=-1; //Defalt no answer found
                D.at(i).len=0; //Defalt len of digits is 0
                for (int j=0; j<A.size(); j++) { // for each Number
                        int N=i-A.at(j).tip; // num of tips left
                        if (N>=0) //if tips left or zero
                                if (D.at(N).val>=0) { //if answer exists
                                        if (D.at(N).len+1>D.at(i).len) { // replace only when longer digits
                                                D.at(i).len=D.at(N).len+1; // new len of digits
                                                D.at(i).S=to_string(A.at(j).val)+D.at(N).S; // new String
                                                D.at(i).val=A.at(j).val;
                                        }
                                }
                }
        }
        cout <<D.at(N).S << endl;
        return 0;
}

Measured memory_bytes: 33152
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = Long.parseLong(sc.next());
        Map<Long, Long> map = getPf(n);
        long ans = 0;
        for (Map.Entry<Long, Long> e : map.entrySet()) {
            int temp = 1;
            long temp2 = e.getValue();
            while (temp <= temp2) {
                temp2 -= temp;
                temp++;
                ans++;
            }
        }
        System.out.println(ans);
    }

    private static Map<Long, Long> getPf(long n) {
        Map<Long, Long> map = new HashMap<>();
        for (long i = 2; i * i <= n; i++) {
            while (n % i == 0) {
                map.merge(i, 1L, Long::sum);
                n /= i;
            }
        }
        if (n != 1) {
            map.put(n, 1L);
        }
        return map;
    }
}

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

int main()
{
	int N,D,M, T,ans = 0;
	map<int, int >mp;

	cin >> N;

	for (int n = 0; n < N; n++) {
		cin >> D;
		mp[D]++;
	}

	cin >> M;

	for (int m = 0; m < M; m++) {
		cin >> T;
		if (mp[T] > 0)mp[T]--;
		else ans = 1;
	}

	if (ans == 0)cout << "YES";
	else cout << "NO";

	return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

int main()
{
    ll R, G;
    cin >> R >> G;

    cout << (R + (G - R) * 2) << endl;
}

Measured memory_bytes: 256
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_10_D&lang=jp
  * Math Functions - Distance II
  */
object Main {
  def main(args: Array[String]): Unit = {
    val n = io.StdIn.readInt()
    val x = io.StdIn.readLine().split(" ").map(_.toInt)
    val y = io.StdIn.readLine().split(" ").map(_.toInt)
    println(manhattanDistance(x, y))
    println(euclidDistance(x, y))
    println(minkowskiDistance(3, x, y))
    println(chebyshevDistance(x, y))
  }

  def minkowskiDistance(p: Int, x: Seq[Int], y: Seq[Int]): Double = {
    math.pow(
      (x zip y).foldLeft(0.0) {
        (acc, pair) => acc + math.pow(math.abs(pair._1 - pair._2), p)
      }, 1.0 / p)
  }

  def manhattanDistance(x: Seq[Int], y: Seq[Int]): Double = {
    minkowskiDistance(1, x, y)
  }

  def euclidDistance(x: Seq[Int], y: Seq[Int]): Double = {
    minkowskiDistance(2, x, y)
  }

  def chebyshevDistance(x: Seq[Int], y: Seq[Int]): Double = {
    (x zip y).map(pair => math.abs(pair._1 - pair._2)).max
  }

}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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 int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

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

    sort(all(a));
    sort(rall(f));
    ll l = -1;
    ll r = LINF;
    while (r - l > 1) {
        ll m = (l + r) / 2;
        ll num = 0;
        for (int i = 0; i < n; ++i) {
            num += max(0LL, a[i] - m / f[i]);
        }
        if (num <= k) r = m;
        else l = m;
    }
    cout << r << endl;
}

Measured memory_bytes: 6424
#include <cstdio>
#include <string>
#include <iostream>
#include <math.h>

using namespace std;





int main(void){

    

    long n;
    cin >>n;
    string ans = "";

    int a[100001];

    for(int i = 0; i < 100001; i++) {
        a[i] = 0;
    }

    int t;
    long sum = 0;
    for(int i = 0 ; i < n; i++) {
        cin>>t;
        a[t]++;
        sum += t;
    }

    long q;
    cin>>q;

    int *b = new int[q];
    int *c = new int[q];
    for(int i = 0; i < q; i++) {
        cin>>b[i]>>c[i];
    }

    

    for(int i = 0; i < q; i++) {
        sum += a[b[i]]*(c[i]-b[i]);
        a[c[i]]+=a[b[i]];
        a[b[i]] = 0;
        cout<<sum<<"\n";
    }

    //cout<<ans;


    return 0;
}

Measured memory_bytes: 4800
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef struct point
{
	int x,y;
	bool operator < (const struct point & t)const
	{
		return x==t.x?y<t.y:x<t.x;
	}
}POINT,*PPOINT;
int w,h;
POINT arr[200002];
long long fac[200010],rev[200010],f[200002];
void init()
{
	int i;
	fac[0]=fac[1]=rev[0]=rev[1]=1;
	for(i=2;i<=h+w-2;i++)
	{
		fac[i]=fac[i-1]*i%MOD;
		rev[i]=(MOD-MOD/i)*rev[MOD%i]%MOD;	
	}
	for(i=2;i<=h+w-2;i++)
		rev[i]=rev[i-1]*rev[i]%MOD;	
}
long long mycomb(int n,int m)
{
	return fac[n]*rev[m]%MOD*rev[n-m]%MOD; 
}
int main()
{
	int i,j,n;
	scanf("%d %d %d",&h,&w,&n);
	for(i=0;i<n;i++)
		scanf("%d %d",&arr[i].x,&arr[i].y);
	arr[n].x=h;
	arr[n].y=w;
	sort(arr,arr+n+1);
	init();
	for(i=0;i<=n;i++)
	{
		f[i]=mycomb(arr[i].x+arr[i].y-2,arr[i].x-1);
		//printf("%d %d\n",i,f[i]);
		for(j=0;j<i;j++)
		{
			f[i]=f[i]-f[j]*mycomb(arr[i].x-arr[j].x-arr[j].y+arr[i].y,arr[i].x-arr[j].x)%MOD;
		}
		f[i]=(f[i]+MOD)%MOD;
	}
	printf("%lld\n",(f[n]+MOD)%MOD);
	return 0;
}

Measured memory_bytes: 4864
#include<stdio.h>

int main(){
    int n,i,max=0; int sum=0;
    int p[10];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&p[i]);
        sum+=p[i];
        if(p[i]>max){
            max = p[i];
        }
    }
    printf("%d",sum-max/2);

    return 0;
}

Measured memory_bytes: 128
from copy import *
from collections import*
n=int(input())
if n==1:
    print(1)
    exit()
p=[list(map(int,input().split()))for i in range(n)]
l=[]
for i in range(n):
    q=deepcopy(p)
    a,b=q.pop(i)
#    print(a,q)
    l.extend([(s-a,t-b)for s,t in q])
print(n-(Counter(l).most_common()[0][1]+1)+1)

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a<b){
    cout << "a < b" << endl;
  } else if (a>b){
    cout << "a > b" << endl;
  } else {
    cout << "a == b" << endl;
  }
}

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

int main() {
    string n;
    while(cin >> n, n != "0") {
        vector<vector<int>> dp(n.size()+1, vector<int>(11));
        int res = 0;
        for(int i=0; i<n.size(); ++i) {
            int m = n[i]-'0';
            if(m != 0) {
                dp[i+1][m] += 1;
            }
            for(int j=0; j<11; ++j) {
                dp[i+1][(j*10+m)%11] += dp[i][j];
            }
            res += dp[i+1][0];
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 9960
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
#define lld long double
#define F first
#define S second
#define f(i,a,b) for(int i=a;i<=b;i++)
#define g(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define mh make_heap
#define ph push_heap
#define pq priority_queue
#define bits(x) __builtin_popcountll(x)
#define op(x) cout<<"Case #"<<x<<": "
#define op1(x) cout<<"Scenario #"<<x<<": "
#define endl "\n"
using namespace std;
const ll mod = 1000000007;
const ll INF = LLONG_MAX;
const ll NEGINF = LLONG_MIN;
const int N = 18;
const ll MAXN = 1000001;


#define MAXN   1000001
ll spf[MAXN];

void sieve()
{
	spf[1] = 1;
	for (ll i = 2; i < MAXN; i++)

		spf[i] = i;

	for (int i = 4; i < MAXN; i += 2)
		spf[i] = 2;

	for (int i = 3; i * i < MAXN; i++)
	{
		if (spf[i] == i)
		{
			for (int j = i * i; j < MAXN; j += i)

				if (spf[j] == j)
					spf[j] = i;
		}
	}
}




void solve(int t)
{

	sieve();
	int n;
	cin >> n;

	ll cnt = 0;

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

		map<ll, ll> m;
		while (x != 1)
		{
			m[spf[x]]++;
			x = x / spf[x];
		}
		ll p = 1;

		for (auto i : m) p *= (i.S + 1);

		cnt += p;
	}

	cout << cnt << endl;


}



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





	int t = 1;
	//cin >> t;



	for (int i = 1; i <= t; i++)
	{
		solve(i);

	}
}

Measured memory_bytes: 11464
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
    int n, m, l,a[101][101] = { 0 }, b[101][101] = { 0 };
    long long c[101][101] = { 0 },s=0;
    scanf("%d%d%d", &n, &m,&l);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++)scanf("%d", &a[i][j]);
    }
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < l; j++)scanf("%d", &b[i][j]);
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l; j++) {
            s = 0;
            for (int k = 0; k < m; k++)s += a[i][k] * b[k][j];
            c[i][j] = s;
        }
    }
    for (int i = 0; i < n; i++) {
        printf("%lld", c[i][0]);
        for (int j = 1; j < l; j++) printf(" %lld", c[i][j]);
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2112
#!/mnt/c/Users/moiki/bash/env/bin/python
N, K = map(int, input().split())
# = int(input())
h = []
sums = [0]
for i in range(N):
    h.append(int(input()))

h = sorted(h)
diff = []
bef = 0
for e,i in enumerate(h):
    if e == 0:
        bef = i
    else:
        diff.append(i - bef)
        bef = i
        # sums.append(diff[e-1])

diffin = 0
for n in diff:
    sums.append(sums[diffin] + n  )
    diffin += 1

# print("sums: {}".format(sums))
mins = 10e9
leng = len(sums)
for i in range(leng-K+1):
    # print("sums[{}]: {}, sums[{}]: {}".format(i+K-1,sums[i+K-1], i, sums[i]))
    mins = min(mins, sums[i+K-1] - sums[i])
print(mins)



Measured memory_bytes: 16852
A,B,K=map(int,input().split())

D={}
for i in range(A,min(A+K,B)):
    D[i]=1
for i in range(max(B+1-K,A),B+1):
    D[i]=1
L=list(D)
L.sort()

for i in range(len(L)):
    print(L[i])

Measured memory_bytes: 38384
import numpy as np
n,m,*xyz = map(int,open(0).read().split())
xyz = np.array(xyz).reshape(n,3)
abs_pattern = np.array(np.meshgrid((1,-1),(1,-1),(1,-1))).reshape(-1,3)
if m==0:
    ans = 0
else:
    ans = np.sort(np.dot(abs_pattern,xyz.T))[:,-m:].sum(axis=1).max()
print(ans)

Measured memory_bytes: 12648
import java.util.*;

public class Main {
    public static void main(String[] args) {
    	StringBuffer sb = new StringBuffer();
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        String T = sc.next();
        char s[] = S.toCharArray();
        char t[] = T.toCharArray();
        for(int i = 0; i < N; i++) {
        	sb.append(s[i]).append(t[i]);
        }
        System.out.println(sb.toString());
    }
  }

Measured memory_bytes: 21332
while True:
    h,w = map(int,raw_input().split())
    if h == w == 0:break
    print ("#" * w)
    print (("#" + "." * (w - 2) + "#" + "\n") * (h - 3))+("#" + "." *(w-2)+"#")
    print ("#" * w + "\n")

Measured memory_bytes: 6328
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N = i()
S = s()
if N % 2 != 0:
    print("No")
else:
    a = N // 2
    if S[:a] == S[a:N]:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 10000
#include <bits/stdc++.h>
#define S second
#define F first
#define ld I64d
#include <cstdio>
#ifdef DEBUG
    #define D(X) X
#else
    #define D(X)
#endif
#define mehh ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define sz(v) (int)v.size()
#define loop(i, v) for (int i = 0; i < sz(v); ++i)
#define PrimeRange(n) (n / log(n))
#define NumOfDigits(n) 1 + (int)log10(n)

using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int N = 2e4, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

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

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

int main(){
    mehh
    ll n, m, k, x;
    cin >> n >> m;
    k = (n + m)/ 2;
    if (abs(n - k) == abs(m - k)) cout << k;
    else cout << "IMPOSSIBLE";
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

//const long long int MOD = 1000000007;
//const long long int MOD = 1000003;
//const int MOD = 998244353;
const long long int MOD = 998244353;

int N, M, K, H, W, L, R;
//long long int N, M, K, H, W, L, R;

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

	while (cin >> N, N) {
		vector<pair<int, int>>v(N);
		int fsum = 0, ssum = 0;
		for (auto &i : v) {
			cin >> i.first >> i.second;
			fsum += i.first;
			ssum += i.second;
		}
	//	cout << fsum << " " << ssum << endl;
		sort(v.begin(), v.end());
		if (v.back().first * 2 > fsum) {
			int box = v.back().first * 2 - fsum;
			vector<int>dp(box + 1);
			dp[0] = 1;
			for (int i = 0; i < N - 1; i++) {
				for (int j = box; j >= v[i].second; j--) {
					dp[j] |= dp[j - v[i].second];
				}
			}
			for (int i = box; i >= 0; i--) {
				if (dp[i]) {
				//	cout << i << endl;
					cout << fsum + ssum + box - i << endl;
					break;
				}
			}
		}
		else {
			cout << fsum + ssum << endl;
		}
	}
}


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

typedef long long ll;
typedef long double ld;
//#define int ll
//#define endl '\n'

// use unique(x) - removec consecutive items, returns vec.begin() + number of items
// for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
// use iota(all(vec), 0) for filling a vector with 0,1,2...
// use fill(all(vec), 1) for filling a vector with 1,1,1...
// use rotate(vec.begin(), vec.begin() + 1, vec.end()) to rotate a vector | middle arg becomes first
// print number in binary -> cout << bitset<20>(n);

const int N=3030;
const ll inf=1e18;
int a[N];
ll dp[N][N];
int n;

main(){
	cin.tie(0);cin.sync_with_stdio(0);
	cin>>n;
	for(int i=0;i<n;++i)cin>>a[i];
	for(int i=0;i<=n;++i)
		for(int j=0;j<=n;++j)
			dp[i][j]=(i+j==n)?0:((i+j)%2?inf:-inf);
	for(int i=n;i>=0;--i)
		for(int j=0;j<=n&&i-j>=0;++j){
			if(i%2){ // maximize
				if(j)dp[i-j][j-1]=max(dp[i-j][j-1],dp[i-j][j]+a[n-j]);
				if(i-j)dp[i-j-1][j]=max(dp[i-j-1][j],dp[i-j][j]+a[i-j-1]);
			}else{
				if(j)dp[i-j][j-1]=min(dp[i-j][j-1],dp[i-j][j]-a[n-j]);
				if(i-j)dp[i-j-1][j]=min(dp[i-j-1][j],dp[i-j][j]-a[i-j-1]);
			}
		}
//	for(int i=0;i<=n;++i,cout<<endl)
//		for(int j=0;j<=n;++j)
//			cout<<dp[i][j]<<" ";
	cout<<dp[0][0]<<endl;
}


Measured memory_bytes: 74720
#include <cstdlib>
#include <iostream>
#include <string>


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

  std::string s;
  std::cin >> s;

  s.resize(s.length() - (s.length() % 2 == 0 ? 2 : 1));
  for (; s.length() > 1; s.resize(s.length() - 2)) {
    auto t = s.substr(0, s.length() / 2);
    if (s == t + t) {
      std::cout << s.length() << std::endl;
      return EXIT_SUCCESS;
    }
  }
  std::cout << 0 << std::endl;

  return EXIT_SUCCESS;
}


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

int main ()
{
  unsigned long long N, A, B, sum = 0;
  cin >> N >> B;
  
  for (int i=0; i<N-1; i++)
  {
    cin >> A;
    if (A < B)
      sum += B - A;
    else
      B = A;
  }
  
  cout << sum;
  return 0;
}

Measured memory_bytes: 3192
#include<stdio.h>
using namespace std;

int main(){
  int n, i;
  long a, min, max, sum;

  max = -1000001;
  min = 1000001;
  sum = 0;

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%ld", &a);
    if(a>max) max = a;
    if(a<min) min = a;
    sum += a;
  }
  printf("%ld %ld %ld\n", min, max, sum);
  return 0;
}


Measured memory_bytes: 2760