akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// #define LOCAL // 提出時はコメントアウト
#define DEBUG_

typedef long long ll;
const double EPS = 1e-9;
const ll INF = ((1LL<<62)-(1LL<<31));
typedef vector<ll> vecl;
typedef pair<ll, ll> pairl;

template<typename T, typename U>
using mapv = map<T,vector<U>>;

#define ALL(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define contains(S,x) find(ALL(S),x) != S.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> vector<vector<T>> genarr(ll n, ll m, T init) { return vector<vector<T>>(n,vector<T>(m,init)); }

///// For Debug

#define DUMPOUT cerr
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
template<typename T>istream&operator>>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<typename T,typename U>ostream&operator<<(ostream&os,pair<T,U>&pair_var){os<<"("<<pair_var.first<<", "<<pair_var.second<<")";return os;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&vec){os<<"{";for(int i=0;i<vec.size();i++){os<<vec[i]<<(i+1==vec.size()?"":", ");}
os<<"}";return os;}
template<typename T,typename U>ostream&operator<<(ostream&os,map<T,U>&map_var){os<<"{";repi(itr,map_var){os<<*itr;itr++;if(itr!=map_var.end())os<<", ";itr--;}
os<<"}";return os;}
template<typename T>ostream&operator<<(ostream&os,set<T>&set_var){os<<"{";repi(itr,set_var){os<<*itr;itr++;if(itr!=set_var.end())os<<", ";itr--;}
os<<"}";return os;}
void dump_func(){DUMPOUT<<endl;}
template<class Head,class...Tail>void dump_func(Head&&head,Tail&&...tail){DUMPOUT<<head;if(sizeof...(Tail)>0){DUMPOUT<<", ";}
dump_func(std::move(tail)...);}
#ifndef LOCAL
#undef DEBUG_
#endif
#ifdef DEBUG_
#define DEB
#define dump(...)                                                          \
DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
        << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
        << endl                                                            \
        << "    ",                                                         \
    dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

//////////
ll N;
vecl A;
 
vector<vecl> dp;
vecl v;
 
ll solve(ll i,ll j) { // [i,j) 
    if (i==j) return 0;
 
    ll &ans = dp[i][j];
    if (ans != INF) return ans;
 
    ll sum = v[j] - v[i];
    REP(l,i+1,j) {
        chmin(ans,solve(i,l)+solve(l,j)+sum);
    }
 
    assert(ans != INF);
    dump(i,j,ans);
 
    return ans;
}
 
 
int main() {
    #ifdef LOCAL
    ifstream in("../../Atcoder/input.txt");
    cin.rdbuf(in.rdbuf());
    #endif
 
    cin>>N;
    A.assign(N,0);
    rep(i,N){
        cin>>A[i];
    }
 
    dp = genarr(N+10,N+10,INF);
    v.assign(N+10,0);
    rep(i,N) {
        dp[i][i+1] = A[i];
        v[i+1] = v[i] + A[i];
    }
 
    ll sum = v[N] - v[0];
    cout << solve(0,N) - sum << endl;
 
    return 0;
}

Measured memory_bytes: 4848
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	int N;
	cin >> N;
	vector<int> p(N), p_sort(N);
	rep(i, N) {
		cin >> p[i];
		p_sort[i] = p[i];
	}
	sort(all(p_sort));
	int cnt = 0;
	rep(i, N) {
		if (p_sort[i] == p[i]) {
			cnt++;
		}
	}
	if (cnt == N) {
		cout << "YES" << endl;
		return 0;
	}

	vector<int> p_tmp(N, 0);

	rep(i, N) {
		for (int j = i + 1; j < N; j++) {
			rep(k, N) {
				p_tmp[k] = p[k];
			}
			swap(p_tmp[i], p_tmp[j]);
			cnt = 0;
			rep(k, N) {
				if (p_sort[k] == p_tmp[k]) {
					cnt++;
				}
			}
			if (cnt == N) {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
blue_dic={}
for i in range(N):
  s=input()
  if s in blue_dic:
    blue_dic[s]+=1
  else:
    blue_dic[s]=1
    
M=int(input())
red_dic={}
for i in range(M):
  t=input()
  if t in red_dic:
    red_dic[t]+=1
  else:
    red_dic[t]=1
    
answer=0
for s in blue_dic:
  plus=blue_dic[s]
  minus=0
  if s in red_dic:
    minus=red_dic[s]
  
  answer=max(answer,plus-minus)
  
print(answer)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N,M;
    cin >> N>>M;
    vector<int> good(N,1);
    vector<int> H(N);
    for(int i=0;i<N;i++){
        cin >> H[i];
    }
    for(int j=0;j<M;j++){
        int a, b;
        cin >>a >>b;
        if(H[a-1]>H[b-1]){
            good[b-1]=0;
        }else if(H[a-1]==H[b-1]){
            good[a-1]=0;
            good[b-1]=0;
        }else{
            good[a-1]=0;
        }
    }
    int sum=0;
    for(int k=0;k<N;k++){
        sum+=good[k];
    }
    cout << sum <<endl;
}

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

typedef long long ll;

int main()
{
    int cake_num[3];
    int k;
    vector<vector<ll> >  cake_val(3);
    vector<ll>  cake_sum;
    vector<ll>  cake_ans;
    for(int i = 0; i < 3; i++)
    {
        int num;
        cin >> num;
        cake_num[i] = num;
    }
    cin >> k;
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0; j < cake_num[i]; j++)
        {
            ll tmp;
            cin >> tmp;
            cake_val[i].push_back(tmp);
        }
    }

    for(int i = 0; i < cake_num[0]; i++)
    {
        for(int j = 0; j < cake_num[1]; j++)
        {
            ll tmp = cake_val[0][i] + cake_val[1][j];
            cake_sum.push_back(tmp);
        }
    }

    sort(cake_val[2].begin(), cake_val[2].end(), greater<ll>());
    sort(cake_sum.begin(), cake_sum.end(), greater<ll>());
    
    for(int i = 0; i < min(k, (int)cake_sum.size()); i++)
    {
        for(int j = 0; j < min(k, (int)cake_val[2].size()); j++)
        {
            ll tmp = cake_sum[i] + cake_val[2][j];
            cake_ans.push_back(tmp);
        }
    }
    
    sort(cake_ans.begin(), cake_ans.end(), greater<ll>());
    for(int i = 0; i < k; i++)
    {
        cout << cake_ans[i] << endl;
    }

}


