akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int n, k;
    cin >> n >> k;
    vector<bitset<5000>> dp(n + 1), dp2(n + 1);
    dp[0][0] = 1, dp2[n][0] = 1;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        dp[i + 1] = dp[i] | (dp[i] << a[i]);
    }
    for(int i = n - 1; i >= 0; --i){
        dp2[i] = dp2[i + 1] | (dp2[i + 1] << a[i]);
    }
    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(a[i] >= k){
            ++ans;
            continue;
        }
        vector<int> S(k + 1);
        S[0] = 0;
        for(int j = 0; j < k; ++j)  S[j + 1] = S[j] + dp[i][j];
        for(int j = 0; j < k; ++j){
            if(!dp2[i + 1][j])  continue;
            int R = k - j, L = R - a[i];
            if(S[max(0, R)] - S[max(0, L)] > 0){
                ++ans;
                break;
            }
        }
    }
    ans = n - ans;
    cout << ans << endl;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int n, k, x, y;
    cin >> n >> k >> x >> y;

    // 処理
    // 出力
    cout << min(k * x + (n - k) * y, n * x) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
//#define MOD (1000000007)
#define MOD (998244353)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    int n,m;cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize("O1")
#pragma GCC optimize("O2")
#pragma GCC optimize("Os")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(ll i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
using namespace std;
bool sortbysec(const pair<pair<int,int>,int> &a, const pair<pair<int,int>,int> &b)
{
    return (a.first.second<b.first.second);
}
bool sortbysecll(const pll &a, const pll &b)
{
    return (a.second<b.second);
}
ll modinv(ll x, ll y, ll modulo)
{
    return ((x%modulo)*(P(y,modulo-2LL,modulo)%modulo))%modulo;
}
void vok()
{
    FAST
    FO
    FI
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}
int main()
{
    vok();
    int n;
    ll k;
    IN n>>k;
    int v[n+1];
    loop(i,1,n+1)
    {
        IN v[i];
    }
    vector<int> cycle;
    map<int,bool> vis;
    vis[1]=1;
    cycle.pb(1);
    int i=1;
    int point=1;
    while(1)
    {
        if(vis[v[i]])
        {
            point=v[i];
            break;
        }
        cycle.pb(v[i]);
        vis[v[i]]=1;
        i=v[i];
        // flag=false;
    }
    int pos=-1;
    loop(i,0,cycle.size())
    {
        if(point==cycle[i])
        {
            pos=i;
            break;
        }
    }
    // for(auto x:cycle)
    // {
    //     OUT x<<" ";
    // }
    // OUT endl
    // OUT point<<endl
    if(k<=pos)
    {
        OUT cycle[k];
        return 0;
    }
    k-=pos;
    vector<int> temp;
    loop(i,pos,cycle.size())
    {
        temp.pb(cycle[i]);
    }
    cycle=temp;
    int ver=int(cycle.size());
    k-=((k/ver)*ver);
    OUT cycle[k%ver]<<endl
    return 0;
}

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

int main(){
    using namespace std;
    unsigned long X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<unsigned long> p(A), q(B), r(C), pq(X + Y), pqr(X + Y + C);
    copy_n(istream_iterator<unsigned long>(cin), A, p.begin());
    copy_n(istream_iterator<unsigned long>(cin), B, q.begin());
    copy_n(istream_iterator<unsigned long>(cin), C, r.begin());
    partial_sort(p.begin(), p.begin() + X, p.end(), greater<>());
    partial_sort(q.begin(), q.begin() + Y, q.end(), greater<>());
    sort(r.begin(), r.end(), greater<>());
    merge(p.begin(), p.begin() + X, q.begin(), q.begin() + Y, pq.begin(), greater<>());
    merge(pq.begin(), pq.end(), r.begin(), r.end(), pqr.begin(), greater<>());
    cout << accumulate(pqr.begin(), pqr.begin() + X + Y, 0UL) << endl;
    return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef pair<long long int, long long int> P;

void abc_170a();
void abc_171a();
void abc_172a();
void abc_173a();
void abc_174a();
void abc_175a();

void abc_170b();
void abc_171b();
void abc_172b();
void abc_173b();
void abc_174b();


int main()
{
  //abc_170a();
  //abc_171a();
  //abc_172a();
  //abc_173a();
  //abc_174a();
  //abc_175a();

  //abc_170b();
  //abc_171b();
  //abc_172b();
  //abc_173b();
  abc_174b();

}

void abc_170a()
{
  vector<int> x(5);
  for (int i = 0; i < 5; ++i) cin >> x[i];

  for (int i = 0; i < 5; ++i)
  {
    if (x[i] == 0)
    {
      cout << i + 1 << "\n";
      return;
    }
  }
}

void abc_171a()
{
  char c;
  cin >> c;

  if (c == tolower(c)) cout << "a\n";
  else cout << "A\n";
}

void abc_172a()
{
  int a;
  cin >> a;

  cout << a + a * a + a * a * a << "\n";
}

void abc_173a()
{
  int N;
  cin >> N;

  if (N % 1000) cout << 1000 - N % 1000 << "\n";
  else cout << "0\n";
}

void abc_174a()
{
  int x;
  cin >> x;

  if (x >= 30) cout << "Yes\n";
  else cout << "No\n";
}

void abc_175a()
{
  string s;
  cin >> s;

  int cnt = 0, tmp = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    if (s[i] == 'S')
    {
      tmp = 0;
    }
    else
    {
      ++tmp;
      cnt = tmp;
    }
  }

  cout << cnt << "\n";
}


