akhauriyash/Code-Regression huggingface dataset:
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  ll n;
  cin >> n;
  ll ans = 0;
  vector<string> s(n);

  rep(i,n)
  {
    string buf;
    cin >> buf;
    vsort(buf);
    s[i] = buf;
  }

  unordered_map<string,ll> m;

  rep(i,n)
  {
    m[s[i]]++;
  }

  for(auto itr=m.begin();itr!=m.end();itr++)
  {
    ans += itr->second * (itr->second - 1) / 2;
  }

  cout << ans << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 11428
def main():
    n,k = map(int,input().split())
    v = list(map(int,input().split()))
    m = 0
    for k_ in range(k+1):
        v_c = v
        if k_>n:
            v_ = v_c
            v_c = []
            s = k-n
        else:
            v_ = v_c[0:k_]
            v_c = v_c[k_:]
            s = k-k_
        for i in range(s+1):
            if i>len(v_c):
                v__ =v_+ v_c
                s_ = s-len(v_c)
            else:
                v__ = v_+ v_c[len(v_c)-i:]
                s_ = s-i
            while s_>0 and len(v__)>0 and min(v__)<0:
                v__.pop(v__.index(min(v__)))
                s_ = s_-1
            if sum(v__)>m:
                m = sum(v__)
    print(m)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 +7

col = [0,0,0]

ans = 1

for i in range(n):
    if not a[i] in col:
        print(0)
        exit()
    else:
        ans *= col.count(a[i])
        ans %= mod
        col[col.index(a[i])] += 1

if sum(col) != n:
    print(0)
    exit()

print(ans%mod)

Measured memory_bytes: 52824
import numpy as np
h, w = map(int, input().split())
square = np.array([list(input()) for i in range(h)]).ravel()=="#"
def main():
    for i in range(h*w):
        if square[i] == True:
            flag = 0
            if i // w == 0:
                if square[i+w] == True:
                    flag += 1
            elif i // w == h-1:
                if square[i-w] == True:
                    flag += 1
            else:
                if square[i+w] + square[i-w] == True:
                    flag += 1
            if i % w == 0:
                if square[i+1] == True:
                    flag += 1
            elif i % w == w-1:
                if square[i-1] == True:
                    flag += 1
            else:
                if square[i+1] + square[i-1] == True:
                    flag += 1
            if flag == 0:
                print("No")
                return 0
    print("Yes")
main()

Measured memory_bytes: 12500
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

/*
    1-indexed であることに注意 !! 
*/
template <typename T>
struct BIT{
    int n;
    vector<T> dat;

    BIT(int n) : n(n), dat(n + 1, 0) {}

    T sum(int a){
        T res = 0;
        for(int i = a; i > 0; i -= (i & (-i))) res += dat[i];
        return res;
    }

    T sum(int a, int b){
        return sum(b - 1) - sum(a - 1);
    }

    void add(int k, T x){
        if(k == 0) return;
        for(int i = k; i <= n; i += (i & (-i))) dat[i] += x;
    }

    /*
        a[0] + a[1] + ... + a[res] >= x
    */
    int lower_bound(T x){
        if(x <= 0) return T(0);
        int res = 0, k = 1;
        while(k < n) k <<= 1;
        for(; k > 0; k >>= 1){
            if(res + k <= n && dat[res + k] < x){
                x -= dat[res + k];
                res += k;
            }
        }
        return res + 1;
    }
};

