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

using namespace std;

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

    char s[10]="";
    int cnt=0;
    for (int i=1;i<=N;i++) {
        sprintf(s, "%d", i);
        if (strlen(s)%2==1) {
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}

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

int main() {
	// your code goes here
	string s;
	cin>>s;
  int l=0;
if(s[0]=='R' && s[1]=='R' && s[2]=='R'){
	cout<<3;
}
else if((s[0]=='R' && s[1]=='R') || (s[1]=='R' && s[2]=='R')){
	cout<<2;
}
	else if(s[0]=='S' && s[1]=='S' && s[2]=='S'){
	cout<<0;
}
else cout<<"1";
	return 0;
}

Measured memory_bytes: 3624
def resolve():
    S=input()
    T=input()
    a,b={},{}
    for s,t in zip(S,T):
        if a.setdefault(s,t)!=t :
            print('No')
            return()
        if b.setdefault(t,s)!=s :
            print('No')
            return()
    print('Yes')
resolve()

Measured memory_bytes: 3632
#include <cstdio>
#include <vector>

constexpr int MAX_N = 100100;

using namespace std;
using ll = long long;

int n;
int arr[MAX_N];

int my_abs(int x) {
    return x < 0 ? -x : x;
}

int main() {
    scanf(" %d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf(" %d", &arr[i]);
    }

    ll initial = 0;
    for (int i = 1; i <= n + 1; ++i) {
        initial += my_abs(arr[i] - arr[i - 1]);
    }

    for (int i = 1; i <= n; ++i) {
        printf("%lld\n", initial - my_abs(arr[i] - arr[i - 1]) - my_abs(arr[i + 1] - arr[i]) + my_abs(arr[i - 1] - arr[i + 1]));
    }

    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld%lld",&n,&m)
#define scs(ch) scanf("%s", ch)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

ll trie[1000002][27];
ll cnt[30],ans=0,nxt=1;

char ch[1000005];
ll vec[1000005][27];
vector < pair < ll,string> > tmp;
string s;

void op(ll node,ll p)
{
    //cout<<node<< " " <<p<< " " <<ans<<endl;
    if(p<0)return;
    ll i,j,k,a,b,c,x,y,z;
    z=s[p]-'a';


    for(i=0;i<26;i++){
        if(cnt[i]>0){
            ans+=vec[node][i];
        }
    }
    if(trie[node][z]==0){
        trie[node][z]=nxt++;
    }
    if(p==0){
        //cout<<node<<endl;
        vec[node][z]++;
    }
    cnt[z]--;
    op(trie[node][z],p-1);
    return;

}

int main()
{
    ll n,m,i,j,k,a,b,c,x,y,z;
    scl(n);
    for(i=1;i<=n;i++)
    {
        scs(ch);
        s.clear();
        for(j=0;ch[j]!='\0';j++){
            s+=ch[j];
        }
        tmp.pb(mp(j,s));
    }
    sort(tmp.begin(),tmp.end());
    //for(i=0;i<n;i++)cout<<tmp[i].sc<<endl;
    for(i=0;i<n;i++){
        for(j=0;j<26;j++)cnt[j]=0;

        s=tmp[i].sc;
        m=tmp[i].fr;
        for(j=0;j<m;j++){
            cnt[s[j]-'a']++;
        }
        //cout<<i<< " " <<s<<endl;
        op(0,m-1);
        //cout<<endl<<endl;

    }
    cout<<ans<<endl;


    return 0;


}


Measured memory_bytes: 267556
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

struct LazySegmentTree {
private:
    int n;
    vector<ll> node, lazy;

public:
    LazySegmentTree(vector<ll> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }
    // k 番目のノードについて遅延評価を行う
void eval(int k, int l, int r) {

    // 遅延配列が空でない場合、自ノード及び子ノードへの
    // 値の伝播が起こる
    if(lazy[k] != 0) {
        node[k] += lazy[k];

        // 最下段かどうかのチェックをしよう
        // 子ノードは親ノードの 1/2 の範囲であるため、
        // 伝播させるときは半分にする
        if(r - l > 1) {
            lazy[2*k+1] += lazy[k] / 2;
            lazy[2*k+2] += lazy[k] / 2;
        }

        // 伝播が終わったので、自ノードの遅延配列を空にする
        lazy[k] = 0;
    }
}
void add(int a, int b, ll x, int k=0, int l=0, int r=-1) {
    if(r < 0) r = n;

    // k 番目のノードに対して遅延評価を行う
    eval(k, l, r);

    // 範囲外なら何もしない
    if(b <= l || r <= a) return;
    
    // 完全に被覆しているならば、遅延配列に値を入れた後に評価
    if(a <= l && r <= b) {
        lazy[k] += (r - l) * x;
        eval(k, l, r);
    }

    // そうでないならば、子ノードの値を再帰的に計算して、
    // 計算済みの値をもらってくる
    else {
        add(a, b, x, 2*k+1, l, (l+r)/2);
        add(a, b, x, 2*k+2, (l+r)/2, r);
        node[k] = node[2*k+1] + node[2*k+2];
    }
}
ll getsum(int a, int b, int k=0, int l=0, int r=-1) {
    if(r < 0) r = n;
    if(b <= l || r <= a) return 0;

    // 関数が呼び出されたら評価！
    eval(k, l, r);
    if(a <= l && r <= b) return node[k];
    ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
    ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
    return vl + vr;
}
};

int main() {
    int M = 998244353;
    int N, K;
    cin >> N >> K;
    vector<int> L(K), R(K);
    rep(i,0,K) cin >> L[i] >> R[i];

    LazySegmentTree lst(vector<ll>(2*N+5,0));
    lst.add(1,2,1);
//    cout << lst.getsum(1,2) << endl;
    rep(i,1,N) {
        ll tmp = lst.getsum(i,i+1) % M;
//        cout << tmp << endl;
        rep(j,0,K) {
            lst.add(i+L[j],i+R[j]+1,tmp);
        }
    }
    cout << lst.getsum(N,N+1) % M << endl;
}

Measured memory_bytes: 22804
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    fast;
    str x,y; cin>>x>>y;
    int a = x.size(), b = y.size();
    vec<vec<int>> dp(a+1, vec<int>(b+1));
    vec<vec<pii>> pr(a+1, vec<pii>(b+1, {-1, -1}));
    for(int q=1; q<=a; q++){
        for(int w=1; w<=b; w++){
            if(x[q-1]==y[w-1]){
                dp[q][w] = dp[q-1][w-1]+1;
                pr[q][w] = {q-1, w-1};
            }
            else{
                dp[q][w] = max(dp[q-1][w], dp[q][w-1]);
                if(dp[q-1][w] > dp[q][w-1]) pr[q][w] = {q-1, w};
                else pr[q][w] = {q, w-1};
            }
        }
    }
    str o;
    int i = a, j = b;
    for(; i>0;){
        if(x[i-1]==y[j-1]) o.pb(x[i-1]);
        pii p = pr[i][j];
        i = p.F, j = p.S;
    }
    reverse(o.begin(), o.end());
    cout<<o;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n;
ll h[e5];
ll max_height = 0;
ll ans;

int main(){
  cin >> n;
  for(ll i = 0;i < n;i++) cin >> h[i];
  for(ll i = 0;i < n;i++){
    if(h[i] >= max_height) ans++;
    max_height = max(max_height,h[i]);
  }
  cout << ans << endl;
}


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

vector<tuple<int, int, char>> a;
int f(char c, char d) {
    int p, m = 1e9, px = 1e9;
    for(auto [x, y, u] : a) {
        if(x != px) {
            px = x;
            p = -1e9;
        }
        if(u == c)
            p = y;
        if(u == d)
            m = min(m, y - p);
    }
    return m;
}
int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int x, y;
        char u;
        cin >> x >> y >> u;
        a.emplace_back(x, y, u);
    }
    int m = 1e9;
    sort(a.begin(), a.end());
    m = min(m, f('U', 'D') * 5);
    for(auto &[x, y, u] : a)
        swap(x, y);
    sort(a.begin(), a.end());
    m = min(m, f('R', 'L') * 5);
    for(auto &[y, x, u] : a)
        y -= x;
    sort(a.begin(), a.end());
    m = min(m, f('U', 'L') * 10);
    m = min(m, f('R', 'D') * 10);
    for(auto &[y, x, u] : a)
        y += x + x;
    sort(a.begin(), a.end());
    m = min(m, f('D', 'L') * 10);
    m = min(m, f('R', 'U') * 10);
    if(m < 1e8)
        cout << m << endl;
    else
        cout << "SAFE" << endl;
    return 0;
}