Measured memory_bytes: 43256
#include<iostream>
using namespace std;
int main(){
	int n,b,f,r,v,p[4][3][10]={0},i,j,k,d,c;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>b>>f>>r>>v;
		p[b-1][f-1][r-1]+=v;
	}
	for(j=0;j<4;j++){
		for(k=0;k<3;k++){
			for(d=0;d<10;d++){
				cout<<" "<<p[j][k][d];
			}
			cout<<endl;
		}
		if(j<3){
			cout<<"####################"<<endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3084
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

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

using namespace std;

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

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

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

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


int main()
{
	ll a, b, c, k;
	cin >> a >> b >> c >> k;

	ll res = 0;

	res = min(k, a);

	k -= (a + b);
	if (k > 0)
	{
		res -= k;
	}

	println(res);
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    if(n % 2 == 0){
        cout << n / 2 - 1 << endl;
    }else{
        cout << n / 2 << endl;
    }
    return 0;
}

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

int next(int n)
{
	n++;
	int res  = n;

	int add = 1;
	while(n)
	{
		if(n%10==4)
		{
		res -= add*4;
		res += add*10;
		n+=10;
		}
		add*=10;
		n/=10;
	}
	return res;
}
int ten(int n)
{
	int res = 1;
	for(int i = 0;i<n;i++)
	{
		res*=10;
	}
	return res;
}


int main()
{
	int n;
	cin >> n;
	int tn = ten(n);
	int bit = 0;
	int A[4];
	cin >> A[1] >> A[2] >> A[3];
	vector<int> l(n);
	for(int i =0 ;i<n;i++)
	{
		cin >> l[i];
	}
	int  ans = 1001001001;
	for(int i = 0;bit<tn;i++)
	{
		//cout<<bit<<endl;
		bit = next(bit);

		int B = bit;
		int cnt[4]={};
		int add[4]={};
		int j = 0;
		while(B)
		{
			add[B%10]+=l[j++];
			cnt[B%10]++;
			B/=10;
		}
		int cost = 0;
		for(int i = 1;i<=3;i++)
		{
			if(cnt[i]==0)cost= 1e9;
			cost += 10*max(0,cnt[i]-1);
			cost += abs(add[i]-A[i]);
		}
		ans = min(ans,cost);
		//if(cost==120)cout<<bit<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
/**
 *    author        : Saurav Paul 
 *    created       : August 15, 2020 6:03 PM
 *    Problem Name  : B - Making Triangle
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc175/tasks/abc175_b
 *    @genarated by : ai-virtual-assistant
**/

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

using ll = long long int ;

void solve(){

    int N ;
    cin >> N ;
    vector<int> V(N) ;

    for(auto &x : V){
        cin >> x ;
    }

    ll ans = 0 ;
    
    auto get = [](int i , int j , int k){
        if(i == j || j == k || k == i) return 0 ;
        vector<int> v({i,j,k}) ;
        sort(v.begin(),v.end()) ;
        if(v[0] + v[1] > v[2]) return 1 ;
        return 0 ;
    } ;

    for(int i = 0 ; i < N ; i++){
        for(int j = i + 1; j < N ; j++){
            for(int k = j + 1; k < N ; k++){
                ans += get(V[i], V[j] , V[k]) ;
            }
        }
    }
    cout << ans << endl ;
}

int main(){
    ios_base::sync_with_stdio(false);

    int testcases = 1;
    for(int i = 1 ; i <= testcases ; i ++){
        solve();
    }

    return 0 ;
}


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

#define vint vector<int> 
#define vbool vector<bool>
#define vvint vector<vector<int>>

#define rep(a, b, c) for(int (a)=(b); (a)<(c); (a)++)
#define all(a) (a).begin(), (a).end()

int main(){

    int n,cn; cin>>n>>cn;
    vector<int> s(n), t(n), c(n);
    rep(i, 0, n){
        cin>>s[i]>>t[i]>>c[i];
    }
    
    long t_max = pow(10, 5) * 2;
    
    vector<vector<int>> schedule(cn, vector<int>(t_max));
    rep(i, 0, n){
        rep(j, s[i]*2-1, t[i]*2){
    
            schedule[c[i]-1][j] = 1;
    
        }
    }
    

    int max = 0;
    rep(i, 0, t_max){
        int count = 0;
        rep(j, 0, cn){
            count+= schedule[j][i];
        }
        if(count > max) max = count;
    }

    cout << max;
}

Measured memory_bytes: 25728
#include<iostream>
#include  <stdio.h>
#include  <cmath>

using namespace std;


int main(){

    int N;
    int T;
    int A;

    cin >> N;
    cin >> T;
    cin >> A;

    int H[N];
    double Tx;
    double Tbet_min;
    double Tbet;
    int ans;

    Tbet_min = 500.0;
    ans = 0;

    for( int n = 0 ; n < N ; n++ ){

        cin >> H[n];
        Tx   = T - H[n] * 0.006;
        Tbet = abs( Tx - A );

        if(Tbet < Tbet_min){
            ans      = n;
            Tbet_min = Tbet;
        }

    }
    cout << ans + 1;





}

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

int main()
{
int n;
  cin>>n;
  int arr[n];
  unordered_map<int,int>m;
  for(int i=1;i<=n-1;i++)
  {
     cin>>arr[i];
    m[arr[i]]++;
  }
//  sort(arr,arr+n);
  for(int i=1;i<=n;i++)
  {
    if(m[i])
    {
      cout<<m.find(i)->second<<endl;
    }
    else
      cout<<0<<endl;
     
    
  }
 
}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i <= k; i++)
#define SZ 110000
#define PB push_back
#define MEM(n, val) memset((n), val, sizeof(n))
#define INF 1000000000
#define F first
#define S second
#define MP make_pair
#define LL long long

int n, k;
string ss;
LL ara[100010], csum[100010];


int main()  {
//    freopen("in.txt", "r", stdin);
    cin >> n >> k;
    cin >> ss;

    ss = " " + ss;n++;

    FOR(i, 1, n - 1)   {
        if((ss[i] == 'A') && (ss[i + 1] == 'C'))    {
            ara[i]++;
        }
    }

    FOR(i, 1, n)   {
        csum[i] = ara[i] + csum[i - 1];
    }

    FOR(i, 1, k)   {
        int l, r;
        cin >> l >> r;
        LL ans = (csum[r] - csum[l - 1]);
        if((r + 1 <= n) && (ss[r] == 'A' && ss[r + 1] == 'C'))    {
            ans--;
        }
        cout << ans << "\n";
    }

    return 0;
}
/**
*/


Measured memory_bytes: 2556
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
long long n,m,i,j,dp[3005][3005],llx=1e9+7,ans;
int main()
{
	cin>>n>>m;
	for (i=0;i<=n;i++) dp[0][i]=1;
	for (i=1;i<=m;i++)
	{
		for (j=0;j<=n;j++)
		{
			if (j>0) 
			{
				(dp[i][j]+=dp[i-1][j-1]+dp[i-1][j])%=llx;
			}
			if (j<n)
			{
				(dp[i][j]+=dp[i-1][j+1]+dp[i-1][j])%=llx;
			}
		}
	}
	for (i=0;i<=n;i++) (ans+=dp[m][i])%=llx;
	n--;
	memset(dp,0,sizeof(dp));
	for (i=0;i<=n;i++) dp[0][i]=1;
	for (i=1;i<=m;i++)
	{
		for (j=0;j<=n;j++)
		{
			if (j>0) 
			{
				(dp[i][j]+=dp[i-1][j-1]+dp[i-1][j])%=llx;
			}
			if (j<n)
			{
				(dp[i][j]+=dp[i-1][j+1]+dp[i-1][j])%=llx;
			}
		}
	}
	for (i=0;i<=n;i++) (ans-=dp[m][i])%=llx;
	cout<<(ans+llx)%llx;
	return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  string s;
  cin >> s;
  int a = s.size() - 2;
  int b = s.size() - 1;
  cout << s[0] << a << s[b] << endl;
}


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

int main(){
    string S, T;

    cin >> S >> T;

    int ans = 0;
    for(int i = 0; i < 3; i++){
        if(S[i] == T[i]){
            ans++;
        }
    }
    cout << ans << endl;
}

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

namespace AOJ0506
{
    class Program
    {
        static void Main()
        {
            var regex = new Regex(@"(\d)\1*");
            ReadInputs()
                .Select(set =>
                {
                    for (var i = 0; i < set.Repeat; i++)
                    {
                        set.Text = regex.Replace(set.Text, match => string.Format("{0}{1}", match.Length, match.Value[0]));
                    }

                    return set.Text;
                })
                .ForEach(Console.WriteLine);

        }

        private static IEnumerable<DataSet> ReadInputs()
        {
            while (true)
            {
                var repeat = int.Parse(Console.ReadLine() ?? "0");
                if (repeat == 0) yield break;
                var text = Console.ReadLine();
                yield return new DataSet {Repeat = repeat, Text = text};
            }
        } 

        private class DataSet
        {
            public int Repeat { get; set; }
            public string Text { get; set; }
        }
    }

    static class EnumerableExtensions
    {
        public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
            {
                action(item);
            }
        }
    }
}

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

using namespace std;

int main()
{
	long long n,i,ans;

	cin >> n;

	ans = 0;
	for(i=1 ;i <= n ; ++i)
	{
		if ((i % 3 > 0) && (i % 5 > 0))
			ans += i;
	}

	cout << ans << endl;

	return(0);
}


Measured memory_bytes: 3584
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'

int n;
vector<int64> ans;

void rec(int64 num){
  //  ans.push_back(num);
  if (num > n) return;
  else {
    ans.push_back(num);
    rec(num * 10 + 3);
    rec(num * 10 + 5);
    rec(num * 10 + 7);
  }
}

inline bool good(string s){
  if (s.find("3") == string::npos || s.find("5") == string::npos || s.find("7") == string::npos) return false;
  else return true;
}

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

  cin >> n;
  rec(0);

  int cnt = 0;
  for (auto x : ans){
    string t = to_string(x);
    if (good(t)) ++cnt;
  }
  print(cnt);

  return 0;
}

Measured memory_bytes: 640
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

n = i()
L = [s() for _ in range(n)]
ans = []
for i in range(ord('a'),ord('z')+1):
    s = chr(i)
    num = 10000
    for j in range(n):
        num = min(num,L[j].count(s))
    if num:
        for i in range(num):
            ans.append(s)
print(''.join(ans))

Measured memory_bytes: 10096
#include <iostream>
#include <algorithm>
#include <vector>
#define endl "\n"
#define whats(x) cout<<#x<<" is: "<<x<<endl;
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s, t;
    cin>>s>>t;
    int lcs[s.length()+1][t.length()+1];
    for(int i=0; i<=s.length(); ++i)
        lcs[i][0]=0;
    for(int i=0; i<=t.length(); ++i)
        lcs[0][i]=0;
    for(int i=1; i<=s.length(); ++i){
        for(int j=1; j<=t.length(); ++j){
            if(s[i-1]==t[j-1]){
                lcs[i][j]=1+lcs[i-1][j-1];
            }
            else{
                lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
            }
        }
    }
    //print the lcs
    string res="";
    size_t i=s.length(), j=t.length();
    while(i>0&&j>0){
        if(s[i-1]==t[j-1]){
            res.push_back(s[i-1]);
            i--;
            j--;
        }
        else{
            if(lcs[i-1][j]>lcs[i][j-1])
                i--;
            else
                j--;
        }
        if(res.size()==lcs[s.size()][t.size()])
            break;
    }
    reverse(res.begin(), res.end());
    cout<<res<<endl;
    return 0;
}


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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