/*
    vector<long long> a(n) を座圧する場合 : 
    auto v = compress(a);
    auto m = dict(v);
    i番目の要素の取り出し方 : 
    m[a[i]]
*/
template<typename T>
vector<T> compress(vector<T> vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

template<typename T>
map<T, int> dict(vector<T> & vec){
    map<T, int> res;
    for(int i = 0; i < (int)vec.size(); i++){
        res[vec[i]] = i;
    }
    return res;
}

signed main(){
    int n;
    cin >> n;
    ll pre = 0;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
        pre += a[i];
    }
    auto v = compress(a);
    auto m = dict(v);
    BIT<int> bit1(m.size());
    BIT<ll> bit2(m.size());
    rep(i,n){
        bit1.add(m[a[i]], 1);
        bit2.add(m[a[i]], a[i]);
    }
    rep(i,n){
        ll t = bit2.sum(m[a[i]], m.size()) - bit1.sum(m[a[i]], m.size()) * a[i];
        if(pre - t > 0){
            cout << pre - t << endl;
            pre = t;
        }else{
            cout << 0 << endl;
        }
        bit1.add(m[a[i]], -1);
        bit2.add(m[a[i]], -a[i]); 
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  ll ans = 0;
  rep(i, n) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    ans += mp[s];
    mp[s]++;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 11368
imput_1 = gets.chomp.split("\s")
n, m = imput_1[0].to_i, imput_1[1].to_i

# m行n列の行列A
determinant_A = Array.new(n){ Array.new(m)}

for i in 0..n - 1
	imput_2 = gets.chomp.split("\s")
	
	# 文字列のinteger化と代入
	for j in 0..m - 1
		determinant_A[i][j] = imput_2[j].to_i
	end
end

# m行1列の行列B
determinant_B = Array.new(m)

# 文字列のinteger化と代入
for k in 0..m - 1
	determinant_B[k] = gets.chomp.to_i
end

# 行列の計算
for q in 0..n - 1
	
	# sumは行ごとにリセット
	sum = 0
	
	# 要素の計算
	for r in 0..m - 1
		sum += determinant_A[q][r] * determinant_B[r]
	end
	puts sum
end

Measured memory_bytes: 6196
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,a,b,c,f=1;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) {
        scanf("%d%d%d",&a,&b,&c);
        if(a<b+c||(a-b-c)&1){f=0;break;}
    }
    if(f)printf("Yes");
    else printf("No");
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] nums=new int[n];
        int[] ans=new int[n];
        for(int i=0;i<n;i++){
            nums[i]=sc.nextInt();
        }
        int tmp;
        for(int i=n;i>0;i--){
            tmp=0;
            for(int j=1;j<n/i;j++){
                tmp+=ans[i*(j+1)-1];
            }
            if(tmp%2==nums[i-1]){
                ans[i-1]=0;
            }else{
                ans[i-1]=1;
            }
        }
        int m=0;
        for(int i=0;i<n;i++){
            if(ans[i]==1){
                m++;
            }
        }
        System.out.println(m);
        for(int i=0;i<n;i++){
            if(ans[i]==1){
                System.out.print((i+1)+" ");
            }
        }
        System.out.println();
    }
}


Measured memory_bytes: 80912
//#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	ll N,A[501];
	vll As;
	ll yen=1000,kabu=0;
	int lastbuy=0;
	scan(N);
	rep(i,N){
		scan(A[i]);
		if(i==0||(i>0&&A[i]!=A[i-1])) As.push_back(A[i]);
	}
	if(As.size()==1){
		prin(yen);
		return 0;
	}
	rep(i,As.size()){
		if(i==0&&As[i]<As[i+1]){
			kabu+=yen/As[i];
			yen-=yen/As[i]*As[i];
			lastbuy=i;
		}
		else if(i==(int)As.size()-1&&As[i]>As[i-1]){
			yen+=kabu*As[i];
			kabu=0;
		}
		else if(As[i]>As[i-1]&&As[i]>As[i+1]){
			yen+=kabu*As[i];
			kabu=0;
		}
		else if(As[i]<As[i-1]&&As[i]<As[i+1]){
			kabu+=yen/As[i];
			yen-=yen/As[i]*As[i];
			lastbuy=i;
		}
		debug(i,As[i],yen,kabu);
	}
	prin(yen+kabu*As[lastbuy]);
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()


//library mod int
template <int mod>
struct modint{
    ll x;

    //constructor
    modint(ll x=0): x((x%mod+mod)%mod){}

    //unary operator
    modint operator-() const { return modint(mod-x);}
    modint inv() const { return this->pow(mod-2);}
    

    //compound assignment
    modint& operator+=(const modint& a){
        if((x+=a.x)>=mod) x-=mod;
        return *this;
    }
    modint& operator-=(const modint& a){
        if((x-=a.x)<0) x+=mod;
        return *this;
    }
    modint& operator*=(const modint& a){
        (x*=a.x)%=mod;
        return *this;
    }
    modint& operator/=(const modint& a){
        return *this *= a.inv();
    }

    //arithmetic
    // なぜmodintの後ろに＆を書いたり書かなかったりしてるかの理解ができていない
    //おそらく＆をつけるとポインタで参照しているのでもとの値を書き換えることができる
    //＆をつけないとコピーを作ってからそれに対して計算するので、もとの値は変更されない
    modint operator-(const modint& a) const {return modint (*this) -= a ; }
    modint operator+(const modint& a) const {return modint (*this) += a ; }
    modint operator*(const modint& a) const {return modint (*this) *= a ; }
    modint operator/(const modint& a) const {return modint (*this) /= a ; }
    //n should not be smaller than 0.
    modint pow(ll n) const{
        auto x=modint(1);
        auto m=*this;
        while(n>0){
            if(n&1) x*=m;
            n>>=1;
            m*=m;
        }
        return x;
    }

    //compare
    bool operator==(const modint& a) const {return x==a.x ; }
    bool operator!=(const modint& a) const {return x!=a.x ; }

    //I/O
    friend istream& operator>>(istream& is, modint& a ) noexcept {return is >> a.x ; }
    friend ostream& operator<<(ostream& os, const modint& a ) noexcept {return os << a.x ; }

};

//modの調整
constexpr int mod = 1e9 + 7;
using mint = modint<mod>;





