akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	l := 0
	r := len(a) - 1
	for l <= r {
		m := (l + r) / 2
		if a[m] >= x {
			r = m - 1
		} else {
			l = m + 1
		}
	}
	return l
}

func upperBound(a []int, x int) int {
	l := 0
	r := len(a)
	for l <= r {
		m := (l + r) / 2
		if len(a) == m {
			break
		}
		if a[m] <= x {
			l = m + 1
		} else {
			r = m - 1
		}
	}
	return l
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}
	dp := make([]int, N)
	for i := 0; i < N; i++ {
		dp[i] = -1
	}

	for i := 0; i < N; i++ {
		p := lowerBound(dp, a[i])
		dp[p-1] = a[i]
		// out(p, dp)
	}
	ans := 0
	for i := 0; i < N; i++ {
		if dp[i] != -1 {
			ans++
		}
	}
	out(ans)
}


Measured memory_bytes: 3840
n = int(input())
A = [int(i) for i in input().split()]

if n == 1:
    cnt = 1
else:
    if A[0] < A[1]:
        flag = 1
    elif A[0] > A[1]:
        flag = -1
    else:
        flag = 0
    
    cnt = 1
    x = A[1]
    for i in range(2, n):
        if flag == 1:
            if x > A[i]:
                cnt += 1
                flag = 0                
        elif flag == -1:
            if x < A[i]:
                cnt += 1
                flag = 0
        else:
            if x < A[i]:
                flag = 1
            elif x > A[i]:
                flag = -1
            else:
                flag = 0
        x = A[i]
    
print(cnt)

Measured memory_bytes: 14436
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int N, M;
  ci(N, M);
  ve<int> a(N, 0);
  rep(i, M * 2){
    int x;
    ci(x);
    a.at(x - 1)++;
  }
  rep(i, N){
    co(a.at(i));
  }
}

Measured memory_bytes: 256
# -*- coding:utf8 -*-
from collections import Counter

n,k,q = map(int, input().split())
a = Counter([int(input()) for _ in range(q)])
if k > q:
    for _ in range(n):
        print('Yes')
else:
    d = q - k + 1
    for i in range(1, n + 1):
        if not a[i]:
            print('No')
        else:
            if a[i] >= d:
                print('Yes')
            else:
                print('No')

Measured memory_bytes: 11896
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main() {
	int a, b, c;

	cin >> a >> b >> c;

	if (a + b < b + c && a + b < a + c) {
		cout << a + b << endl;

	}
	else if (b + c < a + b && b + c < a + c) {
		cout << b + c << endl;
	}
	else {
		cout << a + c << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n, m; cin >> n >> m;
    int ans = 1900 * m +100 * (n - m);
    FOR(i, 0, m)ans *= 2;
    cout << ans << "\n";
}


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


int N, Q;
Graph G;
vector<long long> Counter;  //各頂点を根とする部分木に足す値をカウント(初期値は0)
vector<bool> Visited;       //その頂点を訪れたかどうか(初期値はfalse)
vector<long long> ans;      //各頂点のカウンター(初期値は0)


void dfs(int now, long long count){
    Visited.at(now) = true;           //頂点nowを訪れたのでtrue
    count += Counter.at(now);         //頂点now以降の部分木のカウンターに足す値をプラス
    ans.at(now) += count;             //カウンターにプラス
    
    for(auto v : G.at(now)){
        if(Visited.at(v))continue;    //隣接する頂点が探索済ならcontinue
        dfs(v, count);                //探索済でない頂点についてdfs
    }
    return;
}


int main(){
    cin >> N >> Q;
    
    //各配列を初期化
    G.assign(N, vector<int>());
    Counter.assign(N, 0);
    Visited.assign(N, false);
    ans.assign(N, 0);
    
    //木の構築 インデックスに注意
    for(int i = 1; i < N; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G.at(a).push_back(b);
        G.at(b).push_back(a);
    }
    
    //各頂点を根とする部分木に足す値を構築 インデックスに注意
    for(int i = 0; i < Q; i++){
        int p;
        long long x;
        cin >> p >> x;
        p--;
        Counter.at(p) += x;
    }
    
    //探索開始
    //この木の根は頂点1, 最初のカウントは0
    dfs(0, 0);
    
    //答えを出力
    for(int i = 0; i < N; i++){
        cout << ans.at(i);
        if(i == N - 1)cout << endl;
        else cout << " ";
    }
    
    return 0;
}
    

Measured memory_bytes: 25856
#include <bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
map<ll, int> mp;
int main(){
	ios
	int n,x=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		ll a;
		cin>>a;
		if(mp[a]==1&&x==0){
			x++;
			cout<<"NO"<<endl;
		}
		mp[a]++;
	}
	if(x==0){
		cout<<"YES"<<endl;
	}
	return 0;
}

