akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
using namespace std;

int main()
{
    int n; cin>>n;
    string str1,str2,str3="";cin>>str1>>str2;
    
//    char ch1[n],ch2[n];
//    scanf("%s", ch,n);
    
    for(int i=0;i<n;++i){
        str3+=str1[i];
        str3+=str2[i];
    }

	cout<<str3<<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <unordered_map>
#include <set>
#include <string>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <queue>

#define N 17

using namespace std;

long long int dp[N][42768],val[42768];
int a[509],b[509],c[509];
vector< pair<int,int> > l[N];

int main(){
    int i,j,t1,t2,t3,t4,n,m,allmask,compmask,mask;
    long long int buf1,ans=1e18;
    scanf("%d %d",&n,&m);
    allmask=(1<<n)-1;
    for(i=0;i<m;i++){
        scanf("%d %d %d",&a[i],&b[i],&c[i]);
        a[i]--;
        b[i]--;
        l[a[i]].push_back(make_pair(b[i],c[i]));
        l[b[i]].push_back(make_pair(a[i],c[i]));
    }
    for(i=0;i<=allmask;i++){
        buf1=0;
        for(j=0;j<m;j++){
            if((i&(1<<a[j])) && (i&(1<<b[j]))){
                buf1+=c[j];
            }
        }
        val[i]=buf1;
    }
    for(i=0;i<=allmask;i++){
        for(j=0;j<n;j++){
            dp[j][i]=1e18;
        }
    }
    dp[0][1]=0;
    for(i=1;i<=allmask;i++){
        // extending the path to a new vertex
        for(j=0;j<n;j++){
            if(i&(1<<j)){
                for(auto it : l[j]){
                    if(i&(1<<it.first)){
                        continue ;
                    }
                    t1=i^(1<<j);
                    t2=(1<<it.first);
                    dp[it.first][i|t2]=min(dp[it.first][i|t2],dp[j][i]+val[t1|t2]-val[t1]-val[t2]);
                }
            }
        }
        
        // adding some branches without harm
        compmask=allmask-i;
        for(mask=compmask;mask;mask=(mask-1)&compmask){
            for(j=0;j<n;j++){
                if(i&(1<<j)){
                    t1=i^(1<<j);
                    t2=mask;
                    dp[j][i|t2]=min(dp[j][i|t2],dp[j][i]+val[t1|t2]-val[t1]-val[t2]);
                }
            }
        }
        
    }
    ans=dp[n-1][allmask];
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 4864
require 'matrix'
while gets
	a = $_.split.map{|s|s.to_i}
	v = Matrix[[a[0], a[1]], [a[3], a[4]]].inv * Vector[a[2], a[5]]
	puts v.to_a.map{|r|sprintf("%.3f", r.to_f.round(3))}.join(" ")
end

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

#include <iostream>
using namespace std;
int main() {
  int64_t n;
  cin >> n;
  vector<int64_t> t(n + 1), x(n + 1), y(n + 1);
  t[0] = x[0] = y[0] = 0;
  for (int64_t i = 0; i < n; ++i) {
    cin >> t[i + 1] >> x[i + 1] >> y[i + 1];
  }

  bool can = true;
  for (size_t i = 0; i < n; i++) {
    int dt = t[i + 1] - t[i];
    int dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
    if (dt < dist) {
      can = false;
      break;
    }
    if (dist % 2 != dt % 2) {
      can = false;
      break;
    }
  }

  if (can) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 2560
sx,sy,tx,ty = map(int,input().split())
root = ''
dx = tx-sx
dy = ty-sy

for i in range(dy):
    root += 'U'
for j in range(dx):
    root += 'R'
for k in range(dy):
    root += 'D'
for j in range(dx):
    root += 'L'
    
root += 'L'

for i in range(dy+1):
    root += 'U'
for j in range(dx+1):
    root += 'R'
    
root += 'D'
root += 'R'

for k in range(dy+1):
    root += 'D'
for j in range(dx+1):
    root += 'L'
    
    
root += 'U'    
    
print(root)

Measured memory_bytes: 3064
n = int(input())
S = list()
S.append(int(input()))
flag = 0
for i in range(n):
    a, b = map(int, input().split())
    daisu = S[i] +a -b
    if daisu < 0:
        print(0)
        flag = 1
        break
    S.append(daisu)
if flag == 0:
    print(max(S))


Measured memory_bytes: 5908
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	vector<ll> dp(n + 1);

	dp[1] = 1;
	dp[2] = 2;

	ll old = -1;
	for (int i = 0; i < m; i++)
	{
		int x;
		cin >> x;
		
		dp[x] = -1;

		if (x == 1)
		{
			dp[2] = 1;
		}
	}

	for (int i = 3; i <= n; i++)
	{
		if (dp[i] >= 0)
		{
			if (dp[i - 1] >= 0)
			{
				dp[i] = (dp[i] + dp[i - 1]) % mod;
			}

			if (i - 2 >= 0 && dp[i - 2] >= 0)
			{
				dp[i] = (dp[i] + dp[i - 2]) % mod;
			}
		}
	}

	println(dp[n] % mod);
}


Measured memory_bytes: 1024
N=int(input())
A = [int(i) for i in input().split( )]
B = [int(i) for i in input().split( )]
C = [int(i) for i in input().split( )]
mansoku=0
A.append(-1)
for i in range(N):
    mansoku += B[A[i]-1]
    if A[i]+1 == A[i+1]:
        mansoku += C[A[i]-1]
print(mansoku)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111

	int mo = 1e9+7;

	int dp[310000];
	int last[310000];
	void solve(){

		ini(n);
		FOR(i,0,310000)last[i] = -1;
		int tmp = 0;
		dp[0]  = 1;
		FOR(i,1,n+1){
			ini(x);
			dp[i] = dp[i-1];
			if(last[x] != -1 and x!=tmp ){
				dp[i]+=dp[last[x]]%mo;
				dp[i]%=mo;
			}
			last[x] = i;
			tmp = x;
		}
		out(dp[n]);

		





















	}























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define vd vector<double>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

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

int eve(int x)
{
    if (x % 400 == 0)
        return 1;
    if (x % 100 == 0)
        return 0;
    if (x % 4 == 0)
        return 1;
    return 0;
}

int main(void)
{
    ll n;
    cin >> n;
    vll x(n), y(n);
    rep(i, 0, n) cin >> x[i] >> y[i];

    map<pair<ll, ll>, ll> mp;
    rep(i, 0, n)
    {
        rep(j, 0, n)
        {
            if (i != j)
                mp[make_pair(x[i] - x[j], y[i] - y[j])]++;
        }
    }
    ll ans = 0;
    for (auto itr = mp.begin(); itr != mp.end(); itr++)
    {
        ans = max(ans, itr->second);
    }
    cout << n - ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int nmax=40,abmax=10,inf = 1000000;
 
int a[nmax],b[nmax],c[nmax];
int dp[nmax+1][nmax*abmax+1][nmax*abmax+1];
 
int main(void){
	int n,ma,mb;
	cin >> n >> ma >> mb;
 
	for(int i=0;i<n;++i){
		cin >> a[i] >> b[i] >> c[i];
	}
 
	for(int i = 0; i <= n; ++i){
		for(int ca = 0; ca <= nmax*abmax; ++ca){
			for(int cb = 0; cb <= nmax*abmax; ++cb){
				dp[i][ca][cb]=inf;
			}
		}
	}
 
	dp[0][0][0]=0;
 
	for(int i = 0; i < n; ++i){
		for(int ca = 0; ca <= nmax*abmax; ++ca){
			for(int cb = 0; cb <= nmax*abmax; ++cb){
				if(dp[i][ca][cb]==inf) continue;
				dp[i+1][ca][cb]=min(dp[i+1][ca][cb],dp[i][ca][cb]);
				dp[i+1][ca+a[i]][cb+b[i]]=min(dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]);
			}
		}
	}
 
	int ans=inf;
	for(int ca = 1; ca <= nmax*abmax; ++ca){
		for(int cb = 1; cb <= nmax*abmax; ++cb){
			if(ca*mb==cb*ma) ans=min(ans,dp[n][ca][cb]);
		}
	} 
	
	if(ans==inf) ans=-1;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 25984
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    int a[n];
    int c,c2,c4;  c = c2 = c4 = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i]%4 == 0) c4++;
        else if(a[i]%2 == 0) c2++;
        else if(a[i]%2 != 0) c++;
    }
    if(c2 >= 1) c++;
    if(c4+1 >= c) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 640