void abc_170b()
{
  int x, y;
  cin >> x >> y;

  for (int i = 0; i <= x; ++i)
  {
    int n_c = i, n_t = x - i;
    if (n_c * 2 + n_t * 4 == y)
    {
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
}

void abc_171b()
{
  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  for (int i = 0; i < N; ++i) cin >> p[i];

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

  int price = 0;
  for (int i = 0; i < K; ++i)
  {
    price += p[i];
  }
  cout << price << "\n";
}

void abc_172b()
{
  string s, t;
  cin >> s >> t;

  int cnt = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    if (s[i] != t[i]) ++cnt;
  }

  cout << cnt << "\n";
}

void abc_173b()
{
  int N;
  cin >> N;

  int n_ac = 0, n_wa = 0, n_tle = 0, n_re = 0;
  for (int i = 0; i < N; ++i)
  {
    string s;
    cin >> s;

    if (s == "AC") ++n_ac;
    else if (s == "WA") ++n_wa;
    else if (s == "TLE") ++n_tle;
    else ++n_re;
  }

  cout << "AC x " << n_ac << "\n";
  cout << "WA x " << n_wa << "\n";
  cout << "TLE x " << n_tle << "\n";
  cout << "RE x " << n_re << "\n";
}

void abc_174b()
{
  long long int N, D;
  cin >> N >> D;
  vector<P> xy(N);
  for (int i = 0; i < N; ++i) cin >> xy[i].first >> xy[i].second;

  int cnt = 0;
  for (int i = 0; i < N; ++i)
  {
    if (xy[i].first * xy[i].first + xy[i].second * xy[i].second <= D * D) ++cnt;
  }
  cout << cnt << "\n";
}

Measured memory_bytes: 6372
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

const int MAX = 200000;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    COMinit();
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    map<ll, ll> mp;
    for (ll i = 0; i < n + 1; i++)
    {
        cin >> a[i];
        mp[a[i]]++;
    }
    ll num, idx[2]; // 重複している数、その数の内右側のindex
    for (auto p : mp)
    {
        if (p.second > 1)
        {
            num = p.first;
        }
    }
    for (ll i = n; i >= 0; i--)
    {
        if (a[i] == num)
        {
            idx[1] = i;
            break;
        }
    }
    for (ll i = 0; i < n; i++)
    {
        if (a[i] == num)
        {
            idx[0] = i;
            break;
        }
    }

    for (ll i = 0; i < n + 1; i++)
    {
        ll k = i + 1;
        ll ans = COM(n + 1, k);
        ll yobun = COM(idx[0] + (n - idx[1]), k - 1);
        cout << (ans - yobun + MOD) % MOD << endl;
    }
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define rep(i , n) for (int i = 0; i < (int)(n); i++)
const int INF = 1<<29;
using namespace std;
using ll = long long;
int main(){
    int N , X;
    cin >> N >> X;
    int ans = 0;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        ans = gcd(ans , X - a);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>
#include <set>

class BinaryIndexedTree {
	std::vector<int> vec;
public:
	BinaryIndexedTree(int size) : vec(size, 0) {};
	int get(int position) const {
		int result = 0;
		while (position >= 0) {
			result += vec[position];
			position -= (position + 1) & ~position;
		}
		return result;
	}
	void add(int position, int value) {
		while (position < vec.size()) {
			vec[position] += value;
			position += (position + 1) & ~position;
		}
	}
};
int main(void) {
	int n; std::cin >> n;
	std::vector<int> permutation(n);
	for (auto& p : permutation) std::cin >> p;
	BinaryIndexedTree bit(n + 1);
	int count = 0;
	for (const auto p : permutation) {
		if (bit.get(p) == 0) {
			++count;
		}
		bit.add(p, 1);
	}
	std::cout << count << std::endl;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=2e5+5,MOD=998244353;
int n,q,l,r,v;
int ll[N<<2],rr[N<<2],num[N<<2],sum[10][N],add[N<<2],bin[N];
	
void build(int k,int l,int r)
{

	ll[k]=l; rr[k]=r;
	if (l==r)
	{
		num[k]=1;
		return;
	}
	int mid=l+r>>1;
	build(k<<1,l,mid);
	build(k<<1|1,mid+1,r);
	num[k]=(num[k<<1]*bin[rr[k<<1|1]-ll[k<<1|1]+1]%MOD+num[k<<1|1])%MOD;	
}
inline void pushdown(int k)
{
	if (add[k])
	{
		num[k<<1]=sum[add[k]][rr[k<<1]-ll[k<<1]+1];
		num[k<<1|1]=sum[add[k]][rr[k<<1|1]-ll[k<<1|1]+1];
		add[k<<1]=add[k<<1|1]=add[k];
		add[k]=0;
	}
}
void change(int k,int l,int r,int qx,int qy,int v)
{
	if (qx<=l && r<=qy)
	{
		num[k]=sum[v][r-l+1];
		add[k]=v;
		return;
	}
	pushdown(k);
	int mid=l+r>>1;
	if (qx<=mid) change(k<<1,l,mid,qx,qy,v);
	if (mid<qy) change(k<<1|1,mid+1,r,qx,qy,v);
	num[k]=(num[k<<1]*bin[rr[k<<1|1]-ll[k<<1|1]+1]%MOD+num[k<<1|1])%MOD;
}
	
signed main(){
	scanf("%lld%lld",&n,&q);
	bin[0]=1;
	for (register int i=1; i<=n; ++i) bin[i]=bin[i-1]*10%MOD;
	for (register int i=1; i<=9; ++i)
	{
		sum[i][1]=i;
		for (register int j=2; j<=n; ++j) sum[i][j]=(sum[i][j-1]*10%MOD+i)%MOD;
	}
	build(1,1,n);
	for (register int i=1; i<=q; ++i) 
	{
		scanf("%lld%lld%lld",&l,&r,&v);
		change(1,1,n,l,r,v);
		printf("%lld\n",num[1]);
	}
return 0;	
}

Measured memory_bytes: 35852
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int         long long   
#define double      long double
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define sort(v)     sort((v).begin(),(v).end())
#define rall(v)     (v).rbegin(),(v).rend()
#define rsort(v)     sort((v).rbegin(),(v).rend())
#define gcd(a,b)    __gcd((a),(b))

typedef pair<int,int> pii;  
typedef vector<int> vi;

signed main() 
{
    fastio;
    string s;
    cin>>s;
    bool flag=true;
    if(s.length()%2==1)
    {
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0;i<s.length();i++)
    {
        if(i&1)
        {
            if(s[i]!='i')
            {
                flag=false;
            }
        }
        else
        {
            if(s[i]!='h')
            {
                flag=false;
            }
        }
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    string ss;
    cin>>ss;
    string s;
    for (int i = 0; i < ss.size(); i++)
    {
        if(ss[i]=='A')
        {
            s+='A';
        }
        else if(i<=ss.size()-1 && ss[i]=='B' && ss[i+1]=='C')
        {
            s+='X';
            i++;
        }
        else
        {
            s+='_';
        }
    }
    ll ans=0;
    ll acnt=0;
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i]=='A')
        {
            acnt++;
        }
        else if(s[i]=='X')
        {
            ans+=acnt;
        }
        else
        {
            acnt=0;
        }
        
    }
    
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 776
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=2e5+10;
const int mod=1e9+7;

int a;
int b;
int c;
int sum=0;
int main()
{
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        char s[11];
        cin>>s;
        int len=strlen(s);
        if(s[0]=='B'&&s[len-1]!='A')
        {
            b++;
        }
        if(s[0]!='B'&&s[len-1]=='A')
        {
            a++;
        }
        if(s[0]=='B'&&s[len-1]=='A')
        {
            c++;
        }
        for(int j=0; j<len-1; j++)
        {
            if(s[j]=='A'&&s[j+1]=='B')
            {
                sum++;
            }
        }
    }
     if(c)
    {
        sum+=c-1;
        if(a)a--,sum++;
        if(b)b--,sum++;
    }
    sum+=min(a,b);
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3616
//Bismillahir Rahmanir Rahim
// AtCoder-gacha
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  set<string>st;
  int n; cin>>n;
  while(n--){
  	string s;  cin>>s;
//	getline(cin,s);
  	st.insert(s);
  }
  cout<<st.size()<<endl;
  return 0;
}

Measured memory_bytes: 19092
#include <bits/stdc++.h>
#define endl        '\n'
#define pi          2*acos(0.0)
#define pb(a)       push_back(a)
#define db          double
#define ld          long double
#define ll          long long
#define ull         unsigned long long
#define mod         1000000007
#define inf         1000000000000000001
#define sqr(x)      (x) * (x)
#define gcd(a, b)   __gcd(a, b)
#define lcm(a, b)   ((a/gcd(a,b)) * b) 
#define unsyncIO    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAX 100003

using namespace std;

vector<int> primes;
bitset<MAX> marked;

void sieve(int n) {
    for (int i = 3; i * i <= n; i += 2) {
        if(!marked[i]) {
            for (int j = i * i; j <= n; j += 2 * i) {
                marked[j] = true;
            }
        }
    }
    primes.push_back(2);
    for (int i = 3; i <= n; i += 2) {
        if(!marked[i])
            primes.push_back(i);
    }
}

bool isPrime(int n) {
    if(n < 2) return false;
    if(n == 2) return true;
    if(n % 2 == 0) return false;
    return !marked[n];
}

int main()
{
    //freopen("/home/sohel/Documents/my_codes/out.txt", "wt", stdout);
    unsyncIO;
    sieve(100003);
    int n;
    cin >> n;
    if(isPrime(n))
        cout << n << endl;
    else {
        for (int i = 0; i <= 100003; i++) {
            if(primes[i] > n) {
                cout << primes[i]<<endl;
                break;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3740
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
using namespace std;

const long long INF = 100100100100100;
const int MOD = 1000000007;
const int inf = 1001001001;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



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

    int N;cin >> N;
    long long D;cin >> D;
    vector<pair<long long,long long>> za(N);
    for(int i = 0;i<N;i++) cin >> za.at(i).first >> za.at(i).second;
    int ans = 0;
    for(int i = 0;i<N;i++){
        long double x = za.at(i).first,y = za.at(i).second;
        long double dist = x*x+y*y;
        dist = sqrt(dist);
        if(D >= dist){
            ans++;
        }
        //cout << dist << " " << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6364
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
for i in range(n):
    if a[i] < b[i]:
        count += a[i]
        b[i] -= a[i]
        if a[i+1] < b[i]:
            count += a[i+1]
            a[i+1] = 0            
        else:
            a[i+1] -= b[i]
            count += b[i]
    else:
        count += b[i]
print(count)

Measured memory_bytes: 18476
// D - Even Relation
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using NODE = vector<pair<int,int>>;
using TREE = vector<NODE>;

void dfs(TREE &T, vi &dist, int p, int w){
	if(dist[p] >= 0) return;
	dist[p] = w;
	for(auto c:T[p]){
		int np,nw; tie(np,nw) = c;
		dfs(T, dist, np, w^nw);
	}
}

int main(){
	int N; cin>>N;
	vi dist(N, -1);
	TREE T(N, NODE());
	while(--N){
		int u,v,w; cin>>u>>v>>w; u--,v--,w&=1;
		T[u].emplace_back(v,w);
		T[v].emplace_back(u,w);
	}
	dfs(T, dist, 0, 0);
	for(int a:dist) cout<< a << endl;
}

Measured memory_bytes: 8192
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

typedef std::uint64_t u64;
typedef std::int64_t  i64;
typedef std::uint32_t u32;
typedef std::int32_t  i32;

using namespace std;

int main(int argc, const char* argv[]) {
  u64 lh, lw, h, w;
  cin >> lh >> lw >> h >> w;
  
  cout << (lh * lw) - (h * lw) - (lh * w) + (h * w) << endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/local/gnu/bin/bash
read a b
c=0
n=$((a/100))
(($n${n:1:1}${n:0:1}<a)) && n=$((n+1))
while(($n${n:1:1}${n:0:1}<=b))
do
    c=$((c+1))
    n=$((n+1))
done
echo $c


Measured memory_bytes: 504
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  ll ans = 0;

  int num = 0;
  rep(i, s.size()){
    if(s[i] == 'B'){
      ans += num;
    }else{
      num++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define pb push_back
#define vi vector < int >
#define ii pair < int, int >
#define vii vector < pair < int, int > >
#define vvi vector < vector < int > >
#define ll long long
#define X first
#define Y second
#define mp make_pair
#define FOR( i, lo, hi ) for( int i = (lo);i < (hi);i++ )
#define DFOR( i, hi, lo ) for( int i = (hi);i >= (lo);i-- )
#define pqueue priority_queue

using namespace std;

const long long int MOD = 1e9 + 7;

ll REM( ll a )
{
	a %= MOD;
	if ( a < 0 )
	   a += MOD;
	return a;
}

ll ADD( ll a, ll b )
{
	return REM( REM( a ) + REM( b ) );
}

ll SUB( ll a, ll b )
{
	return REM( REM( a ) - REM( b ) );
}

ll MUL( ll a, ll b )
{
	return REM( REM( a ) * REM( b ) );
}

ll POT( ll n, ll k )
{
	if ( k == 0 )
		return 1;

	ll ret = POT( n, k / 2 );
	ret = MUL( ret, ret );

	if ( k % 2 )
		return MUL( ret, n );
	return ret;
}

ll DIV( ll a, ll b )
{
	return MUL( a, POT( b, MOD - 2 ) );
}

bool isPrime( ll x )
{
	for ( ll i = 2;i <= sqrt( x ); i++ )
		if ( x % i == 0 )
			return false;
	return true;
}

const int MAXN = 3e5 + 10;

int n;
ll ans = 0;
ll A[ MAXN ];
ll bits[ 61 ][ 2 ];

int main()
{
	cin >> n;
	FOR( i, 0, n )
	{
		cin >> A[ i ];
		vi v;
		ll x = A[ i ];
		FOR( j, 0, 61 )
		{
			v.pb( x % 2 );x = ( x >> 1 );
		}
		
		FOR( j, 0, 61 )
		{
			if ( v[ j ] )
			{
				ll sum = MUL( bits[ j ][ 0 ], POT( 2, j ) );
				ans = ADD( ans, sum );
			}
			else
			{
				ll sum = MUL( bits[ j ][ 1 ], POT( 2, j ) );
				ans = ADD( ans, sum );
			}
		}
		
		FOR( j, 0, 61 )
			bits[ j ][ v[ j ] ]++;
	}
	
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 2560
k, n = map(int, input().split())
a = list(map(int, input().split()))

a = sorted(a)

d = -1

for i in range(n-1):
    if a[i+1]-a[i] >= d:
        d = a[i+1] - a[i]

if a[0]+k - a[n-1] >= d:
    d = a[0]+k - a[n-1]

ans = k - d
print(ans)
    

Measured memory_bytes: 32240
use std::io::*;
use std::str::*;


// while let Some(x)=read(cin) { ... }
fn read<T: FromStr>(cin: &mut StdinLock) -> Option<T> {
    let cin = cin.by_ref().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    cin.parse::<T>().ok()
}


fn read_vec<T: FromStr>(cin: &mut StdinLock) -> Vec<T> {
    let mut s = String::new();
    cin.read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


fn main(){
    let cin = stdin();
    let mut cin = cin.lock();
    let cin = &mut cin;
    
    let n:usize = read(cin).unwrap();
    let a1 :&[i32]=&(read_vec(cin));
    let a2 :&[i32]=&(read_vec(cin));

    let mut v :Vec<i32>=Vec::new();
    let sum :i32= a1.iter().sum::<i32>()+ a2.iter().sum::<i32>();

    for i in 0..n {
        let x:i32=a1[0..i+1].iter().sum::<i32>()+a2[i..n].iter().sum::<i32>();
        v.push(x)
    }
    println!("{}",*(v.iter().max().unwrap()));

    
}


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

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  
  1 <= N <= 20;
  1 <= A <= 100;
  1 <= B <= 2000;
  
  int plan1 = N * A;
  int plan2 = B;
  
  if (plan1 == plan2 || plan1 < plan2){
    cout << plan1 << endl;
  }
  else{
    cout << plan2 << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  	int n;
  	cin>>n;
  	int r;
  	r=(n%1000);
  	if(r==0){
    	cout<<0;
    }
    else{
        cout<<(1000-r);
    }
  	return 0;
}

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

int main()
{
    string S; cin >> S;
    const auto N = int(S.size());

    auto possible = vector<bool>(N+6);
    possible[0] = true;
    for (auto i = 0; i < N; i++) if (possible[i])
    {
        if (S.substr(i, 5) == "dream") possible[i+5] = true;
        if (S.substr(i, 7) == "dreamer") possible[i+7] = true;
        if (S.substr(i, 5) == "erase") possible[i+5] = true;
        if (S.substr(i, 6) == "eraser") possible[i+6] = true;
    }

    cout << (possible[N] ? "YES" : "NO") << endl;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
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 end

ll dp[3010]={};

int main(){
    int n,t; scanf("%d%d",&n,&t);
    vector<pair<int,int>> p(n);
    rep(i,0,n)scanf("%d%d",&p[i].first,&p[i].second);
    sort(ALL(p));
    ll ans=0;
    rep(i,0,t+1)dp[i]=-INF;
    dp[0]=0;
    rep(i,0,n){
        rrep(j,t-1,-1)if(dp[j]!=-INF){
            chmax(dp[min(t,j+p[i].first)],dp[j]+p[i].second);
        }
    }
    rep(i,0,t+1)chmax(ans,dp[i]);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int N; cin >> N;
  cout << N / 2 + N % 2 << endl; 
}

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

// size of longest common prefix s and s[i...]
vector<int> Zalgorithm(string s) {
  int n = s.size();
  vector<int> Z(n);
  Z[0] = n;
  int i = 1, j = 0;
  while(i < n) {
    while(i + j < n && s[j] == s[i + j]) ++j;
    Z[i] = j;
    if(j == 0) { ++i; continue; }
    int k = 1;
    while(i + k < n && Z[k] < j - k) Z[i + k] = Z[k], ++k;
    i += k, j -= k;
  }
  return Z;
}

// 書くだけです
// 把握しようね
vector<int> calc(string s) {
  auto Z = Zalgorithm(s);
  vector<int> G(s.size(), 1);
  for(int p = 1; p < (int) s.size(); p++) {
    for(int k = 2; (k - 1) * p <= Z[p]; k++) {
      G[k * p - 1] = 0;
    }
  }
  return G;
}

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  string s; cin >> s;
  auto G = calc(s);
  string rev = s; reverse(begin(rev), end(rev));
  auto rG = calc(rev);

  int mono = 1;
  { int i = 1; while(mono && i < (int) s.size()) mono = s[i] == s[0], ++i; }

  if(G[s.size() - 1]) {
    cout << 1 << endl << 1 << endl;
  } else if(mono) {
    cout << s.size() << endl << 1 << endl;
  } else {
    int cnt = 0;
    for(int i = 0; i < (int) s.size() - 1; i++)
      if(G[i] && rG[(int) s.size() - 1 - i - 1]) cnt++;
    cout << 2 << endl << cnt << endl;
  }
}



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

int main() {
  int r, d, x;
  cin >> r >> d >>x;
  long long int X = x;
  for (int i = 1; i < 11; i++) {
    X = r * X - d;
    printf("%lld\n", X);
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=55;
int n,a[N],b[N];
bool mp[N][N];
ll ans;
bool check()
{
    memset(mp,0,sizeof(mp));
    for(int i=0;i<=50;i++)
        mp[i][i]=true;
    for(int k=50;k>=1;k--)
        if(ans>>k&1)
    for(int i=1;i<=50;i++)
        for(int j=1;j<=50;j++)
        mp[i][j%k]|=mp[i][j];
    for(int i=1;i<=n;i++)
        if(!mp[a[i]][b[i]]) return false;
    return true;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=n;i++) scanf("%d",&b[i]);
    for(int i=1;i<=50;i++) ans|=1ll<<i;
    if(!check()){printf("-1\n");return 0;}
    for(int i=50;i>=1;i--)
    {
        ans^=1ll<<i;
        if(!check()) ans|=1ll<<i;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 384
import sys
S = input()
T = input()

if len(set(S)) != len(set(T)):
    print("No")
    sys.exit()

record = {}
for i, s in enumerate(S):
    if s in record.keys():
        record[s].append(i)
    else:
        record[s] = [i]


def eq(x, t):
    if len(x) == 1:
        return 1
    for w in x[1:]:
        if t[w] == t[x[0]]:
            pass
        else:
            return 0
    return 1


ans = "Yes"
for i in record.values():
    if eq(i, T):
        pass
    else:
        ans = "No"
        break
print(ans)


Measured memory_bytes: 12444
#include <iostream>
#include <deque>

class ProcessInfo {
public:
	ProcessInfo(std::string name, int time)
	: m_name(name), m_time(time)
	{}
	std::string getName() { return m_name; }
	int getTime() { return m_time; }
	void subtractTime(int sub) { m_time -= sub; }
private:
	std::string m_name;
	int m_time;
};

int main(int argc, const char *argv[]) {
	int n, q;
	std::cin >> n >> q;
	std::deque<ProcessInfo*> queue;
	for (int i = 0; i < n; i++) {
		std::string name;
		int time;
		std::cin >> name >> time;
		queue.push_back(new ProcessInfo(name, time));
	}
	int total = 0;
	while (queue.size() > 0) {
		ProcessInfo* pInfo = queue.front();
		queue.pop_front();
		if (pInfo->getTime() > q) {
			total += q;
			pInfo->subtractTime(q);
			queue.push_back(pInfo);
		} else {
			total += pInfo->getTime();
			std::cout << pInfo->getName() << " " << total << std::endl;
			delete pInfo;
		}
	}
	return 0;
}


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

class UnionFindTree {
public:
    vector<int> rank, p;

    UnionFindTree() {}

    UnionFindTree(int size) {
        rank.resize(size, 0);
        p.resize(size, 0);
        for (int i = 0; i < size; ++i) {
            makeSet(i);
        }
    }

    void makeSet(int x)
    {
        p[x] = x;
        rank[x] = 0;
    }

    bool same(int x, int y)
    {
        return findSet(x) == findSet(y);
    }

    void unite(int x, int y)
    {
        link(findSet(x), findSet(y));
    }

    void link(int x, int y)
    {
        if (rank[x] > rank[y]) {
            p[y] = x;
        } else {
            p[x] = y;
            if (rank[x] == rank[y]) {
                rank[y]++;
            }
        }
    }

    int findSet(int x)
    {
        if (x != p[x]) {
            p[x] = findSet(p[x]);
        }
        return p[x];
    }

    int maxUnion()
    {
        int size = p.size();
        int r = 0;
        REP(i,size) {
            r = max(r, (int)count(p.begin(), p.end(), i));
        }
        return r;
    }
};

int main()
{
    int n, m;
    cin>>n>>m;
    UnionFindTree uf(n);
    REP(i,m) {
        int x, y, z;
        cin>>x>>y>>z;
        uf.unite(x-1, y-1);
    }

    int cnt = 0;
    set<int> p_set;
    REP(i,n) {
        if (p_set.find(uf.findSet(i)) == p_set.end()) {
            p_set.insert(uf.findSet(i));
            cnt++;
        }
    }

    cout<<cnt<<endl;

    return 0;
}


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

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] arr = new int[n];
      for(int i = 0; i < n; i++) {
        arr[i] = sc.nextInt() - i - 1;
      }
      Arrays.sort(arr);
      int b = arr[(arr.length - 1) / 2];
      long sum = 0;
      for(int num : arr)
        sum += Math.abs(num - b);
      
      System.out.println(sum);
  }

}


Measured memory_bytes: 62804
<?php

$n = trim(fgets(STDIN));
for($i=0; $i<$n; $i++){
    $array[$i] = explode(" ", trim(fgets(STDIN)));
}

$s = range(1,13);
$h = range(1,13);
$c = range(1,13);
$d = range(1,13);

foreach($array as $v){
    if($v[0] == "S"){
        unset($s[$v[1]-1]);
    }elseif($v[0] == "H"){
        unset($h[$v[1]-1]);
    }elseif($v[0] == "C"){
        unset($c[$v[1]-1]);
    }else{
        unset($d[$v[1]-1]);
    }
}

foreach($s as $v){
    echo "S", " " , $v,"\n";
}
foreach($h as $v){
    echo "H", " " , $v,"\n";
}
foreach($c as $v){
    echo "C", " " , $v,"\n";
}
foreach($d as $v){
    echo "D", " " , $v,"\n";
}
?>


Measured memory_bytes: 9304
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		for(int i=s.length()-t.length(); i>=0; i--){
			int count=0;
			for(int j=i; j<i+t.length(); j++){
				if(s.charAt(j)==t.charAt(j-i) || s.charAt(j)=='?'){
					count++;
					continue;
				}else{
					break;
				}
			}
			if(count==t.length()){
				String ans=s.substring(0,i)+t+s.substring(i+t.length(),s.length());
				ans=ans.replace("?","a");
				System.out.println(ans);
				return;
			}
		}
		System.out.println("UNRESTORABLE");
	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    char c;
    rep(i, 9){
        cin >> c;
        if(!(i%4)){
            cout << c;
        }
    }
    cout << endl;
}


Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

vi A(3);

signed main(){

    in(A);
    sort(all(A));
    YN(A[0]==5&&A[1]==5&&A[2]==7);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long dp[2][100005];
int v[101],w[101],W,n;
int main()
{
    scanf("%d%d",&n,&W);
    for(int i=0;i<n;++i)
      scanf("%d%d",w+i,v+i);
    for(int i=0;i<n;++i)
        for(int j=0;j<=W;++j)
        {
            dp[i&1][j]=dp[(i+1)&1][j];
            if(j>=w[i])
            dp[i&1][j]=max(dp[i&1][j],dp[(i+1)&1][j-w[i]]+v[i]);
        }
    printf("%lld",dp[(n-1)&1][W]);
    return 0;
}


Measured memory_bytes: 5296
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int d[40][40];
int s[510][510];
int co1[40] = { 0 }, co2[40] = { 0 }, co3[40] = { 0 };
int main() {
	int n, c;
	long long min = 1000000000000007;
	cin >> n >> c;
	for (int a = 1; a <= c; a++) {
		for (int b = 1; b <= c; b++) {
			cin >> d[a][b];
		}
	}
	for (int k = 1; k <= n; k++) {
		for (int l = 1; l <= n; l++) {
			cin >> s[k][l];
			if ((k + l) % 3 == 0) {
				co1[s[k][l]]++;
			}
			else if ((k + l) % 3 == 1) {
				co2[s[k][l]]++;

			}
			else {
				co3[s[k][l]]++;
			}
		}
	}
	for (int e = 1; e <= c; e++) {
		for (int f = 1; f <= c; f++) {
			if (e == f) continue;
			for (int g = 1; g <= c; g++) {
				if (e == g || f == g) continue;
				long long co = 0;
				for (int h = 1; h <= c; h++) {
					co += d[h][e] * co1[h];
					co += d[h][f] * co2[h];
					co += d[h][g] * co3[h];
				}
				
				if (min > co) {
					min = co;
				}
				co = 0;
			}
		}
	}
	printf("%lld\n", min);
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(v) for (int i = 0; i < v.size(); i++)
#define SORT(i,v) sort(v.begin(), v.end())
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = INF + 7;

ull ans[10];
map<pair<int, int>, int> mp;

int main()
{
  int h, w, n;
  cin>>h>>w>>n;
  ans[0] = (ull)(h-2) * (w-2);

  REP(i,n) {
    int a, b;
    cin>>a>>b;
    FOR(dx,-1,2) {
      FOR(dy,-1,2) {
        if (a+dx<2 || a+dx>h-1 || b+dy<2 || b+dy>w-1)
          continue;

        //cout<<a<<" "<<b<<" "<<a+dx<<" "<<b+dy<<endl;
        pair<int, int> tmpp = {a+dx,b+dy};//make_pair(a+dx,b+dy);
        //ここの入力形式はどちらでも問題がないようです
        if (mp.find(tmpp) == mp.end()) {
          mp[tmpp] = 1;
          ans[0]--;
        } else {
          mp[tmpp]++;
        }
      }
    }
  }

  for (auto itr : mp) {
    //cout<<itr.first.first<<" "<<itr.first.second<<" "<<itr.second<<endl;
    ans[itr.second]++;
  }

  REP(i,10) {
    cout<<ans[i]<<endl;
  }

  return 0;
}


Measured memory_bytes: 56448
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

const int mod = 1e9 + 7;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	/*
	lの桁数が7桁以下のはlを全部試す
	8桁以上は桁数を全部試す。剰余取りすぎるとTLE
	*/
	int s; cin >> s;
	ll ans = 0;
	
	for(int l = 1; l < (int)1e7; l++){
		int cl = l, rem = s, k = 0, nl = 1;
		for(int i = l; i; i /= 10) k++, nl *= 10;
		for(; rem >= k; k++){
			if(rem > (nl - cl) * (ll)k){
				rem -= (nl - cl) * (ll)k;
				cl = nl;
				nl *= 10;
			}
			else{
				if(rem % k == 0) ans++;
				break;
			}
		}
	}
	
	ll ten = (ll)1e7;
	for(int k = 8; k <= s; k++){
		int n = s / k, r = s - k * n;
		if(r == 0) ans += 9 * ten + mod - n + 1;
		
		int rem = r ? r : k + 1;
		if(n > rem) ans += (n - rem - 1) / (k + 1) + 1;
		
		ten = ten * 10 % mod;
	}
	
	cout << ans % mod << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    int n; cin >> n;
    ll ans = 1;
    REP(i,1,n+1){
        ans *=i;
        ans = ans % 1000000007;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(){
  int N;
  double ans=0;
  cin>>N;
  double data[N];
  
  for(int i=0;i<N;i++){
    cin>>data[i];
  }
  
  for(int i=0;i<N;i++){
    ans+=1.0/data[i];
  }
  
  cout<<1.0/ans<<endl;
  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll k,n;
ll a,b,ans[60];
int main() {
	//freopen("1.txt","w",stdout);
    scanf("%lld",&k);
    if (k==0)
		printf("4\n3 3 3 3\n");
    else if (k==1)
		printf("3\n1 0 3\n");
	else {
		n=min(50LL,k);
		a=k/n; b=k%n;
		for (int i=1;i<=n;i++)
			ans[i]=n-1+a;
		for (int i=1;i<=b;i++)
			ans[i]++;
		for (int i=b+1;i<=n;i++)
			ans[i]-=b;
		printf("%lld\n",n);
		for (int i=1;i<=n;i++)
			printf("%lld ",ans[i]);
		printf("\n");
	}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i<N; i++)
#define RVROOP(i, N) for(int i=N; i>=0; i--)
#define INF 1e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  string S; cin>>S;
  int ans, N;
  ans=0;
  N=S.size();
  int num=N/2;
  for(int i=0; i<num; i++){
    if(S.at(i)!=S.at(N-1-i)){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256