int main(){
    int n;
    cin>>n;
    vector<ll> p(n);
    rep(i,n) cin>>p[i];
    mint ans=0;
    rep(i,60){
        ll cnt=0;
        rep(j,n){
            if(p[j]>>i&1) cnt++;
        }
        mint a=cnt*(n-cnt);
        a=a*mint(2).pow(i);
        ans+=a;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    int N;
    cin>>N;
    vector<int> Ai(N);
    vector<int64_t> a(N+1,0);
    for (int i=0;i<N;i++){
        cin>>Ai.at(i);
        a.at(Ai.at(i))++;
    }
    int64_t sum=0;
    for(int i=0;i<N+1;i++){
        sum+=(a.at(i)*(a.at(i)-1))/2;
    }
    for(int k=0;k<N;k++){
        int d=a.at(Ai.at(k))-1;
        cout<<sum-d<<endl;
    }
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <tuple>

using namespace std;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

#define int long long

typedef long long ll;
typedef long double ld;

const ll MOD = 1e9 + 7, SZ = 2003;

ll n, m, x;

vector<tuple<ll, ll, ll>> edges;

ll dsu[SZ];

int find(int v) {
	if (dsu[v] == v) return v;
	else return dsu[v] = find(dsu[v]);
}

void uni(int u, int v) {
	u = find(u);
	v = find(v);
	if (u != v) dsu[u] = v;
}

ll mst() {
	ll ans = 0;

	for (auto cur : edges) {
		if (find(get<1>(cur)) != find(get<2>(cur))) {
			ans += get<0>(cur);
			uni(get<1>(cur), get<2>(cur));
		}
	}

	for (int i = 0; i < n; i++) dsu[i] = i;
	return ans;
}

ll bpow(ll vl, ll p, ll mod) {
	if (p == 0) return 1;
	else if (p % 2 == 1) {
		return (bpow(vl, p - 1, mod) * vl) % mod;
	}
	else {
		ll b = bpow(vl, p / 2, mod);
		return (b * b) % mod;
	}
}

void debug() {
	debug();
}

signed main() {
	fastInp;

	cin >> n >> m >> x;

	ll m2 = m;
	for (int i = 0; i < m; i++) {
		ll u, v, w;
		cin >> u >> v >> w;
		u--; v--;
		edges.push_back({ w, u, v });
	}

	sort(edges.begin(), edges.end());

	ll cnt = 0;
	for (int i = 0; i < n; i++) dsu[i] = i;
	ll m = mst();

	ll cmr = 0, cls = 0;
	for (int i = 0; i < edges.size(); i++) {
		ll cur = get<0>(edges[i]);
		uni(get<1>(edges[i]), get<2>(edges[i]));
		cur += mst();
		if (cur > x) {
			cmr++;
		}
		if (cur < x) {
			cls++;
		}
		if (cur == x) cnt++;
	}

	if (x == m) {
		cout << (bpow(2, m2, MOD) - (2 * bpow(2, cmr, MOD)) + MOD * 3) % MOD;
	}
	else {
		if (cnt == 0) {
			cout << "0";
			return 0;
		}
		cout << (((bpow(2, cmr, MOD) * bpow(2, cnt, MOD)) % MOD) * 2 - bpow(2, cmr, MOD) * 2 + MOD * 10) % MOD;
	}

	return 0;
}

Measured memory_bytes: 3744
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD=1777777777;
const ll INF=1000000000;
const ll LINF=4000000000000000010;
vector<int> v[100010];
int id[100010];
bool vis[100010];
int main(){
	int n;cin>>n;
	int s=0;
	bool f=true;
	for(int i=1;i<=1000;i++){
		s+=i;
		if(s==n){
			f=false;
			s=i;
			break;
		}
		if(s>100000){
			break;
		}
	}
	if(f){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	int c=(n*2)/s;
	cout<<(n*2)/s<<endl;
	int k=1;
	cout<<s<<" ";
	for(int i=0;i<s;i++){
		cout<<k;
		v[0].push_back(k);
		k++;
		if(i<s-1)cout<<" ";
	}
	cout<<endl;
	for(int i=0;i<c-1;i++){
		cout<<s<<" ";
		int co=0;
		id[i+1]=i+1;
		for(int j=max(i-s+1,0);j<=i;j++){
			cout<<v[j][id[j]]<<" ";
			v[i+1].push_back(v[j][id[j]]);
			id[j]++;
			co++;
		}
		while(co<s){
			cout<<k<<" ";
			k++;
			co++;
			v[i+1].push_back(k-1);
		}
		cout<<endl;
	}
}	


Measured memory_bytes: 4608
while True:
    ans = 0
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        exit()
    for i in range(1,n - 1):
        for j in range(i + 1, n):
            for k in range(j + 1, n + 1):
                if i + j + k == x:
                    ans += 1
    print(ans)


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
 	ll cost;
 };
using Graph = vector<vector<Edge>>;

const int MAX = 10000000;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = LLONG_MAX;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/****** define constant end ********/
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
	if (n & 1)
	  res = res * a % mod;
	a = a * a % mod;
	n >>= 1;
  }
  return res;
}
/****** define variable start ******/
ll s;
/******* define variable end *******/
int solve() {
	cin >> s;
	vl dp(s+1, 0);
	dp[0] = 1;
	REP(i, s+1){
		REP(j, i-2){
			dp[i] += dp[j];
			dp[i] %= MOD;
		}
	}
	cout << dp[s] << endl;
	return 0;
}