use std::collections::HashSet;
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let s = read::<String>()
        .chars()
        .map(|c| (c as u8 - b'a') as i64)
        .collect::<Vec<i64>>();
    let mut ans = 0;
    'outer_loop: for l in 1..n {
        let bases = vec![221, 23030, 4257, 221809];
        let mods = vec![
            // 1e+9 as i64 + 7,
            847602874987i64,
            // (1 << 39) + 83874329,
            // (1 << 40) - 7,
        ];
        'inner_loop: for iter in 0..mods.len() {
            let base = bases[iter];
            let m = mods[iter];
            let mut values = vec![0; n];
            let mut sum = 0;
            let mut diff = 1;
            let mut opens = HashSet::<i64>::new();
            for i in 0..l {
                sum = (sum * base + s[i]) % m;
                diff = (diff * base) % m;
            }
            values[0] = sum;
            for i in 0..n - l {
                sum = (sum * base + s[l + i]) % m;
                sum = (sum - diff * s[i] % m + m) % m;
                values[i + 1] = sum;
                if i + 1 >= l {
                    opens.insert(values[i + 1 - l]);
                }
                if opens.contains(&values[i + 1]) {
                    continue 'inner_loop;
                }
            }
            continue 'outer_loop;
        }
        ans = l;
    }
    println!("{}", ans);
}


