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

#define ll long long
#define mod 1000000007
#define pll pair<long long,long long>
#define pdd pair<long double,long double>
#define vll vector<ll>
#define rep(i,j,n) for(int i=j;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1e18+9
#define N 100010
priority_queue<pll,vector<pll>,greater<pll> >pq;
priority_queue<ll,vector<ll>,greater<ll> >pq1;

ll result(ll a, ll b, ll p){
    ll ans=1;
    if(b==(-1))
        b=p-2;
    while(b){
        if(b&1){
            ans=(ans*a)%p;
        }
        a=(a*a)%p;
        b>>=1;
    }
    return ans;
}

ll T,n,m;

int main(){
	if(fopen("input.txt", "r"))
	freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll arr[1000000];
    for(ll i=1;i<=9;i++)
    	arr[i] = i;
    ll p = 1;
    ll q = 10;
    while(1){
    	if(q>100000)
    		break;
    	ll d = arr[p]%10;
    	if(d==0){
    		arr[q] = arr[p]*10;
    		q++;
    		arr[q] = arr[p]*10+1;
    		q++;
    	}
    	else if(d==9){
    		arr[q] = arr[p]*10+8;
    		q++;
    		arr[q] = arr[p]*10+9;
    		q++;
    	}
    	else{
    		arr[q] = arr[p]*10+d-1;
    		q++;
    		arr[q] = arr[p]*10+d;
    		q++;
    		arr[q] = arr[p]*10+d+1;
    		q++;
    	}
    	p++;
    }
    
    cin >> q;
    cout << arr[q];

    return 0;
}


Measured memory_bytes: 3072
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double PI = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
ll mod = 1e9 + 7;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	long long n, d, x;
	cin >> n >> d >> x;
	vi a(n);
	rep(i, n)
		cin >> a[i];
	ll ans = 0;
	rep(i, n) {
		if ((d) / a[i] > 0)
			ans += ((d) / a[i]);
		ans++;
		if ((d) % a[i] == 0)
			ans--;
		//cout << (d) / a[i] + 1 << " " << endl;
	}
	cout << ans + x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8101145141919364364;