int main() {
	// clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


Measured memory_bytes: 3656
#include "stdio.h"
#include <iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>

using namespace std;
typedef long long int lld;

int main(){
	int n;
	cin>>n;
	int A,B;
	cin>>A>>B;
	int l,m,r;
	l=0;m=0;
	r=0;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		if(x<=A)l++;
		if(x>A && x<=B)m++;
		if(x>B)r++;
	}
	cout<<min(l,min(r,m))<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;


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

  string res = "";


  ll Smin = min(S.size(), T.size());

  sort(S.begin(), S.end());
  sort(T.begin(), T.end(),greater<ll>());

  REP(i, Smin)
  {
    if(S[i] - '0' < T[i] - '0')
    {
      res = "Yes";
      break;
    }
    else if(S[i] - '0' == T[i] - '0')continue;
    else
    {
      res = "No";
      break;
    }
  }

  if(res == "")
  {
    //Sのほうが短いなら
    if(S.size() < T.size())
    {
      res = "Yes";
    }
    else
    {
      res = "No";
    }
  }
  cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
//  0563.cpp
//  2012/11/07.

#if 1

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

const ll INF = 1LL << 62;

ll calc(vint& v, int p)
{
	ll res = 0;
	
	rep(i, v.size()) res += 2 * abs(p - v[i]);
	
	return res;
}

int main()
{
    int W, H, N;
	cin >> W >> H >> N;
	
	vint X(N), Y(N);
	vector<pint> points(N);
	rep(i, N)
	{
		cin >> X[i] >> Y[i];
		points[i] = mp(X[i], Y[i]);
	}
	
	sort(ALL(X));
	sort(ALL(Y));
	
	ll best = INF, best_x = 0, best_y = 0;
	int px[] = { X[(N-1)/2], X[(N+1)/2] };
	int py[] = { Y[(N-1)/2], Y[(N+1)/2] };
	
	rep(i, 4)
	{
		int x = px[i/2], y = py[i%2];
		ll sub = calc(X, x) + calc(Y, y);

		int far_dst = 0;
		rep(j, N) chmax(far_dst, abs(x - points[j].first) + abs(y - points[j].second));

		sub -= far_dst;
		
		if(sub < best)
		{
			best = sub;
			best_x = x;
			best_y = y;
		}
	}

	cout << best << endl << best_x << " " << best_y << endl;
}

#endif

Measured memory_bytes: 2592
import sys

S = list(input())
if S[0] != 'A':
    print('WA')
    sys.exit()

S_aida = S[2:-1]
if S_aida.count("C") != 1:
    print('WA')
    sys.exit()

S.pop(0)
S.pop(S.index('C'))

for string in S:
    if not string.islower():
        print('WA')
        sys.exit()

print('AC')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
const int N = 1e5 + 10;

int a[N];

int main() {
	int n;
	std::cin >> n;
	int minus = 0;
	for (int i = 0; i < n; ++i)
	{
		int cur = 0;
		std::cin >> cur;
		if (cur != 0)
			a[cur - 1]++;
		else
			minus++;
		a[cur]++;
		a[cur + 1]++;
	}
	int max = minus;
	for (int i = 0; i < N; ++i) {
		max = std::max(max, a[i]);
	}
	std::cout << max;
}

Measured memory_bytes: 640
<?php
$p='';
while(1){
  list($a,$o,$b)=explode(' ',trim(fgets(STDIN)));
  if($o=='?')break;
  elseif($o=='+')$p.=$a+$b;
  elseif($o=='-')$p.=$a-$b;
  elseif($o=='*')$p.=$a*$b;
  elseif($o=='/')$p.=floor($a/$b);
  $p.=PHP_EOL;
}
print $p;

Measured memory_bytes: 15308
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int main()
{
	int a[3] = {0};
	int b[3] = {0};
	int key = 0;

	int c[3][3] = { 0 };

	for (int i = 0; i < 3; i++) {
		for (int k = 0; k < 3; k++) {
			cin >> c[i][k];
		}
	}

	for (int i = 0; i <= c[0][0]; i++) {
		a[0] = c[0][0] - i;
		b[0] = c[0][0] - a[0];
		//上段
		b[1] = c[0][1] - a[0];
		b[2] = c[0][2] - a[0];
		//中段
		a[1] = c[1][0] - b[0];
		a[2] = c[2][0] - b[0];
		
		if (a[0] + b[0] == c[0][0] && a[0] + b[1] == c[0][1] && a[0] + b[2] == c[0][2]){
			if (a[1] + b[0] == c[1][0] && a[1] + b[1] == c[1][1] && a[1] + b[2] == c[1][2]){
				if (a[2] + b[0] == c[2][0] && a[2] + b[1] == c[2][1] && a[2] + b[2] == c[2][2]){
					key = 1;
					}
				}
			}

		if (key == 1) { break; }
	}

	if (key == 1) {
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.math.BigInteger;
 
public class Main implements Runnable {
	
	//static int mod = 1000000007;

    public static void main(String[] args) {
    	new Thread(null, new Main(), "", 1024 * 1024 * 1024).start();
    }
    
    public void run() {
        FastScanner sc = new FastScanner();

        long w = sc.nextInt();
        long h = sc.nextInt();
        long x = sc.nextInt();
        long y = sc.nextInt();
        double rec = w*h/(double)2;

        System.out.print(rec + " ");
        
        if(x*2 == w && y*2 == h){
            System.out.print(1);
        }
        else{
            System.out.print(0);
        }
        
    }

}


class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}
	public int[] nextIntArray(int n){
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = nextInt();
		}
		return a;
	}
	public Integer[] nextIntegerArray(int n){
		Integer[] a = new Integer[n];
		for(int i=0;i<n;i++){
			a[i] = nextInt();
		}
		return a;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 22740
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

inline double convertDeg2Rad(const int degree)	{ return ((double)degree / 180 * M_PI); }
inline double square(const double x)			{ return pow(x, 2); }

int main() {
	int a, b, C;
	double S, L, h;
	cin >> a >> b >> C;

	h = b * sin(convertDeg2Rad(C));
	L = a + b + sqrt(square(a) + square(b) - 2 * a * b * cos(convertDeg2Rad(C)));
	S = a * h * 0.5;

	cout << fixed << setprecision(8) << S << endl
	     << L << endl
	     << h << endl;
	return 0;
}



Measured memory_bytes: 3452
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,c;
	cin>>n>>m>>c;
	int b[m];
	for(int i=0;i<m;i++){
		cin>>b[i];
	}
	int a[n][m];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>a[i][j];
		}
	}
	int ans=0;
	for(int i=0;i<n;i++){
		int tmp=0;
		for(int j=0;j<m;j++){
			tmp+=a[i][j]*b[j];
		}
		tmp+=c;
		if(tmp>0){
			ans++;
		}
	}
	cout<<ans;
}

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