Measured memory_bytes: 2404
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set;

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define     int                 ll
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
    int k,ans = 1, r = 7;
    cin >> k;
    map<int, int> hmap;
    while(r%k && hmap[r%k]!=1){
    	hmap[r%k] = 1;
    	r = (10*r + 7)%k;
    	ans++;
    }
    if(r%k){
    	cout << "-1\n";
    }
    else{
    	cout << ans  << '\n';
    }
}

signed main() { 
    IO();
    
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}


Measured memory_bytes: 66140
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
using ll = long long;

int N,A,B,C;
vector<int> l;

int dfs(int cur,int a,int b,int c){
    if(cur == N){
        if(min({a,b,c}) > 0){
            return abs(a-A)+abs(b-B)+abs(c-C)-30;
        }
        else{
            return INF;
        }
    }
    int ret0,ret1,ret2,ret3;
    ret0 = dfs(cur+1,a,b,c);
    ret1 = dfs(cur+1,a+l[cur],b,c)+10;
    ret2 = dfs(cur+1,a,b+l[cur],c)+10;
    ret3 = dfs(cur+1,a,b,c+l[cur])+10;
    return min({ret0,ret1,ret2,ret3});
    
}

int main(){
    cin >> N >> A >> B >> C;
    l = vector<int>(N);
    for(int i=0;i<N;i++){
        cin >> l[i];
    }
    cout << dfs(0,0,0,0) << endl;
}


Measured memory_bytes: 256
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y:
      return

    if self.parents[x] > self.parents[y]:
      x, y = y, x

    self.parents[x] += self.parents[y]
    self.parents[y] = x

  def size(self, x):
    return -self.parents[self.find(x)]

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def group_count(self):
    return len(self.roots())

  def all_group_members(self):
    return {r: self.members(r) for r in self.roots()}

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = map(int, input().split())
Ps = [0] + list(map(int, input().split()))

uf = UnionFind(N+1)

for _ in range(M):
  x, y = map(int, input().split())
  uf.union(x, y)

rlt = 0
for i in range(1,N+1):
  if uf.find(i) == uf.find(Ps[i]):
    rlt += 1
  
print(rlt)

Measured memory_bytes: 85500
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    ll n, x;
    cin >> n >> x;
    VL b(n), l(n), u(n);
    vector<PL> p(n);
    REP(i,n){
        b[i] = in(), l[i] = in(), u[i] = in();
        p[i].first = -(u[i] * (x - b[i]) + l[i] * b[i]);
        p[i].second = i;
    }
    sort(ALL(p));

    VL bb(b), lll(l), uu(u);
    REP(i,n){
        int j = p[i].second;
        b[i] = bb[j];
        l[i] = lll[j];
        u[i] = uu[j];
    }

    VL su(n + 1), sl(n + 1);
    REP(i,n){
        su[i + 1] = su[i] + u[i] * (x - b[i]);
        sl[i + 1] = sl[i] + l[i] * b[i];
    }

    ll ok = n * x, ng = -1;
    while (ok - ng > 1){
        ll c = (ok + ng) / 2;
        ll p = c / x;
        ll q = c % x;
        bool found = false;
        REP(i,n){
            ll tmp = 0;
            if (i < p){
                tmp = su[p + 1] - (sl[n] - sl[p + 1]) - u[i] * (x - b[i]);
            }else{
                tmp = su[p] - (sl[n] - sl[p]) + l[i] * b[i];
            }
            if (q >= b[i]) tmp += u[i] * (q - b[i]);
            else tmp -= l[i] * (b[i] - q);
            if (tmp >= 0) found = true;
        }
        if (found) ok = c;
        else ng = c;
    }
    cout << ok << endl;

    return 0;
}


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


int main(void)
{
    int n;
    scanf("%d", &n);
    double v[n];
    for (int i=0; i < n; i++) scanf("%lf", &v[i]);

    for (int i=0; i < n-1; i++){
        for (int j=i+1; j < n; j++){
            if (v[i] > v[j]){
                double tmp = v[i];
                v[i] = v[j];
                v[j] = tmp;
            }
        }
    }

    double res = v[0];
    for (int i=1; i < n; i++){
        res += v[i];
        res /= 2;
    }

    printf("%f\n", res);

    return 0;
} 



Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;
using boost::algorithm::split;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using boost::multiprecision::cpp_dec_float_50;
#define rep(i, n) for(int i = 0; i < n; ++i)

