akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int D;
    cin >> D;
    ll c[26], sum = 0;
    rep(i, 26) {cin >> c[i]; sum += c[i];}
    ll s[D][26];
    rep(i, D){
        rep(j, 26) cin >> s[i][j];
    }
    int pre[26];
    fill(pre, pre+26, -1);
    int t[D];
    rep(i, D){
        ld tmp[26];
        rep(j, 26){
            tmp[j] = s[i][j] + c[j]*(i-pre[j])*min((ld)26, ((ld)(D-i)/(ld)(26)));
        }
        int res = -1;
        ld m = -INF;
        rep(j, 26){
            if(chmax(m, tmp[j])) res = j;
        }
        pre[res] = i;
        t[i] = res;
        //cout << res+1 << endl;
    }
    ll tmp = 0;
    set<int> ids[26];
    rep(i, 26) ids[i].insert(-1);
    rep(i, D){
        //cin >> t[i]; t[i]--;
        tmp += s[i][t[i]];
        pre[t[i]] = i;
        ids[t[i]].insert(i);
        rep(j, 26){
            tmp -= c[j]*(i-pre[j]);
        }
    }
    rep(i, 26) ids[i].insert(D);
    rep(k, 10){
        rep(i, D){
            rep(j, 26){
                int d, q;
                //cin >> d >> q;
                d = i, q = j;
                int p = t[d];
                ll ans = tmp-s[d][p]+s[d][q];
                set<int>::iterator it1, it2;
                it1 = ids[p].upper_bound(d);
                it2 = ids[q].upper_bound(d);
                int a1, a2, b1, b2;
                b1 = *it1, b2 = *it2;
                it1--, it1--, it2--;
                a1 = *it1, a2 = *it2;
                ans -= c[p]*(b1-d)*(d-a1);
                ans += c[q]*(b2-d)*(d-a2);
                if(chmax(tmp, ans)){
                    t[d] = q;
                    ids[p].erase(d);
                    ids[q].insert(d);
                }
            }
        }
    }
    rep(i, D) cout << t[i]+1 << endl;
}

Measured memory_bytes: 3740
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

void solve() {
    string S;
    cin >> S;

    if (S[S.length() - 1] == 's') {
        S = S + "es";
    } else {
        S += "s";
    }

    cout << S << endl;
}

int main(void) {
#ifndef ONLINE_JUDGE
    const auto in_stream = freopen("../in.txt", "r", stdin);
    if (in_stream == nullptr) {
        cerr << "ERROR!" << endl;
        return 1;
    }
#endif

    solve();

#ifndef ONLINE_JUDGE
    fclose(in_stream);
#endif
}


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