template <class T, class Op = multiplies<T>>
constexpr T power(T a, long long n, Op op = Op(), T e = {1}) {
  assert(n >= 0);
  while (n) {
    if (n & 1) e = op(e, a);
    if (n >>= 1) a = op(a, a);
  }
  return e;
}

template <unsigned M> struct modular {
  using m = modular;
  static constexpr unsigned mod = M;
  unsigned v;
  modular(long long x = 0) : v((x %= mod) < 0 ? x + mod : x) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m b) { if ((int)(v += b.v - mod) < 0) v += mod; return *this; }
  m& operator-=(m b) { if ((int)(v -= b.v) < 0) v += mod; return *this; }
  m& operator*=(m b) { v = (uint64_t)v * b.v % mod; return *this; }
  m& operator/=(m b) { return *this *= power(b, mod - 2); }
  friend m operator+(m a, m b) { return a += b; }
  friend m operator-(m a, m b) { return a -= b; }
  friend m operator*(m a, m b) { return a *= b; }
  friend m operator/(m a, m b) { return a /= b; }
  friend bool operator==(m a, m b) { return a.v == b.v; }
};

using mint = modular<998244353>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  vector f(c + 1, vector(d + 1, mint()));
  vector g(c + 1, vector(d + 1, mint()));
  f[a][b] = 1;
  for (int i = a; i <= c; ++i) {
    for (int j = b; j <= d; ++j) {
      if (i < c) {
        f[i + 1][j] += f[i][j] * j;
        f[i + 1][j] += g[i][j];
      }
      if (j < d) {
        g[i][j + 1] += (f[i][j] + g[i][j]) * i;
      }
    }
  }
  cout << (f[c][d] + g[c][d]).v << '\n';
}


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