using namespace std;


// Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
// initialize: UnionFind UF(N)

class UnionFind {                                              // OOP style
private:
	vector<int> p, rank, setSize;
	// p = path toward the root of disjoint set; p[i] = i means it is root
	// rank = upper bound of the actual height of the tree; not reliable as accurate measure
	// setSize = size of each disjoint set

	int numSets;
public:
	UnionFind(int N) {
		setSize.assign(N, 1);
		numSets = N;
		rank.assign(N, 0);
		p.assign(N, 0);
		for (int i = 0; i < N; i++) p[i] = i;	// each belongs to its own set
	}

	int findSet(int i) {
		return (p[i] == i) ? i : (p[i] = findSet(p[i]));		// path compression: cut short of the path if possible
	}

	bool isSameSet(int i, int j) {
		return findSet(i) == findSet(j);
	}

	void unionSet(int i, int j) {
		if (!isSameSet(i, j)) {
			numSets--;
			int x = findSet(i), y = findSet(j);
			// rank is used to keep the tree short
			if (rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
			else {
				p[x] = y; setSize[y] += setSize[x];
				if (rank[x] == rank[y]) rank[y]++;
			}
		}
	}

	int numDisjointSets() {		// # of disjoint sets
		return numSets;
	}

	int sizeOfSet(int i) {		// size of set
		return setSize[findSet(i)];
	}
};


#define MAXN 100010

long long xcount[MAXN * 2], ycount[MAXN * 2];

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

	long long n, i, j, k, x, y, ans;
	cin >> n;

	UnionFind uf(MAXN * 2);
	for (i = 0; i < n; i++) {
		cin >> x >> y;
		uf.unionSet(x, y + MAXN);
	}

	for (i = 0; i < MAXN * 2; i++) {
		if (uf.sizeOfSet(i) != 1) {
			if (i < MAXN) xcount[uf.findSet(i)]++;
			else ycount[uf.findSet(i)]++;
		}
	}

	ans = 0;
	for (i = 0; i < MAXN * 2; i++) {
		ans += xcount[i] * ycount[i];
	}
	ans -= n;

	cout << ans << "\n";
	   	   
	return 0;
}


Measured memory_bytes: 3712
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"2018 218"# => "Yes",
// r#"2763 0"# => "No",
r#"5 3 2"# => "NO",

}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: usize,
        b: usize,
    }

    if b >= a {
        a
    } else {
        a - 1
    }.to_string()
}

