akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;
double eps = 1e-11;

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


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef long long ll;

#define f first
#define s second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int md = 1e9+7;
const ll inf = 1e18;
const int maxn = 2e5+5;

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

void add(int &a, int b)
{
	a += b;
	if(a >= md) a -= md;
}

void sub(int &a, int b)
{
	a -= b;
	if(a< 0) a += md;
}

int mul(int a, int b)
{
	return (1LL*a*b)%md;
}

int expo(int a, int b)
{
	if(b == 0) return 1;
	int x = expo(a, b/2);
	int res = mul(x, x);
	if(b%2) res = mul(res, a);
	return res;
}

int inv(int x)
{
	return expo(x, md-2);
}

int main()
{
	int n; scanf("%d", &n);
	int sum = 0;
	int ssq = 0;
	for(int i = 0; i< n; i++)
	{
		int x; scanf("%d", &x);
		add(sum, x);
		add(ssq, mul(x, x));
	}

	int res = mul(sum, sum);

	sub(res, ssq);

	int ret = mul(res, inv(2));

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

Measured memory_bytes: 3828
n , k = map(int , input().split())
done = set()
for i in range(k):
	c = int(input())
	arr = list(map(int , input().split()))
	for ele in arr:
		done.add(ele)
ans = 0
for i in range(1,n+1):
	if i not in done:
		ans+=1
print(ans)


Measured memory_bytes: 9052
#include <stdio.h>

int A[50], n;

int solve(int i, int m) {
	if (m == 0) return 1;
	if (i >= n) return 0;

	int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
	return res;
}

int main() {
	int q, M, i;
	scanf("%d", &n);
	for (i = 0; i < n; ++i) {
		scanf("%d", &A[i]);
	}
	scanf("%d", &q);
	for (i = 0; i < q; ++i) {
		scanf("%d", &M);
		if (solve(0, M))
			printf("yes\n");
		else
			printf("no\n");
	}
	return 0;
}


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

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

const int lim = 1000000007;
const int INF = 1000000000;

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    rep(i, H) cin >> S[i];

    //移動するときの単位を定義
    //右・下・左・上の順番
    const vector<int> di = {1, 0, -1, 0};
    const vector<int> dj = {0, 1, 0, -1};

    //最長経路の長さを取得
    int mx = 0;
    rep(i, H){
        rep(j, W){
            //開始点が壁の時はやめる
            if(S[i][j] == '#') continue;
            //BFSで用いるqueue
            queue<pair<int, int>> q;
            //始点(i, j)からの経路長を格納する2次元配列
            vector<vector<int>> dist(H, vector<int>(W, INF));
            //情報の更新関数
            if(dist[i][j] != INF) continue;
            dist[i][j] = 0;
            q.emplace(i, j);
            
            //BFS開始
            while(!q.empty()){
                int vi = q.front().first;
                int vj = q.front().second;
                q.pop();

                //上下左右への移動
                rep(dir, 4){
                    int nvi = vi + di[dir];
                    int nvj = vj + dj[dir];
                    //終了条件
                    if(nvi < 0 || nvj < 0 || nvi >= H || nvj >= W) continue;
                    if(S[nvi][nvj] == '#') continue;
                    //発見した場所のdist更新
                    if(dist[nvi][nvj] != INF) continue;
                    dist[nvi][nvj] = dist[vi][vj] + 1;
                    q.emplace(nvi, nvj);
                }
            }
            rep(vi, H){
                rep(vj, W){
                    if(dist[vi][vj] == INF) continue;
                    mx = max(mx, dist[vi][vj]);
                }
            }
        }
    }
    cout << mx << endl;
    return 0;
}

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,x,t;
	cin >> n>>x>>t;
	if (n%x != 0)
	cout << ((n+x)/x)*t<<endl;
	else
	{
		cout <<(n/x)*t<<endl;
	}
	

}


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  cout << (c >= a && c <= b ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  string s;
  cin>>s;
  for (int i(0);i<int(s.size());i++){
    cout << 'x';
  }
  cout << endl;
  return 0;
}



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