Measured memory_bytes: 6336
// can i beat Mod Love? 
#include <bits/stdc++.h>

using namespace std;
#define int long long 
#define eps 1e-8
#define close std::ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
typedef long long ll;
ll bin(ll x, ll n, ll MOD) {ll ret = MOD != 1;for (x %= MOD; n; n >>= 1, x = x * x % MOD)if (n & 1) ret = ret * x % MOD;return ret;}
constexpr int INF = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = acos(-1.0);
constexpr ll mod = 1e9+7;
constexpr int maxn = 5000+100; // remember to calculate.
int n , k , p[maxn], c[maxn], ans = -linf, vis[maxn];
int32_t main()
{
	close;
	cin >> n >> k;
	for(int i = 1; i <= n; i++) cin >> p[i];
	for(int i = 1; i <= n; i++) cin >> c[i];
	for (int i=1; i<=n; i++) {
		ll cur = 0;
		int tmp = 0;
		vector<bool> vis(n+1);
		vis[i] = true;
		int idx = i;
		while (tmp < k) {
			idx = p[idx];
			cur += c[idx];
			ans = max(ans, cur);
			tmp++;
			if (vis[idx]) break;
			vis[idx] = true;
		}
		if (cur > 0) {
			ll mul = k/tmp - 1;
			cur *= mul;
			ans = max(ans, cur);
			tmp = k - mul*tmp;
			idx = i;
			while (tmp--) {
				idx = p[idx];
				cur += c[idx];
				ans = max(ans, cur);
			}
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3724
nv, ne = gets.split.map(&:to_i)

to = []
nv.times do to << [] end

ne.times do 
    u, v, c = gets.split.map(&:to_i)
    to[u] << [v, c, to[v].size]
    to[v] << [u, 0, to[u].size-1]
end

def dfs(to, seen, u, t, f)
    return f if u == t
    seen[u] = true
    to[u].each do |e|
        v, c, rev = e
        next if seen[v] or c == 0
        d = dfs(to, seen, v, t, [f, c].min)
        next if d == 0
        e[1] -= d
        to[v][rev][1] += d
        return d
    end
    return 0
end

ans = 0
while true
    seen = Array.new(nv, false)
    f = dfs(to, seen, 0, nv-1, 10005)
    if f == 0
        puts ans
        break
    else
        ans += f
    end
end



Measured memory_bytes: 9008
/*                    ___          |\    /|           ____   ____   ____  ____
   |     |    /\    /    \ |     | | \  / |    /\    |    \ |    \ |     |    \
   |_____|   /__\   \____  |_____| |  \/  |   /__\   |____/ |____/ |__   |____/
   |     |  /    \       \ |     | |      |  /    \  |      |      |     |   \
   |     | /      \ \____/ |     | |      | /      \ |      |      |____ |    \
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<pl, null_type,less<pl>, rb_tree_tag,tree_order_statistics_node_update>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lb lower_bound
#define ub upper_bound
#define pf push_front
#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define pld pair<long double,long double>
#define endl '\n'
#define loop(i,n) for(ll i=0;i<n;i++)
#define rep(i, begin, end) for (__typeof(begin) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define mod ((ll)(1e9+7))
#define in(x) scanf("%lld",&x)
#define in2(x,y) scanf("%lld %lld",&x,&y)
#define in3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define inv(v) for(auto&i:v) in(i)
#define all(x) x.begin(), x.end()
#define vl vector<ll>
#define ml unordered_map<ll,ll> 
#define vpl vector<pair<ll,ll>>
#define INF 0x3f3f3f3f
 
template<typename T, typename TT>
ostream& operator<<(ostream &os, const pair<T, TT> &t) { return os<<t.first<<" "<<t.second; }
template<typename T>
ostream& operator<<(ostream& os, const vector<T> &t) { for(auto& i: t) os<<i<<" "; return os; }

int main() {
    fast;
    // int t; scanf("%d",&t);
    // while(t--) {
    // }
    ll n,k; in2(n,k);
    vl v(n); inv(v);
    vector<bool> vis(n+1,0);
    ll i=1,c1=0,c2=1;
    if(k<=n) {
        while(k--) i=v[i-1];
        cout<<i<<endl;
        return 0;
    } 
    while(!vis[i]) {vis[i]=1;i=v[i-1];c1++;}
    ll j=v[i-1];
    while(j!=i) j=v[j-1],c2++;
    // cout<<i<<" "<<c1<<" "<<c2<<endl;
    k-=c1-c2;k%=c2;
    while(k--) i=v[i-1];
    cout<<i<<endl; 
    #ifdef LOCAL
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}

Measured memory_bytes: 4864
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for (int i = (int)n - 1; j <= i; --i)

#define dbg(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
template <typename T>
ostream& operator<<(ostream& os, vector<T>& a) {
  for (int i = 0; i < (int)a.size(); ++i)
    os << a[i] << " \n"[i == (int)a.size() - 1];
  return os;
}

constexpr ll MOD = 1000000007;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
  int x;
  cin >> x;
  if (x >= 30)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
  string s;
  cin>>s;

  ll sum=0ll;
    
    for(int i=0;s[i];++i){
      sum+=(s[i]-'0');
    }

    if(sum % 9 ==0)printf("Yes\n");
    else{
      printf("No\n");
    }

    return 0;
}






Measured memory_bytes: 3696
from collections import deque
from itertools import product

H, W = map(int, input().split())
Ch, Cw = map(lambda x: int(x)-1, input().split())
Dh, Dw = map(lambda x: int(x)-1, input().split())
maze = [list(input()) for _ in range(H)] # 迷路
walkFrom = deque([(Ch, Cw)]) # 歩く出発地点の候補集
warpFrom = deque() # ワープ出発地点の候補集
WalkRange = [(1, 0), (-1, 0), (0, 1), (0, -1)]
WarpRange = list(filter(lambda x: not x in WalkRange + [(0, 0)], product(range(-2, 3), repeat=2)))
warpCount = 0

def move(h_from, w_from, moveRange):
  for h_dist, w_dist in moveRange:
    h_to, w_to = h_from + h_dist, w_from + w_dist
    if 0 <= h_to < H and 0 <= w_to < W and maze[h_to][w_to] == '.':
      maze[h_to][w_to] = warpCount
      walkFrom.append((h_to, w_to))

# 迷路上の到達可能な全ての場所について、道(".")を必要なワープ回数で上書きする
maze[Ch][Cw] = warpCount
while walkFrom:
  # 歩ける範囲をすべて歩く
  while walkFrom:
    h, w = walkFrom.popleft()
    warpFrom.append((h, w))
    move(h, w, WalkRange)
  # 一度のワープで到達できる未踏の場所すべてにワープする
  warpCount += 1
  while warpFrom:
    h, w = warpFrom.popleft()
    move(h, w, WarpRange)

goal = maze[Dh][Dw]
print('-1') if goal in ['.', '#'] else print(goal)


Measured memory_bytes: 174800
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long n,q,a,b,c,ans = 0; cin >> n;
    vector<int> v(100000);
    for(int i=0;i<n;i++){
        cin >> a; v[a-1]++; ans += a;
    }
    cin >> q;
    for(int i=0;i<q;i++){
        cin >> b >> c;
        ans += (c-b)*v[b-1];
        cout << ans << endl;
        v[c-1] += v[b-1];
        v[b-1] = 0;
    }
    
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.begin(), a.end())
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t; cin>>t;
    string s;
    map<string, int> m;
    while(t--){
        cin>>s;
        m[s]++;
    }
    cout<<m.size();
    return 0;
}

Measured memory_bytes: 19140
#include <iostream>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

int main(){
    int N,D,ans=0;
    cin>>N>>D;
    double X[10][10],M[10][10];
    for(int i=0;i<N;i++){
        for(int k=0;k<D;k++){
            cin>>X[i][k];
        }
    }
    for(int i=0;i<N-1;i++){
        for(int k=i+1;k<N;k++){
            M[i][k]=0;
            for(int l=0;l<D;l++){
                M[i][k]=M[i][k]+pow((X[i][l]-X[k][l]),2);
            }
             if(ceil(pow(M[i][k],0.5))==floor(pow(M[i][k],0.5)))ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>

int kitamuraeri(const void* asumisu, const void* mizuhasu) {
	int satorina = *(const uint64_t*)asumisu, zaasan = *(const uint64_t*)mizuhasu;
	return satorina > zaasan ? -1 : satorina < zaasan;
}

int32_t N;
uint64_t A[114514];

int main(void) {
	int32_t i;
	uint64_t horieyui = 0;
	if (scanf("%" SCNd32, &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%" SCNu64, &A[i]) != 1) return 1;
	}
	qsort(A, N, sizeof(*A), kitamuraeri);
	for (i = 0; i + 1 < N;) {
		if (A[i] == A[i + 1]) {
			if (horieyui == 0) {
				horieyui = A[i];
				i += 2;
			} else {
				printf("%" PRIu64 "\n", A[i] * horieyui);
				return 0;
			}
		} else {
			i++;
		}
	}
	puts("0");
	return 0;
}


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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 53;

int n, p;
int a[MAXN];
LL dp[MAXN][2];

void init ();
void input ();
void work ();



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here

	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method

	scanf ( "%d%d", &n, &p );
	lpi ( i, 1, n ) scanf ( "%d", &a[i] ), a[i] &= 1;
}

void work ()
{
	// main work

	dp[0][0] = 1;
	lpi ( i, 1, n ){
		lp ( j, 0, 2 ){
			dp[i][j^a[i]] += dp[i-1][j];
			dp[i][j] += dp[i-1][j];
		}
	}

	cout << dp[n][p] << endl;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

    ll N;
    cin >> N;
    vector<string> s(N);
    vector<ll> a(N);
    rep(i, N) {
        cin >> s[i] >> a[i];
    }
    string S; cin >> S;
    ll cnt = 0, f = 0;
    rep(i, N) {
        if (f == 1) {
            cnt += a[i];
        }
        if (S == s[i]) f = 1;

    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] arr = sc.next().toCharArray();
        if (arr[2] == arr[3] && arr[4] == arr[5]) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include <cstdint>
#include <iostream>
#include <map>
#include <vector>
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); i++)

using namespace std;

const int H = 80, W = 80;
int table[H + 1][W + 1][2];
int dp_pre[W + 1][15001];
int dp[W + 1][15001];

int main() {
  int h, w;
  scanf("%d%d", &h, &w);
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      scanf("%d", &table[i][j][0]);
    }
  }
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      scanf("%d", &table[i][j][1]);
    }
  }
  dp_pre[1][0] = 1;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      int diff = abs(table[i][j][0] - table[i][j][1]);
      for (int k = 0; k <= 15000; k++) {
        if (dp_pre[j][k] || dp[j - 1][k]) {
          int tmp1 = abs(k - diff);
          int tmp2 = abs(k + diff);
          dp[j][tmp1] = 1;
          dp[j][tmp2] = 1;
        }
      }
    }
    for (int j = 1; j <= w; j++) {
      for (int k = 0; k <= 15000; k++) {
        dp_pre[j][k] = dp[j][k];
        dp[j][k] = 0;
      }
    }
  }
  for (int k = 0; k <= 15000; k++) {
    if (dp_pre[w][k]) {
      printf("%d\n", k);
      return 0;
    }
  }
}


Measured memory_bytes: 9728
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) throws Exception {
	    Scanner sc = new Scanner(System.in);   
	    
	    int A = sc.nextInt();
	    int B = sc.nextInt();
	    
	    for (int i = 1; i <= 3; i++) {
	    	if ((A * B * i) % 2 == 1) {
	    		System.out.println("Yes");
	    		return;
	    	}
	    }
	    
	    System.out.println("No");
	}    
}	

Measured memory_bytes: 22608
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main(){
   int a,b,c;
   cin>>a>>b>>c;
   if(a+b+c>=22) cout<<"bust"<<endl;
   else cout<<"win"<<endl;
   
    return 0;
}

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

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

	int cnt = 0;
	for(int i = 1; i < S.size(); ++i) {
		if(S.at(i - 1) == S.at(i)) {
			if(S.at(i) == '0') {
				S.replace(i, 1, "1");
			} else {
				S.replace(i, 1, "0");
			}
			cnt++;
		}
	}

	cout << cnt << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;cin>>n;
    string s;cin>>s;
    vector<int> ok1(10,0);
    vector<vector<int>> ok2(10,vector<int>(10,0));
    vector<vector<vector<int>>> ok3(10,vector<vector<int>>(10,vector<int>(10,0)));
    int ans = 0;
    for(int i=0; i<n; i++){
        int num = s[i]-'0';
        for(int j=0; j<10; j++){
            for(int k=0; k<10; k++){
                if(ok2[j][k])ok3[j][k][num]=1;
            }
        }
        for(int j=0; j<10; j++){
            if(ok1[j])ok2[j][num]=1;
        }
        ok1[num]=1;
    }
    for(int i=0; i<10; i++){
        for(int j=0; j<10; j++){
            for(int k=0; k<10; k++)if(ok3[i][j][k])ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

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

  string S;
  cin >> S;

  int dome_st = 0, fori_st = 0, sum = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == 'a') {
      if (sum < A+B) {
        dome_st++;
        cout << "Yes" << endl;
      }
      else cout << "No" << endl;
    }
    else if (S[i] == 'b') {
      if (sum < A+B && fori_st < B) {
        fori_st++;
        cout << "Yes" << endl;
      }
      else cout << "No" << endl;
    }
    else cout << "No" << endl;   // if(S[i] == c)
    sum = dome_st + fori_st;
  }

  return 0;
}


Measured memory_bytes: 896
function Main(i: string) {
	const input = splitBySpace(i);
  let a = +input[0];
  let b = +input[1];
	console.log(a * b % 2 === 0 ? 'Even' : 'Odd');
}

function splitBySpace(input: string): string[] {
  return input.split(" ");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

enum P = 10L^^9+7;
long[(10^^6)*2+50] F, RF;

long pow(long x, long n) {
    long y = 1;
    while (n) {
        if (n%2 == 1) y = (y * x) % P;
        x = x^^2 % P;
        n /= 2;
    }
    return y;
}

long inv(long x)
{
    return pow(x, P-2);
}

void init()
{
    F[0] = F[1] = 1;
    foreach (i, ref x; F[2..$]) x = (F[i+1] * (i+2)) % P;

    {
        RF[$-1] = 1;
        auto x = F[$-1];
        auto k = P-2;
        while (k) {
            if (k%2 == 1) RF[$-1] = (RF[$-1] * x) % P;
            x = x^^2 % P;
            k /= 2;
        }
    }
    foreach_reverse(i, ref x; RF[0..$-1]) x = (RF[i+1] * (i+1)) % P;
}

long comb(N)(N n, N k)
{
    if (k > n) return 0;
    auto n_b = F[n];    // n!
    auto nk_b = RF[n-k]; // 1 / (n-k)!
    auto k_b = RF[k];    // 1 / k!

    auto nk_b_k_b = (nk_b * k_b) % P; // 1 / (n-k)!k!

    return (n_b * nk_b_k_b) % P;  // n! / (n-k)!k!
}

void main()
{
    init();
    auto K = readln.chomp.to!long;
    auto S = readln.chomp;
    auto len = S.length.to!long;

    long x;
    foreach (k; 0..K+1) {
        auto y = comb(len+k-1, len-1) * pow(25, k) % P * pow(26, K-k) % P;
        (x += y) %= P;
    }
    writeln(x);
}

Measured memory_bytes: 35856
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

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

	ll N; cin >> N;
	if (N % 2 == 1) cout << 0 << endl;
	else {
		ll ans = 0;
		ll num = 5LL;
		while (N >= num) {
			ans += N / num / 2;
			num *= 5;
		}
		cout << ans << endl;
	}

	return 0;
}

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

pair<int,int> calc(int a){
    int x,y;
    x = a%10;
    y = 0;
    while(a != 0){
        y = a;
        a /= 10;
    }
    return pair<int,int>(x,y); 
}

int main(){
    int n; cin>>n;
    long long sum =0;

    map <pair<int,int>,int> cnt;
    
    for(int i=1; i<=n; i++){
        cnt[calc(i)]++;
    }

    for(int i=1; i<=n; i++){
        pair<int,int> def;
        def = calc(i);
        pair<int,int> rev(def.second,def.first);
        sum += cnt[rev];
    }

    cout<<sum<<endl;

    return 0;
}

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

int main(){
    int n; int k; cin >> n >> k;
    vector<int>a(n);
    rep(i,n) a[i] = i+1;
    while(a[0] < k){
        rep(i,n){
            if(a[i] < k) a[i] *= 2;
        }
    }
    //rep(i,n) cout << a[i] << " "; cout << endl;
    rep(i,n) a[i] /= i+1;
    double ans = 0.0;
    rep(i,n) ans += 1.0/a[i];
    ans /= n;

    //rep(i,n) cout << a[i] << " "; cout << endl;
    cout << fixed << setprecision(20);
    cout << ans << endl;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            sS = System.Console.ReadLine().Trim().Split(' ');
            List<int> lstInp = new List<int>();
            for (int i = 0; i < sS.Length; i++) { lstInp.Add(int.Parse(sS[i])); }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = 0;
            for (int i = 0; i < lstInp.Count; i++)                  // 西から一つ一つ調査
            {
                List<int> lstTmp = new List<int>();
                for (int j = 0; j <= i; j++)                        // 該当の山までの一群
                {
                    lstTmp.Add(lstInp[j]);
                }
                if (lstInp[i] >= lstTmp.Max()) { iOut += 1; }       // 該当の山までの一群の中で最大？
            }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  
  string ok = "NG";
  for (int i = A; i <= B; i++){
     if(i % K == 0){
       ok = "OK";
       break;
     }
  }
  
  cout << ok << endl;
}


Measured memory_bytes: 3624
from collections import defaultdict

N, M = map(int, input().split())
adjacent = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    adjacent[a].append(b)
    adjacent[b].append(a)

dp = defaultdict(int)
dp[(1, 0)] = 1
for S in range(1 << N):
    for v in range(N):
        if S & (1 << v) == 0:
            continue
        sub = S ^ (1 << v)
        for u in adjacent[v]:
            if sub & (1 << u):
                dp[(S, v)] += dp[(sub, u)]
print(sum(dp[((1 << N) - 1, u)] for u in range(1, N)))


Measured memory_bytes: 3444
#include<iostream>
using namespace std;
int main(){
	int m,f,r;
	while(true){
		cin>>m>>f>>r;
		if(m==-1 && f==-1 && r==-1){
			break;
		}
		if(m==-1 || f==-1){
			cout<<"F"<<endl;
		}
		else if(m+f>=80){
			cout<<"A"<<endl;
		}
		else if(m+f>=65){
			cout<<"B"<<endl;
		}
		else if(m+f>=50){
			cout<<"C"<<endl;
		}
		else if(m+f>=30){
			if(r>=50){
				cout<<"C"<<endl;
			}
			else{
				cout<<"D"<<endl;
			}
		}
		else if(m+f<=30){
			cout<<"F"<<endl;
		}
	}
}

Measured memory_bytes: 1152
import sys
from collections import Counter
from itertools import permutations

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, C = map(int, readline().split())
    D = [0] * C
    for i in range(C):
        D[i] = list(map(int, readline().split()))
    G = [0] * N
    for i in range(N):
        G[i] = [int(s) - 1 for s in readline().split()]

    counter = [[0] * C for _ in range(3)]
    cost = [[0] * C for _ in range(3)]
    for x in range(N):
        for y in range(N):
            counter[(x + y) % 3][G[x][y]] += 1

    for cur_cost, cur_counter in zip(cost, counter):
        for i in range(C):
            for j in range(C):
                cur_cost[i] += cur_counter[j] * D[j][i]

    ans = INF
    for c1, c2, c3 in permutations(range(C), 3):
        if ans > cost[0][c1] + cost[1][c2] + cost[2][c3]:
            ans = cost[0][c1] + cost[1][c2] + cost[2][c3]

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 11816
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(x...) cerr << __LINE__ << ": " << #x << " = "; DBG::_print(x)
#else
#define DEBUG(x...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;



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

   int N;
   cin >> N;

   VI D(N);
   REP(j, N-1) {
      int p;
      cin >> p;
      --p;
      D[p]++;
   }

   REP(u, N)
      cout << D[u] << '\n';

   return 0;
}


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

const int INF = 1e9;

vector<int> get_divisions(int ai) {
  vector<int> d;
  for (int j=1; j<=(int)sqrt(ai); j++) {
    if (ai % j == 0) {
      d.push_back(j);
      if (j != ai / j){
        d.push_back(ai/j);
      }
    }
  }
  return d;
}
int main() {
  int n;
  cin>>n;
  int a[n];
  for (int i=0; i<n; i++) {
    cin>>a[i];
  }
  if (n == 2) {
    cout<<max(a[0], a[1])<<endl;
    return 0;
  }
  sort(a, a+n);
  vector<int> x = get_divisions(a[0]);
  vector<int> y = get_divisions(a[1]);
  vector<int> z = get_divisions(a[2]);

  map<int, int> tmp;
  for (int xi: x) {
    ++tmp[xi];
  }
  for (int yi: y) {
    ++tmp[yi];
  }
  for (int zi: z) {
    ++tmp[zi];
  }

  map<int, int> m;
  vector<int> nums;
  for (auto tmpi: tmp) {
    if (tmpi.second >= 2) {
      m[tmpi.first] = tmpi.second;
      nums.push_back(tmpi.first);
    }
  }

  for (int i=3; i<n; i++) {
    for (int ni: nums) {
      if (a[i] % ni == 0) {
        ++m[ni];
      }
    }
  }
  int ans = 1;

  for (auto mi: m) {
    if (mi.second >= n - 1) {
      ans = max(ans, mi.first);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
<?php

fscanf(STDIN, '%d %d %d', $h, $w, $n);
$a = array();
$b = array();
for ($i = 0; $i < $n; $i++){
	fscanf(STDIN, '%d %d', $a[$i], $b[$i]);
}
$table = array();

$results = array_fill(0, 10, 0);
$results[0] = ($h - 2) * ($w - 2);

for ($i = 0; $i < $n; $i++) {
	for ($j = max($a[$i] - 1, 2); $j <= min($a[$i] + 1, $h - 1); $j++) {
		for ($k = max($b[$i] - 1, 2); $k <= min($b[$i] + 1, $w - 1); $k++) {
            if (isset($table[$j])) {
            	if (!isset($table[$j][$k])) {
                    $table[$j][$k] = 0;
                }

            } else {
            	$tmp = array();
            	$tmp[$k] = 0;
            	$table[$j] = $tmp;
            }
			$results[$table[$j][$k]]--;
			$results[++$table[$j][$k]]++;
		}
	}
}
echo implode(PHP_EOL, $results).PHP_EOL;

Measured memory_bytes: 248568
#include<bits/stdc++.h>
#define ll long long
#define MOD = 1e9+7
#define rep(i,n) for(int i=0;i<(n);++i)
const double PI=3.14159265358979323846; 
const int INF = 1001001001;
using namespace std;


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


Measured memory_bytes: 3624
s,_,*q=open(0)
a=['','']
p=1
for q in q:
  try:
    q,f,c=q.split()
    a[(f<'2')^p]+=c
  except:p^=1
print(a[p^1][::-1]+s[:-1][::p or-1]+a[p])

Measured memory_bytes: 18136
#include <stdio.h>
int main(){

	char str[1001];
	char *p;
	
	scanf("%s\n",str);

	p=str;
	while(*p!='\0'){
		if(*p>='D'){
			*p-=3;
		} else {
			*p+=23;
		}
		p++;
	}
	
	printf("%s\n",str);
	return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const ll INF = 1e18;
const ld PI = acos((ld) - 1);

int main() {
	ld n, d;
	cin >> n >> d;
	int sol = 0;
	while(n--) {
		ld x, y;
		cin >> x >> y;
		ld dist = sqrt(x * x + y * y);
		if(dist <= d) sol++;
	}

	cout << sol << '\n';
}


Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
        ios::sync_with_stdio(0);
        cin.tie(0), cout.tie(0);

       string s1,s2;
       ll n,mark=0;

       cin>>s1;
       cin>>s2;
       n=s2.size();

       for(ll i=0;i<s1.size();i++){
                if(s1[i]!=s2[i]){
                        mark=1;
                }
       }
       if(!(s2[n-1]>='a'&&s2[n-1]<='z')){
        mark=1;
       }
       if(mark==0){
        cout<<"Yes"<<endl;
       }
       else{
        cout<<"No"<<endl;
       }

       return 0;
}


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

int main()
{
    lli h;
    cin>>h;
    lli ans = 0, c = 1;
    while(h > 0) {
        ans = ans + c;
        c = c * 2;
        h = h / 2;
    }
    cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int n,ans,ans1=0;
int main()
{
	cin>>n;
	while(n--)
	{
		char a;
		cin>>a;
		ans=(a=='I'?ans+1:ans-1);
		ans1=max(ans1,ans);
	}
	cout<<ans1<<'\n';
	return 0;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

void solve(){
    int n,m,p;
    cin >> n >> m >> p;
    vector<int> d(m);
    rep(i,0,m){
        cin >> d[i];
        d[i]=(d[i]+n-p)%n;
    }
    sort(d.begin(),d.end());
    
    int ans=min(n-d[0],d[m-1]);
    rep(i,0,m-1) ans=min(ans,2*d[i]+(n-d[i+1]));
    rep(i,1,m) ans=min(ans,2*(n-d[i])+d[i-1]);
    
    ans*=100;
    cout << ans << endl;
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 1256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
void solve(void)
{
  int A,B;
  cin>>A>>B;
  if(B==100)B++;
  cout<<(int)(B*pow(100,A))<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
using ll = long long;
const int INF = 1e9 + 5;

int main()
{
        ll n, m;
        cin>>n>>m;
        vector<ll> height(n), vec(n, 1);
        for(ll i=0; i<n; i++)
        {
            cin>>height[i];
        }
        for(ll i=0; i<m; i++)
        {
            ll a, b;
            cin>>a>>b;
            if(height[a-1] < height[b-1])
            {
                vec[a-1] = 0;
            }
            else if
            (height[a-1] > height[b-1])
            {
                vec[b-1] = 0;
            }
            else
            {
                vec[a-1] = 0;
                vec[b-1] = 0;
            }
        }
        cout<<accumulate(vec.begin(), vec.end(), 0);

    return 0;
}


Measured memory_bytes: 4768
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

bool is_parindrome(const string &s, char c = '?'){
    auto n = s.length();
    for (int i = 0; i < (n+1)/2; ++i) {
        if(s[i] == c || s[n-i-1] == c) continue;
        if(s[i] != s[n-i-1]) return false;
    }
    return true;
}

int main() {
    string s;
    cin >> s;
    int n = s.size();
    string a = s.substr(0, n/2), b = s.substr(n/2+1, n);
    if(is_parindrome(s) && is_parindrome(a) && is_parindrome(b)) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int L = sc.nextInt();
        sc.nextLine();
        String S[] = new String[N];
        
        for(int i=0 ; i< N ; i++){
            S[i] = sc.nextLine();
        }
        
        Arrays.sort(S);
        
        for(String i:S){
            System.out.print(i);
        }
    }
}


Measured memory_bytes: 24660
/*
 * main.c
 *
 *  Created on: 2019/03/03
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

char S[100002] = {0};

int main()
{
	int i = 0;
	int len = 0;
	int ans = 0;
	int zero = 0;
	int one = 0;

	scanf("%s", S);
	len = strlen(S);
	for(i = 0; i < len; i++) {
		if(S[i] == '0') {
			zero++;
		} else {
			one++;
		}
	}

	if (zero > one) {
		ans = one;
	} else {
		ans = zero;
	}

	printf("%d\n", ans*2);
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.lang.*;

class Main {
    static class FastReader
        {
            BufferedReader br;
            StringTokenizer st;

            public FastReader()
            {
                br = new BufferedReader(new
                        InputStreamReader(System.in));
            }

            String next()
            {
                while (st == null || !st.hasMoreElements())
                {
                    try
                    {
                        st = new StringTokenizer(br.readLine());
                    }
                    catch (IOException e)
                    {
                        e.printStackTrace();
                    }
                }
                return st.nextToken();
            }

            int nextInt()
            {
                return Integer.parseInt(next());
            }

            long nextLong()
            {
                return Long.parseLong(next());
            }

            double nextDouble()
            {
                return Double.parseDouble(next());
            }

            String nextLine()
            {
                String str = "";
                try
                {
                    str = br.readLine();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
                return str;
            }
        }
    public static void main(String[] args) {
        FastReader ob = new FastReader();
        int t = ob.nextInt();
        long ans=0;
        int num=3;
        for (int i = 1; i <=t ;i++ ) {
            if(i%3!=0 && i%5!=0){
                ans+=i;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 32792
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
#define NIL -2000000001
#define MAX 2000000000000

int main() {
  long long a, b;
  scanf("%lld %lld", &a, &b);
  printf("%lld\n", a+b/2);
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = str(input())
s = [str(si) for si in s]
ans = [0 for _ in range(n)]
for i in range(1, n):
    sp = s[:i]
    sp.sort()
    ss = s[i:]
    tmp = ""
    for j in sp:
        if j == tmp: continue
        else:
            if j in ss:
                ans[i] += 1
                tmp = j
print(max(ans))

Measured memory_bytes: 3064