void d_m_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input_dp.txt", "r", stdin);
	freopen("output_dp.txt", "w", stdout);
#endif
}

int frog1(int *height, int n)
{
	int dp[n + 1];
	dp[0] = dp[1] = 0;
	dp[2] = abs(height[1] - height[0]);

	for (int i = 3; i <= n; i++)
	{
		int op1 = abs(height[i - 1] - height[i - 2]) + dp[i - 1];
		int op2 = abs(height[i - 1] - height[i - 3]) + dp[i - 2];
		dp[i] = min(op1, op2);
	}

	return dp[n];
}

int main()
{
	d_m_c();

	int n;
	cin >> n;

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

	cout << frog1(height, n);

	return 0;
}

Measured memory_bytes: 4408
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <utility> 
#include <tuple>
#include <iterator>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)




void solve(){
  int n;
  cin >> n;
  vector<int> w;
  rep(i,n){
    int a;
    cin >> a;
    w.emplace_back(a);
  }
  
  int ans=100000000;
  rep(i,n){
    int s1=0;
    int s2=0;
    for(int j=0; j<=i; j++){
       s1 += w[j];
    }
    for(int k=n-1; k>i; k--){
       s2 += w[k]; 
    }
    ans = min(ans, abs(s2-s1)); 
  }
  cout << ans << endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
//Daniel Grzegorzewski
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

int n, m;
VII v;

signed main() {
  init_ios();
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    int x, y;
    cin >> x >> y;
    v.PB({-x, y});
  }
  sort(v.begin(), v.end());
  int wyd = 0;
  while (m) {
    auto p = v.back();
    v.pop_back();
    p.ST = -p.ST;
    if (p.ND >= m) {
      wyd += p.ST*m;
      break;
    }
    wyd += p.ST*p.ND;
    m -= p.ND;
  }
  cout<<wyd<<"\n";
}