int main(){
	int n,K; cin>>n>>K;
	pair<int,int> p[n];
	rep(i,n){
		int x,y; cin>>x>>y;
		p[i]={x,y};
	}
	long long ans=LINF;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			long long left=min(p[i].first,p[j].first);
			long long right=max(p[i].first,p[j].first);
			for(int k=0;k<n;k++){
				for(int l=0;l<n;l++){
					long long down=min(p[k].second,p[l].second);
					long long up=max(p[k].second,p[l].second);
					int cnt=0;
					for(int m=0;m<n;m++){
						int x=p[m].first,y=p[m].second;
						if(left<=x&&x<=right){
							if(down<=y&&y<=up){
								cnt++;
							}
						}
					}
					if(cnt>=K){
						long long tmp=(right-left)*(up-down);
						ans=min(ans,tmp);
					}
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline T GCD(T a, T b) {
    return b ? GCD(b, a % b) : a;
}
template<class T>
inline T LCM(T a, T b) {
    return (a + (b - 1)) / b;
}

int round_int(int a, int b) {
    return (a + (b - 1)) / b;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

    vl a(n);
    rep(i, n) cin >> a[i];

    ll res = 0;
    for (int d = 60; d >= -1; d--) {
        if (d != -1 && !(k & (1LL << d))) continue;

        ll tmp = 0;
        for (int e = 60; e >= 0; e--) {
            ll mask = 1LL << e;
            int num = 0;
            rep(i, n) if (a[i] & mask) ++num;

            if (e > d) {
                if (k & mask) tmp += mask * (n - num);
                else tmp += mask * num;
            }
            else if (e == d) {
                tmp += mask * num;
            }
            else {
                tmp += mask * max(num, n - num);
            }
        }
        res = max(res, tmp);
    }
    cout << res << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
	using namespace std;
	typedef long long int ll;
	
	#define pii                 pair<int,int>
	#define vi                  vector<int>
	#define vii                 vector<std::vector<int>> v;
	#define mem(dp,a)           memset(dp,a,sizeof dp)
	#define sonic               ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	#define pb(x)               push_back(x)
	#define mkpr(x,y)             make_pair(x,y)
	#define itr(it,c)           for(auto const &it : c)
	#define all(c)              c.begin(), c.end()
	#define ff                  first
	#define ss                  second
	#define INF                 INT_MAX
	#define REPl(i,a,b)         for (ll i=a;i<b;i++)
	#define REPi(i,a,b)         for (ll i=a;i<b;i++)
	
	ll cnt[100005];
	
	//*******User-Defined Functions*********//
	
	//*******Functions end here************//
	//*******Main func starts**************//
	int main()
	{
	    sonic;
	    ll n, k;
	    vector<ll> v;
	    cin >> n;
	    v.resize(n+1,0);
	    ll preSum = 0;
	    for (ll i=1,x;i<=n;i++)
	    {
	    	cin >> x;
	    	v[i] = x;
	    	preSum += x;
	    	cnt[x]++;
	    }
	    cin >> k;
	    for (ll i=1,x,y;i<=k;i++)
	    {
	    	cin >> x >> y;
	    	preSum -= cnt[x] * x;
	    	preSum += cnt[x] * y;
	    	cnt[y] += cnt[x];
	    	cnt[x] = 0;
	    	cout << preSum << endl;
	    }
		
	}
	//******Main Ends here****************//

Measured memory_bytes: 4740
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;
const long long inf = 5e18;

int n, k;
vector<int> xs, ys;

long long calc(int ix, int jx, int iy, int jy) {
	long long x1 = min(xs[ix], xs[jx]);
	long long x2 = max(xs[ix], xs[jx]);
	long long y1 = min(ys[iy], ys[jy]);
	long long y2 = max(ys[iy], ys[jy]);

	int n_inside = 0;
	for (int l = 0; l < n; l++) {
		if (x1 <= xs[l] && xs[l] <= x2 &&
			y1 <= ys[l] && ys[l] <= y2)
		{
			n_inside++;
		}
	}

	if (n_inside < k) {
		return inf;
	}

	return (x2 - x1) * (y2 - y1);
}

int main() {
	cin >> n >> k;

	int x, y;
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		xs.emplace_back(x);
		ys.emplace_back(y);
	}

	long long ans = inf;
	for (int ix = 0;      ix < n; ix++) {
	for (int jx = ix + 1; jx < n; jx++) {
	for (int iy = 0;      iy < n; iy++) {
	for (int jy = iy + 1; jy < n; jy++) {
			auto tmp = calc(ix, jx, iy, jy);
			ans = min(ans, tmp);
	}}}}

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


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

using i64 = int64_t;

struct Sushi{
    int t;
    i64 d;
    bool operator<(const Sushi &obj)const{
        return d < obj.d;
    }
    bool operator>(const Sushi &obj)const{
        return d > obj.d;
    }
};

int cnt[100005]={0};

int main(){
    int n, k;
    cin >> n >> k;
    vector<Sushi> v;
    for(int i=0;i<n;++i){
        int t;
        i64 d;
        cin >> t >> d;
        v.push_back({t, d});
    }
    sort(v.rbegin(), v.rend());
    priority_queue<Sushi, vector<Sushi>, greater<Sushi>> que1;
    priority_queue<Sushi> que2;
    i64 sum = 0, kind = 0;
    for(int i=0;i<n;++i){
        if(i < k){
            que1.push(v[i]);
            sum += v[i].d;
            if(cnt[v[i].t] == 0)kind++;
            cnt[v[i].t]++;
        }else{
            que2.push(v[i]);
        }
    }
    i64 ans = sum + kind*kind;
    while(!que2.empty()){
        Sushi sushi = que2.top(); que2.pop();
        if(cnt[sushi.t] > 0)continue;
        Sushi sushi2;
        do{
            sushi2 = que1.top(); que1.pop();
        }while(!que1.empty() && cnt[sushi2.t] <= 1);
        if(que1.empty())break;
        sum -= sushi2.d;
        sum += sushi.d;
        kind++;
        cnt[sushi2.t]--;
        cnt[sushi.t]++;

        ans = max(ans, sum + kind*kind);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5872
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>

#include <random>
#define all(x) (x).begin(), (x).end()


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

#define debug(x) cout << #x " = " << (x) << endl

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

template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

//#define solvsh
//#define multi
#ifdef solvsh

void solve(){

}

#else


bool is_palin(string s){
    int n = s.length();
    for (int i = 0; i < n; ++i){
        if (s[i] != s[n - 1 - i])
            return false;
    }

    return true;
}

void solve() {

    ld l;
    cin >> l;

    cout << pow(l / 3, 3);
}

#endif

void multisolve() {
    int t;
    cin >> t;

    int i = 1;
    while (t--) {
//        cout << "Case #" << (i++)  << ": ";
        solve();
//        cout << "\n";
    }
}


#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

#ifdef multi
    multisolve();
#else
    solve();
//    gen();
#endif

#ifdef LOCAL
    //cout << '\n' << (double)clock() / CLOCKS_PER_SEC << '\n';
#endif
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int H, W, K;
int s[333][333];
void input() {
  cin >> H >> W >> K;
  rep(i, 1, H) {
    ;
    rep(j, 1, W) {
      char c;
      cin >> c;
      if (c == '#') {
        s[i][j] = 1;
      } else {
        s[i][j] = 0;
      }
    }
  }
}
bool rows[333];
void solve() {
  // 1 次元にする
  rep(i, 1, H) {
    rows[i] = false;
    rep(j, 1, W) {
      if (s[i][j] == 1) {
        rows[i] = true;
      }
    }
  }
  // 横に切った状態

  vector<pii> cutrow;
  int cnt = 0;
  int lastindex = 1;
  rep(i, 1, H) {
    if (rows[i]) {
      cnt++;
    }

    if (cnt == 2) {
      cutrow.push_back(pii(lastindex, i - 1));
      cnt = 1;
      lastindex = i;
    }
    if (i == H && cnt) {
      cutrow.push_back(pii(lastindex, i));
    }
  }

  // for (auto x : cutrow) {
  //   cout << "[" << x.first << "," << x.second << "]\n";
  // }
  int index = 1;
  int anss[333][333];
  for (auto x : cutrow) {
    int srow = x.first;
    int erow = x.second;
    int columns[333];
    rep(i, 1, W) {
      columns[i] = false;
      rep(j, srow, erow) {
        if (s[j][i] == 1) {
          columns[i] = true;
        }
      }
    }

    int cnt = 0;
    vector<pii> colcut;
    int li = 1;
    rep(i, 1, W) {
      if (columns[i]) {
        cnt++;
      }
      if (cnt == 2) {
        colcut.push_back(pii(li, i - 1));
        li = i;
        cnt = 1;
      }
      if (i == W && cnt) {
        colcut.push_back(pii(li, i));
      }
    }

    // ans push!!
    rep(i, srow, erow) {
      rep(l, 0, colcut.size() - 1) {
        rep(j, colcut[l].first, colcut[l].second) { anss[i][j] = index + l; }
      }
    }
    index += colcut.size();
  }
  rep(i, 1, H) {
    rep(j, 1, W) { cout << anss[i][j] << " "; }
    cout << endl;
  }
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <cstdio>
#include <map>
#include <vector>
#include <cstring>
#include <algorithm>
//

using namespace std;
int a[3];
int b[3];
int _min;
int mabs(int x)
{
    if(x<0) return x*-1;
    return x;
}
void find(int sum,int last)
{
    int flag=0;
    for(int i=0;i<3;i++)
    {
        if(!b[i])
        {
            b[i]=1;
            find(mabs(a[i]-a[last])+sum,i);
            b[i]=0;
            flag=1;
        }
    }
    if(!flag) {_min=min(_min,sum);}
}
int main()
{
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    _min=mabs(a[2]-a[1])+mabs(a[1]-a[0]);
    for(int i=0;i<3;i++)
    {
        b[i]=1;
        find(0,i);
        b[i]=0;
    }
    printf("%d\n",_min);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    long long n,d;
    long long x,y;
    scanf("%lld %lld",&n,&d);
    d=d*d;
    long long count=0;
    while(n--)
    {
        scanf("%lld %lld",&x,&y);
        if(x*x+y*y<=d)
            count++;
    }
    printf("%lld\n",count);
    return 0;
}


Measured memory_bytes: 3820
#include <iostream>
#include <cctype>
#include <string>

using namespace std;

int main()
{
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  cout << (char)toupper(s1[0]) << (char)toupper(s2[0]) << (char)toupper(s3[0]) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define max(a, b) ((a)<(b) ? (b) : (a))
int main(){
  int n;  scanf("%d", &n);
  int count = 0, ans = 0;
  int pre;  scanf("%d", &pre);
  for(int i=1; i<n; i++){
    int now;  scanf("%d", &now);
    if(pre >= now){
      count++;
      if(i == n-1)  ans = max(ans, count);
    }else{
      ans = max(ans, count);
      count = 0;
    }
    pre = now;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string S, T;
    int count = 0;
    cin >> S >> T;
    if (S[0] == T[0]) ++count;
    if (S[1] == T[1]) ++count;
    if (S[2] == T[2]) ++count;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 384
a, b, k = [int(x) for x in input().split()]
if a + k - 1 < b - k + 1:
    l = list(range(a, a + k)) + list(range(b - k + 1, b + 1))
else:
    l = list(range(a, b + 1))
for ans in l:
    print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    ll res = 2*n;
    rep(i,n){
        string sub = s.substr(i);
        rep(j,sub.size()){
            if(sub.at(j)!=t.at(j)) break;
            if(j==sub.size()-1) res = 2*n-sub.size();
        }
        if(res!=2*n) break;
    }
    cout << res << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>

using namespace std;

int main()
{

	int n;
	int ts = 0;
	int hs = 0;
	char taro[100+1] = {};
	char hana[100+1] = {};;
	scanf("%d", &n);
	while (n)
	{
		scanf("%s %s", taro, hana);
		int tlen = strlen(taro);
		int hlen = strlen(hana);
		int len = tlen < hlen ? hlen : tlen;
		int cmp = strncmp(taro, hana, len);
		if (cmp > 0)
			ts += 3;
		else if (cmp < 0)
			hs += 3;
		else
		{
			ts++;
			hs++;
		}
		n--;
	}
	cout << ts << " " << hs << endl;
	return 0;
	
}

Measured memory_bytes: 1216
class UnionFind
  attr :parent, :rank
  def initialize
    @parent = Hash.new
    @rank = Hash.new
  end
  def make(x)
    @parent[x] = x
    @rank[x] = 0
  end
  def union(a, b)
    x, y = find(a), find(b)
    x, y = y, x if @rank[x] < @rank[y]
    @parent[y] = x
    @rank[x] += 1 if @rank[x] == @rank[y]
  end
  def find(x)
    @parent[x] == x ? x : @parent[x] = find(@parent[x])
  end
  def size
    @parent.keys.map{|k| find(k)}.sort.uniq.size
  end
end

until (n, m = gets.split.map(&:to_i)).all?(&:zero?)
  degree = Array.new(n, 0)
  set = UnionFind.new
  n.times do |i| set.make(i) end
  m.times do
    u, v = gets.split.map{|i| i.to_i - 1}
    degree[u] += 1
    degree[v] += 1
    set.union(u, v)
  end
  puts (degree.all?{|i| i <= 2} && (degree.count{|i| i == 0} + degree.count{|i| i == 1} / 2) == set.size) ? "yes" : "no"
end

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

typedef long long ll;

ll m[100005], c[100005];
int n, S, a[100005];
ll ans;

void add(int lo, int hi, ll M, ll C)
{
	m[lo] += M; m[hi] -= M;
	c[lo] += C; c[hi] -= C;
}

int main()
{
	scanf("%d%d", &n, &S);
	for (int i = 0;i < n;i++) scanf("%d", a+i);
	for (int i = 1;i < n;i++)
		if (a[i] > a[i-1])
		{
			add(a[i-1]+1, a[i]+1, 1, -a[i-1]-1);
		} else
		{
			add(a[i-1]+1, S+1, 1, -a[i-1]-1);
			add(1, a[i]+1, 1, S-a[i-1]-1);
		}
	for (int i = 1;i <= S;i++) m[i] += m[i-1], c[i] += c[i-1];
	for (int i = 1;i <= S;i++) ans = max(ans, m[i]*i+c[i]);
	ans = -ans;
	for (int i = 1;i < n;i++) ans += (a[i]-a[i-1]+S)%S;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 2176
# ABC 153C
import numpy as np
n, k = map(int, input().split())
h = list(map(int, input().split()))
h = np.array(h)
h = np.sort(h)
if k >= n:
    print(0)
else:
    if k>0:
        print(np.sum(h[:-k]))
    else:
        print(np.sum(h))

Measured memory_bytes: 40184
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define ar array<int,2>
#define inf 1000000000000000000 
int mod=1e9+7;
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;}


const int N=2e5+5;



void solve()
{
  int s;
  cin>>s;
  int dp[s+1]={0};
  for(int i=3;i<=s;i++)
  {
    dp[i]=1;
    for(int j=3;j<=s;j++)
    {
      if(i-j>=3)
      dp[i]=(dp[i]+dp[i-j])%mod;
    }
   // cout<<dp[i]<<endl;
  }
  cout<<dp[s];
}

signed main() {
 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
 srand(time(0));
 int t=1;
 //cin>>t;
 //cout<<(t^1);
 for(int i=1;i<=t;i++)
 {
   solve();
 }


}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n;
    scanf("%lld", &n);
    if(n%2 == 1) printf("0\n");
    else{
        long long ans5 = 0, ans2 = 0;
        long long sum = 5;
        while(sum <= 1e18){
            ans5 += n/(sum*2);
            sum *= 5;
        }
        sum = 2;
        while(sum <= 1e18){
            ans2 += n/sum;
            sum *= 2;
        }
        printf("%lld\n", min(ans5, ans2));
    }
}

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

int main(){
    int N;
    int64_t _;
    cin >> N >> _;
    map<int64_t, int> mp;
    int64_t L[200000], R[200000];
    for(int i=0; i<N; i++){
        cin >> L[i] >> R[i];
        mp[L[i]] = mp[R[i]] = 0;
    }
    int sz = 0;
    for(auto p : mp) mp[p.first] = sz++;
    vector<int> L2R(sz);
    for(int i=0; i<N; i++){
        L[i] = mp[L[i]];
        R[i] = mp[R[i]];
        L2R[L[i]] = max(L2R[L[i]], (int)R[i]);
    }

    int rnow = 0, rnxt = 0, ans1 = 0;
    for(int i=0; i<sz-1; i++){
        rnxt = max(rnxt, L2R[i]);
        if(rnow == i){
            ans1++;
            rnow = rnxt;
        }
    }

    vector<int> imos(sz);
    for(int i=0; i<N; i++){
        imos[L[i]]++;
        imos[R[i]]--;
    }
    imos.pop_back();
    for(int i=1; i<sz-1; i++) imos[i] += imos[i-1];
    int ans2 = N - *min_element(imos.begin(), imos.end()) + 1;
    cout << ans1 << " " << ans2 << endl;
    return 0;
}



Measured memory_bytes: 32840
import sys

from numba import njit

import numpy as np

readline = sys.stdin.buffer.readline


@njit('i8[:](i8, i8, i8[:])', cache=True)
def f(N, K, A):
    for i in range(min(K, 100)):
        C = np.zeros(N + 1, dtype=np.int64)

        for j, a in enumerate(A):
            l = max(0, j - a)
            r = min(j + a + 1, N)
            C[l] += 1
            C[r] -= 1

        A = np.cumsum(C)

    return A


def solver():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))
    A = f(N, K, np.array(A))
    print(*A[:-1])


solver()


Measured memory_bytes: 126440
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N, l[1123], r[1123];
int ans;

int main()
{
	in >> N;
	rep(i, N) { in >> l[i] >> r[i]; }

	rep(i, N)
	{
		ans += r[i] - l[i] + 1;
	}

	out << ans << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long a=0,b,m=0,n,i;
  cin>>n;
  string s;
  cin>>s;
  for(i=0;i<s.size();i++)
  {
     if(s[i]=='I') a++;
     else a--;
     m=max(a,m);

  }
  std::cout << m << '\n';
return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string s;
  ll k;
  cin >> s >> k;
  vl a;
  ll now = 1;
  rep2(i, 1, s.size()) {
    if(s[i - 1] == s[i])
      now++;
    else {
      a.push_back(now);
      now = 1;
    }
  }
  a.push_back(now);
  ll ans = 0;
  if(a.size() == 1) {
    ans = a[0] * k / 2;
  } else if(s[0] == s.back()) {
    rep2(i, 1, a.size() - 1) ans += a[i] / 2;
    ans *= k;
    ll ex = a[0] + a.back();
    ans += a[0] / 2 + a.back() / 2 + ex / 2 * (k - 1);
  } else {
    rep(i, a.size()) ans += a[i] / 2;
    ans *= k;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3608
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

ll n, m;

int main() {
    fastio();

    cin >> n >> m;

    ll k = min(n, m / 2);

    n -= k;
    m -= 2LL * k;

    k += m / 4;

    cout << k << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = input()

if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9':
    print('hon')
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '6' or N[-1] == '8':
    print('pon')
else:
    print('bon')



Measured memory_bytes: 10568
# 2019/04/21
# Tenka1 Programmer Beginner Contest 2019 - C

# Input
n = int(input())
s = input()

bl = [0] * (n+1)
wl = [0] * (n+1)

for i in range(n):
    if s[i] == ".":
        wl[i+1] = wl[i] + 1
        bl[i+1] = bl[i]
    else:
        wl[i+1] = wl[i]
        bl[i+1] = bl[i] + 1

# Calc minimum Left black and Right white
mins = 10**6
for i in range(0, n+1):
    wks = bl[i] + (wl[n] - wl[i])
    if mins > wks:
        mins = wks

# Output
print(mins)


Measured memory_bytes: 12808
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL long long
#define MOD 100000
#define inf 1999999999
#define ALL(x) (x).begin(), (x).end()
#define LBi(x, n) lower_bound(ALL(x), n) - (x).begin()
#define ZIP(x) (x).erase(unique(ALL(x)), (x).end())
#define Pi pair<int, int>
#define Vi vector<int>

#define rep(n) for(int i = 0; i < n; i++)

string s, t;
char ch[10];
int n, a, b, c, d, x, m[5];

int main() {
	cin >> s >> t;
	string tmp = s;
	s[0] = tmp[2];
	s[2] = tmp[0];
	cout << (s == t ? "YES":"NO") << endl;
	return 0;
}


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

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

	if (s.length() > k)
	{
		cout << s.substr(0, k) + "...\n";
	}
	else
	{
		cout << s << endl;
	}
}

Measured memory_bytes: 3616
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define INF 2147483647
using namespace std;
using Graph=vector<vector<int>>;

int main(){
  int k,s,ans=0;
  cin>>k>>s;
  for(int x=0;x<=k;x++){
    for(int y=0;y<=k;y++){
      if(0<=s-x-y && s-x-y<=k){
        ans++;
      }
    }
  }
  cout<<ans;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    d,x = map(int, input().split())
    A = []
    for i in range(n):
        A.append(int(input()))

    ans = 0
    for i in range(n):
        ans += (d-1)//A[i] + 1
    print(ans+x)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
"use strict";
const main = (input) => {
    const inputs = input.trim().split("\n");
    const S = inputs[1];
    const map = [];
    let cnt = 0;
    for(let i=0;i<S.length;i++){
      if(S[i]=='C' && S[i-1]=='A') cnt++;
      map[i+1]=cnt;
    }
    for(let i=2;i<inputs.length;i++){
      let l = Number(inputs[i].split(" ")[0]);
      let r = Number(inputs[i].split(" ")[1]);
      console.log(map[r]-map[l]);
    }
  }
  
  main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
  

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int a, b, c, d;

int main(void) {
  // Here your code !
  scanf("%d %d %d %d",&a, &b, &c, &d);

  printf("%d\n", min(a, b) + min(c, d));
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <complex>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;
constexpr double EPS = 1e-10;

using Point = complex<double>;
using Line  = pair<Point, Point>;
double dot(Point p, Point q) { return (conj(p) * q).real(); }
double cross(Point p, Point q) { return (conj(p) * q).imag(); }
double slope(Line l) { return tan(arg(l.second - l.first)); }

Point project(Line l, Point p) { // project p onto line (s,t)
    return l.first + (l.second - l.first) * dot(p - l.first, l.second - l.first) / norm(l.second - l.first);
}

Point reflect(Line l, Point p) {
    return l.first + conj((p - l.first) / (l.second - l.first)) * (l.second - l.first);
}

int ccw(Point a, Point b, Point c) {
    b -= a; c -= a;
    if(cross(b, c) >  EPS) return +1; // counter-clockwise
    if(cross(b, c) < -EPS) return -1; // clockwise
    if(  dot(b, c) < -EPS) return +2; // c--a--b
    if(abs(b)+EPS < abs(c))return -2; // a--b--c
    return 0; // a--c--b
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    double a,b,c,d;
    cin >> a >> b >> c >> d;
    Line l(Point(a,b),Point(c,d));

    int q;
    cin >> q;
    for(int i=0; i < q; ++i) {
        double x,y;
        cin >> x >> y;
        Point ret = project(l, Point(x,y));
        cout << ret.real() << " " << ret.imag() << '\n';
    }
    return 0;
}


Measured memory_bytes: 3372
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
int main() {
 int N;
 cin>>N;
 vector<int>A(N);
 int ans=10000000;
 rep(i,N){
   	cin>>A[i];
     int cnt=0;
     bool a=true;
     while(a==true){
         if(A[i]%2==1||A[i]<2){
             a=false;
         }
         else{
             A[i]/=2;
             cnt++;
         }
     }
     if(cnt<ans){
         ans=cnt;
     }
 }
 cout<<ans<<endl;
}


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

using namespace std;

int main(){
    long long N ;
    cin >> N;
    string res;
    // N--;
    while (N > 0) {
        int t = N / 26;
        res += ('a'+(N-1)%26);
        N = (N-1) / 26;
    
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  Vl A(N);
  ll tmp;
  REP(i, N - 1) {
    cin >> tmp;
    A.at(tmp - 1)++;
  }

  REP(j, N) cout << A.at(j) << endl;
}

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

#define ll long long
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

using namespace std;
ll power(ll a,ll n)
{
          ll result=1;
          while(n>0)
          {
               if(n&1)
                    result=result*a;
               a=a*a;
               n=n>>1;
          }
          return result;
}
ll lcm(ll a,ll b)
{
          return ((a*b)/__gcd(a,b));
}
bool ispow2(ll n)
{
          return (ceil(log2(n))==floor(log2(n)));
}
bool isprime(ll n)
{
          if(n==1)
               return false;
          else if(n==2)
               return true;
          else
          {
               for(ll i=2;i*i<=n;++i)
               {
                    if(n%i==0)
                         return false;
               }
               return true;
          }
}

ll ncr(ll n,ll r)
{
    if(r > n - r)
          r = n - r;
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++)
     {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
void sieve(int n)
{
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
     prime[1]=false;
     prime[0]=false;
    for (int p=2; p*p<=n; p++)
    {
        // If prime[p] is not changed, then it is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p greater than or
            // equal to the square of it
            // numbers which are multiple of p and are
            // less than p^2 are already been marked.
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    // Print all prime numbers
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout<<p<<" ";
}
int main()
{
          ios_base::sync_with_stdio(0);
          cin.tie(0);

          int t=1;
          //cin>>t;
          while(t--)
          {
                    string a,b;
                    cin>>a>>b;
                    int ans = b.size();
                    int count=0;
                    int n=a.size();
                    int m=b.size();
                    int k=0;
                    for(int i=0;i<=n-m;++i)
                    {
                         count=0;
                         k=0;
                         for(int j=i;j<i+m;++j)
                         {
                              if(a[j]==b[k++])
                                   continue;
                              else
                                   count++;
                         }
                         ans = min(ans,count);
                    }
                    cout<<ans;
          }
          return 0;
}


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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("file.1", "r", stdin);

  int N;
  cin >> N;
  vector<map<string, ll>> a(N + 1);
  a[0]["TTT"] = 1;
  for (int i = 0; i < N; i++) {
    for (const string& c1 : { "A", "C", "G", "T" }) {
      for (const string& c2 : { "A", "C", "G", "T" }) {
        for (const string& c3 : { "A", "C", "G", "T" }) {
          string key = c1 + c2 + c3;
          if (a[i][key] == 0)
            continue;
          // NG combination
          // AGC
          // ACG
          // GAC
          // AG?C
          // A?GC
          for (const string& nc : { "A", "C", "G", "T" }) {
            if (nc == "C" && c1 == "G" && c2 == "A")
              continue;
            if (nc == "G" && c1 == "C" && c2 == "A")
              continue;
            if (nc == "C" && c1 == "A" && c2 == "G")
              continue;
            if (nc == "C" && c2 == "G" && c3 == "A")
              continue;
            if (nc == "C" && c1 == "G" && c3 == "A")
              continue;
            string nkey = nc + c1 + c2;
            a[i + 1][nkey] += a[i][key];
            a[i + 1][nkey] %= MOD;
          }
        }
      }
    }
  }
  ll ans = 0;
  for (const string& c1 : { "A", "C", "G", "T" }) {
    for (const string& c2 : { "A", "C", "G", "T" }) {
      for (const string& c3 : { "A", "C", "G", "T" }) {
        string key = c1 + c2 + c3;
        ans += a[N][key];
        ans %= MOD;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int k, x;
    cin >> k >> x;

    for (int pos = max(-1000000, x - k + 1); pos <= min(1000000, x + k - 1); pos++) {
        cout << pos << ' ';
    }

    return 0;
}

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

int main() {
	string str;

	int N, M;

	int n_pe = 0;
	int n_an = 0;
	cin >> N;
	cin >> M;
	//AC出されたか
	int *flag;
	int *WA;
	flag = new int[N];
	WA = new int[N];
	for (int i = 0;i < N;i++) {
		flag[i] = 0;
		WA[i] = 0;
	}

	for (int i = 0;i <M;i++) {
		int n;
		string s;
		cin >> n;
		cin >> s;
		n -= 1;
		if (flag[n] == 0 && s == "WA") {
			WA[n]++;

		}
		else if (flag[n] == 0 && s == "AC") {
			n_an += 1;
			flag[n] = 1;
			n_pe += WA[n];
		}
	}
	cout << n_an << " ";
	cout << n_pe << endl;

}

Measured memory_bytes: 1024
N = int(input())
Ss = [int(input()) for _ in range(N)]
Ss.sort()
ans = sum(Ss)
if ans % 10 != 0:
    print(ans)
    exit()
cnt_10 = 0
for s in Ss:
    if s % 10 == 0:continue
    ans -= s
    if ans % 10 != 0:
        print(ans)
        exit()
print(0)

Measured memory_bytes: 3060
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

int main() {
	ll N;
	cin >> N;
	struct Block {
		ll weight;
		ll strength;
		ll value;
	};
	vector<Block> blocks;
	for (ll i = 0; i < N; i++) {
		Block b;
		cin >> b.weight >> b.strength >> b.value;
		blocks.push_back(b);
	}
	sort(blocks.begin(), blocks.end(), [](Block lhs, Block rhs) {
		return lhs.weight + lhs.strength < rhs.weight + rhs.strength;
	});
    auto dp = make_vec_nd(numeric_limits<ll>::min(), blocks.size()+1, 20001);
    dp[0][0] = 0;
    for (ll n = 1; n < blocks.size()+1; n++) {
        for (ll w = 0; w <= 20000; w++) {
            dp[n][w] = dp[n-1][w];
            if (blocks[n-1].weight <= w && w - blocks[n-1].weight <= blocks[n-1].strength) {
                dp[n][w] = max(dp[n][w], dp[n-1][w - blocks[n-1].weight] + blocks[n-1].value);
            }
        }
    }
    ll ans = numeric_limits<ll>::min();
    for (ll w = 0; w <= 20000; w++) {
        ans = max(ans, dp[N][w]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 160640
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  double d, t, s;
  cin >> d >> t >> s;
  double x = d / s;
  if (t >= x)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3712
#include "bits/stdc++.h"
using namespace std;

//@@@@@
//@ snippet FenwickTree
//@ alias   BIT
//@ options head
template <class T> struct FenwickTree { // {{{
    vector<T> dat;
    const size_t SIZE_POW2;
    explicit FenwickTree(int size): dat(size+5, 0), SIZE_POW2(1 << (__lg(size+5)+1)) {}

    inline void add(int i, const T &v){
        for (++i; i < dat.size(); i += i & -i) dat[i]+=v;
    }
    inline T sum(int i) const {
        T s = 0;
        for (++i; i > 0; i -= i & -i) s += dat[i];
        return s;;
    }
    inline T sum(int s, int t) const {
        if (s > t) swap(s, t);
        return sum(t) - sum(s - 1);
    }
    inline int lower_bound(T v) const {
        if (v <= 0) return 0;
        int i = 0;
        for (int w = SIZE_POW2; w > 0; w >> 1) {
            if (i + w < dat.size() && dat[i + w] < v) {
                v -= dat[i + w];
                i += w;
            }
        }
        return i;
    }
}; // }}}
//@@@@@


/*
 * Verified on : 2019-07-30
 * https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_B
 */
void AOJ_DSL_2_B() // {{{
{
    int N, Q;
    cin >> N >> Q;

    FenwickTree<int> ft(N);
    while(Q--) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) {
            ft.add(x, y);
        } else {
            cout << (ft.sum(x, y)) << '\n';
        }
    }
} // }}}

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

    AOJ_DSL_2_B();

    return 0;
}



Measured memory_bytes: 3260
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a[3], d = 0;
    cin >> a[0];
    for (int i = 1; i < 3; i++) 
    {
        cin >> a[i];
        for (int j = 0; j < i; j++) 
            if (a[i] == a[j]) d++;
    }
    if (d == 1) cout << '2';
    else if (d == 3) cout << '1';
    else cout << '3';
}

Measured memory_bytes: 3548
#include<stdio.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<ctime>
#include<complex>
using namespace std;

int k;
int dist[100005];
deque<int> q;

int main(){
	cin>>k;
	for(int i=0;i<k;i++) dist[i]=1e9+7;
	dist[1]=1;
	q.push_back(1);
	while(!q.empty()){
		int s=q.front();
		q.pop_front();
		if(dist[s]<dist[s*10%k]){
			dist[s*10%k]=dist[s];
			q.push_front(s*10%k);
		}
		if(dist[s]+1<dist[(s+1)%k]){
			dist[(s+1)%k]=dist[s]+1;
			q.push_back((s+1)%k);
		}
	}
	cout<<dist[0]<<endl;
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v;
    for (int i = 1; i <= 9; i++) {
        for (int j = i; j <= 9; j++) {
            v.push_back(i * j);
        }
    }

    auto result = find(v.begin(), v.end(), n);
    cout << ((result == v.end()) ? "No" : "Yes") << endl;
}

Measured memory_bytes: 256
def fib(n):
    if n == 0:
        return 1
    if n == 1:
        return 1
    if F[n] > 0:
        return F[n]
    F[n] = fib(n-1) + fib(n-2)
    return F[n]

n = int(input())
F = [0 for i in range(n+1)]
print(fib(n))

Measured memory_bytes: 7724
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  if ( S[0] == S[1] && S[2] == S[3] && S[1] != S[2]){
    cout << "Yes" << endl;
  }
  else if (S[0] == S[2] && S[1] == S[3] && S[0] != S[1]){
    cout << "Yes" << endl;
  }
  else if (S[0] == S[3] && S[1] == S[2] && S[0] != S[1]){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
                                     
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
ll N,Q;
string S;
ll k[75];
ll s[1000001], ss[1000002], c[1000001], m[1000002];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>S>>Q;
    rep(i,0,Q){
        cin>>k[i];
    }
    rep(i,0,N){
        s[i+1]=s[i]+(S[i]=='M'?1:0);
        ss[i+2]=ss[i+1]+s[i+1];
        c[i+1]=c[i]+(S[i]=='C'?1:0);
        m[i+2]=m[i+1]+(S[i]=='C'?s[i]:0);
    }
    rep(x,0,Q){
        ll K=k[x];
        ll ans=0;
        rep(i,0,N){
            if(S[i]=='D'){
                ans+=(i+K<=N?m[i+K+1]:m[N+1])-m[i+1];
                ans-=((i+K<=N?c[i+K]:c[N])-c[i])*s[i];
            }
        }
        cout <<ans<<"\n";
    }
}

Measured memory_bytes: 32668
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int xyz(int a, int b)
{
	if(b == 0)
	{
		return 1;
	}
	else
	{
		return a * xyz(a, b - 1);
	}
}

int main()
{
	int x;
	cin >> x;
	
	int ans = 0;
	for(int i = 1; i <= x; i++)
	{
		for(int j = 2; j < x + 2; j++)
		{
			if(ans < xyz(i, j) && xyz(i, j) <= x)
			{
				ans = xyz(i, j);
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  long long n;
  long long x = 1;
  cin >> n;
  int i;
  for(i=1;i<=n;i++){
    x *= i;
    x %= 1000000007;
  }
  cout << x << "\n";
  return 0;
}

Measured memory_bytes: 3592
/*
  AUTHOR:SOURABH
  CREATED:06:05:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,n,i;
    string s,tt;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>s>>tt;
        n=s.length();
        fn(i,n)
        {
            if(s[i]!=tt[i])
            {cout<<"No";goto e;}
        }
        cout<<"Yes";
        e:
        ;
    }
    return 0;
}















Measured memory_bytes: 3648