int main() {
  int n;
  cin >> n;
  cpp_dec_float_50 x = 0.0;
  rep(i, n) {
    int a;
    cin >> a;
    x += 1.0 / a;
  }
  cout << 1.0 / x << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
using namespace std;
typedef pair<int, int>P;
typedef pair<int, pair < int, int > > PP;
typedef long long ll;
ll inf = -1;
ll mod = pow(10, 9) + 7;
	pair<int,int>ba[200020];
int main() {
	int n;cin>>n;
	for(int i=0;i<n;i++){
		cin>>ba[i].second>>ba[i].first;
	}
	sort(ba,ba+n);
	int r[200010];
	for(int i=0;i<n;i++){
		r[i]=ba[i].second;
	}
	for(int i=1;i<n;i++){
		r[i]+=r[i-1];
	}
	for(int i=0;i<n;i++){
		if(r[i]>ba[i].first){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

int main() {
    char a;
    cin >> a;
    if('A' <= a && a <= 'Z'){
        cout << "A" << endl;
    }else{
        cout << "a" << endl;
    }

    return 0;
}

Measured memory_bytes: 3616
use self::union_find::UnionFind;
use proconio::input;
use proconio::marker::Usize1;

fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(Usize1, Usize1); m],
    };
    let mut uf = UnionFind::new(n);
    for &(a_i, b_i) in ab.iter() {
        uf.unite(a_i, b_i);
    }
    let mut q = std::collections::BTreeSet::new();
    for i in 0..n {
        q.insert(uf.root(i));
    }
    let ans = q.len() - 1;
    println!("{}", ans);
}

mod union_find {
    pub struct UnionFind {
        p: Vec<usize>,
        s: Vec<usize>,
    }

    impl UnionFind {
        pub fn new(n: usize) -> Self {
            let mut p = vec![0; n];
            for i in 0..n {
                p[i] = i;
            }
            let s = vec![1; n];
            Self { p, s }
        }

        pub fn root(&mut self, x: usize) -> usize {
            if self.p[x] == x {
                return x;
            } else {
                self.p[x] = self.root(self.p[x]);
                self.p[x]
            }
        }

        pub fn size(&mut self, x: usize) -> usize {
            let rx = self.root(x);
            self.s[rx]
        }

        pub fn unite(&mut self, x: usize, y: usize) {
            let rx = self.root(x);
            let ry = self.root(y);
            if rx == ry {
                return;
            };
            if self.s[rx] >= self.s[ry] {
                self.s[rx] += self.s[ry];
                self.p[ry] = rx;
            } else {
                self.s[ry] += self.s[rx];
                self.p[rx] = ry;
            }
        }
    }
}


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

using namespace std;

int main() {
   ios_base::sync_with_stdio(false);
   int n;
   cin >> n;
   vector<int> a(n);
   int evenSum = 0;
   int oddSum = 0;
   for (int i = 0; i < n; ++i) {
      cin >> a[i];
      if (i % 2) {
         oddSum += a[i];
      } else {
         evenSum += a[i];
      }
   }
   if (n % 2 == 0) {
      cout << max(evenSum, oddSum) << " " << min(evenSum, oddSum) << "\n";
      return 0;
   }
   int l = 0, r = 1e9;
   while (l < r) {
      int md = (l + r + 1) >> 1;
      vector<int> f(n);
      for (int i = 0; i < n; i += 2) {
         if (i == 0) {
            f[i] = a[i];
         } else if (f[i - 2] < md) {
            f[i] = f[i - 2] - a[i - 1] + a[i];
         } else {
            f[i] = max(f[i - 2] - a[i - 1] + a[i], a[i]);
         }
      }
      if (f[n - 1] >= md) {
         l = md;
      } else {
         r = md - 1;
      }
   }
   cout << oddSum + l << " " << evenSum - l << "\n";
   return 0;
}


Measured memory_bytes: 2668
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
#include <cassert>
#include <unordered_map>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k, c;
	cin >> n >> k >> c;
	string s;
	cin >> s;
	vector<int> l(k), r(k);
	int d = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'o') {
			if (d == 0 || l[d - 1] + c < i) {
				l[d] = i;
				d++;
			}
		}
		if (d == k)break;
	}
	d = k - 1;
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == 'o') {
			if (d == k - 1 || r[d + 1] - c > i) {
				r[d] = i;
				d--;
			}
		}
		if (d == -1)break;
	}
	int ans = 0;
	for (int i = 0; i < k; i++) {
		if (l[i] == r[i]) {
			cout << l[i] + 1 << "\n";
		}
	}
}