Measured memory_bytes: 4352
#include<stdio.h>
#include<string.h>
int MAX(int a,int b){return a<b?b:a;}
//int P[1010],L[1010],R[1010],H[1010],C=1;
int P[4][1010],C=1,H[1010];
//int hyouka(int i,int x){return N[i]<=x?N[i]<x?-1:0:1;}
char N[1010][110];
int hyouka(int i,char *s){return strcmp(N[i],s);}
int h(int a){return H[P[2][a]]-H[P[1][a]];}
void rot(int a,int t){
  int b=P[t][a],r=P[0][a];
  P[t][r]==a?(P[1][r]=b):(P[2][r]=b);
  if(P[3-t][b])P[0][P[3-t][b]]=a;
  P[t][a]=P[3-t][b];
  P[3-t][b]=P[0][b];
  P[0][b]=P[0][a];
  P[0][a]=b;
  H[a]=MAX(H[P[1][a]],H[P[2][a]])+1;
  H[b]=MAX(H[P[1][b]],H[P[2][b]])+1;
}
void rotr(int a){
  int b=P[2][a],r=P[0][a];
  P[2][r]==a?(P[1][r]=b):(P[2][r]=b);
  if(P[1][b])P[0][P[1][b]]=a;
  P[2][a]=P[1][b];
  P[1][b]=P[0][b];
  P[0][b]=P[0][a];
  P[0][a]=b;
  H[a]=MAX(H[P[1][a]],H[P[2][a]])+1;
  H[b]=MAX(H[P[1][b]],H[P[2][b]])+1;
}
int mfind(char *x){
  int i,j,r,n;
  if(C==1){
    P[1][0]=C;
    //N[C]=x;
    strcpy(N[C],x);
    P[0][C++]=0;
    return 1;
  }
  for(i=1;r=hyouka(i,x);i=n){
    if(r<0){
      if(P[1][i]==0){
	P[1][i]=C;
	P[0][C]=i;
	H[i]=MAX(1,H[i]);
	//N[C]=x;
	strcpy(N[C],x);
	C++;
      }
      n=P[1][i];
    }
    else{
      if(P[2][i]==0){
	P[2][i]=C;
	P[0][C]=i;
	H[i]=MAX(1,H[i]);
	strcpy(N[C],x);
	//N[C]=x;
	C++;
      }
      n=P[2][i];
    }
  }//printf("%d\n",i);
  j=P[0][i];
  while(1){
    if(h(j)<-1){
      if(h(P[1][j])>0)rot(P[1][j],1);
      rot(j,2);
      break;
    }
    if(h(j)>1){
      if(h(P[2][j])<0)rot(P[2][j],2);
      rot(j,1);
      break;
    }
    if(h(j)==0)break;
    j=P[0][j];
    if(j==0)break;
  }//printf("%d\n",i);
  return i;
}      
int main(){
  int i,l,max=0,mj=1,r,a[1010]={};
  char *c,*mi,s[1020];
  fgets(s,1010,stdin);
  mi=strtok(s," \n");
  a[mj=mfind(mi)]++;
  max=strlen(mi);
  // printf("%s\n",mi);
  while(c=strtok(NULL," \n")){
    //printf("%s\n",c);
    a[r=mfind(c)]++;
    //printf("%d\n",r);
    l=strlen(c);//printf("%s %d\n",mi,l);
    if(max<l){
      max=l;
      strcpy(mi,c);
    }//printf("a\n");
    if(a[r]>a[mj])mj=r;//printf("a\n");
  }
  //printf("%s %d\n",mi,mj);
  printf("%s %s\n",N[mj],mi);
  return 0;
}

Measured memory_bytes: 564
// 物极必反

#include <bits/stdc++.h>

#define append push_back

using namespace std;
using ll = long long;

const int N = 1e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 22, BL = 400;
const double EPS = 1e-9;
const double PI = acos(-1);
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};

void debug(){
	cerr << "\n";
}
template<typename Type1, typename... Type2>
void debug(Type1 a, Type2... b) {
    cerr << a << " ";
    debug(b...);
}

int main(){
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    long long x; cin >> x;

    if(400 <= x && x <= 599) cout << 8;
    else if(600 <= x && x <= 799) cout << 7;
    else if(800 <= x && x <= 999) cout << 6;
    else if(1000 <= x && x <= 1199) cout << 5;
    else if(1200 <= x && x <= 1399) cout << 4;
    else if(1400 <= x && x <= 1599) cout << 3;
    else if(1600 <= x && x <= 1799) cout << 2;
    else if(1800 <= x && x <= 1999) cout << 1;
    return 0;
}


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

int main(){
    string s;cin>>s;
    vector<int> a;a.push_back(1);
    int length=s.length();
    
    int res[s.length()+1];
    for(int i=0;i<=length;i++)res[i]=0;
    

    for(int i=1;i<length;i++){
        if(s[i]==s[i-1]){int l=a.size();a[l-1]=a[l-1]+1;} 
        else a.push_back(1);
    }
    
     
    int size = a.size();
    int sum=0;
    for(int i=0;i<size/2;i++){
        if(a[2*i]%2==0){
            res[a[2*i]+sum]+=a[2*i]/2;
            res[a[2*i]+sum+1]+=a[2*i]/2;
        }
        else{
            res[a[2*i]+sum]+=(a[2*i]-1)/2+1;
            res[a[2*i]+sum+1]+=(a[2*i]-1)/2;
        }
        if(a[2*i+1]%2==0){
            res[a[2*i]+sum]+=a[2*i+1]/2;
            res[a[2*i]+sum+1]+=a[2*i+1]/2;
        }
        else{
            res[a[2*i]+sum]+=(a[2*i+1]-1)/2;
            res[a[2*i]+sum+1]+=(a[2*i+1]-1)/2+1;
        }


        sum+=a[2*i]+a[2*i+1];
    }
    for(int i=1;i<=length;i++)cout <<res[i]<<endl;
    
  //for(int i=0;i<a.size();i++)cout<<a[i]<<endl;
  //cout << length<<endl;
}