int main(){
    using namespace std;
    constexpr unsigned long C = 26;
    unsigned long D;
    cin >> D;
    vector<unsigned long> c(C);
    for(auto&& i : c)cin >> i;
    vector v(D, vector<unsigned long>(C));
    for(auto&& i : v)for(auto&& j : i)cin >> j;

    vector last(C, vector<unsigned long>{0});
    vector<unsigned long> ans(D);

    for(unsigned long i{0}; i < D; ++i){
        unsigned long mx{0}, mxi{0};
        for(unsigned long j{0}; j < C; ++j){
            unsigned long tmp{v[i][j]};// + c[j] * (i + 1 - last[j].back())};
            if(tmp > mx){
                mx = tmp;
                mxi = j;
            }
        }
        ans[i] = mxi;
        last[mxi].push_back(i + 1);
    }
    for(auto&& i : last)i.push_back(D + 1);

    mt19937_64 mt{random_device{}()};
    uniform_int_distribution<unsigned long> uid(1, D);

    auto start = chrono::system_clock::now();

    do for(unsigned long iter{0}; iter < 131072; ++iter){
            unsigned long d{uid(mt)};
            auto f = ans[d - 1];
            unsigned long tmp{c[f] * (*upper_bound(begin(last[f]), end(last[f]), d) - d) * (d - *prev(lower_bound(begin(last[f]), end(last[f]), d))) + v[d - 1][f]};
            unsigned long mx{tmp}, mxi{0};
            for(unsigned long i{0}; i < C; ++i){
                unsigned long temp{c[i] * (*upper_bound(begin(last[i]), end(last[i]), d) - d) * (d - *prev(lower_bound(begin(last[i]), end(last[i]), d))) + v[d - 1][i]};
                if(temp > mx){
                    mx = temp;
                    mxi = i;
                }
            }
            if(mx > tmp){
                last[f].erase(lower_bound(begin(last[f]), end(last[f]), d));
                last[mxi].insert(upper_bound(begin(last[mxi]), end(last[mxi]), d), d);
                ans[d - 1] = mxi;
            }
        } while(chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() < 1800);

    for(const auto& i : ans)cout << i + 1 << endl;

    return 0;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
struct sta {int t,h,w;};
int main(){
    vector<sta> c;
    sta tmp;
    for(int i=1;i<150;i++){
        for(int j=i+1;j<150;j++){
            tmp.t=i*i+j*j;
            tmp.h=i;
            tmp.w=j;
            c.push_back(tmp);
        }
    }
    int flag=1;
    while(flag){
        flag=0;
        for(int i=c.size();i>0;i--){
            if(c[i].t<c[i-1].t){
                swap(c[i],c[i-1]);
                flag=1;
            }
        }
    }
    
    int h,w;
    while(cin>>h>>w,h){
        int ans;
        for(int i=0;i<10001;i++){
            if(c[i].h==h && c[i].w==w){
                ans=i;
                break;
            }
        }
        cout<<c[ans+1].h<<" "<<c[ans+1].w<<endl;
    }
    /*for(int i=0;i<1000;i++){
        cout<<c[i].t<<" "<<c[i].h<<" "<<c[i].w<<endl;
    }*/
    return 0;
}



Measured memory_bytes: 3228
#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(){
    ll k,a, b;
    cin >> k >> a >> b;
    bool ans=false;

    for(int i=a; i<=b;i++){
        if(i%k==0){
            ans=true;
        }
    }

    if(ans){
        cout << "OK" << endl;
    }else{
        cout << "NG" << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<int,int> P;
typedef unsigned long long int ull;
const ll MOD=1e9+7;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=1e18;

struct UnionFind{
    vector<int> par,rank;
    UnionFind(int n):par(n),rank(n,0){
        for(int i=0;i<n;i++) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[rx]<rank[ry]){
            par[rx]=ry;
        }else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[ry]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};

struct edge{
    int from,to;
    ll cost;
};

vector<edge> es(2000);
vector<ll> d(1000,INF);
vector<bool> negative(1000,false);
int n,m;

int main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b,c;cin>>a>>b>>c;
        a--;b--;
        es[i]=edge{a,b,-c};
    }
    d[0]=0;
    for(int i=0;i<n-1;i++){
        for(int j=0;j<m;j++){
            edge e=es[j];
            if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
            }
        }
    }
    ll ans=-d[n-1];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            edge e=es[j];
            if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
                negative[e.to]=true;
            }
            if(negative[e.from]) negative[e.to]=true;
        }
    }
    if(negative[n-1]) cout<<"inf"<<endl;
    else cout<<ans<<endl;
    return 0;
}

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

    //long long
    using ll = long long;

    // pair<int, int>
    using PII = pair<int, int>;

    //最大値、mod
    const int MOD = 1000000007;
    const int INF = 1000000000;
    const long long LINF = 1e18;

    //出力系
    #define print(x) cout << x << endl
    #define prints(x) cout << fixed << setprecision(10) << x << endl
    #define printc(x) cout << setw(2) << setfill('0') << x << endl;
    #define yes cout << "Yes" << endl
    #define YES cout << "YES" << endl
    #define no cout << "No" << endl
    #define NO cout << "NO" << endl
    
    // begin() end()
    #define all(x) (x).begin(),(x).end()

    //for
    #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

    //最大公約数 
    unsigned gcd(unsigned a, unsigned b) {
      if(a < b) return gcd(b, a);
      unsigned r;
      while ((r=a%b)) {
        a = b;
        b = r;
      }
      return b;
    }

    // 最小公倍数
    unsigned lcm(unsigned a, unsigned b){
        return a / gcd(a, b) * b; 
    }

    // a = max(a, b), a = min(a, b)
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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