Measured memory_bytes: 12800
# include <iostream>
# include <stdio.h>
# include <cmath>
# include <iomanip>
// # include <cstring>
// # include <string>
// # include <cctype>
// # include <algorithm> //transformの関数はaslgorithmライブラリに入っているみたい。
using namespace std;
int main(){
  double n,sum;
  double s[1000];
  double mean;
  while(1){
    cin >> n;
    if(n == 0){
      break;
    }
    sum = 0;
    for(int i = 0;i<n;i++){
      cin >> s[i];
      sum += s[i];
    }
    mean = sum / n;
    sum = 0;
    for(int i = 0;i<n;i++){
      sum += pow(s[i]-mean,2);
    }
    cout << fixed;
    cout << setprecision(6) << sqrt(sum/n) << endl;
  }
  return 0;
}


Measured memory_bytes: 3228
#include <string>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
typedef long long ll;
const int mod=1e9+7;
#define lol(i,n) for(int i=0;i<n;i++)
#define tot(i,n) for(int i=0;i<=n;i++)

using namespace std;
int H,W;
int A[501][501];
ll sum=0;
int main() {
    cin >> H >> W;
    for (int i=1;i<=H;i++) {
        for (int j=1;j<=W;j++) {
            cin >> A[i][j];
            ll S1=i*(H+1-i);
            ll S2=j*(W+1-j);
            sum+=A[i][j]*S1*S2;
        }
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    long long X;
    cin>>X;
    long long amount =100;
    for(int i=1;;i++){
        long long interest=amount/100;
        amount+=interest;
        if(amount>=X){
             cout<<i<<"\n";
             break;
        }
    }
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin >> n;
    long long int cnt = 0;
    for(long long int i=1;i<n;i++)
    {
        for(long long int j=1;i*j<n;j++)
        {
           cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<string>
#include<cstdio>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
    int n,k,q;
    cin >> n >> k >> q;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    priority_queue<int,vector<int>,greater<int> > pq;
    int answer = 1000000000;
    for(int i=0;i<n;i++){
        int p = a[i];
        priority_queue<int,vector<int>,greater<int> > pq;
        priority_queue<int,vector<int>,greater<int> > ans;
        int l = 0;
        for(int j=0;j<n;j++){
            if(a[j]>=p){
                pq.push(a[j]);
            }else{
                while(pq.size()>=k){
                    int ss = pq.top();
                    pq.pop();
                    ans.push(ss);
                }
                while(!pq.empty()){
                    pq.pop();
                }
            }
        }
        while(pq.size()>=k){
            int ss = pq.top();
            //cout << p << " " << ss << endl;
            pq.pop();
            ans.push(ss);
        }
        while(!pq.empty()){
            pq.pop();
        }
        //cout << ans.size() << endl;
        if(ans.size()>=q){
            int cnt = 0;
            int sss;
            while(cnt!=q){
                sss = ans.top();
                ans.pop();
                cnt++;
            }
            //cout << p << " " << sss << endl;
            answer = min(answer,sss-p);
        }
        
    }
    cout << answer << endl;
    return 0;
}

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

int main() {
	int A,B,C,X,Y;
	cin >> A >> B >> C >> X >> Y;
	int planA=0;
	int planB=0;
	int planC=0;

	planA = A*X+B*Y;

	int hoge=min(X,Y);
	planB = hoge*C*2 + A*(X-hoge) + B*(Y-hoge);

	int piyo=max(X,Y);
	planC = piyo*C*2;

	int tako=min(planA,min(planB,planC));
	cout << tako << endl;


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define fi              first
#define se              second
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define fo(i,n)         for(i=0; i<n; i++)
#define fo1(i,n)        for(i=1; i<=n; i++)
#define Fo(i,k,n)       for(i=k; k<=n?i<=n:i>=n; k<=n?i++:i--)
#define all(x)          x.begin(), x.end()
#define rall(x)         x.rbegin(), x.rend()
#define sortall(x)      sort(all(x))
#define sortrall(x)     sort(rall(x))
#define clr(x)          memset(x, 0, sizeof(x))
#define tr(it, a)       for(auto it = a.begin(); it != a.end(); it++)
#define pii             pair<int, int>
#define mk(arr,n,type)  type *arr = new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int, int>
#define umii            unordered_map<int, int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int, vi, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y) / gcd(x, y)
#define mod             1000000007
#define endl            '\n'
#define PI              3.1415926535897932384626
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x
void __print(int32_t x) {cout<<x;}
void __print(int x) {cout<<x;}
void __print(ld x) {cout<<x;}
void __print(double x){cout<<x;}
void __print(float x){cout<<x;}
void __print(bool x) {cout<<(x?"true":"false");}
void __print(char x){cout <<'\''<<x<<'\'';}
void __print(const char *x){cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}void _print() {cout << "]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif
int power(int base, int exp){ int res = 1; base %= mod; while(exp > 0){ if(exp & 1) res = (res * base) % mod; base = (base * base) % mod; exp = exp >> 1; } return res; }
int inv(int x){ return power(x, mod - 2) % mod; }
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




const int N = 1e6 + 6, M = N;
int i, j;

void solve(){
    
    int a,b; cin>>a>>b;
    cout<<a*b<<endl;
    
    
    
    
}




int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t = 1;
    // cin >> t;
    while(t--)
        solve();
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  string S, T;
  cin >> S >> T;

  ll l = 1LL * N * M / __gcd(N, M);
  map<int, int> mp;
  for (int i = 0; i < N; i++) {
    mp[i * l / N] = S[i];
  }

  bool ans = true;
  for (int i = 0; i < M; i++) {
    if (!mp[i * l / M]) continue;
    if (mp[i * l / M] != T[i]) {
      ans = false;
    }
  }

  cout << ( (ans) ? l : -1 ) << endl;
  return 0;
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

string vow = "aeiou";

void solve ( int test_case )
{
    int n ;
    cin >> n ;

    vi v ( n ) ;
    for ( int i=0 ; i < n ; i++ ) cin >> v[i] ;

    int ans = INT_MAX ;
    for ( int t = -100 ; t < 101 ; t++ )
    {
        int temp = 0 ;
        for ( auto i : v )
            temp += (i-t)*(i-t) ;
        ans = min ( ans , temp ) ;
    }

    cout << ans ; line
}

int main()
{
    int t = 1;
    //cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


Measured memory_bytes: 256
using System;

namespace ChokudaiScanner
{
    class MainClass
    {
        static void Main()
        {
            Scanner cin = new Scanner();
            int a = cin.NextInt();
            int b = cin.NextInt();
            long c = a * b;

            if (c % 2 == 0)
            {
                Console.WriteLine("Even");
            }
            else
            {
                Console.WriteLine("Odd");
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string Next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next();
            i = 0;
            return s[i++];
        }

        public string[] ArrayNext(int N)
        {
            string[] Array = new string[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Next();
            }
            return Array;
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong() + add;
            }
            return Array;
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble() + add;
            }
            return Array;
        }
    }
}



Measured memory_bytes: 11092
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

void solve(){
    int H, W;
    cin >> H >> W;
    int h, w;
    cin >> h >> w;
    int a[H][W] = {};
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            a[i][j] = 0;
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < W; j++){
            a[i][j] = 1;
        }
    }
    for(int i = 0; i < w; i++){
        for(int j = 0; j < H; j++){
            a[j][i] = 1;
        }
    }
    int res = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            res += (a[i][j] == 0);
        }
    }
    cout << res << "\n";
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
char s[1000000];
int a[500];
bool vis[500];
int main()
{
	scanf("%s",s+1);
	int len=strlen(s+1);
	for(int i=1;i<=len;i++)
	  a[s[i]]++;
	if((a['S']>0&&a['N']>0||a['S']==0&&a['N']==0)&&(a['E']==0&&a['W']==0||a['E']>0&&a['W']>0))
	  printf("Yes");
	else
	  printf("No");
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
int main() 
{
	int n,i,a=0,b=0,c=0,d=0;
	char s[10];
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>s;
		if(strcmp(s,"AC")==0)
		a++;
		if(strcmp(s,"WA")==0)
		b++;
		if(strcmp(s,"TLE")==0)
		c++;
		if(strcmp(s,"RE")==0)
		d++;
	}
	cout<<"AC x "<<a<<endl;
	cout<<"WA x "<<b<<endl;
	cout<<"TLE x "<<c<<endl;
	cout<<"RE x "<<d<<endl;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC return 0;
using namespace std;
map<string, bool> M;
string s;
int n;
inline void Back(int k, char maxc, string s) {
    if (k == n)
        M[s];
    else for (char c = 'a'; c <= maxc; ++c) {
        if (c == maxc)
            Back(k + 1, maxc + 1, s + c);
        Back(k + 1, maxc, s + c);
    }
}
int main() {
    DAU
    cin >> n;
    Back(0, 'a', "");
    for (const auto& p : M)
        cout << p.first << '\n';
    PLEC
}


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

class Main {
    private static void solve() {
        final Scanner scanner = new Scanner(System.in);

        while (true) {
            int n = scanner.nextInt();
            if (n == 0) {
                break;
            }
            int[] colors = new int[n];
            for (int i = 0; i < colors.length; i++) {
                colors[i] = scanner.nextInt();
            }
            Arrays.sort(colors);
            int maximum = 0;
            int maximumColor = -1;
            int index = 0;
            while (index < colors.length) {
                int color = colors[index];
                int counter = 1;
                while (++index < colors.length && colors[index] == color) {
                    counter++;
                }
                if (counter > maximum) {
                    maximum = counter;
                    maximumColor = color;
                }
            }
            if (maximum > colors.length / 2) {
                System.out.println(maximumColor);
            } else {
                System.out.println("NO COLOR");
            }
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 17000
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int N, t, x, y, tt = 0, xx = 0, yy = 0;

  std::cin >> N;

  for (int i = 0; i < N; i ++) {
    std::cin >> t >> x >> y;

    int d = std::abs(x - xx) + std::abs(y - yy), dt = t - tt;

    if (! (d <= dt && (d - dt) % 2 == 0)) {
      std::cout << "No" << std::endl;

      return 0;
    }

    tt = t;
    xx = x;
    yy = y;
  }

  std::cout << "Yes" << std::endl;

  return 0;
}


Measured memory_bytes: 888
def resolve():
  A, B, C = map(int, input().split(" "))
  K = int(input())

  for _ in range(K):
    if A >= B:
      B *= 2
    elif B >= C:
      C *= 2
    
    if A < B and B < C:
      print("Yes")
      return True
  print("No")

if __name__ == "__main__":
  resolve()


Measured memory_bytes: 9168
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int N, A;
  cin >> N >> A;

  N = N - (N / 500) * 500;
  if (N <= A)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //入力
      	int n = sc.nextInt();
        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
        }
 		//0を見つけたいので昇順にソート
        Arrays.sort(a);
 		//10の18乗
        final long K = (long) Math.pow(10, 18);
 		//0があるとき
        if (a[0] == 0) {
            System.out.println(0);
            return;
        }
 
        long result = 1;
      	//取り出した値を格納する変数:順に取り出したい配列
        for (long l : a) {
            if (result > K / l) {
                System.out.println(-1);
                return;
            }
          //取り出した値を掛ける
            result *= l;
        }
        System.out.println(result);
 
    }
}

Measured memory_bytes: 62316
#include <cstdio>
int X;

int main() {
	scanf("%d", &X);
	// 500 => 1000
	// 100 => 0
	// 50 => 0
	// 10 => 0
	// 5 => 5
	// 1 => 0

	int c500 = X / 500;
	int c5 = (X - (c500 * 500)) / 5;
	// printf("%d\n", c500);
	// printf("%d", c5);

	printf("%d", (c500 * 1000) + (c5 * 5));

    return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;


int main() {

    string S;
    cin >> S;
    ll w;
    cin >> w;

    for(ll i = 0; i < S.length(); i+=w){
        cout << S[i];
    }
    cout << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long A, B;
    cin >> A >> B;
    if ((A + B) % 2 == 0)
    {
        cout << (A + B) / 2 << endl;
    }
    else
    {
        cout << "IMPOSSIBLE" << endl;
    }
}


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

int main() {
    int n;
    string s;
    cin >> n>> s;
    for( int i=0; i<s.length(); ++i){
        for( int j=0; j<n;++j){
            if( s.at(i)=='Z'){
              s.at(i)='A';       
            }
            else{
              s.at(i) +=1; 
            }
        }
    }
    cout << s << endl;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
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;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  string s,t;cin>>s>>t;
  rep(i,0,3){
    if(s[i]==t[i])res++;
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int W, H, x, y, r;
    
    cin >> W >> H >> x >> y >> r;
    
    if (r <= x && x <= W-r && r <= y && y <= H-r){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3100
k = gets.chomp.to_i
cnt = 0
que = []
(1..9).each do |i|
  que.push(i)
  cnt += 1
  if cnt==k
    puts i
    exit
  end
end
while que.size > 0 do
  n = que.shift
  if n % 10 == 0
    cnt += 1
    if cnt == k
      puts n * 10
      exit
    end
    que.push(n * 10)
    cnt += 1
    if cnt == k
      puts n * 10 + 1
      exit
    end
    que.push(n * 10 + 1)
  end
  if n % 10 != 0 && n % 10 != 9
    cnt += 1
    if cnt == k
      puts n * 10 + n % 10 - 1
      exit
    end
    que.push(n * 10 + n % 10 - 1)
    cnt += 1
    if cnt == k
      puts n * 10 + n % 10
      exit
    end
    que.push(n * 10 + n % 10)
    cnt += 1
    if cnt == k
      puts n * 10 + n % 10 + 1
      exit
    end
    que.push(n * 10 + n % 10 + 1)
  end
  if n % 10 == 9
    cnt += 1
    if cnt == k
      puts n * 10 + 8
      exit
    end
    que.push(n * 10 + 8)
    cnt += 1
    if cnt == k
      puts n * 10 + 9
      exit
    end
    que.push(n * 10 + 9)
  end
end

Measured memory_bytes: 3836
#include <iostream>
#include <iomanip>
#define FZ2 setw(2)<<setfill('0')
using namespace std;
void hout(int sec){cout<<FZ2<<sec/3600<<":"<<FZ2<<(sec%3600)/60<<":"<<FZ2<<(sec%3600)%60<<"\n";}
int main(){
	const int rec = 7200;
	int h,m,s;
	while(cin>>h>>m>>s){
		if(h==-1&&m==-1&&s==-1) break;
		int rem = rec - (h*3600+m*60+s);
		hout(rem);hout(rem*3);
	}
	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    string s;
    cin >> s;

    bool flag = true;
    for (int i = 0; i < a; i++) {
        if (s[i] < '0' || '9' < s[i]) {
            flag = false;
        }
    }
    if (s[a] != '-') {
        flag = false;
    }
    for (int i = a + 1; i < a + b + 1; i++) {
        if (s[i] < '0' || '9' < s[i]) {
            flag = false;
        }
    }

    if (flag) {
        puts("Yes");
    } else {
        puts("No");
    }

    return 0;
}


Measured memory_bytes: 256
#MLE注意！

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    mod = 10**9 + 7

    n,k = map(int, input().split())
    res = 0
    d = [0]*k
    for i in range(k, 0, -1):
        d[i-1] = pow((k//i), n, mod)
        for j in range(2, (k//i)+1):
            d[i-1] -= d[i*j-1]
        res += i * d[i-1] % mod
    print(res%mod)

if __name__ == '__main__':
    main()

Measured memory_bytes: 11556
#include <bits/stdc++.h>
using namespace std;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};

map<ll, ll> cnt;

vector<pair<ll, ll>> factorization_vector(ll n)
{
    vector<pair<ll, ll>> rtn;

    ll m = n;
    ll idx = 0;
    for (ll i = 2; i * i <= m; i++) {
        if (n % i != 0)
            continue;

        rtn.push_back({i,0});
        while (m % i == 0) {
            rtn[idx].second++;
            m /= i;
        }
        idx++;
    }
    if (m != 1) {
        rtn.push_back({m,1});
    }

    return rtn;
}

int main()
{
    ll n, ans = 1ll;
    cin>>n;
    FOR(i,2,n+1) {
        vector<pair<ll, ll>> tmp = factorization_vector(i);
        REPALL(i,tmp) {
            cnt[tmp[i].e1] += tmp[i].e2;
        }
    }
    FOR(i,2,n+1) {
        ans *= cnt[i] + 1;
        ans %= MOD;
    }

    cout<<ans<<endl;

    return 0;
}


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

int main(void){
	int i,len,size;
	char s[1024],rst[512],n[6][8]={"abcde","fghij","klmno","pqrst","uvwxy","z.?! "};
	bool flg;

	while(cin>>s){
		size = 0;
		flg = true;
		if((len = strlen(s)) % 2 != 0) flg = false;

		for(i=0;flg && i<len;i+=2){
			if('0'<s[i] && s[i]<'7' && '0'<s[i+1] && s[i+1]<'6')
				rst[size++] = n[s[i]-'1'][s[i+1]-'1'];
			else
				flg = false;
		}
		rst[size] = 0;

		if(flg) cout<<rst<<endl;
		else cout<<"NA\n";
	}

	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
vector<int> G[150001];
double dp[150001];
bool used[150001];
double res[150001];

double func(int v){
	used[v]=true;
	double res=0.0;
	int cnt=0;
	for(int i=0;i<G[v].size();i++){
		if(!used[G[v][i]]){
			res+=func(G[v][i]);
			cnt++;
		}
	}
	if(cnt==0){
		dp[v]=0.0;
		return (dp[v]+1.0);
	}
	dp[v]=(double)res/cnt;
	return (dp[v]+1.0);
}

void solve(int v,int p,double val){
	used[v]=true;
	if(p==-1){
		res[v]=val;
	}else{
		double pn=(double)G[v].size()-1.0;
		double nn=(double)G[v].size();
		if(pn==0){
			res[v]=dp[v];
			res[v]+=val;
		}else{
			res[v]=(dp[v]*pn/nn);
			res[v]+=val/nn;
		}
	}
	//printf("%d %d %.9f\n",v,p,val);
	val=res[v];
	//printf("%d %d %.9f\n",v,p,val);
	for(int i=0;i<G[v].size();i++){
		if(!used[G[v][i]]){
			int nv=G[v][i];
			double sendval=val;
			//printf("%.9f\n",sendval);
			if(p==-1){
				if(G[v].size()==1)sendval-=(dp[nv]+1.0);
				else{
					sendval-=(dp[nv]+1.0)/G[v].size();
					sendval*=(double)G[v].size()/(G[v].size()-1);
				}
			}else{
				if(G[v].size()==1)sendval-=(dp[nv]+1.0);
				else{
					//printf("sv %d %d %.9f\n",v,nv,sendval);
					sendval-=(dp[nv]+1.0)/((double)G[v].size());
					//printf("sv %d %d %.9f\n",v,nv,sendval);
					sendval*=(double)G[v].size()/(G[v].size()-1);
				}
			}
			solve(G[v][i],v,sendval+1.0);
		}
	}
	return;
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		int f,t;
		scanf("%d%d",&f,&t);
		f--;
		t--;
		G[f].push_back(t);
		G[t].push_back(f);
	}
	memset(used,false,sizeof(used));
	func(0);
	memset(used,false,sizeof(used));
	solve(0,-1,dp[0]);
	for(int i=0;i<n;i++){
		printf("%.9f\n",res[i]);
	}
	return 0;
}


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

const int MAX_N = 100010;

struct UFDS{
    int par[MAX_N];

    void init(){
        memset(par, -1, sizeof(par));
    }

    int root(int x){
        return par[x] < 0 ? x : par[x] = root(par[x]);
    }

    void merge(int x, int y){
        x = root(x);
        y = root(y);

        if (x != y){
            if (par[x] > par[y])
                swap(x, y);

            par[x] += par[y];
            par[y] = x;
        }
    }
};

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

    UFDS uf;
    uf.init();

    int n, m, k;
    cin >> n >> m >> k;
    
    vector<int> f[n], b[n];
    for (int i = 0; i < m; i++){
        int u, v;
        cin >> u >> v;
        u--;
        v--;

        if (uf.root(u) != uf.root(v))
            uf.merge(u, v);

        f[u].push_back(v);
        f[v].push_back(u);
    }

    for (int i = 0; i < k; i++){
        int u, v;
        cin >> u >> v;
        u--;
        v--;

        b[u].push_back(v);
        b[v].push_back(u);
    }

    vector<int> ans(n);
    for (int i = 0; i < n; i++){
        ans[i] = -uf.par[uf.root(i)] - (int) f[i].size() - 1;
        for (auto j: b[i]){
            if (uf.root(j) == uf.root(i))
                ans[i] -= 1;
        }
    }

    for (auto i: ans)
        cout << i << " ";
    cout << '\n';

    return 0;
}


Measured memory_bytes: 12664
#pragma GCC optimize("O3") //コンパイラ最適化用

#define _GLIBCXX_DEBUG //配列に[]でアクセス時のエラー表示
#include <algorithm>   //sort,二分探索,など
#include <bitset>      //固定長bit集合
#include <chrono>      //実行時間計測
#include <cmath>       //pow,logなど
#include <complex>     //複素数
#include <deque>       //両端アクセスのキュー
#include <functional>  //sortのgreater
#include <iomanip>     //setprecision(浮動小数点の出力の誤差)
#include <iostream>    //入出力
#include <iterator>    //集合演算(積集合,和集合,差集合など)
#include <map>         //map(辞書)
#include <numeric>     //iota(整数列の生成),gcdとlcm,accumulate
#include <queue>       //キュー
#include <set>         //集合（順序保持）
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility> //pair
#include <vector>  //可変長配列
using namespace std;
typedef long long ll;
typedef long double ld;

#define REP(i, n) for (int i = 0; i < ll(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < ll(b); i++)
#define FORD(i, a, b) for (int i = a; i > ll(b); i--)
// xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size()) // sizeをsize_tからllに直しておく
const long long INF = 1e12;
const int MOD = 1e9 + 7;
#define MAXR 100000 // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define Umap unordered_map
#define Uset unordered_set
#define int long long
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000

// https://qiita.com/Lily0727K/items/06cb1d6da8a436369eed#c%E3%81%A7%E3%81%AE%E5%AE%9F%E8%A3%85
void print() { cout << endl; }

template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}

template <class T> void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}

template <class T> void print(vector<vector<T>> &df) {
    for (auto &vec : df) {
        print(vec);
    }
}

void add(long long &a, long long b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
}
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

signed main() {

    int n;
    cin >> n;
    vector<pair<pair<string, int>, int>> p(n);

    string a;
    int b;
    REP(i, n) {
        cin >> a >> b;
        p[i].first.first = a;
        p[i].first.second = -b;
        p[i].second = i + 1;
    }

    sort(ALL(p));
    REP(i, n) { print(p[i].second); }
}


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

int main(){
	cin.tie(nullptr) ;
	ios::sync_with_stdio(false) ;
	int n ; cin >> n ;
	int ans = 1000 ;
	for(int i=0;i<n;i++){
		int a ; cin >> a ;
		int cnt = 0 ;
		while(1){
			if(a&1) break ;
			cnt++ ;
			a /= 2 ;
		}
		if(ans>cnt) ans = cnt ;
	}
	cout << ans << "\n" ;
}


Measured memory_bytes: 888
from sys import stdin
import bisect
from itertools import accumulate
import numpy as np

a,b,c,d= [int(x) for x in stdin.readline().rstrip().split()]

if abs(a-c) <= d:
    print("Yes")
elif abs(a-b)<= d and abs(b-c) <= d:
    print("Yes")
else:
    print("No")

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;
int power[10][10];
int wall[205][205];
int main(){

    int h,w;
    cin>>h>>w;

    rep(i,10)rep(j,10)cin>>power[i][j];

    rep(i,h)rep(k,w)cin>>wall[i][k];

    rep(j,10){
        rep(i,10){
            rep(k,10){
                power[i][k]=min(power[i][k],power[i][j]+power[j][k]);
            }
        }
    }
    long long ans=0;
    rep(i,h){
        rep(k,w){
            if(wall[i][k]!=-1){
                ans+=power[wall[i][k]][1];
            }
        }
    }
    cout<<ans<<endl;

    return 0;

}
/*


*/


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

int main(){
    vector<string> s;
    string p;
    int n,l;
    cin >> n >> l;
    rep(i,n){
        cin >> p;
        s.push_back(p);
    }
    
    sort(s.begin(), s.end());
    
    rep(i,n){
        cout << s[i];
    }cout << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

type p struct {
	x, y int
}

func main() {
	var n int
	fmt.Scan(&n)
	xs := make([]int, n)
	ys := make([]int, n)
	for i := range xs {
		fmt.Scan(&xs[i], &ys[i])
	}

	cnt := make(map[p]int)
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			cnt[p{x: xs[i] - xs[j], y: ys[i] - ys[j]}]++
			cnt[p{x: xs[j] - xs[i], y: ys[j] - ys[i]}]++
		}
	}

	max := 0
	for _, v := range cnt {
		if v > max {
			max = v
		}
	}
	fmt.Println(n - max)
}


Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    private int N;
    private int[]A;
    private void Scan()
    {
        var l=Console.ReadLine().Split(' ');
        N=int.Parse(l[0]);
        l=Console.ReadLine().Split();
    
        A=new int[N];
        for(int i=0;i<N;i++)
        {
            A[i]=int.Parse(l[i]);
        }
    }
    
    
    public void Solve()
    {
        Scan();
        int one=0,two=0,four=0;
        foreach(int i in A)
        {
            if(i%4==0)
            {
                four++;
            }
            else if(i%2==0)
            {
                two++;
            }
            else
            {
                one++;
            }
        }
        bool ans;
        if(two==0)
        {
            ans=four+1>=one;
            if(four==0)
            {
                ans=false;
            }
        }
        else
        {
            ans=four>=one;
        }
        Console.WriteLine(ans?"Yes":"No");
    } 
    
    static void Main()
    {
        new Program().Solve();
    }
}

Measured memory_bytes: 20448
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,s1;
    cin>>s>>s1;
    int flag=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=s1[i])
             flag=1;
    }
    if(flag==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3628
import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	A = []
	B = []
	for i in range(N):
		a, b = getlist()
		A.append(a)
		B.append(b)

	A.sort()
	B.sort()

	if N % 2 == 0:
		M = int(N // 2)
		L = A[M - 1] + A[M]
		R = B[M - 1] + B[M]
		ans = R - L + 1
		print(ans)

	else:
		M = int(N // 2)
		L = A[M]
		R = B[M]
		ans = R - L + 1
		print(ans)

if __name__ == '__main__':
	main()

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

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

    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int ans = h[0];
    rep(i, n - 1) ans += max(0, h[i + 1] - h[i]);
    cout << ans << endl;
}

Measured memory_bytes: 256