int main(){
    int A,B;
    cin >> A >> B;
    if(A >= 13){
        cout << B << endl;
    }else if(6 <= A){
        cout << (B / 2) << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

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

const LL INF=1<<29;
const LL MOD=1000000007;

LL gcd(LL a,LL b){
    if(b==0)return a;

    return gcd(b,a%b);
}

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(c%gcd(a,b)==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;    
}

Measured memory_bytes: 256
/*Points to be noted :
1)Don't be afraid to fail.
2)Never give up easily,keep trying.
3)Don't care about other ppl's progress.
4)Spend much time on each problem & keep trying. I WILL DO IT!💯*/

// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//


#include<bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define r0 return 0;
#define tc int t;cin>>t;while(t--)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define md 998244353
#define inf 1000000000000000 //1e15
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
int min(int a,int b){
    return (a<b)?a:b;
}
int max(int a,int b){
    return (a>b)?a:b;
}
int fp(int a,int b){
    if(b==0) return 1;
    int x=fp(a,b/2);
    x=(x*x)%mod;
    if(b&1) x=(x*a)%mod;
    return x;
}
int factorial(int n)
{
    int fact=1;
    for(int i=2;i<=n;i++)
    fact=fact*i;
    
    return fact;
}
int ncr(int n,int r)
{
    return factorial(n)/(factorial(r)*factorial(n-r));
}
void c_p_c()
{
    crap;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
signed main()
{
    c_p_c();
    int n;
    cin>>n;
    int ac=0,tle=0,wa=0,re=0;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        if(s=="AC")
        ac++;
        else if(s=="WA")
        wa++;
        else if(s=="TLE")
        tle++;
        else
        re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
}

Measured memory_bytes: 3672
N = int(input())
W = list(map(int, input().split()))

sums = [0]
for w in W:
    sums.append(sums[-1]+w)
wholesum = sum(W)
ans = 10**7
for i in range(len(sums)-1):
    tmp = abs(wholesum-sums[i]-sums[i])
    ans = min(ans, tmp)
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
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; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int a;
    cin >> a;
    cout << a+a*a+a*a*a << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

int main() {
    int h,n; cin>>h>>n;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        h -= a;
        if (h <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;

int main()
{
    ll N;
    cin>>N;
    vector<ll> d(N);
    rep(i, N)cin >> d[i];
    sort(d.begin(), d.end());
    if (d[N / 2] != d[N / 2 - 1]) {
        cout << d[N / 2] - d[N / 2 - 1] << endl;
        //cout << d[N / 2] << endl;
    }
    else {
        cout << 0 << endl;
    }
    return 0;
}


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

int main(){
    int n; 
    cin >> n; 
    vector<int> p(n), o(n);
    rep(i,n) cin >> p[i];
    o = p;
    sort(p.begin(),p.end());
    int count = 0;
    rep(i,n) if(p[i] != o[i]) count++;
    if(count<=2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

map<string, string> mp, mpg,mpa;

/*--------------------template--------------------*/

int main()
{
	cin >> n >> m >> k;
	if (n == m) {
		cout << k << endl;
		return 0;
	}
	if (n == k) {
		cout << m << endl;
		return 0;
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int a, b, c; cin >> a >> b >> c;
    set<int> se;
    se.insert(a);
    se.insert(b);
    se.insert(c);
    cout << se.size() << endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  int n;
  ll d;
  cin >> n >> d;

  int ans=0;
  REP(i,n){
    ll x,y;
    cin >> x >> y;
    if(x*x + y*y <= d*d)ans++;
  }
  cout << ans << endl;

}



Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
int main()
{
    char s[100],t[100];
    int n,i,j,k,count=0,p=0;
    scanf("%s %s",&s,&t);
    n=strlen(s);
    while(p<n){
        char temp=s[0];

        for(i=0;i<n;i++)
        {
            s[i]=s[i+1];
        }
            s[n-1]=temp;

        for(k=0;k<n;k++)
        {
            if(s[k]==t[k])
            {
                count++;
            }
        }
        if(count==n)
        {
            printf("Yes\n");
            break;
        }
        else {count=0;}
    p++;
}
    if(count!=n)
    {
        printf("No\n");
    }
    return 0;

}


Measured memory_bytes: 128
/*                                  /   \                                                                   (Hello)//JSM//*/      
/*                                 /*****\                                                                              */
/*     Jai Shree Mataji           /       \ |\| |_| $ |-| K                                                            */
#include<vector>
#include<iostream>
#include<algorithm>                
#include<string.h>                 
#include<bits/stdc++.h>            
#include<cstring>                  
#include<map>                     
#include<cmath>                  
#include<set>
using namespace std;            
#define ll long long int        
#define ld long double
#define MOD 1000000007 
#define PI 3.1415926535897932384626433832795                                               
#define YY cout<<"YES"
#define NN cout<<"NO"
#define EE cout<<"\n"
#define ee cout<<"\n"
#define ne cout<<"-1"
#define pb push_back 
#define fi first
#define se second
#define mkp make_pair    
#define mkt make_tuple
#define sall(v ) sort(v.begin(), v.end())      
#define all(v )  v.begin(), v.end()      
#define rall(v )  reverse(v.begin(), v.end())      
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#define vl vector<ll>
#define vll vector< pair<ll,ll> > 
#define mpl map<ll, ll>
#define pr pair<ll,ll>
#define tpl tuple<ll,ll,ll>
ll containsDigit(ll number, ll digit){while (number != 0){int curr_digit = number % 10;if (curr_digit == digit) return 1;number /= 10;}return 0;}
ll soltn(ll x, ll n) {if(x>=0) return x%n;    else return n+x%n;}
ll pd(ll x,ll y){if(x%y==0) return x/y;else return x/y+1;}
ll coda(ll n,ll d){ll count=0;while(n!=0){if(n%10==d)count++;n/=10;}return count;}
ll mdls(ll x){return max(x,-x);}
ll pow1(ll n,ll p){if(p==0)return 1;ll x=pow1(n, p/2);x=(x*x)%MOD;if(p%2==0) return x;else return (x*n)%MOD;}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);	
	  ll t=1;
      
	//   cin>>t;

	      while(t--)
{

//jsmstart
ll n,m;
cin>>n>>m;
ll a[n];
ll ans=1,s=0;;
fo(i,n)
{cin>>a[i];
	
	s+=a[i];
	if(s<=m)
	{
		
		ans++;
	}
	//else
	//break;
}
cout<<ans;
ee;
}
return 0;
}














Measured memory_bytes: 3664
while 1:
    try:
        a, b, c = map(int, raw_input().split())
    except EOFError:
        break
    cards = set(xrange(1, 11))
    cards -= {a, b, c}
    ret = 0.0
    rest = 20 - a - b
    for card in cards:
        if rest >= card:
            ret += 1
    if ret / 7.0 >= 0.5:
        print "YES"
    else:
        print "NO"

Measured memory_bytes: 4240
import sys
ABC = [int(n) for n in input().split()]
# N = int(input())
# a = [int(input()) for _ in range(N)]
# S = str(input())
# L = len(S)
# T = str(input()
sumABC = sum(ABC)
for i in range(0,3):
    if(sumABC - ABC[i] == ABC[i]):
        print("Yes")
        sys.exit()
print("No")


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

using namespace std;


int my_max(int a, int b) {
    return a > b ? a : b;
}

template <typename T>
T my_abs(T x) {
    return x < 0 ? -x : x;
}

template <typename T>
map<T, T> prime_factor(T n) {
    map<T, T> ret;
    for(T i = 2; i * i <= n; i++) {
        T tmp = 0;
        while(n % i == 0) {
            tmp++;
            n /= i;
        }
        ret[i] = tmp;
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

template <typename T>
T divisor_num(T n) {
    map<T, T> pf = prime_factor(n);
    T ret = 1;
    for(auto p : pf) {
        ret *= (p.second + 1);
    }
    return ret;
}

int main() {

    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    int result = 1E+9;
    int pizza = my_max(x, y);
    for(int i = 0; i <= pizza; i++) {
        int temp = (i * c * 2);
        if(x-i>0) temp += (x-i)*a;
        if(y-i>0) temp += (y-i)*b;
        if(temp < result) {
            result = temp;
        }
    }

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(int(input()) for _ in range(N))
a.sort()

ans = sum(a)
if ans%10 > 0:
    print(ans)
    exit()
for ai in a:
    if ai%10 > 0:
        print(ans - ai)
        break
else:
    print(0)


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

int main() {
	int n;
	cin >> n;
	int d[n];
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	sort(d, d + n);
	cout << d[n / 2] - d[n / 2 - 1] << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
typedef long long ll;
 
int main(){
    int n, q;
    cin >> n >> q;
    vector<int> g[n];
    vector<bool> used(n,false);
    vector<ll> ans(n,0); 
    rep(i,n-1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i,q){
        int p, x;
        cin >> p >> x;
        ans[p-1] += x;
    }
    queue<int> que;
    que.push(0);
    while(que.size()){
        int y = que.front();
        que.pop();
        used[y] = true;
        rep(i,g[y].size()){
            if(!used[g[y][i]]) {
                ans[g[y][i]] += ans[y];
                que.push(g[y][i]);
            }
        }
    }
    rep(i,n) cout << ans[i] << " ";
    cout << endl;
    return 0;
}

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

signed main(){
	int A, B;
	scanf("%d%d", &A, &B);
	if((A + B) % 2 == 0){
		printf("%d\n", (A + B) / 2);
	}
	else{
		printf("IMPOSSIBLE\n");
	}
	return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  int r;
  cin>>r;
  cout<<r*r<<endl;
  return 0;
}


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

int main(){
    string c;
    int a, b, num = 0;
    cin >> a >> b;
    for(int i=a; i<=b; i++){
        c = to_string(i);
        if(c[0] == c[4] && c[1] == c[3])
            num++;
    }
    cout << num << endl;
    return 0;
}

Measured memory_bytes: 3696
#include<iostream>
#include<string.h>
#include<math.h>
#define ll long long
using namespace std;

int main()
{
    /*checking typecasting
    ll a, b;
    float f;
    double d;
    cin>>a>>b>>f>>d;
    cout<<"long long "<<a<<"\nlong long "<<b<<"\nfloat "<<f<<"\ndouble "<<d<<"\n";
    int t1 = (int)f;
    ll t2 = (ll)d;
    cout<<"Typecast int (from float): "<<t1<<"\nTypecast ll (from double): "<<t2<<"\n";
    return 0;
    */

    ll n, d;
    cin>>n>>d;
    ll x[10][10];
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<d; j++)
        {
            cin>>x[i][j];
        }
    }

    ll c=0, g_i=0;
    double dist=0, sum;
    for(int i=0; i<n; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            sum = 0;
            for(int k=0; k<d; k++)
            {
                sum += pow((x[i][k]-x[j][k]), 2);
            }
            dist = sqrt(sum);
            g_i = (ll)dist;
            if(g_i == dist)
            {
                c++;
            }
        }
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;


int main(void){


	          cin.tie(0);  ios_base::sync_with_stdio(false);

	          ll K,A,B;
	          cin >> K >> A >> B;

	          if(A+2LL>=B){
	        	  cout << K+1LL << endl;
	        	  return 0;
	          }

	          if(K-A-1LL<0LL){
	        	  cout << K+1LL << endl;
	        	  return 0;
	          }


	          ll q=(K-A-1LL)/2LL,r=(K-A-1LL)%2LL;
	          cout << B+q*(B-A)+r << endl;


	          return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
  char s[11];
  int len,min=1000,i;
  scanf("%s",s);
  len=strlen(s);
  for(i=0;i<len-2;i++){
    int a=abs((s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0')-753);
    if(a<min)
      min=a;
  }
  printf("%d\n",min);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;
typedef long long ll;
ll mod = 1000000007;

int main(void)
{
    int N;
    ll A[200005], t = 0, t2 = 0;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        t += A[i];
        t %= mod;
        t2 = t2 + ((A[i] % mod) * (A[i] % mod)) % mod;
        t2 %= mod;
    }
    ll ans = (((t * t) % mod) + (mod - t2)) % mod;
    if (ans < 0) {
        ans += mod;
    }
    ans *= (mod + 1) / 2;
    cout << ans % mod << endl;
    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin >> n;
    long long sum = 0;
    for(int i = 1;i <= n;i++)
    {
        if((i%3 != 0) && (i%5 != 0))sum += i;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3652
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

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

fn main() {
    input! {
        value: String,
    };
    let patterns: Vec<Vec<char>> = ["dream", "dreamer", "erase", "eraser"]
        .iter()
        .map(|s| s.chars().rev().collect())
        .collect();
    let value: Vec<char> = value.chars().rev().collect();
    let mut value = &value[..];
    while value.len() > 0 {
        match patterns.iter().find(|&p| value.starts_with(p)) {
            Some(p) => value = &value[p.len()..],
            None => {
                println!("NO");
                return;
            }
        }
    }
    println!("YES");
}


Measured memory_bytes: 2636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;

int main(){
    vector<int> a(3);
    rep(i, 3) cin >> a[i];
    sort(all(a));
    cout << a[2]-a[0] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int n;
int v[100100];
int cnt[2][100100];
priority_queue<P> p,q;
int main(){
	cin >> n;
	for(int i=0;i<n;i++)cin >> v[i];
	for(int i=0;i<n;i++){
		cnt[i%2][v[i]]++;
	}
	for(int i=0;i<=100000;i++){
		if(cnt[0][i]>0)p.push(P(cnt[0][i],i));
		if(cnt[1][i]>0)q.push(P(cnt[1][i],i));
	}
	P a = p.top(), b = q.top();
	//cout << a.fi << ' ' << a.sec << endl;
	//cout << b.fi << ' ' << b.sec << endl;
	p.pop();q.pop();
	if(a.sec!=b.sec){
		cout << n - a.fi -b.fi << endl;
		return 0;
	}
	int ans = INF;
	if(p.empty())ans = min(ans,n-b.fi);
	else ans = min(ans,n-b.fi-(p.top()).fi);
	if(q.empty())ans = min(ans,n-a.fi);
	else ans = min(ans,n-a.fi-(q.top()).fi);
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main (){
  int N;
  cin >> N;
  vector <int> input(N);
  int i,answer,check;
  check = 0;
  answer =0;
  for (i=0;i<N;i++){
    cin >> input.at(i);
  }
  
  sort(input.begin(),input.end());
  
  for (i=0;i<N;i++){
    if(check != input.at(i)){
      check = input.at(i);
      answer++;
    }
  }
  cout << answer << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main(){
	string s;
	cin >> s;
	int n=s.size();
	
	if(s[n-7]=='k' && s[n-6]=='e' && s[n-5]=='y' && s[n-4]=='e' && s[n-3]=='n' && s[n-2]=='c' && s[n-1]=='e'){
		cout << "YES" << endl;
		return 0;
	}
	
	if(s[0]=='k' && s[n-6]=='e' && s[n-5]=='y' && s[n-4]=='e' && s[n-3]=='n' && s[n-2]=='c' && s[n-1]=='e'){
		cout << "YES" << endl;
		return 0;
	}
	if(s[0]=='k' && s[1]=='e' && s[n-5]=='y' && s[n-4]=='e' && s[n-3]=='n' && s[n-2]=='c' && s[n-1]=='e'){
		cout << "YES" << endl;
		return 0;
	}
	
	if(s[0]=='k' && s[1]=='e' && s[2]=='y' && s[n-4]=='e' && s[n-3]=='n' && s[n-2]=='c' && s[n-1]=='e'){
		cout << "YES" << endl;
		return 0;
	}
	
	if(s[0]=='k' && s[1]=='e' && s[2]=='y' && s[3]=='e' && s[n-3]=='n' && s[n-2]=='c' && s[n-1]=='e'){
		cout << "YES" << endl;
		return 0;
	}
	
	if(s[0]=='k' && s[1]=='e' && s[2]=='y' && s[3]=='e' && s[4]=='n' && s[n-2]=='c' && s[n-1]=='e'){
		cout << "YES" << endl;
		return 0;
	}
	
	if(s[0]=='k' && s[1]=='e' && s[2]=='y' && s[3]=='e' && s[4]=='n' && s[5]=='c' && s[n-1]=='e'){
		cout << "YES" << endl;
		return 0;
	}
	
	if(s[0]=='k' && s[1]=='e' && s[2]=='y' && s[3]=='e' && s[4]=='n' && s[5]=='c' && s[6]=='e'){
		cout << "YES" << endl;
		return 0;
	}
	
	cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 256
n,a,b=map(int,input().split())

mod=10**9+7
def modpow(a,n):
    if n<1:
        return 1
    ans=modpow(a,n//2)
    ans=(ans*ans)%mod
    if n%2==1:
        ans*=a
    return ans%mod
    
def cmb(n,i):#逆元
    inv,ans=1,1
    for j in range(1,i+1):
        ans=ans*(n-j+1)%mod
        inv=inv*j%mod
    return (ans*modpow(inv,mod-2))%mod



ans_n=pow(2,n,mod)-1
ans_a=cmb(n,a)%mod
ans_b=cmb(n,b)%mod

print((ans_n-ans_a-ans_b)%mod)

Measured memory_bytes: 9168
#include <bits/stdc++.h>
#define ll long long
#define inf 10000000000LL
using namespace std;

ll w[101],v[101];
ll wg,n;
ll dp[101][100001];

ll solve(ll i, ll tmp){
    //cout<<i<<" "<<tmp<<endl;
    if(dp[i][tmp]==-1){
        if(i==n && tmp>0)return dp[i][tmp]=inf;
        if(i==n && tmp==0)return dp[i][tmp]=0;
        if(tmp-v[i]<0)return dp[i][tmp]=solve(i+1,tmp);
        return dp[i][tmp]=min(solve(i+1,tmp), solve(i+1,tmp-v[i])+w[i]);
    }
    return dp[i][tmp];
}

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */ 
    cin>>n>>wg;
    ll mx=0;
    for(ll x=0; x<n; x++){
        cin>>w[x]>>v[x];
        mx+=v[x];
    }
    for(ll x=0; x<=n; x++){
        for(ll y=0; y<=100000; y++){
            dp[x][y]=-1;
        }
    }
    ll a;
    for(ll x=mx; x>=0; x--){
        a=solve(0,x);
        //cout<<a<<" ";
        if(a<=wg){
            cout<<x;
            break;
        }
        //cout<<endl;
    }
    //cout<<solve(0,0);
    return 0;
}



Measured memory_bytes: 79104
#include <iostream>
#include<vector>
using namespace std;
int main(void){
    string s;
    cin >> s;
    long sum = 0;
    long n = 1 << (s.size() - 1);
    for(int i = 0;i < n;i++){
        long a = s[0] - '0';
        long b = 0;
        
        for(int j = 1;j < s.size();j++){
              if((i >> (j - 1)) & 1){
                    b += a;
                    a = s[j] - '0';
              }else{
                    a = a * 10 + (s[j] -'0');
              }
              
        }
        b += a;
        sum += b;
    }
    cout << sum << endl;
}


Measured memory_bytes: 3592
N = int(input())
A = [i for i in map(int,input().split())]
max_count=0
temp=0
for i in range(N-1):
    if A[i]>=A[i+1]:
        temp+=1
        if temp>max_count:
            max_count=temp
    else:
        temp=0
print(max_count)

Measured memory_bytes: 14252
use std::io;
    fn main(){
    	let mut x = String::new();
        let mut a = String::new();
        let mut b = String::new();
        
        io::stdin().read_line(&mut x).unwrap();
        io::stdin().read_line(&mut a).unwrap();
        io::stdin().read_line(&mut b).unwrap();
        
        let y: i64 = x.trim().parse::<i64>().unwrap();
        let c: i64 = a.trim().parse::<i64>().unwrap();
        let d: i64 = b.trim().parse::<i64>().unwrap();
        
        let ans: i64 = (y-c)%d;
        println!("{:?}", ans);
    }

Measured memory_bytes: 4352
N,K=map(int,input().split())
h=[int(input()) for _ in range(N)]

h=sorted(h)
bet=[h[N-1]]*(N-K+1)

for i in range(N-K+1):
    bet[i]=h[i+K-1]-h[i]

print(min(bet))
#print(h)
#print(bet)

Measured memory_bytes: 10892
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;


int main() {
  int n;
  cin >> n;
  int a[n];
  rep(i,n){
    cin >> a[i];
  }
  vi v(n);
  rep(i,n){
    v[i] = a[i];
  }
  sort(rng(v));
  int count=0;
  rep(i,n){
    if(a[i]!=v[i]){
      count++;
    }
  }
  if(count<=2){
    cout << "YES" <<endl;
    return 0;
  }
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int flg = 0;
	string c, c2;
	cin >> c >> c2;
	if (c[0] == c2[2] && c[1] == c2[1] && c[2] == c2[0])
	{
		cout << "YES";
	}
	else
	{
		cout << "NO";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
	long n;
	cin >> n;
	long p[n];
	long i = n;
	cin >> p[0];
    long min = p[0];
	for(int k=1;k<n;k++){
		cin >> p[k];
        if(p[k] < min) {
			min = p[k];
		} else {
			i--;
		}
	}
	cout << i << endl;
	return 0;
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

vector<int> v[110];
int ls[110];

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

    while(true){
        int N;
        std::cin >> N;
        if(!N){break;}
    
        for(int i=0;i<N;++i){
            v[i].clear();

            int M;
            std::cin >> M;

            for(int j=0;j<M;++j){
                int p;
                std::cin >> p;
                --p;
            
                v[i].emplace_back(p);
            }

            sort(v[i].begin(), v[i].end());
        }

        int K;
        std::cin >> K;

        for(int i=0;i<K;++i){
            std::cin >> ls[i];
            --ls[i];
        }

        vector<int> ss;
        for(int i=0;i<N;++i){
            bool ok = true;
            for(int j=0;j<K;++j){
                if(!binary_search(v[i].begin(), v[i].end(), ls[j])){
                    ok = false;
                    break;
                }
            }

            if(ok){
                ss.emplace_back(i);
            }
        }

        int res = ss.size() == 1 ? (ss[0] + 1) : -1;
        std::cout << res << std::endl;
    }
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#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(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    vector<vector<int>> A = vector<vector<int>>(3, vector<int>(3, 0));
    vector<vector<int>> ans = vector<vector<int>>(3, vector<int>(3, 0));
    rep (i, 0, 3) {
        cin >> A[i][0] >> A[i][1] >> A[i][2];
    }
    int N; cin >> N;
    rep (i, 0, N) {
        int b; cin >> b;
        rep (j, 0, 3) {
            rep (k, 0, 3) {
                if (b == A[j][k]) {
                    ans[j][k] = 1;
                }
            }
        }
    }

    // check
    rep (i, 0, 3) {
        if ((ans[i][0] == 1 and ans[i][1] == 1 and ans[i][2] == 1) or
                (ans[0][i] == 1 and ans[1][i] == 1 and ans[2][i] == 1)) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if ((ans[0][0] == 1 and ans[1][1] == 1 and ans[2][2] == 1) or
            (ans[0][2] == 1 and ans[1][1] == 1 and ans[2][0] == 1)) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
int a,b,c; 
int main(){
	a=read(),b=read(),c=read();
	cout<<max(c-(a-b),0)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//cin.sync_with_stdio(false);

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FOR_RE(i,a,b) for(int i = (a); i > (b); --i)
#define rep(i,n) FOR(i,0,n)

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;
int n;

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

    cin >> n;
    int A[n];
    
    rep(i, n){
        cin >> A[i];
    }
    
    int count = -1; //一回目が0になるように
    int flag = 1;
    
    while(flag){
        count++;
        rep(i, n){
            int temp = A[i];
            
            if(temp % 2 == 0){
                A[i] = temp / 2;
            }else{
                flag = 0;
            }
        }
    }
    
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import math
def main():
    A,P = map(int, input().split())
    pieces = A*3 + P
    if pieces < 3:
        print(0)
        return
    apple_pie = math.floor(pieces/2)
    print(apple_pie)

if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
//void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////



int main(){fastio
    string s;cin>>s;
    ll k;cin>>k;
    ll n=s.size();
    vector<ll>v;
    rep(i,0,n-1){
        ll c=1;
        while(i<=n-2&&s[i]==s[i+1]){
            c++;i++;
        }
        v.pb(c);
    }
    if(v.size()==1){
        ll len=n*k;
        cout<<len/2<<endl;return 0;
    }
    //for(auto x:v)cout<<x<<" ";cout<<endl;
    ll vs=v.size();
    if(s[0]==s[n-1]){
        ll c=0;
        rep(i,1,vs-2){
            c+=v[i]/2;
        }
        ll ans=c*k;
        ans+=v[0]/2+v[vs-1]/2;
        ans+=(v[0]+v[vs-1])/2*(k-1);
        cout<<ans<<endl;
    }else{
        ll c=0;
        rep(i,0,vs-1){
            c+=v[i]/2;
        }
        cout<<c*k<<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define forn(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pb push_back
 
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	int x,y; cin >> x >> y;
	bool can = 0;
	forn(i,0,x+1){
		int cranes = i;
		int turtles = x-i;
		if(2*cranes + 4*turtles == y){
			can = 1;
			break;
		}
	}
	cout << (can ? "Yes" : "No");
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define yoi cout<<"yo"<<endl;
#define debug(x) cerr << #x << " is " << x << endl;
#define all(x) x.begin(),x.end()
const lli inf=1e18;
const int mod=1e9+7;
int main(){
IOS;
int n,i,j;
cin>>n;
string s;
cin>>s;
vector<vector<int> > v(10);
for(i=0;i<s.length();i++){
    v[s[i]-48].pb(i);
}
int count=0;
for(i=0;i<1000;i++){
    int x=i;
    vector<int> temp;
    while(x){
        temp.pb(x%10);
        x/=10;
    }
    while(temp.size()<3)
        temp.pb(0);
    reverse(all(temp));
    int ind=-1;
    for(j=0;j<3;j++){
        auto it=upper_bound(all(v[temp[j]]),ind);
        if(it==v[temp[j]].end())
            break;
        ind=*it;
    }
    if(j==3){
        count++;
    }
}
cout<<count<<endl;
}


Measured memory_bytes: 512
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

# print(a)
# print(b)
# print(c)
# print(d)
# print(e)
# print(k)

# print(e - a)

if e - a <= k:
    print('Yay!')
else:
    print(':(')

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		System.out.println(solve());
	}

	static long solve() {
		long M = sc.nextLong();
		int rd = sc.nextInt();
		int rr = sc.nextInt();
		long cd = sc.nextLong();
		long cr = sc.nextLong();
		long minD = (cd * 100 + rd - 1) / rd;
		long minR = (cr * 100 + rr - 1) / rr;
		if (M < minD + minR) return -1;
		long ans = 0;
		for (int i = 0; i < 100; ++i) {
			long yd = minD + i;
			long md = yd * rd / 100;
			for (int j = 0; j < 100; ++j) {
				long yr = minR + j;
				if (M < yd + yr) break;
				long mc = yr * rr / 100;
				long rem = M - yd - yr;
				rem += (md - cd) * 100 / rd;
				rem += (mc - cr) * 100 / rr;
				ans = Math.max(ans, rem);
			}
		}
		return ans;
	}

}

Measured memory_bytes: 18172
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

int main() {
    ll N, M;
    cin >> N >> M;
    ll countn = 1, countm = 1;
    rep(i, N) {
        countn = (countn * (i + 1)) % mod;
    }
    rep(i, M) {
        countm = (countm * (i + 1)) % mod;
    }
    if (N == M + 1 || M == N + 1) {
        cout << (countn * countm) % mod << endl;
    }
    else if (N == M) {
        cout << (2 * (countn * countm)) % mod << endl;
    }
    else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define vec1(V,T,a) vector<T> V (a)
#define vec2(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define vec3(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool>::reference b) { return to_string(bool(b)); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a,b;
  cin >> a >> b;
  if (a <= 5) cout << 0 << endl;
  else if (a <= 12) cout << b / 2 << endl;
  else cout << b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

bool eval(int val, string str, int &i){
	if( 'a' <= str[i] && str[i] <= 'k' ){
		return val & (1<<(str[i++]-'a'));
	}else if( str[i] == 'T' ){
		return true;
	}else if( str[i] == 'F' ){
		return false;
	}else if( str[i] == '-' && str[i+1] != '>' ){
		return !eval(val, str, ++i);
	}else if( str[i] == '(' ){
		bool ret = eval(val, str, ++i);
		while( i<str.length() ){
			if( str[i] == '+' ) ret |= eval(val, str, ++i);
			else if( str[i] == '*' ) ret &= eval(val, str, ++i);
			else if( str[i] == '-' && str[i+1] == '>'){
				i++;
				ret = !ret | eval(val, str, ++i);
			}
			else if( str[i] == ')' ) break;
			else i++;
		}
		i++;
		return ret;
	}
	return false;
}

int main(){
	string in;
	while(cin>>in, in[0]!='#'){
		string str1 = "(" + in.substr(0, in.find("=")) + ")";
		string str2 = "(" + in.substr(in.find("=")+1) + ")";
		bool f = true;
		for(int val=0, i=0, j=0; val<(1<<11); val++, i=0, j=0){
			if( eval(val, str1, i) != eval(val, str2, j) )
				f = false;
		}
		cout << (f?"YES":"NO") << endl;
	}
	return 0;
}

Measured memory_bytes: 2324
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::f64::consts::PI;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn z_algo(str: &[char]) -> Vec<usize> {
    let mut result = vec![0; str.len()];

    result[0] = str.len();
    let mut i = 1;
    let mut j = 0;
    while i < str.len() {
        while i+j < str.len() && str[j] == str[i+j] {
            j += 1;
        }
        result[i] = j;
        if j == 0 {
            i += 1;
            continue;
        }
        let mut k = 1;
        while i+k < str.len() && k+result[k] < j {
            result[i+k] = result[k];
            k+=1;
        }
        i += k;
        j -= k;
    }

    result
}


fn main() {
    let n: usize = read_line().trim().parse().unwrap();
    let s: Vec<char> = read_line().trim().chars().collect();

    let mut ans = 0;
    for i in 0..n {
        let a =  z_algo(&s[i..]);
        for j in 1..a.len() {
            ans = cmp::max(ans, cmp::min(j, a[j]))
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//      debug shrine
//
// #######################
//     ##           ##
//   ###################
//     ##           ##
//     ##           ##
//     ##           ##
//     ##           ##
//     ##           ##


int main(int argc, char *argv[]) {
	int A,B,C;
  cin >> A >> B >> C;
  if(A == B && B == C) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256