Measured memory_bytes: 2420
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float("inf")

for bit in range(1 << d):
    count = 0
    sum = 0
    nokori = set(range(1, d + 1))

    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
            nokori.discard(i + 1)

    # G 点に満たなければ nokori のうち一番大きいものを解く
    if sum < g:
        use = max(nokori)
        n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= g:
        ans = min(ans, count)

print(ans)

Measured memory_bytes: 42604
#include<algorithm>
#include <cstring>
#include <iostream>
#include<cmath>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<vector>
#include<utility>
#include<stack>
#include <complex>
#include <cassert>
using namespace std;

#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOR(i,c) for (__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(),(c).end();
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
typedef int Weight;
struct Edge {
  int src,dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src),dst(dst),weight(weight) {}
};
bool operator<(const Edge &e, const Edge &f) {
  return e.weight > f.weight;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
Weight k_shortestPath(const Graph &g, int s, int t, int k) {
  const int n = g.size();
  Graph h(n);
  REP(u,n)FOR(e,g[u])
    h[e->dst].push_back(Edge(e->dst,e->src,e->weight));

  vector<Weight> d(n,INF); d[t] = 0;
  vector<int> p(n,-1);
  priority_queue<Edge> Q; Q.push(Edge(t,t,0));

  while(!Q.empty()) {
    Edge e = Q.top(); Q.pop();
    if (p[e.dst] >= 0)continue;
    p[e.dst] = e.src;
    FOR(f,h[e.dst]) if (d[f->dst] > e.weight + f->weight) {
      d[f->dst] = e.weight + f->weight;
      Q.push(Edge(f->src, f->dst, e.weight + f->weight));
    }
  }
  if (p[s] == -1) return -1;
  int l = 0;
  priority_queue<Edge> R; R.push(Edge(-1,s,0));
  while(!R.empty()) {
    Edge e = R.top(); R.pop();
    if (e.dst == t && ++l == k) return e.weight + d[s];
    FOR(f,g[e.dst])
      R.push(Edge(f->src,f->dst,e.weight + f->weight - d[f->src] + d[f->dst]));
  }
  return -1;
}

int n;
int l;

int NODE(int i, int S) {
  return i*(1<<l)+S;
}

int f[100];
  
int main() {
  int m,k;
  while(cin>>n>>m>>l>>k,n||m||l||k) {
    Graph tg(n);
    Graph g(n*(1<<l));
    REP(i,m) {
      int a, b, c;
      cin >> a >> b >> c;
      a--;b--;
      tg[a].push_back(Edge(a,b,c));
      tg[b].push_back(Edge(b,a,c));
    }
    int s,t;
    cin >> s >> t;
    s--;t--;
    memset(f,-1,sizeof(f));
    REP(i,l) {
      int a;
      cin >> a; a--;
      f[a] = i;
    }
    REP(i,n) {
      FOR(it, tg[i]) {
        int a = i;
        int b = it->dst;
        int c = it->weight;
        REP(S,1<<l) {
          if (f[i]!=-1 && !(S>>f[i]&1)) continue;
          int A = NODE(a,S);
          int T = S;
          if (f[b]!=-1) T |= 1<<f[b];
          int B = NODE(b,T);
          g[A].push_back(Edge(A,B,c));
        }
      }
    }
    REP(i,n*(1<<l)) {
      FOR(it, g[i]) {
        // cout << i <<" " << it->dst << " " << it->weight << endl;
      }
    }
    int S = 0;
    if (f[s] != -1) S|=1<<f[s];
    
    int ans = k_shortestPath(g,NODE(s,S),NODE(t,(1<<l)-1),k);
    if (ans == -1) cout << "NA" << endl;
    else cout << ans << endl;
  }
}

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

int main(){
  int n;  cin >> n;
  int l[n+1], r[n+1];

  int ans=0;
  for(int i=1; i<=n; i++) {
    cin >> l[i] >> r[i];
    ans += r[i]-l[i]+1;
  }

  cout << ans << endl;

  return 0;
}


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

#define int long long 

#define fs first
#define sc second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define pb push_back
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MP make_pair
#define sqr(x) ((x) * (x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
	fastio;
	#ifdef FlameDragon
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif

	int n, k;
	cin >> n >> k;
	vector<int> bad(10);
	for (int i = 0; i < k; i++) {
		int x;
		cin >> x;
		bad[x] = 1;
	}	
	auto check = [&](int x) {
		while (x) {
			if (bad[x % 10]) return false;
			x /= 10;
		}
		return true;
	};
	while (!check(n)) n++;
	cout << n << '\n';
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<bool> l(m,1);
  for(int i=0;i<n;i++){
    int k;
    cin>>k;
    vector<bool> li(m,0);
    for(int j=0;j<k;j++){
      int a;
      cin>>a;
      li.at(a-1)=1;
    }
    for(int j=0;j<m;j++)
      l.at(j)=l.at(j)&&li.at(j);
  }
  int c=0;
  for(int i=0;i<m;i++)
    if(l.at(i))
      c++;
  cout<<c<<endl;
}

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