Measured memory_bytes: 3348
#include <iostream>
using namespace std;
int main(void){
    
    int N, A;
    cin >> N;
    
    
    for(int i = 0; i < N; i++){
        cin >> A;
        if(A % 2 == 0){
            if(A % 3 != 0 && A % 5 != 0){
            cout << "DENIED" << endl;
            return 0;
            }
        }
    }
    
    cout << "APPROVED" << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <math.h>
#include <stdlib.h>
#include <numeric>


int main(){
	int n, k;
	char s;
	std::cin >> n >> k;
	for(int i = 0; i < n; i++){
		std::cin >> s;
		if(i == k - 1){
			s += 'a' - 'A';
		}
		std::cout << s;
	}
	std::cout << std::endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
        
	ll n,m,x;cin>>n>>m>>x;
	ll a[n+2][m+2];
	ll cost[n+2];
	rep(i,0,n)
	{
		cin>>cost[i];
		rep(j,1,m+1)
		cin>>a[i][j];
	}

	ll ans=hell;
	rep(i,1,(1LL<<n))
	{
		//test1(i);
		ll skill[m+2]={0};
		ll money=0;
		rep(j,0,n)
		{
			if((1LL<<j)& i)
			{
				money+=cost[j];
				rep(k,1,m+1)
				skill[k]+=a[j][k];
			}
		}
		bool flag=0;
		//test3("yaya",i,money);
		rep(k,1,m+1)
		{
			//test2(k,skill[k]);
			if(skill[k]>=x)
				continue;
			flag=1;
		}
		if(!flag)
		ans=min(ans,money);
	}
	if(ans==hell)
		ans=-1;
	cout<<ans<<endl;
}

Measured memory_bytes: 3652
def getroot():
    return [key for key,node in nodes.items() if node[0] == -1][0]

def Preorder(id):
    yield id
    for child_id in (child_id for child_id in nodes[id][1:] if child_id != -1):
        yield from Preorder(child_id)

def Inorder(id):
    if nodes[id][1] != -1:
        yield from Inorder(nodes[id][1])
    yield id
    if nodes[id][2] != -1:
        yield from Inorder(nodes[id][2])

def Postorder(id):
    for child_id in (child_id for child_id in nodes[id][1:] if child_id != -1):
        yield from Postorder(child_id)
    yield id

nodes = dict()
n = int(input())
for _ in range(n):
    id,l,r = list(map(int, input().split()))
    if id not in nodes:
        nodes[id] = (-1, -1, -1)
    node = nodes[id]
    node = (node[0], l, r)
    nodes[id] = node
    for child_id in [child_id for child_id in node[1:] if child_id != -1]:
        if child_id not in nodes:
            nodes[child_id] = (-1, -1, -1)
        child_node = nodes[child_id]
        child_node = (id, child_node[1], child_node[2])
        nodes[child_id] = child_node

rootid = getroot()
print("Preorder")
print(" ", end="")
print(*Preorder(rootid))
print("Inorder")
print(" ", end="")
print(*Inorder(rootid))
print("Postorder")
print(" ", end="")
print(*Postorder(rootid))


Measured memory_bytes: 5616
n,x = map(int, input().split())
if 1 < x < (2*n - 1):
    print("Yes")
    if n == 2:
        for i in range(3):
            print(i+1)
        exit()
    if x != 2:
        ans = [-1 for i in range(2*n-1)]
        k = (n*2-1) //2
        ans[k-1] = x-1
        ans[k] = x
        ans[k+1] = x+1
        ans[k+2] = x-2
        used = set([x-1,x,x+1,x-2])
        insert = iter([i+1 for i in range(n*2-1) if (i+1) not in used])
        for i in range(2*n-1):
            if ans[i] == -1:
                ans[i] = insert.__next__()
        for i in range(n*2-1):
            print(ans[i])
    else:
        ans = [-1 for i in range(2*n-1)]
        k = (n*2-1) // 2
        ans[k-1] = x+2
        ans[k] = x
        ans[k+1] = x-1
        ans[k+2] = x+1
        used = set([x+1,x,x+2,x-1])
        insert = iter([i+1 for i in range(n*2-1) if (i+1) not in used])
        for i in range(2*n-1):
            if ans[i] == -1:
                ans[i] = insert.__next__()
        for i in range(n*2-1):
            print(ans[i])
else:
    print("No")

Measured memory_bytes: 14096
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;



signed main(){
  string s;cin>>s;
  bool k=false;
  rep(i,s.size()-1){
    if(s[i]=='A'&&s[i+1]=='C')k=true;
  }
  cout<<(k?"Yes":"No")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1100000000

void ruiseki(vector<vector<int>> &X){
	for(int i=0;i<X.size();i++){
		for(int j=0;j<X[i].size()-1;j++){
			X[i][j+1] += X[i][j];
		}
	}
	
	for(int i=0;i<X.size()-1;i++){
		for(int j=0;j<X[i].size();j++){
			X[i+1][j] += X[i][j];
		}
	}
}

int get(vector<vector<int>> &X,int x0,int y0,int x1,int y1){
	return X[x1][y1]-X[x1][y0-1]-X[x0-1][y1]+X[x0-1][y0-1];
}

int main(){
	
	int N,M,Q;
	cin>>N>>M>>Q;
	
	vector<string> S(N);
	for(int i=0;i<N;i++)cin>>S[i];
	
	vector<vector<int>> blue(N+1,vector<int>(M+1,0));
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			if(S[i][j]=='1'){
				blue[i+1][j+1] = 1;
			}
		}
	}
	
	vector<vector<int>> right(N+1,vector<int>(M+1,0));
	auto down = right;
	
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			if(j!=M-1){
				if(S[i][j]=='1'&&S[i][j+1]=='1'){
					right[i+1][j+1] = 1;
				}
			}
			if(i!=N-1){
				if(S[i][j]=='1'&&S[i+1][j]=='1'){
					down[i+1][j+1] = 1;
				}
			}
		}
	}
	
	ruiseki(blue);
	ruiseki(right);
	ruiseki(down);
	
	for(int i=0;i<Q;i++){
		int x0,y0,x1,y1;
		cin>>x0>>y0>>x1>>y1;
		int ans = get(blue,x0,y0,x1,y1);
		ans -= get(right,x0,y0,x1,y1-1);
		ans -= get(down,x0,y0,x1-1,y1);
		
		cout<<ans<<endl;
	}
	
	return 0;
}

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