Measured memory_bytes: 4376
import java.util.Scanner;
class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] a = new int[n][m];
        int[] b = new int[m];
        for (int i=0; i<n; i++) {
        		for (int j=0; j<m; j++) {
        			a[i][j] = sc.nextInt();
        		}
        }
        for (int i=0; i<m; i++) {
        		b[i] = sc.nextInt();
        }
        for (int i=0; i<n; i++) {
        		int c = 0;
        		for (int j=0; j<m; j++) {
        			c += a[i][j]*b[j];
        		}
        		System.out.println(c);
        }
    }
}


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

typedef long long ll;

int n, k;
string s;

int solve(int i, int cnt, int upper, bool limit) {
    if (cnt == 0) return 1;
    if (i == n) return 0;
    if (limit) {
        int res = 0;
        if (upper != 0) {
            res += solve(i + 1, cnt - 1, s[i + 1] - '0', true); // choose upper
            res += solve(i + 1, cnt - 1, 0, false) * (upper - 1); // choose others
        }
        res += solve(i + 1, cnt, s[i + 1] - '0', upper == 0); // choose 0
        return res;
    } else {
        return solve(i + 1, cnt - 1, 0, false) * 9
               + solve(i + 1, cnt, 0, false);
    }
}

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

    cin >> s >> k;
    n = s.length();

    int res = solve(0, k, s[0] - '0', true);
    cout << res << endl;

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
    char c[1200] = {0};
    int i = 0;
    int j = 0;
    for(i=0;i<1200;i++){
        scanf("%c",&c[i]);
        if(c[i]=='\n'){
            break;
        }
    }
    for(j=0;j<=i;j++){
        if(c[j]>=65&&c[j]<=90){
            c[j] = c[j]+32;
        }
        else if(c[j]>=97&&c[j]<=122){
            c[j] = c[j]-32;
        }
    }
    for(j=0;j<=i;j++){
        printf("%c",c[j]);
    }
   // printf("\n");
    return 0;
}



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

const ll mod=1e9+7;

template<typename T>inline bool chmax(T &a,const T &b){if(a>=b){return false;}a=b;return true;}
template<typename T>inline bool chmin(T &a,const T &b){if(a<=b){return false;}a=b;return true;}

/*-------------------------------------------*/

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

    int n,ans=0;
    string s;
    cin>>n>>s;
    rep(i,n-2){
        if(s.substr(i,3)=="ABC")ans++;
    }
    cout<<ans<<endl;
}

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

namespace ABC061A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);

            if (a <= c && b >= c)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
            Console.ReadKey();

        }
    }
}

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

int n;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    cin >> n;
    vector<int> a(n), ans;
    for (auto& i : a) cin >> i;
    
    while (!a.empty()) {
        bool found = false;

        for (int i = (int)a.size() - 1; i >= 0; --i) {
            if (a[i] == i + 1) {
                ans.push_back(i + 1);
                a.erase(a.begin() + i);
                found = true;
                break;
            }
        }
        
        if (!found) {
            cout << -1 << "\n";
            return 0;
        }
    }

    reverse(ans.begin(), ans.end());
    for (int i = 0; i < n; i++) cout << ans[i] << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
typedef long long ll;
typedef pair<ll,ll> P;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
#define MAX 100000


int main(){
    ll n;
    cin>>n;
    ll rmain;
    ll quo=n;
    vi p;
    while(n){
        n-=1;
        p.push_back(n%26);
        n=n/26;
    }
    reverse(p.begin(),p.end());

    string a="abcdefghijklmnopqrstuvwxyz";
    for(int i=0;i<p.size();i++){
        cout<<a[p[i]];
    }


}