int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  string ans = "No";
  if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) {
    ans = "Yes";
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    string s; cin >> s;
    rep(i,s.size()) {
        if (s.substr(i,2) == "BC") s.replace(i,2,"D");
    }
    reverse(all(s));
    int len = 0;
    ll ans = 0;
    rep(i,s.size()) {
        if (s[i] == 'B' || s[i] == 'C') len = 0;
        else if (s[i] == 'D') len++;
        else if (s[i] == 'A') ans += len;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3728
from itertools import accumulate
N, K = map(int, input().split())
P = list(map(int, input().split()))

A = list(accumulate(P))

largest = A[K-1]
point = 0
for i in range(K, N):
    if largest < A[i] - A[i-K]:
        largest = A[i] - A[i-K]
        point = i

ans = 0
for j in range(point - K + 1, point+1):
    p = P[j]
    ans += (((p + 1) * p) / 2) / p

print(ans)

Measured memory_bytes: 31892
# AOJ GRL_5_C Lowest Common Ancestor
# calculate LCA O(logN) for each query

# start form 0 node

# prev[i][k]: 2^k parent of node i 
# Depth[i]: depth of node i from 0


import sys
input = sys.stdin.readline

N = int(input())
Log_N = (N-1).bit_length()

prev = [[-1]*(Log_N+1) for _ in range(N)]
graph = [[] for _ in range(N)]
for i in range(N):
    K, *A = map(int, input().split())
    graph[i] = A
    for a in A:
        prev[a][0] = i

Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]


# BFS
Depth = [-1]*N
q = [0]
Depth[0] = 0
d = 0
while q:
    qq = []
    d += 1
    for p in q:
        for np in graph[p]:
            if Depth[np] == -1:
                Depth[np] = d
                qq.append(np)
    q = qq


# construct
for k in range(Log_N):
    for i in range(N):
        if prev[i][k] == -1:
            prev[i][k+1] = -1
        else:
            prev[i][k+1] = prev[prev[i][k]][k]

# LCA
def LCA(u, v):
    dd = Depth[v] - Depth[u]
    if dd < 0:
        u, v = v, u
        dd = -dd
    
    # set same depth
    for k in range(Log_N+1):
        if dd & 1:
            v = prev[v][k]
        dd >>= 1
    
    if u == v:
        return u
    
    for k in reversed(range(Log_N)):
        pu = prev[u][k]
        pv = prev[v][k]
        if pu != pv:
            u, v = pu, pv
    
    return prev[u][0]


for a, b in Query:
    print(LCA(a, b))


Measured memory_bytes: 65368
#include<stdio.h>
main()
{
	int a,b,c,flag,d = 1;
	int num[200],i,j,k;
	scanf("%d %d %d",&a,&b,&c);
	if(a > b)
	flag = b;
	else flag = a;
	for(i = flag; i > 0; i--)
	{
		if(a % i == 0&&b % i == 0)
		{
		 num[d] = i; 
		 d++;
	    }
	}
   printf("%d",num[c]);
}


Measured memory_bytes: 128
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
          var nums = cin.Read;
          WriteLine(nums.Count(n => n == '1'));	
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 11348
def wanna_go_home():
	s = str(raw_input())
	setlist = sorted(list(set(s)))
	distinct_chars = len(setlist)
	if distinct_chars%2!=0:
		print "No"
	else:
		if distinct_chars==4:
			print "Yes"
		else:
			if ''.join(setlist)=='NS' or ''.join(setlist)=='EW':
				print "Yes"
			else:
				print "No"


if __name__ == "__main__":
	wanna_go_home()

Measured memory_bytes: 2568
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
double a[20][20];
int main(){
	int n,d;
	cin>>n>>d;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < d;j++){
			cin>>a[i][j];
//			cout<<a[n][d]<<endl;
		}
	}
	int ans = 0; 
	for(int i = 0; i < n; i++){
		for(int j = i+1; j < n;j++){
			double sum = 0;
			for(int k = 0; k < d;k++){
//				cout<<a[i][k]<<endl;
				sum+=pow( (a[i][k]-a[j][k]) , 2 );
//				cout<<a[i][k]<<endl;
			}
//			cout<<sqrt(sum)<<endl;
			if( !(sqrt(sum)-(int)sqrt(sum)>0.0000001) ) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;


int main() {
    int n;
    ll a, b, c, d;
    cin >> n >> a >> b >> c >> d;

    for (int i = 0; i < n; ++i) {
        if (i * c - (n - 1 - i) * d <= a - b
            && a - b <= i * d - (n - 1 - i) * c) {
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;

    return 0;
}


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

using namespace std;

#define endl "\n"

double dp[3001][3001];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed;
    cout << setprecision(10);
    int t;
    cin >> t;
    vector<double> A(t);
    for (double &i : A) cin >> i;

    memset(dp, 0, sizeof dp);
    dp[0][0] = 1;
    for (int i = 1; i <= t; i++) {
        for (int j = 0; j <= t; j++) {
            if (j == 0) {
                dp[i][j] = (1.0 - A[i - 1]) * dp[i - 1][j];
            } else {
                dp[i][j] = A[i - 1] * dp[i - 1][j - 1] + (1.0 - A[i - 1]) * dp[i - 1][j];
            }
        }
    }

    double sol = 0;
    for (int i = t / 2 + 1; i <= t; i++) {
        sol += dp[t][i];
    }

    cout << sol << endl;
    return 0;
}

Measured memory_bytes: 74200
#include <stdio.h>
#include <algorithm>
using namespace std;
const int MAX_N=100;
const int MAX_W=10000;
int n,W;
int dp[MAX_N+1][MAX_W+1];
int v[MAX_N];
int w[MAX_N];
int rec(int i,int j){
	if(dp[i][j]>=0){
		return dp[i][j];
	}
	int res;
	if(i==n){
		res=0;
	}
	else if(j<w[i]){
		res=rec(i+1,j);
	}
	else{
		res=max(rec(i+1,j),rec(i+1,j-w[i])+v[i]);
	}
	return dp[i][j]=res;
}
int main(){
	scanf("%d%d",&n,&W);
	for(int i=0;i<n;i++){
		scanf("%d%d",&v[i],&w[i]);
	}
	for(int i=0;i<=MAX_N;i++){
		for(int j=0;j<=MAX_W;j++){
			dp[i][j]=-1;
		}
	}
	printf("%d\n",rec(0,W));
	return 0;

}

Measured memory_bytes: 4972
#include<stdio.h>

int main(){
  int i,j,N,key,A[100];
  
  scanf("%d",&N);
  
  
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  
 
  for(i=0;i<N;i++){
    if(i!=N-1)printf("%d ",A[i]);
    else printf("%d",A[i]);
  }
  printf("\n");

  for(i=1;i<N;i++){
    key=A[i];
    j=i-1;

    while(j>=0 && A[j]>key){  
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=key;

    for(j=0;j<N;j++){
      if(j!=N-1) printf("%d ",A[j]);
      else printf("%d",A[j]);
    }
   printf("\n");
  }
  return 0;
} 


Measured memory_bytes: 2068
input = open(0).read

N, *an = map(int, input().split())


def main():
    ans = 0

    for i in range(N):
        tmp = 0
        while an[i]:
            if an[i] % 2:
                break
            else:
                tmp += 1
                an[i] //= 2

        ans += tmp

    print(ans)
    return


main()


Measured memory_bytes: 4084
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		int[] B = new int[N];
		int[] C = new int[N-1];
		for(int i=0; i<N; i++) {
			A[i] = sc.nextInt();
		}
		for(int i=0; i<N; i++) {
			B[i] = sc.nextInt();
		}
		for(int i=0; i<N-1; i++) {
			C[i] = sc.nextInt();
		}
		sc.close();
		int s = 0;
		int b = 0;
		for(int i=0; i<N; i++) {
			int a = A[i]-1;
			s+=B[a];
			if(i>0 && a-b==1) {
				s+=C[A[i-1]-1];
			}
			b = a;
		}
		System.out.println(s);
	}

}

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

int main(void)
{
    int a[5], k;

    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> k;

    for(int i=0;i<4;i++){
        for(int j=i;j<5;j++){
            if(k<a[j]-a[i]){
                cout << ":(" <<endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
n,x=map(int,input().split())


for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i+5000*j+1000*(n-i-j)==x:
            print(i,j,n-i-j)
            sys.exit()
print(-1,-1,-1)

Measured memory_bytes: 3060
#include<iostream>

using namespace std;

bool is(string s,int len) {	

	bool y = true;
	for(int i = 0; i < len / 2; i++) {

		if(s[i] != s[len - 1 - i]) {
			y = false;
			break;
		}
	}

	return y;
}

int main() {
	string s;
	while(cin >> s) {
		int n = s.length();
		if( is(s,n) && is(s.substr(0,n/2),n/2) && is(s.substr((n+1)/2),n/2) ) cout << "Yes" << endl;
		else cout << "No" << endl;
	} 
	
	return 0;
}


Measured memory_bytes: 256
import math

N, D= input().split()
List = list()
cnt = 0


def Square(one, two):
    sqrt = math.sqrt((one ** 2) + (two ** 2))
    return sqrt


for n in range(int(N)):
    List.append(input().split())

for k in range(int(N)):
    if int(D) >= math.ceil(math.sqrt((int(List[k][0]) ** 2) + (int(List[k][1]) ** 2))):
        cnt += 1


print(cnt)


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

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int n;
    cin >> n;
    ll ans = 0;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    
    int kai = 1;
    int num = 0;
    for (int i = 0; i < n; i++) {
        ans += a[i];
        num++;
        if (kai == 1) {
            kai = 0;
        }
        else {
            kai++;
            i--;
        }
        if (num >= n - 1) break;
    }

    cout << ans << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 4112
import numpy as np

N, M = map(int, input().split())

aced = np.zeros(N, dtype="bool")
waed = np.zeros(N, dtype="int")

AC = "AC"
WA = "WA"

for _ in range(M):
    p, s = input().split()
    p = int(p) - 1

    if s == AC:
        aced[p] = True
    else:
        if not aced[p]:
            waed[p] += 1

ac_count = 0
wa_count = 0

for i in range(N):
    if aced[i]:
        ac_count += 1
        wa_count += waed[i]

print("{} {}".format(ac_count, wa_count))

Measured memory_bytes: 21532
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		//a＜b＜cの条件を満たすとき、Yesを返し、それ以外ならNoを返す
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		if(a<b && b<c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}



Measured memory_bytes: 26164
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstring>
using namespace std;

int main(void) {

	int i = 1;

	int N = 0;
	int M = 0;

	cin >> N;
	
	M = N;

	while (M > 1000) {
		M = M - 1000;
		i++;
	}

	cout << (1000*i-N);

	system("pause");
}

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

int main(void){
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if(A + B == C + D){
		cout << "Balanced" << endl;
	}else if(A + B > C + D){
		cout << "Left" << endl;
	}else{
		cout << "Right" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()

ans = 0
tmp = 0

for i in range(n):
    if tmp+2 > n-1:
        break
    if s[tmp] == 'A' and s[tmp+1] == 'B' and s[tmp+2] == 'C':
        ans += 1
        tmp += 2
        #print(ans,tmp)
    tmp += 1
        
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	long long n,fl[5]={0},ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		if(s[0]=='M') fl[0]++;
		if(s[0]=='A') fl[1]++;
		if(s[0]=='R') fl[2]++;
		if(s[0]=='C') fl[3]++;
		if(s[0]=='H') fl[4]++;
	}
	//cout<<fl[0]<<endl<<fl[1]<<endl<<fl[2]<<endl<<fl[3]<<endl<<fl[4];
	ans=ans+fl[0]*fl[1]*fl[2];
	ans=ans+fl[0]*fl[1]*fl[3];
	ans=ans+fl[0]*fl[1]*fl[4];
	ans=ans+fl[0]*fl[2]*fl[3];
	ans=ans+fl[0]*fl[2]*fl[4];
	ans=ans+fl[0]*fl[3]*fl[4];
	ans=ans+fl[1]*fl[2]*fl[3];
	ans=ans+fl[1]*fl[2]*fl[4];
	ans=ans+fl[1]*fl[3]*fl[4];
	ans=ans+fl[2]*fl[3]*fl[4];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, s, n, m;
  in(n);
  m = n;
  s = 0;
  rep(i, 10){
    a = m % 10;
    m = m / 10;
    s = s + a;
  }
  if(n % s == 0)
    out("Yes");
  else
    out("No");
  memi;
}

Measured memory_bytes: 256
def decode(mes,command):
    if command == 'J':
        return mes[-1] + mes[:-1]
    elif command == 'C':
        return mes[1:] + mes[0]
    elif command == 'E':
        m = len(mes)//2
        if len(mes)%2 == 0:
            return mes[m:] + mes[:m]
        else:
            return mes[m+1:] + mes[m] + mes[:m]
    elif command == 'A':
        return mes[::-1]
    else:
        d = (-1 if command == 'P' else 1)
        ret = ''
        for c in mes:
            if c.isdigit():
                ret += str((int(c)+d) % 10)
            else:
                ret += c
        return ret

N = int(input())
for i in range(N):
    order,mes = input(),input()
    for c in reversed(order):
        mes = decode(mes,c)
    print(mes)

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

#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
#define repinv(i, st, n) for (int i = ((n)-1); i >= (st); --i)
#define MEM(a, b) memset(a, b, sizeof(a));
#ifdef LOCAL
#define debug(x) std::cerr << #x << ": " << x << endl
#else
#define debug(x) 860111
#endif
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileIO(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

//mt19937 mrand(random_device{}());
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod=1e9+7;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
pii operator+(const pii&x, const pii&y) { return mp(x.X+y.X, x.Y+y.Y);}
pii operator-(const pii&x, const pii&y) { return mp(x.X-y.X, x.Y-y.Y);}
//INT_MAX, ULLONG_MAX, LLONG_MAX or numeric_limits<int>::min()

inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}

//------------------------------------------------------------------------//
int T;
const int maxn = 2e5+7;
int n;
//ll a[maxn];

//check T
void solve()
{
	//cin >> n; rep(i, 0, n) cin >> a[i];
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);

  if(a[0] == a[1] && a[0] != a[2]) {cout << "Yes\n"; return;}
  if(a[1] == a[2] && a[0] != a[2]) {cout << "Yes\n"; return;}
  cout << "No\n";
  return;
}


signed main()
{
  fastIO();
  T = 1;
  //cin T; //this
  while(T--) solve();
  return 0;
}


Measured memory_bytes: 256