int main() {

    int N;
    string S;
    cin >> N >> S;

    rep(i, S.length()) S[i] = char((int(S[i]) - int('A') + N) % 26 + int('A'));

    cout << S << endl;

    return 0;
}

Measured memory_bytes: 3564
<?php
fscanf(STDIN, "%s", $s);
$cnt = 0;
$s = str_split($s);
$len = count($s);
$max = floor(count($s) / 2);
for ($i=0;$i<$max;$i++) {
  if ($s[$i] != $s[$len-$i-1]) $cnt++;
}
echo $cnt;

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

void addstr( char *str1, char *str2 ) {

    char temp[1000];
    int max, i;
    
    if ( strlen( str1 ) > strlen( str2 ) ) { max = strlen( str1 ); } else { max = strlen( str2 ); }
    
    memset( temp, '\0', 1000 );
    strcpy( &temp[max-strlen(str1)+1], str1 );
	for ( i = 0; temp[i] == '\0'; i++ ) { temp[i] = '0'; }
    strcpy( str1, temp );
    
    memset( temp, '\0', 1000 );
    strcpy( &temp[max-strlen(str2)+1], str2 );
    i = 0;
    while ( temp[i] == '\0' ) {
         temp[i] = '0';
         i++;
    }
    strcpy( str2, temp );
    
    for ( i = max; i >= 0; i-- ) {

        str1[i] += str2[i] - '0';

        if ( str1[i] > '9' ) {

            str1[i] -= 10;
            str1[i-1] += 1;

        }

    }

    if ( str1[0] == '0' ) {

        memset( temp, '\0', 1000 );
        strcpy( temp, &str1[1] );
        memset( str1, '\0', 1000 );
        strcpy( str1, temp );

    }

}

int main( void ) {

    char a[1000], b[1000];
    int n;
    
    scanf( "%d", &n );
    
    while ( n-- != 0 ){
        
        scanf( "%s", a );
        scanf( "%s", b );
        
        addstr( a, b );
        
        if ( strlen( a ) <= 80 ) {

            printf( "%s\n", a );

        } else {

            printf( "overflow\n" );

        }

    }
    
    return 0;

}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> PA;
typedef priority_queue<int> PQ;
typedef vector<int> VE;
#define int long long
#define INF 1000000009
#define INFL 1000000000000000018
#define mod 1000000007
#define pb push_back
#define MAXN 400

int n, a[MAXN][MAXN], b[MAXN][MAXN], res, ans;