Measured memory_bytes: 3640
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
int n, k, x ,s;
int u[109];
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>k;
    while(k--) {
        cin>>x;
        while(x--) {
            cin>>s;
            u[s] = 1;
        }
    }
    int ans = 0;
    for(int i=1;i<=n;i++)
        if(u[i] == 0)
            ans++;
    cout<<ans;
}
/*
 2
 1 1
 1 0
 1 1
 1 1
 */


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool chmax(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF 1000000007 //4000000000000000037
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

  int N,K;
  cin>>N>>K;
  vector<int> ve(200001);
  int ct=0;
  rep(i,N) ve[i]=0;
  rep(i,N){
    int a;cin>>a;
    if(ve[a]==0) ++ct;
    ++ve[a];
  }

  sort(ALL(ve),greater<int>());

  int ans=0;

  repr(i,ct-1,K){
    ans+=ve[i];
  }

  cout<< ans <<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>

#define reg register
using namespace std;
int n;

int main(void) {
    int t;
    cin >> t;
    int p = 1000 - (t % 1000);
    if (p == 1000) p = 0;
    cout << p << endl;
    return 0;
}

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

using namespace std;

const int MAXN = 3001;
int N,W;

int Na,Nb,memo[MAXN][MAXN],sol[MAXN][MAXN];
string a,b;

int dp(int i,int j){
	if(i >= Na || j >= Nb)return 0;
	if(memo[i][j] != -1)return memo[i][j];
	int mvs = -1,res = 0;
	if(a[i] == b[j]){
		res = 1 + dp(i + 1,j + 1);
		mvs = 1;
	}
	int r1 = dp(i + 1,j);
	int r2 = dp(i,j + 1);
	if(r1 > res){
		res = r1;
		mvs = 2;
	}
	if(r2 > res){
		res = r2;
		mvs = 3;
	}
	sol[i][j] = mvs;
	return memo[i][j] = res;
} 	

int main(){
	#ifdef EVAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	cin >> a >> b;
	Na = a.size();
	Nb = b.size();
	memset(memo,-1,sizeof(memo));
	int N = dp(0,0);
	//cout << "fine dp " << N <<  endl;
	string res;
	
	for(int n = 0,i = 0,j = 0; n < N;){
		if(sol[i][j] == 1){
			n++;
			res += a[i];
			i++;
			j++;
		}else{
			if(sol[i][j] == 2){
				i++;
			}else{
				if(sol[i][j] == 3){
					j++;
				}else{
					return 1;
				}
			}
		}
	}
	
	cout << res;
	return 0;
}

Measured memory_bytes: 71040
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define Reverse(x) reverse(all(x));
#define Sort(x) sort(all(x));
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    string s,t;
    cin >> s >> t;
    lli ans = INF;
    rep(i,s.size()-t.size()+1){
        lli cnt = 0;
        rep(j,t.size()){
            if(t[j]!=s[i+j]){
                cnt++;
            }
           
        }
        ans = min(ans, cnt);
    }
    out(ans);
}

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

#define EPSILON 1e-6
#define ll long long
#define pii pair<int, int>

int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  string s;
  cin >> s;

  int f1 = true;
  int f2 = true;

  int a = stoi(s.substr(0,2));
  int b = stoi(s.substr(2,2));

  if (a > 12 || a < 1) f1 = false;
  if (b > 12 || b < 1) f2 = false;

  if (f1 && !f2) {
    cout << "MMYY\n";
  }
  else if (!f1 && f2) {
    cout << "YYMM\n";
  }
  else if (f1 && f2) {
    cout << "AMBIGUOUS\n";
  }
  else cout << "NA\n";

  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(input()) for _ in range(N)]
B = [int(input()) for _ in range(N)]
mod = 10**9+7

from bisect import bisect_right as br
from bisect import bisect_left  as bl

A.sort(reverse=True)
B.sort(reverse=True)


ans = 1

def mbr(ls, a):
    ok = N
    ng = 0
    mid = (ok+ng)//2
    while abs(ok-ng) > 1:
        if ls[mid] >= a:
            ng = mid
        else:
            ok = mid
        mid = (ok+ng)//2

    return ok

for i in range(N):
    a,b = A[i], B[i]
    if a > b:
        idx = mbr(A,b)
        ans = ans * (idx-i) % mod
    else:
        idx = mbr(B,a)
        ans = ans * (idx-i) % mod
print( ans % mod)

Measured memory_bytes: 62464
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] T = new int[N+1];
        for(int i = 1; i <= N; i++){
        	T[i] = sc.nextInt();
        }
        int M = sc.nextInt();
        int[] P = new int[M+1];
        int[] X = new int[M+1];
        for(int i = 1; i <= M; i++){
        	P[i] = sc.nextInt();
        	X[i] = sc.nextInt();
        }
        int sum;
        for(int i = 1; i <= M; i++){
        	sum = 0;
        	for(int j = 1; j <= N; j++){
        		if(j == P[i]){
        			sum = sum + X[i];
        		}
        		else sum = sum + T[j];
        	}
        	System.out.println(sum);
        }  
	}

}

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



int main(){
	
	string S;
	cin>>S;
	
	long long K;
	cin>>K;
	
	bool f = false;
	for(int i=0;i<min((long long)S.size(),K);i++){
		if(S[i]!='1')f=true;
	}
	
	if(!f){
		cout<<1<<endl;
		return 0;
	}
	
	for(int i=0;i<S.size();i++){
		if(S[i]!='1'){
			cout<<S[i]<<endl;
			return 0;
		}
	}
	
    return 0;
}


Measured memory_bytes: 256