int main(){
  string s;
  cin >> s;
  ll Q;
  cin >> Q;
  deque<string> c;
  c.push_back(s);
  bool flag = true;
  REP(i, Q){
    int x;
    cin >> x;
    if(x == 1){
      flag ? flag = false : flag = true;
    }else if(x == 2){

    int y;
    cin >> y;
    string cc;
    cin >> cc;


    if(flag){
      if(y == 1) c.push_front(cc);
      else c.push_back(cc);
    }else{
      if(y == 1) c.push_back(cc);
      else c.push_front(cc);
    }

    }
  }
string ans;
  while(!c.empty()){
    ans += c.front();
    c.pop_front();
  }
  if(flag == false) reverse(all(ans));
  print(ans);
  return 0;
  
  }

  




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

#define endl '\n'

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(15);
}

int main(int argc,char* argv[]) { 
    io() ;
    long long N,A,B ;
    cin >> N >> A >> B; 
    if(A > B){
        cout<<0<<endl;
        return 0 ;
    }
    else if(N == 1){
        if(A == B){
            cout << 1 << endl ;
        }
        else{
            cout << 0 << endl ;
        }
        return 0 ;
    }
    else if(A == B){
        cout << 1 << endl ;
        return 0 ;
    }
    long long lb = (N - 1)*A + B ;
    long long ub = A + (N -  1)*B ;
    cout << (ub - lb + 1) << endl ;
    return 0 ; 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MAX_H = 100;
const int MAX_W = 100;

int H, W;
char s[MAX_H][MAX_W];
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
int d[MAX_H][MAX_W];

int bfs()
{
    queue<PII> que;
    REP(i,MAX_H) REP(j,MAX_W) d[i][j] = INF;
    que.push(make_pair(0,0));
    d[0][0] = 0;

    while(que.size())
    {
        PII p = que.front(); que.pop();
        if(p.first == H-1 && p.second == W-1) break;
        REP(i,4)
        {
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];
            if(0 <= nx && nx <= H-1 && 0 <= ny && ny <= W-1 && d[nx][ny] == INF
            && s[nx][ny] != '#')
            {
                que.push(make_pair(nx,ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    return d[H-1][W-1];

}

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> H>> W;
    int cnt = 0;
    REP(i,H) REP(j,W) {
        cin >> s[i][j];
        if(s[i][j] == '#') cnt++;
    }
    if(bfs() == INF)
    {
        cout << -1 << endl;
        return 0;
    }


    int ans = H * W - cnt - bfs()-1;
    cout << ans << endl;

}

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

using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define all(v) v.begin(),v.end()
#define ve vector
#define vi vector<int>
#define vi2 vector<vi>
#define vl vector<long long>
#define vl2 vector<vl>

template <class T> T maxAny(T a, T b){
    if(a > b) return a;
    else return b;
}

template <class T> T minAny(T a, T b){
    if(a > b) return b;
    else return a;
}

int main(){
    int a;
    cin >> a;
    cout << a+ a*a + a*a*a << endl;
}

Measured memory_bytes: 3592
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)2e5 + 5;

int main() {
	int a;
	vector<int> v;
	rep(i, 5) {
		cin >> a;
		v.push_back(a);
	}
	sort(ALL(v), greater<int>());
	cout << v.front();
	REP(i, 1, v.size()) {
		cout << " " << v[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  cout << n * (n + 1) / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
x=int(input())
i=1
while i**2<=x:
    i+=1
result=(i-1)**2

i=1
while i**3<=x:
    i+=1
if (i-1)**3>result:
    result=(i-1)**3

i=1
while i**4<=x:
    i+=1
if (i-1)**4>result:
    result=(i-1)**4

i=1
while i**5<=x:
    i+=1
if (i-1)**5>result:
    result=(i-1)**5

i=1
while i**6<=x:
    i+=1
if (i-1)**6>result:
    result=(i-1)**6

i=1
while i**7<=x:
    i+=1
if (i-1)**7>result:
    result=(i-1)**7

i=1
while i**8<=x:
    i+=1
if (i-1)**8>result:
    result=(i-1)**8

i=1
while i**9<=x:
    i+=1
if (i-1)**9>result:
    result=(i-1)**9
print(result)

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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N, A, B;
signed main() {
    cin >> N >> A >> B;
    int h = abs(A - B);
    if (h & 1) {
        cout << h / 2 + 1 + min({A - 1, B - 1, N - A, N - B});
    } else {
        cout << h / 2 << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>


int main(){

    int n;
    int u;
    
    scanf("%d%d", &n,&u);
    double m=((double)n+(double)u)/2;
   
    if(m-(int)m== 0) {
        printf("%d",(int)m);
    }
    else {
        printf("IMPOSSIBLE");
    }
    
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	int a, b, c;
	cin >> a >> b >> c;
	if ((c >= a) && (c <= b)) cout << "Yes";
	else if ((c >= b) && (c <= a)) cout << "Yes";
	else cout << "No";

	return 0;
}



Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;

// Inserted snippets: euclid, io, modint, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
ll euclid(ll a, ll b, ll &x, ll &y) {
	if (b) { ll d = euclid(b, a % b, y, x);
		return y -= a/b * x, d; }
	return x = 1, y = 0, a;
}
template<ll MOD = 1'000'000'007>
struct Mod {
	ll val;
	Mod() : val(0) {}
	Mod(ll xx) {
		if (0 <= xx && xx < MOD) val = xx;
		else val = (xx % MOD + MOD) % MOD;
	}
	Mod operator+=(Mod b) { if ((val += b.val) >= MOD) val -= MOD; return *this; }
	Mod operator-=(Mod b) { if ((val += MOD - b.val) >= MOD) val -= MOD; return *this; }
	Mod operator*=(Mod b) { (val *= b.val) %= MOD; return *this; }
	Mod operator/=(Mod b) { (val *= b.inv().val) %= MOD; return *this; }
	Mod operator+(Mod b) const { Mod<MOD> tmp(*this); return tmp += b; }
	Mod operator-(Mod b) const { Mod<MOD> tmp(*this); return tmp -= b; }
	Mod operator*(Mod b) const { Mod<MOD> tmp(*this); return tmp *= b; }
	Mod operator/(Mod b) const { Mod<MOD> tmp(*this); return tmp /= b; }
	Mod& operator++() { *this += 1; return *this; }
	Mod& operator--() { *this -= 1; return *this; }
	Mod operator++(int) { Mod<MOD> tmp(*this); operator++(); return tmp; }
	Mod operator--(int) { Mod<MOD> tmp(*this); operator--(); return tmp; }
	Mod inv() const {
		ll v, y, g = euclid(val, MOD, v, y);
		assert(g == 1); return Mod((v + MOD) % MOD);
	}
	Mod operator^(ll p) const {
		ll r = 1, b = val;
		for (; p; p >>= 1, b = b * b % MOD) if (p & 1) r = r * b % MOD;
		return Mod(r);
	}
	friend istream& operator>>(istream &is, Mod& mod) {
		ll tmp; is >> tmp;
		mod = Mod<MOD>(tmp);
		return is;
	}
	friend ostream& operator<<(ostream &os, const Mod& mod) {
		return os << mod.val;
	}
};
// End snippets

typedef Mod<> modint;

modint fact[2000005], factinv[2000005];

modint ncr(int n, int r) {
	return fact[n] * factinv[r] * factinv[n - r];
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	fact[0] = factinv[0] = 1;
	rep(i, 1, 2000005)
		fact[i] = fact[i - 1] * i, factinv[i] = factinv[i - 1] / i;

	int k; string s;
	read(k, s);
	int n = sz(s);

	modint ans = 0;

	rep(i, n, n + k + 1) {
		//ans += dp[n + k][i];
		ans += ncr(n + k, i) * (modint(25) ^ (n + k - i));
	}

	write(ans);
}


Measured memory_bytes: 35520
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int dfs(vector<pair<char, int>> &str, int &now) {
    char op = str[now].first;
    int depth = str[now].second + 1;
    if(op == '+') {
        --now;
        int ret = 0;
        while(now >= 0 and depth <= str[now].second) {
            if(str[now].first == '+' or str[now].first == '*') {
                ret += dfs(str, now);
            } else {
                ret += str[now].first - '0';
                --now;
            }
        }
        return ret;
    } else if(op == '*') {
        --now;
        int ret = 1;
        while(now >= 0 and depth <= str[now].second) {
            if(str[now].first == '+' or str[now].first == '*') {
                ret *= dfs(str, now);
            } else {
                ret *= str[now].first - '0';
                --now;
            }
        }
        return ret;
    }
    return 0;
}

int solve(int &n) {
    // {num/op, depth}
    vector<pair<char, int>> str(n);
    for(int i = n - 1; i >= 0; --i) {
        string s; cin >> s;
        str[i] = {s.back(), s.size() - 1};
    }
    int now = n - 1;
    if(str[now].first == '+') return dfs(str, now);
    if(str[now].first == '*') return dfs(str, now);
    return str[now].first - '0';
}

int main() {
    int n;
    while(cin >> n and n > 0) {
        int ans = solve(n);
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3152
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

int main(){
    int ai,am,as,ae,bi,bm,bs,be;
    scanf("%d%d%d%d%d%d%d%d",&ai,&am,&as,&ae,&bi,&bm,&bs,&be);
    int S = ai + am + as + ae;
    int T = bi + bm + bs + be;
    printf("%d\n",S > T ? S : T);
    return 0;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	string s;
	int i,j;
	int x,y;
	int flg[26]={0};
	int flg1[26]={0};
	cin>>n;
	cin>>s;
	int MAX=-1;
	for(i=1;i<n;i++){
		//cout<<"I="<<i<<endl;
		for(j=0;j<26;j++){
			flg[j]=0;
			flg1[j]=0;
		}
		for(j=0;j<i;j++){
			//cout<<s[j]-'a'<<endl;
			flg[s[j]-'a']=1;
		}
		//cout<<endl;
		for(j=i;j<n;j++){
			//cout<<s[j]-'a'<<endl;
			flg1[s[j]-'a']=1;
		}
		int cnt=0;
		for(j=0;j<26;j++){
			if(flg[j]>=1&&flg1[j]>=1){
				cnt++;
			}
		}
		//cout<<"check"<<endl;
		MAX=max(MAX,cnt);
	}
	cout<<MAX<<endl;
	return 0;
}
	
	

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <stdio.h>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <cfloat>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <iomanip>

using namespace std;

#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
// #define req(j, n) for (ll j = 1; j < (n+1); j++)
// #define rer(k, n) for (ll k = 1; k < (n+1); k++)



int main()
{
    int a, b, c, k;
    int count = 0;
    cin >> a >> b >> c >> k;
    while (a >= b) {
        b = b * 2;
        count += 1;
    }
    while (b >= c) {
        c = c * 2;
        count += 1;
    }
    if (count <= k) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define rep(i,a,b) for (int i=(a); i<(b); i++)
#define per(i,a,b) for (int i=(b-1); i>=(a); i--)
#define debug(x) cout << #x << " => " << x << endl
using namespace std;

#define fi first
#define se second
#define mp make_pair
typedef pair<int,int> pii;

#define pb push_back
typedef vector<int> vi;

typedef long long ll;
typedef long double ld;

const int MAX_N = 7 + 100000;
const int g[9][2] = { {-1,-1}, {-1,0}, {-1,1}, {0,-1}, {0,0}, {0,1}, {1,-1}, {1,0}, {1,1} };
///----------------------------------------------
map<ll, int> val;
//ll tab[MAX_N*10], tn=0;
ll ans[10];
int main() {

	///read
	int n,m,k; cin>>n>>m>>k;
	
	///prework
	ans[0] = 1ll*(n-2)*(m-2);
	//debug(ans[0]);
	rep(i,0,k) {
		int x,y; scanf("%d%d",&x,&y);
		rep(j,0,9) {
			int dx = x + g[j][0];
			int dy = y + g[j][1];
			if (dx<=1 || dx>=n) continue;
			if (dy<=1 || dy>=m) continue;
			//cout << dx << " ," << dy << endl;
			//tab[tn++]=1ll*dx*m+dy;
			--ans[val[1ll*dx*m+dy]];
			ans[++val[1ll*dx*m+dy]]++;
		}
		//debug("=====");
	}

	///work
	//sort(tab,tab+tn);
	//for (int l=0,r; l<tn; l=r+1) {
	//	for (r=l; r+1<tn&&tab[r+1]==tab[l]; r++);
	//	ans[0]--; ans[r-l+1]++;
	//}
	
	//print
	rep(i,0,10) cout << ans[i] << endl;



}


Measured memory_bytes: 56448
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 1000000007
//#define mod 987654321
#define sz(a) ((ll)(a).size())

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-9
typedef pair<int, int> II;
typedef pair<ll, ll> LL;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI (2 * acos((ld)0))
#define linf (1ll << 60)
#define y1 y32432
#define y0 y435346

#define maxn 2000025

set<II> S;

ll n, k;

int main() {

//	freopen("in.txt", "r", stdin);
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> k;
	ll res = 0;
	for(ll i = k + 1; i <= n; i++){
		for(ll j = 0; j <= n; j += i){
			ll A = min(j + i - 1, n);
			ll add = max(0ll, A - j - k + 1);
			if(k == 0 && j == 0) add = max(0ll, add - 1);
			res += add;
		}
//		cout << i << " " << res << endl;
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
mod = 10 ** 9 + 7
n = int(input())
s1 = input()
s2 = input()
pre = 0
i = 0
while i < len(s1):
    if pre == 0:
        if s1[i] == s2[i]:
            num = 3
            i += 1
            pre = 1
        else:
            num = 6
            i += 2
            pre = 2
    elif pre == 1:
        if s1[i] == s2[i]:
            num *= 2
            num %= mod
            i += 1
            pre = 1
        else:
            num *= 2
            num %= mod
            i += 2
            pre = 2
    else:
        if s1[i] == s2[i]:
            i += 1
            pre = 1
        else:
            num *= 3
            num %= mod
            i += 2
            pre = 2

print(num)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

int n,a[maxn];

int main()
{
    fastio();
    cin>>n; int t=0;
    rep(i,1,n) {cin>>a[i];t^=a[i];}
    rep(i,1,n){
        cout<<(t^a[i])<<" ";
    }
    return 0;
}


Measured memory_bytes: 4432
import itertools
N,M=map(int,input().split())
edges={tuple(sorted(map(int,input().split()))) for i in range(M)}
ans=0
for i in itertools.permutations(range(2,N+1),N-1):
    l=[1]+list(i)
    ans+=sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1
print(ans)

Measured memory_bytes: 3064
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  double w,h;
  cin >> w >> h;
  double x,y;
  cin >> x >> y;
  int cnt = 0;
  if(2*x==w && 2*y==h) cnt = 1;
  double ans = w*h/2;
  printf("%lf %d\n", ans,cnt);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
signed main(){
    int N , W , w[105] , v[105] , max_volue = 0 , impossible_whight , ans = 0;
    long long volue[100005];
 
    cin >> N >> W;
    for(int i=0 ;i<N ;i++ ){
        cin >> w[i] >> v[i];
        
        //仮に全ての品物を入れて得られる最大の価値 = v[0] + v[1] + ... v[n-1]
        max_volue += v[i];
    }
    
    impossible_whight = W + 1;
    
    for(int i=1 ;i<=max_volue ;i++ ){
        //初期化 volue[i] (iの価値を得るために必要な重さ）をありえない重さにしておく
        volue[i] = impossible_whight;
    }
    //0の価値を得るためには、0の重さが必要とする
    volue[0] = 0;
    
    for(int i=0 ;i<N ;i++ ){
        for(int j=max_volue ;j>=v[i] ;j-- ){
            if(volue[ j-v[i]] + w[i] <= W){
                volue[j] = min( volue[j] , volue[ j-v[i]] + w[i] );
                //品物が詰め込める = jの価値は得られる
                if(ans < j){
                    ans = j;
                }
            }
        }
    }
 
    cout << ans << endl;
 
    return(0);
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
int main() {
	string S; cin >> S;
	int N = S.size() - 1;
	long long ans = 0, num = 0;
	for (int i = 0; i < (1 << N); i++) {
		queue<int>B;
		for (int j = 0; j < N; j++) {
			if (i & (1 << j)) B.push(j);
		}
		for (int j = 0; j < S.size(); j++) {
			num *= 10; num += S.at(j) - '0';
			if (!B.empty()) {
				if (B.front() == j) {
					ans += num;
					num = 0;
					B.pop();
				}
			}
		}
		ans += num;
		num = 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
// Ivan Zanov
// Template
#include <iostream>
#include <utility>
#include <bitset>
#include <vector>
#include <set>
#include <unordered_map>
#include <map>
#include <assert.h>
#include <cmath>
#include <algorithm>
#include <complex>
#include <deque>
#include <iomanip>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <memory>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <sstream>
#include <exception>
#include <functional>
#include <cstring>
#include <cstdlib>
using namespace std;
#define lowbit(x) ((x)&((x)^((x)-1)))
#define max(a,b) (a<b?b:a)
#define IOS ios_base::sync_with_stdio(0);
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define INF (int)1e9
#define EPS (int)1e-9
#define bit_count __builtin_popcount
#define gcd __gcd
#define size(r) r.size()
#define max3(a, b, c) max(a, max(b,c))
#define min3(a, b, c) min(a, min(b,c))
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
inline void set_bit(int & n, int b) { n |= (1 << (int) b); }
inline void unset_bit(int & n, int b) { n &= ~(1 << (int) b); }
inline bool check_bit(int n, int pos) { return ( n & (1 << (pos))); }
inline ll lcm(ll a, ll b){ return (a * b / gcd(a,b));}
int main() {
    long long n;
    cin>>n;
    long long ans = 0;
    if(n % 2 != 0)
    {
        cout<<0<<endl;
        return 0;
    }
    else
    {
        n /= 2;
        while(n > 1)
        {
            ans += n / 5;
            n /= 5;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
package main
 
import "fmt"
 
func main() {
	var n string
	fmt.Scan(&n)
	switch {
	case n == "A":
		fmt.Println("T")
	case n == "T":
		fmt.Println("A")
	case n == "G":
		fmt.Println("C")
	default:
		fmt.Println("G")
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N, 0), B(N, 0), C(N - 1, 0);

    for_each(A.begin(), A.end(), [](auto &a) { cin >> a; });
    for_each(B.begin(), B.end(), [](auto &b) { cin >> b; });
    for_each(C.begin(), C.end(), [](auto &c) { cin >> c; });

    int res = 0;
    for (int i = 0; i < N; i++)
    {
        int ate = A[i] - 1;
        res += B[ate];

        if (A[i + 1] == A[i] + 1)
        {
            res += C[ate];
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
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;
const ll LINF = 1LL<<58;
const ll mod = 1000000007;

int main(){
    int n;
    cin >> n;
    int X[110], Y[110], H[110];
    for(int i = 0; i < n; i++) cin >> X[i] >> Y[i] >> H[i];
    int sx, sy, sh;
    for(int i = 0; i < n; i++) if(H[i]){
        sx = X[i];
        sy = Y[i];
        sh = H[i];
    }
    for(int x = 0; x <= 100; x++){
        for(int y = 0; y <= 100; y++){
            int h = abs(x-sx) + abs(y-sy) + sh;
            bool ok = true;
            for(int i = 0; i < n; i++) {
                if(max(0, h - (abs(x-X[i]) + abs(y-Y[i]))) == H[i])continue;
                ok = false;
            }
            if(ok) {
                cout << x << " " << y << " " << h << endl;;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
// 標準入力
var fs = require('fs'),
length = fs.fstatSync(process.stdin.fd).size,
buffer = new Buffer(length),
bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
input = buffer.toString('utf8', 0, bytesRead).split('\n');
main();
 
// ここから
function main(){
  var intInput = new Int32Array(input);
  var readLine = 0;
  
  while(true){
    var maxLines = intInput[readLine] - 0;
    if(!maxLines){
      break;
    }

    var dp = -1000000;
    var result = -1000000;
    for(var i = 0; i < maxLines; i++){
      var now = intInput[++readLine];

      dp = max(dp + now, now);
      result = max(result, dp);
    }

    console.log(result);
    
    readLine++;
  }
}

function max(a, b) {
  var t = a - b;
  return a - (t & (t >> 31));
}

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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

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

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

inline int read() {
  #define nc getchar()
  int x = 0;
  char c = nc;
  while (c < 48) c = nc;
  while (c > 47) x = x * 10 + (c ^ 48), c = nc;
  return x;
  #undef nc
}

typedef long long ll;
ll A, B, N;

ll check(ll x) {
  return (A * x / B) - A * (x / B);
}

void solve() {
  cin >> A >> B >> N;
  ll res = 0;
  chkmax(res, check(0));
  chkmax(res, check(N));
  if (B <= N) {
    ll val = N - N % B - 1;
    if (val >= 0) chkmax(res, check(val));
  }
  cout << res << endl;
}

int main() {
//  int T = read();
//  while (T--) solve();
  solve();
  return 0;
}

Measured memory_bytes: 3640
n = int(input())
dic = {}
for i in range(n):
    s, p = input().split()
    p = int(p)
    if s in dic:
        dic[s].append(p*101 + i+1)
        dic[s].sort()
        dic[s].reverse()
    else:
        dic[s] = []
        dic[s].append(p*101 + i+1)

dic_sorted = sorted(dic.items(), key = lambda x:x[0])

for tmp in dic_sorted:
    for i in range(len(tmp[1])):
        print(tmp[1][i] % 101)


Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

	    String S=gs();
	    StringBuilder sb= new StringBuilder();
	    for (int i=0; i<S.length();i++) {
	    	if (S.charAt(i)=='0') {
	    		sb.append('0');
	    	}else if(S.charAt(i)=='1') {
	    		sb.append('1');
	    	}else if (S.charAt(i)=='B'&&sb.length()!=0){
	    		sb.deleteCharAt(sb.length()-1);
	    	}
	    }
   
        System.out.print(sb.toString());
//        if (a<=c&&c<=b) {
//        	System.out.print("Yes");
//        }else{
//        	System.out.print("No");
//        }

	   
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
}

Measured memory_bytes: 35656
List = [True for x in range(100001)]
c = [0 for x in range(100001)]
#素数ならば、True
List[0] = False
List[1] = False
List[2] = True
for i in range(2,100001):
    if(List[i] == True):
        for j in range(i+i,100001,i):
            List[j] = False
#1print(List)
for i in range(3,100001, 2):
    if(List[i] and List[int((i+1)/2)]):
        # print('hoge')
        c[i] += 1
# print(c)
for i in range(100001):
    c[i] += c[i-1]
#print(c)
Q = int(input())
for _ in range(Q):
    l,r = map(int,input().split())
    print(c[r] - c[l-1])


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

char G[55][55];

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

inline bool inside(ll y, ll x, ll H, ll W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll h,w; cin>>h>>w;
  rep(i,h) rep(j,w) cin>>G[i][j];
  
  rep(i,h){
    rep(j,w){
      if(G[i][j]=='#'){
        bool ok=false;
        rep(k,4){
          ll ny=i+dy[k], nx=j+dx[k];
          if(inside(ny,nx,h,w) && G[ny][nx]=='#') ok=true;
        }
        if(!ok){
          cout<<"No"<<endl;
          return 0;
        }
      }
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int n, m;
	int A[100][100];
	int B[100];
	int h, w, C[100] = { 0 };
	scanf("%d %d", &n, &m);
	for (h = 0; h<n; h++)
	{
		for (w = 0; w<m; w++)
		{
			scanf("%d", &A[h][w]);
		}
	}
	for (w = 0; w<m; w++)
	{
		scanf("%d", &B[w]);
	}
	for (h = 0; h < n; h++)
	{
		for (w = 0; w < m; w++)
		{
			C[h] += A[h][w] * B[w];
		}
	}
	for (h = 0; h<n; h++)
	{
		printf("%d\n", C[h]);
	}

	return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 1000005
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define P pair<int,int> 
#define INF 1000000000
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> p(n+1);
    int ansac=0,answa=0;
    REP(i,m){
        int a;
        string s;
        cin>>a>>s;
        if(s=="AC"){
            if(p[a]!=-1){
                ansac++;
                answa+=p[a];
                p[a]=-1;
            }
        }else{
            if(p[a]!=-1){
                p[a]++;
            }
        }
    }
    cout<<ansac<<" "<<answa<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<stdio.h>
#include<algorithm>
using namespace std;

class Dice{
public:
  int face[6];
  int label(int n);
  void setFace(int i, int num);
  void rot(char dir);
};

int Dice::label(int n){
  for(int i=0; i<6; i++){
    if(face[i] == n) return i;
  }
}

void Dice::setFace(int i, int num){
  face[i] = num;
  return;
}

void Dice::rot(char dir){
  if(dir == 'A'){
    int temp = face[1];
    face[1]=face[3]; face[3]=face[4];
    face[4]=face[2]; face[2]=temp;
  }else if(dir == 'B'){
    int temp = face[0];
    face[0]=face[2]; face[2]=face[5];
    face[5]=face[3]; face[3]=temp;
  }else if(dir == 'C'){
    int temp = face[0];
    face[0]=face[1]; face[1]=face[5];
    face[5]=face[4]; face[4]=temp;
  } 
}

int isEqual(Dice d1, Dice d2){
  int eq = 1;
  for(int i=0; i<6; i++){
    if(d1.face[i]-d2.face[i] != 0) eq = 0;
  }
  if(eq == 1) return 1;
  return 0;
}

int diceEqual(Dice d1, Dice d2){
  int flag=0;
  for(int i=0; i<4; i++){
    for(int j=0; j<4; j++){
      for(int k=0; k<4; k++){
        d1.rot('A');
        flag += isEqual(d1, d2);
      }
      d1.rot('B');
    }
    d1.rot('C');
  }
  return flag;
}

int main(){
  int num, n;
  Dice d[100];

  cin >> n;
  for(int j=0; j<n; j++){
    for(int i=0; i<6; i++){
      cin >> num;
      d[j].setFace(i, num);
    }
  }

  int flag = 0;
  for(int i=0; i<n-1; i++){
    for(int j=i+1; j<n; j++){
      flag += diceEqual(d[i], d[j]);
    }
  }

  if(flag!=0) cout << "No" << endl;
  else cout << "Yes" << endl;

  return 0;
}



Measured memory_bytes: 3132
import java.util.Scanner;

public class Main {
	private static String text;

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

		String line = scanner.nextLine();
		String[] lines = line.split(" ");

		int K = Integer.parseInt(lines[0]);
		int X = Integer.parseInt(lines[1]);

		for (int i = 0; i < (2 * K) - 1; i++) {
			System.out.print((X - K + 1) + i + " ");
		}

	}
}

Measured memory_bytes: 22612
st = input().split()

ab = list(map(int, input().split()))

u=input()

if st[0]==u:
    print(ab[0]-1,end="")
    print(" ",end="")
    print(ab[1])
elif st[1]==u:
    print(ab[0],end="")
    print(" ",end="")
    print(ab[1]-1)


Measured memory_bytes: 2940