signed main()
{
    cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cin >> a[i][j];
            b[i][j] = a[i][j];
            if(i < j)ans += a[i][j];
        }
    }
    //printf("ans %lld\n", ans);
    for(int k = 0; k < n; k++){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                b[i][j] = min(b[i][j], b[i][k] + b[k][j]);
                //printf("%lld %lld %lld\n", i, j, b[i][j]);
            }
        }
    }
    //printf("\n\n");
    for(int i = 0; i < n - 1; i++){
        for(int j = i + 1; j < n; j++){
            for(int k = 0; k < n; k++){
                if(i == k || j == k) continue;
                if(a[i][j] > b[i][k] + b[k][j]){
                    printf("-1\n");
                    return 0;
                }
                if(a[i][j] == b[i][k] + b[k][j]){
                    ans -= a[i][j];
                    break;
                    //printf("%lld %lld %lld\n", i, j, a[i][j]);
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	char x;
	int sum = 0;
	bool flag = false;

	while(1) {
		scanf("%c", &x);
		if (flag)
			if(x == '0')
				break;
			else
				flag = false;

		if (x == '\n') {
			printf("%d\n", sum);
			sum = 0;
			flag = true;
			continue;
		}
		
		sum += x - '0';
	}

	return (0);
}

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


int main()
{
  ll a, b, k;
  cin >> a >> b >> k;
  cout << max(0ll, a - k) << ' ' << max(0ll, min(b, a + b - k)) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n;
  int L[101];
  scanf("%d",&n);
  int max =0,sum=0;
  for(int i=0;i<n;i++){
    scanf("%d",&L[i]);
    sum+=L[i];
    if(max < L[i]){
      max = L[i];
    }
  }
  if(max < (sum-max)){
    printf("Yes");
  }else{
    printf("No");
  }
}

Measured memory_bytes: 128
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	REP(i,N){
		string S=in<string>();
		vector<char> T(60,'\0');
		int pos=30;
		int M=S.size();
		for(int j=0;j<M;){
			if(S[j]=='-'){
				pos++;
				j+=2;
			}
			else if(S[j]=='<'){
				pos--;
				j+=2;
			}
			else{
				T[pos]=S[j];
				j++;
			}
		}
		for(auto& x:T){
			if(x!='\0') cout<<x;
		}
		out();
	}
	return 0;
}



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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

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

int main() {
	int point[10];
	rep(i, 10) scanf("%d", &point[i]);
	sort(point, point + 10);
	reverse(point, point + 10);
	int W = point[0] + point[1] + point[2];
	rep(i, 10) scanf("%d", &point[i]);
	sort(point, point + 10);
	reverse(point, point + 10);
	int K = point[0] + point[1] + point[2];
	printf("%d %d\n", W, K);
	return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;


int main(){
	int a,b,h;cin >> a >> b >> h;
	cout << ((a+b)*h)/2 << endl;
	
} 


Measured memory_bytes: 3636
// https://atcoder.jp/contests/dp/tasks/dp_d
#include <bits/stdc++.h>

using namespace std;
#define ll long long
int main() {

  ll N, W;
  cin >> N >> W;
  ll items[N][2], sack[N][W + 1]{};

  for (ll i = 0; i < N; ++i)
    cin >> items[i][0] >> items[i][1];

  for (ll i = 0; i <= W; ++i)
    if (items[0][0] <= i)
      sack[0][i] = items[0][1];

  for (ll i = 1; i < N; ++i)
    for (ll j = 1; j <= W; ++j)
      sack[i][j] =
          (items[i][0] <= j
               ? max(items[i][1] + sack[i - 1][j - items[i][0]], sack[i - 1][j])
               : sack[i - 1][j]);

  cout << sack[N - 1][W] << endl;
}


Measured memory_bytes: 78336
from collections import deque
n=int(input())
A=[[[] for j in range(2)] for i in range(n)]
for i in range(n-1):
  u,v,w=map(int,input().split())
  w=w%2
  A[u-1][0].append(v-1)
  A[u-1][1].append(w)
  A[v-1][0].append(u-1)
  A[v-1][1].append(w)
B=deque([0])
C=[0]*n
C[0]=1
ans=[0]*n
while len(B)>0:
  s=B[0]
  B.popleft()
  for i in range(len(A[s][0])):
    if C[A[s][0][i]]==0:
      B.append(A[s][0][i])
      C[A[s][0][i]]=1
      ans[A[s][0][i]]=(ans[s]+A[s][1][i])%2
for i in range(n):
  print(ans[i])

Measured memory_bytes: 46200
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef long long ll;

int main() {
    string s, t; cin >> s >> t;
    vector<int> a(26, -1), d(26, -1);

    for (int i = 0; i < s.size(); i++)
    {
        int b = s[i]-'a', c = t[i]-'a';
        if (a[b] == -1) {
            a[b] = c;
        } else {
            if (a[b] != c) {
                cout << "No" << endl;
                return 0;
            }
        }
        if (d[c] == -1) {
            d[c] = b;
        } else {
            if (d[c] != b) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    

    return 0;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vll;

int main()
{

   string s;
   cin>>s;
   if(s[0]=='7' ||s[1]=='7'||s[2]=='7')
        cout<<"Yes"<<endl;
   else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <tuple>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

typedef std::tuple<string, int, int> mytuple;

// タプルの最初の要素から順番に比較　もしその要素が同じなら次の要素で比較
bool mycompare( const mytuple &lhs, const mytuple &rhs )
{
  if (std::get<0>(lhs) != std::get<0>(rhs)) return std::get<0>(lhs) < std::get<0>(rhs);
  if (std::get<1>(lhs) != std::get<1>(rhs)) return std::get<1>(lhs) > std::get<1>(rhs);
  return std::get<2>(lhs) < std::get<2>(rhs);
}

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

  vector<tuple<string, int, int>> t;
  for(int i = 0; i < n; i++) {
    string s;
    int p;
    cin >> s >> p;
    t.emplace_back(s, p, i+1);
  }

  sort(t.begin(), t.end(), mycompare);

  for(int i = 0; i < n; i++) cout << get<2>(t[i]) << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e9+7)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
int gcd(int A,int B) {if(!B)return A;return gcd(B,A%B);}
vector<ll> fact;
vector<ll> ifact;
ll add(ll a,ll b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}
ll mult(ll a,ll b)
{
	return (a*1LL*b)%MOD;
}
ll binpow(ll a, ll b)
{
	ll r=1;
	while(b)
	{
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}
ll choose(ll a, ll b)
{
	if(a<b) return 0;
	if(b==0) return 1;
	if(a==b) return 1;
	ll r = mult(ifact[b],ifact[a-b]);
	r = mult(r,fact[a]);
	return r;
}
ll inv(int a){return binpow(a,MOD-2);}
void init(ll n)
{
	fact.clear(); ifact.clear();
	fact.resize(n+1);
	ifact.resize(n+1);
	ifact[0]=1;
	fact[0]=1;
	for(int i=1;i<=n;i++){fact[i]=mult(fact[i-1],i);}
	ifact[n] = inv(fact[n]);
	for(int i=n-1;i>=1;i--)
	{
		ifact[i] = mult(ifact[i + 1], i + 1);
	}
}
ll rchoose(ll n,ll r){
	ll res = 1;
	for(int i=0;i<r;i++)res = mult(res,n-i);
	return res;
}
int main()
{
  ll x,y;
  cin>>x>>y;
  init(1e6);
  if((x+y)%3){cout<<0;return 0;}
  if(x > y)swap(x,y);
  ll a = (2*y-x)/3;
  ll b = y - 2*a;
  //cout<<a<<" "<<b<<endl;
  ll ans = choose(a+b,a);
  cout<<ans;
}


Measured memory_bytes: 18784
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			double a=sc.nextDouble();
			double answer=a;
			for(int i=0;i<9;i++){
				if(i%2==0){
					a*=2;
				}else{
					a/=3;
				}
				answer+=a;
			}
			System.out.println(answer);
		}
	}
}

Measured memory_bytes: 19276
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59

int main(){
  ll i,j;
  vector<pair<string,P> > v;
  ll n;
  cin>>n;
  for(i=0;i<n;i++){
    string s;
    ll x;
    cin>>s>>x;
    x=100-x;
    v.pb(make_pair(s,P(x,i)));

  }
  sort(v.begin(),v.end());
  for(i=0;i<n;i++){
    cout<<1+v[i].se.se<<endl;
  }
  
}

Measured memory_bytes: 256
import sys
# from collections import defaultdict, deque
# import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 1000000007

def solve():
    n = getN()
    anums = getList()
    bnums = getList()
    # if sum(anums) > sum(bnums):
    #     print("No")
    #     return

    pair = []
    for i, j in zip(anums, bnums):
        pair.append((i, j))

    pair.sort(key=lambda x:- x[0] + x[1])
    # print(pair)
    kosi = 0
    for a,b in pair:
        # a += kosi
        if b >= a:
            kosi -= (b-a) // 2 * 2
        else:
            kosi += (a - b) * 2
        # print(a, b, kosi)

    if kosi > 0:
        print("No")
        return
    else:
        print("Yes")
        return


def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    # main()
    solve()


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

int main() {
	long long n;
	int dig, sum=0;
	cin >> n;
	long long num = n;
	while(num!=0){
		dig = num % 10;
		num/=10;
		sum += dig;
	}
	if(n%sum==0){
		cout << "Yes";
	}else{
		cout << "No";
	}
	return 0;
}


Measured memory_bytes: 256
N,K,Q=map(int,input().split())
count=[0]*N
for i in range(Q):
    count[int(input())-1]+=1
#Ai=A[i-1],i番目の正答者
#count正答カウンター
for i in range(N):
    if K-Q+count[i]>0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 4680
# coding: utf-8

cnt=[0,0,0,0]
flg=True

for i in range(3):
    a,b=map(int,input().split())
    cnt[a-1]+=1
    cnt[b-1]+=1

for i in range(4):
    if cnt[i]==3:
        flg=False

if flg:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
n = int(input())
x = list(map(int, input().split()))

m1 = -(-sum(x) // len(x))
m2 = sum(x) // len(x)
ans1 = 0
ans2 = 0
for xi in x:
    ans1 += (xi - m1)**2
    ans2 += (xi - m2)**2

print(min(ans1, ans2))

Measured memory_bytes: 38384
import Control.Monad
import Control.Applicative

main = do
    [x1,y1,x2,y2]  <- map read . words <$> getLine
    forM [x2 - y2 + y1, y2 + x2 - x1 , x1 - y2 + y1 , y1 + x2 - x1] $ \i -> do
        print i


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

int n,x;
int ans;
int i, j, k;

int main() {
    while (1) {
        cin >> n >> x;
        if (n == 0 && x == 0) {
            return 0;
        } else {
            for (i = 1; i <= n; i++) {
                for (j = i + 1; j <= n; j++) {
                    for (k = j + 1; k <= n; k++) {
                        if (i + j + k == x) {
                            ans++;
                        }
                    }
                }
            }
            cout << ans << endl;
            ans = 0;
        }
    }
}



Measured memory_bytes: 3088
#include <iostream>

using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int main()
{
  char c;
  cin >> c;
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}


Measured memory_bytes: 256
c = 3.times.map{gets.chomp.split(" ").map(&:to_i)}
b = [c[0][0],c[1][0],c[2][0]]
if c[0][1]-b[0] == c[1][1]-b[1] && c[1][1]-b[1] == c[2][1]-b[2] && c[0][2]-b[0] == c[1][2]-b[1] && c[1][2]-b[1] == c[2][2]-b[2]
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 1788