akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

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

const ll mod = 1e9 + 7;
const ll IMF = 1LL << 60;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//




int main(){
        int n;
        cin >> n;
        vector<int> a(n);
        for(int i = 0; i < n; i++){
                cin >> a[i];
        }

        int ans = 0;
        for(int i = 0; i < n; i++){
                int tmp = 0;
                while(a[i]%2 == 0){
                        tmp++;
                        a[i] /= 2;
                }
                ans += tmp;
        }

        cout << ans << endl;
}




































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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  string s;
  cin >> s;
  int n = s.size();
  i64 ans = 0;
  int a = 0;
  rep(i, n) {
    if (s[i] == 'A') a++;
    else if (i < n - 1 && s[i] == 'B' && s[i+1] == 'C') { ans += a; i++; }
    else a = 0;
  }
  cout << ans << '\n';
}


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

int main(){
    string s;
    cin >> s;
    map<char, int> m;
    for(int i =0; i < s.size(); i++){
        m[s.at(i)]++;
    }
    int u = abs(m['a']- m['b']);
    int v = abs(m['b']- m['c']);
    int w = abs(m['c']- m['a']);
    if(u<=1 && v <= 1 && w <= 1) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <vector>
#include <queue>
using namespace std;

int n, x, y, a[2020], d[2020];
vector<int> g[2020];

void bfs(int s)
{
	for (int i = 1; i <= n; i++) d[i] = -1;
	queue<int> q; q.push(s); d[s] = 0;
	while (!q.empty()){
		int x = q.front(); q.pop();
		for (auto &y : g[x]) if (d[y] == -1){
			q.push(y); d[y] = d[x] + 1;
		}
	}
	for (int i = s + 1; i <= n; i++) a[d[i]]++;
}

int main()
{
	scanf ("%d %d %d", &n, &x, &y);
	g[x].push_back(y);
	g[y].push_back(x);
	for (int i = 2; i <= n; i++){
		g[i].push_back(i - 1);
		g[i - 1].push_back(i);
	}
	for (int i = 1; i <= n; i++) bfs(i);

	for (int i = 1; i < n; i++) printf ("%d\n", a[i]);
	return 0;
}

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

int main(){
  int nn,c,a,n;

  cin >> nn;
  while(nn--){
    int cnt = 0;
    cin >> c >> a >> n;
    while(true){
      if(c >= 1 && a >= 1 && n >= 1){
	c--; a--; n--;
	cnt++;
      }
      else if(c >= 2 && a >= 1){
	c -= 2;
	a--;
	cnt++;
      }
      else if(c >= 3){
	c -= 3;
	cnt++;
      }
      else{
	break;
      }
    }
    cout << cnt << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
using namespace std;
struct cus
{
	int a,b,c,d;
};

int main()
{
	cus a[100];
	for(int i=0;i<100;i++)
	{
		a[i].a=5*i;
		a[i].b=(i%5==1?5:2);
		a[i].c=17*(i%2)+3*(i%3)+19;
		a[i].d=0;
	}
	int t[20]={};
	for(int i=0;i<100;i++)
	{
		//for(int j=0;j<17;j++)printf("%3d",t[j]);
		//cout<<endl;
		int k=max(a[max(0,i-1)].d,a[i].a);
		for(;;k++)for(int j=0;j<17-a[i].b+1;j++)
		{
			bool x=true;
			for(int l=j;l<j+a[i].b;l++)
			{
				if(t[l]>k)x=false;
			}
			if(x)
			{
				for(int l=j;l<j+a[i].b;l++)
				{
					t[l]=k+a[i].c;
				}
				a[i].c=k-a[i].a;
				a[i].d=k;
				goto end;
			}
		}
		;end:;
	}
	int n;
	while(cin>>n)
	{
		cout<<a[n].c<<endl;
	}
}

Measured memory_bytes: 3080
package main

import "fmt"

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	oks := make([]bool, n+1)
	for i := 0; i < n+1; i++ {
		oks[i] = true
	}
	for i := 0; i < m; i++ {
		var a int
		fmt.Scan(&a)
		oks[a] = false
	}

	dp := make([]int, n+1)
	dp[0] = 1
	for now := 0; now < n; now++ {
		for next := now + 1; next <= min(n, now+2); next++ {
			if oks[next] {
				dp[next] += dp[now]
				dp[next] %= 1000000007
			}
		}
	}
	fmt.Println(dp[n])
}


Measured memory_bytes: 5504
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    string t; cin >> t;
    vector<vector<int>> dp(3001, vector<int>(3001));
    vector<vector<int>> froms(3001, vector<int>(3001, -1));
    for(size_t i = 0; i < s.size(); i++){
        for(size_t j = 0; j < t.size(); j++){
            dp[i + 1][j + 1] = dp[i][j + 1];
            froms[i + 1][j + 1] = 0;
            if(dp[i + 1][j + 1] < dp[i + 1][j]){
                dp[i + 1][j + 1] = dp[i + 1][j];
                froms[i + 1][j + 1] = 1;
            }
            if(s[i] == t[j] && dp[i + 1][j + 1] < dp[i][j] + 1){
                dp[i + 1][j + 1] = dp[i][j] + 1;
                froms[i + 1][j + 1] = 2;
            }
            // printde(i, j, dp[i + 1][j + 1]);
        }
    }
    // cout << dp[s.size()][t.size()] << '\n';
    string ans;
    int i = s.size(), j = t.size();
    while(i || j){
        printde(i, j);
        switch(froms[i][j]){
        case 0:
            i--;
            break;
        case 1:
            j--;
            break;
        case 2:
            i--; j--;
            ans += s[i];
            break;
        default:
            i = j = 0;
            break;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << '\n';
}


Measured memory_bytes: 70912
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
#define FAST  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long
#define ar array 
 
 
int main() {
	FAST;
 
	//int t;
	//cin >> t;
	//while(t--) 
	{
		int n,l;
		cin>>n>>l;
		vector<string> s;
		for(int i=0;i<n;i++)
		{
			string c;
			cin>>c;
			s.push_back(c);
		}
		sort(s.begin(),s.end());
		string out;
		for(auto i:s)
		{
			out+=i;
		}
		cout<<out<<'\n';
	}
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define x           first
#define y           second
#define mp          make_pair

using namespace std;

typedef pair<int, int> pii;
const int N = int(2e5) + 7;
const int mod = int(1e9) + 7;
const ll oo = (ll)1e18;

int n;
ll res, x;
vector<ll> s;

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> x, s.pb(x);
    while(1) {
        sort(s.begin(), s.end());
        if(s.back() < n) break;
        for(int i = 0; i < n - 1; ++i) s[i] += s[n - 1] / n;
        res += s[n - 1] / n;
        s[n - 1] %= n;
    }
    cout << res;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    vector<bool> dp(100001);
    dp[0] = 1;
    rep(i, 100001){
        if(!dp[i]){
            continue;
        }
        rep(d, 100, 106){
            if(i + d <= 100000){
                dp[i + d] = 1;
            }
        }
    }

    ll x; cin >> x;
    cout << dp[x] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define SIZE    3

void swap(int *a, int *b)
{
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}


int main(int argc, char *argv[])
{
    int val[SIZE];
    char line[256];

    if (!fgets(line, sizeof(line), stdin)) {
        fprintf(stderr, "error intput val\n");
        return -1;
    }

    if (sscanf(line, "%d %d %d", &val[0], &val[1], &val[2]) != 3) {
        fprintf(stderr, "error input format\n");
        return -1;
    }


    int i, j;
    for (i=0; i<SIZE-1; i++) {
        for (j=i+1; j<SIZE; j++) {
            if (val[i] > val[j]) {
                swap(&val[i], &val[j]);
            }
        }
    }

    printf("%d %d %d\n", val[0], val[1], val[2]);

    return 0;
}

Measured memory_bytes: 604
function main(input) {
    x = input[0];
    if (x == 'A') console.log('T');
    if (x == 'C') console.log('G');
    if (x == 'G') console.log('C');
    if (x == 'T') console.log('A');
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

Measured memory_bytes: 7372
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    vector<int>in(n);
    rep(i,n)cin>>in[i];
    int max=in[0];
    rep(i,n){
      int sum=0;
      loop(j,i,n){
	sum+=in[j];
	if(max<sum)max=sum;
      }
    }
    cout<<max<<endl;
  }


}

Measured memory_bytes: 1204
# -*- coding: utf-8 -*-

A, B = map(int, input().split())
S = input()

if S.count("-") == 1:
    hiphen = S.index("-")
    if A == hiphen and B == len(S) - 1 - hiphen:
        print("Yes")
    else:
        print("No")
else:
    print("No")


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

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}

#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

void err(vector<string>::iterator it) {}

template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> inline T tabs(T a) { return (a > 0) ? a : -a; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

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

	int n;

	cin >> n;
	vector<int> a(n + 1);
	REPU(i, 1, n + 1) cin >> a[i];
	int ans = 0;
	REPU(i, 1, n + 1) {
		if (a[a[i]] == i) ans++;
	}
	ans /= 2;
	cout << ans << endl;

	return 0;
}


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

#define ll long long
#define N 100001
#define MX 1000000001
#define logg(a)(b) log(b)/log(a)
#define pb(x) push_back(x);
#define T int t, q=0; scanf("%d", &t); while(q++<t)
#define pi acos(-1)
#define flag bool fl=true;
#define fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0);

int main()
{

    ll a, b, k;
    cin >> k >> a >> b ;
    while(1){
    if(a%k==0){
    cout<<"OK"<<endl;
            break;

    }
    a++;
    if(a>b){
        cout<<"NG"<<endl;
        break;
    }

    }


}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int l, r;
    cin >> l >> r;
    int mod_min = 2019;
    for (int i = l; i <= min(l + 2019, r); i++) {
        for (int j = i + 1; j <= min(l + 2019, r); j++) {
            mod_min = min(mod_min, ((i % 2019) * (j % 2019)) % 2019);
        }
    }
    cout << mod_min << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int n,a; cin>>n>>a;
    vector <int> x(n); 
    rep(i,n) cin>>x[i];
    vector<vector<vector<int>>> dp (55, vector<vector<int>>(55, vector<int>(2580)));
    dp[0][0][0] = 1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=i;j++){
            for(int k=0;k<2510;k++){
                dp[i+1][j][k] += dp[i][j][k];
                dp[i+1][j+1][k+x[i]] += dp[i][j][k];
                
            }
        }
    }
    int ans = 0;
    for(int j=0;j<=n;j++){
        //cout<<dp[n][j][a*j]<<endl;
        if(j==0) continue;
        else {ans += dp[n][j][a*j];}
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 62464
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
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; }
int main()
{
    int X;
    cin >> X;
    if (X == 1) {
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }
    return 0;
}

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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int   long long
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define m 1000000000000000007LL
int n,a[200005],dp[200005][4][2];
bool vis[200005][4][2];
int f(int pos,int cnt,int last){
	if(cnt<-1) return -m;
	if(pos==n) return 0;
	if(vis[pos][cnt+2][last]) return dp[pos][cnt+2][last];
	vis[pos][cnt+2][last]=1;
	int &ans=dp[pos][cnt+2][last];
	ans=f(pos+1,cnt-1,0);
	if(last==0) ans=max(ans,f(pos+1,cnt+1,1)+a[pos]);
	return ans;
}
void solve(){
    cin>>n;
    rep(i,0,n) cin>>a[i];
    cout<<f(0,n%2,0)<<endl;
}
 
signed main(){
	solve();
	
	
	
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];

// template starts
typedef long long int ll;

vector<bool> vis;
vector<int> ans;
vector<int> d;

void bfs(vector<vector<int>> &adj){
	queue<int> q;
	q.push(1);
	vis[1] = true;
	
	while(q.size() > 0){
		int root = q.front();
		q.pop();
		

		//cout << root << ": ";
		for(int i = 0; i < (int)adj[root].size(); i++){
			int node = adj[root][i];
			if(vis[node]) continue;
			
			//cout << node << " ";
			
			vis[node] = true;
			ans[node] = root;
			
			q.push(node);
		}
		//cout << endl;
	}
}

void solve(){
	// code starts from here
	int N, M;
	cin >> N >> M;
	vector<vector<int>> adj(N+1);
	
	for(int i = 0; i <= N; i++){
		ans.pb(-1);
		vis.pb(false);
	}
	
	for(int i = 0; i < M; i++){
		int t1,t2;
		cin >> t1 >> t2;
		adj[t1].pb(t2);
		adj[t2].pb(t1);
			
	}
	bfs(adj);
	
	for(int i = 2; i <= N; i++){
		if(ans[i] == -1){
			cout << "No" << endl;
			return;
		}
	}
	
	cout << "Yes" << endl;
	for(int i = 2; i <= N; i++) cout << ans[i] << endl;
}

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

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;

bool f(ll i,ll a,ll b){
	ll ans=0; 
	while(i){
		ans+=i%10;
		i/=10;
	}
	return ans>=a && ans<=b;
}

void solve(){

	ll n,a,b,ans=0;
	cin>>n>>a>>b;
	for(int i=0;i<=n;i++)
		if(f(i,a,b)){ans+=i;}
	cout<<ans;

}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;

	//ll t;cin>>t;while(t--)
	solve();

}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e5 + 5

signed main() {
	string s;
	int rest;
	cin >> s >> rest;
	rep(i, s.size()) {
		if (s[i] == 'a') continue;
		// dump(rest);
		if ('z' - s[i] + 1 <= rest) {
			rest -= 'z' - s[i] + 1;
			s[i] = 'a';
		}
	}
	rest %= 26;
	rep(i, rest) {
		s.back()++;
		if (s.back() > 'z') s.back() = 'a';
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=100+50;
ll n,a,b,f[maxn],ans=0,cnt=0,bif=0,minn=1e15+5;
ll xyz,s[105][105],acl=0;
int main()
{
	for(int i=0;i<100;i++)
	{
		s[i][0]=1;
		for(int j=1;j<=i;j++)
		{
			s[i][j]=s[i-1][j]+s[i-1][j-1];
		}
	}
	cin>>n>>a>>b;
	for(int i=0;i<n;i++)
	{
		cin>>f[i];
	}
	sort(f,f+n);
	for(int i=n-1;i>=n-a;i--)
	{
		ans+=f[i];
		minn=min(minn,f[i]);
	}
	printf("%.6lf\n",(double)ans/a);
	for(int i=n-1;i>=n-a;i--)
	{
		if(minn==f[i])
		{
			acl++;
		}
	}
	if(minn==f[n-1])
	{
		for(int i=0;i<n;i++)
		{
			if(f[i]==f[n-1])
				bif++;
		}
		for(int i=a;i<=b&&i<=bif;i++)
		{
			cnt+=s[bif][i];
		}
		cout<<cnt;
	}
	if(minn!=f[n-1])
	{
		for(int i=0;i<n;i++)
		{
			if(f[i]==minn)
				bif++;
		}
		cnt=s[bif][acl];
		cout<<cnt;
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);    
int n;
cin>>n;
for(int i=1;i<10;i++){
if(n%i==0&&n/i<10){
    cout<<"Yes";
    return 0;
}
}
cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long
#define pii pair<int,int>
#define ff first
#define ss second
#define vi vector<int>
#define fo(n) for(int i = 0;i < int(n);i++)
#define foo(a,b) for(int i = int(a);i <= int(b);i++)
#define mk make_pair
#define pb push_back
#define MAXN (int)1e5
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define fastio ios_base:: sync_with_stdio(false)
#define inf (int)1e9

vi h(MAXN);
int dp[MAXN];

int sol(int i,int k){
	if(i == 0) return 0;

	if(dp[i] != -1) return dp[i];

	int min_cost = inf;

	for(int j = 1;j <= k;j++){
		if((i-j) < 0) break;

		min_cost = min(min_cost, abs(h[i]-h[i-j])+sol(i-j,k));
	}

	dp[i] = min_cost;
	return dp[i];
}

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

	fo(n) cin >> h[i];

	memset(dp,-1,sizeof(dp));
	int ans = sol(n-1,k);

	cout << ans << endl;

	return 0;
 }	

Measured memory_bytes: 8832
H, W = map(int, input().split())
S = [input() for _ in range(H)]

L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]

for i in range(H):
	for j in range(W):
		if S[i][j] == ".":
			if j == 0:
				L[i][j] = 1
			else:
				L[i][j] = L[i][j - 1] + 1

# print(L)

for i in range(H):
	for j in range(W - 1, -1, -1):
		if S[i][j] == ".":
			if j == W - 1:
				R[i][j] = 1
			else:
				R[i][j] = R[i][j + 1] + 1

# print(R)

for j in range(W):
	for i in range(H - 1, -1, -1):
		if S[i][j] == ".":
			if i == H - 1:
				D[i][j] = 1
			else:
				D[i][j] = D[i + 1][j] + 1

# print(D)

for j in range(W):
	for i in range(H):
		if S[i][j] == ".":
			if i == 0:
				U[i][j] = 1
			else:
				U[i][j] = U[i - 1][j] + 1

# print(U)


ans = 0
X = [[0] * W for _ in range(H)]
for i in range(H):
	for j in range(W):
		X[i][j] = L[i][j] + R[i][j] + D[i][j] + U[i][j] - 3
	ans = max(ans, max(X[i]))

# print(X)
print(ans)


Measured memory_bytes: 212612
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1000000000
#define mod 1000000007

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

	string s;
	cin>>s;
	string key="keyence";
	int j=0,co,coi;
	REP(i,s.size()-6){
		FOR(k,0,8){
			//int x=0;
			if(s[i+k]!=key[k]){
			//	cout<<i<<" "<<k<<endl;
				break;
			}
			if(k==6){cout<<"YES"<<endl; return 0;}
		}
		//cout<<"A"<<endl;
	}
	REP(i,7){
		if(s[i]==key[i]){
			j=i+1;
			while(j<s.size()){
				FOR(k,i+1,8){
				//int x=0;
					if(s[j+k-1]!=key[k])
						break;
					//cout<<i<<endl;
					if(k==6 && j+k==s.size()){cout<<"YES"<<endl; return 0;}
				}
				j++;
			}
		}
		else break;
	}
	cout<<"NO"<<endl;
	return 0;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;

int h, w;
vec<string> grid;
vi moveh = {0,0,1,-1};
vi movew = {1,-1,0,0};
vii dist;
/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(30);

    // 多点BFS. 最初にqueueに複数の開始点をemplaceすればいい
    cin >> h >> w;
    grid.resize(h);
    dist.resize(h, vi(w, inf));
    rep(i,h) cin >> grid[i];

    queue<PII> que;
    rep(i,h)rep(j,w) {
        if(grid[i][j] == '#') {
            dist[i][j] = 0;
            que.emplace(i,j);
        }
    }

    while(que.size()) {
        int x,y;
        tie(x,y) = que.front(); que.pop();
        rep(i,4) {
            int nx = x+moveh[i];
            int ny = y+movew[i];
            if(!(0<=nx&&nx<h&&0<=ny&&ny<w)) continue;
            if(grid[nx][ny]=='#') continue;
            grid[nx][ny] = '#';
            dist[nx][ny] = dist[x][y] + 1;
            que.emplace(nx,ny);
        }
    }

    int ans = -1;
    rep(i,h)rep(j,w)if(dist[i][j]!=inf) chmax(ans, dist[i][j]);
    cout << ans << '\n';
}

Measured memory_bytes: 13456
from math import ceil
from heapq import heappop,heappush
from collections import deque
N,M = map(int,input().split())
a = list(map(int,input().split()))
a = list(map(lambda x:x*(-1), a))
A = []

for a_ in a:
    heappush(A,a_) 

for _ in range(M):
  maxA = ceil(heappop(A)/2)
  A.append(maxA)
  
ans = sum(A)*-1
print(ans)

Measured memory_bytes: 14636
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
//cout << setprecision(123)<<ans;
//a=atoi(S.c_str());
//S=to_string(a);
int main(){
  double a,b,x,ans;
  cin>>a>>b>>x;
  if(a*a*b<2.0*x){
     ans=180.0/M_PI*atan(2.0*b/a-2.0*x/a/a/a);
  }
  else{
    ans=180.0/M_PI*atan(a*b*b/2.0/x);
  }
  cout<<setprecision(15)<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(a) (a).begin(), (a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x, 0, sizeof(x))
#define MINF(x) memset(x, 0x3f, sizeof(x))
#define MMINUS(a) memset(a, 0xff, sizeof(a))
#define ten(n) ((int)1e##n)

const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const double EPS = 1.0 / INF;
const char ENDL = '\n'; // for JetBrains IDE only supports yen

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;
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

using namespace std;

//===================================== template =========================================================

int main() {
    cin.tie(nullptr); ios_base::sync_with_stdio(false);
    int N; cin >> N; string S; cin >> S;
    int w = 0, e = 0; REP(i, N) S[i] == 'W' ? w++ : e++;
    int res = INF; int cur_w = 0, cur_e = 0;
    REP(i, N) {
        chmin(res, cur_w + e - (cur_e + (S[i] == 'E' ? 1 : 0)));
        S[i] == 'W' ? cur_w++ : cur_e++;
    }
    cout << res << endl;
}


Measured memory_bytes: 720
#include<iostream>
#include<algorithm>
#include<cstdint>
using namespace std;

const int MAX = 100000;
static pair<int, int> A[MAX];

int64_t getValue(int N, int K, int b) {
	int64_t sum = 0, chk;
	if (b == 0) {
		for (int i = 0;i < N;i ++) {
			if (A[i].first == b) sum += A[i].second;
		}
//		cout << "0:" << sum << endl;
		return sum;
	}
	if ((K & b) == 0) return getValue(N, K, b >> 1);
	for (int i = 0;i < N;i ++) {
		if (A[i].first < b) sum += A[i].second;
		else A[i].first -= b;
	}
//	cout << b << ":" << sum << endl;
	chk = getValue(N, K - b, b >> 1);
	if (sum < chk) return chk;
	else return sum;
}

int main() {
	int N, K, a, b;
	cin >> N >> K;
	for (int i = 0;i < N;i ++) {
		cin >> a >> b;
		A[i] = make_pair(a, b);
	}
	sort(A, A+N);
	int t;
	for (int i = 1;i <= K;i <<= 1) t = i;
	cout << getValue(N, K, t);
	return 0;
}

Measured memory_bytes: 1024
# 写経
N, K = map(int, input().split())


top = [0] * N
sub = []
for _ in range(N):
    t, d = map(int, input().split())
    t -= 1
    if top[t] == 0:
        top[t] = d
    else:
        if top[t] >= d:
            sub.append(d)
        else:
            sub.append(top[t])
            top[t] = d
top.sort(reverse=True)
sub.sort(reverse=True)


res = [0]
for i in range(N):
    if top[i] != 0:
        res.append(res[-1] + top[i])
    else:
        res.append(-1)
w = [0]
for i in range(len(sub)):
    w.append(w[-1] + sub[i])


ans = 0
for i in range(1, K+1):
    if (len(w) - 1 >= K-i) and (res[i] != -1):
        ans = max(res[i] + w[K-i] + i**2, ans)
print(ans)


Measured memory_bytes: 12588
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include <cstdlib>
#define mp make_pair
#define pb push_back
#define mem(i,a) memset(i,a,sizeof(i))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
const int DMAX=1000000+5;
const int MOD=1000000000+7;
template<class T> inline void read(T &x){
    x=0; 
    T f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-'){
            f=-1;
        }
        ch=getchar();
    }
    while(ch<='9' && ch>='0'){
        x=x*10+(ch-'0');
        ch=getchar();
    }
    x*=f;
}
ll a,b,n;
ll x;
int main(){
    read(a),read(b);
    read(n);
    if(n<b){
        x=n;
    }
    else{
        x=b-1;
    }
    cout<<floor((db)a*(db(x)/b-floor(db(x)/b)))<<endl;
    return 0;
}

Measured memory_bytes: 3792
#include<cstdio>
#define min(a,b) (a<b?a:b)
int a[101];
int main()
{
	int n;
	scanf("%d",&n);
	int sum=0;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	sum/=n;
	int ans1=0,ans2=0;
	for(int i=1;i<=n;i++){
		ans1+=(a[i]-sum)*(a[i]-sum); 
	}
	sum++;
	for(int i=1;i<=n;i++){
		ans2+=(a[i]-sum)*(a[i]-sum); 
	}
	printf("%d\n",min(ans1,ans2));
	return 0;
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {

	R := oneInt()
	fmt.Print((float64)(2*R) * math.Pi)

}

func exp(val int) float64 {
	var temp float64
	for index := 1; index <= val; index++ {
		temp += float64(index)
	}
	return temp / float64(val)
}

func searchAbove(slice []int, target int, index int) int {
	for i := index + 1; i < len(slice); i++ {
		v := slice[i]
		if v >= target {
			return i
		}
	}
	return -1
}

var sc = bufio.NewScanner(os.Stdin)

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}
func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func scanNums() (nums []int) {
	s := nextLine()
	numStr := strings.Split(s, " ")

	for _, n := range numStr {
		i, _ := strconv.Atoi(n)
		nums = append(nums, i)
	}
	return nums
}

func scanStrings() (strs []string) {
	s := nextLine()
	list := strings.Split(s, " ")
	strs = append(strs, list...)
	return strs
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}


Measured memory_bytes: 1756
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, n) for (int i = 1; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 5000000000000000000;

struct edge {int to; ll cost;};

int main() {
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    --s; --t;
    vector<vector<edge>> g1(n), g2(n);
    rep(i, m) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        --u; --v;
        g1[u].push_back(edge{v, a});
        g1[v].push_back(edge{u, a});
        g2[u].push_back(edge{v, b});
        g2[v].push_back(edge{u, b});
    }
    
    vector<ll> dist1(n, INF), dist2(n, INF);
    vector<int> used1(n, 0), used2(n, 0);
    priority_queue<pair<ll, int>> pq1, pq2;
    dist1[s] = 0;
    pq1.push(pair<ll, int>{0, s});
    while (!pq1.empty()) {
        int v = pq1.top().second;
        pq1.pop();
        if (used1[v]) continue;
        for (auto e : g1[v]) {
            ll alt = dist1[v] + e.cost;
            if (alt < dist1[e.to]) {
                dist1[e.to] = alt;
                pq1.push(pair<ll, int>{-alt, e.to});
            }
        }
        used1[v] = 1;
    }
    dist2[t] = 0;
    pq2.push(pair<ll, int>{0, t});
    while (!pq2.empty()) {
        int v = pq2.top().second;
        pq2.pop();
        if (used2[v]) continue;
        for (auto e : g2[v]) {
            ll alt = dist2[v] + e.cost;
            if (alt < dist2[e.to]) {
                dist2[e.to] = alt;
                pq2.push(pair<ll, int>{-alt, e.to});
            }
        }
        used2[v] = 1;
    }
    
    vector<ll> ans(n, 0);
    ll MAX = 0;
    for (int i = n - 1; i >= 0; --i) {
        MAX = max(MAX, 1000000000000000 - dist1[i] - dist2[i]);
        ans[i] = MAX;
    }
    rep(i, n) cout << ans[i] << "\n";
    return 0;
}


Measured memory_bytes: 22272
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

const int MAX_N = 500;

// trains[i][j] means the number of trains which starts from i (=L) to j (=R)
vector<vector<int>> trains;

vector<vector<int>> acc;

// ref. YouTube AtCoder ABC 106
void build_acc(const int N) {
    acc.resize(N + 1, vector<int>(N + 1, 0));
    for (int l = 1; l <= N; l++) {
        for (int r = 1; r <= N; r++) {
            acc[l][r] = acc[l][r - 1] + acc[l - 1][r] - acc[l - 1][r - 1] + trains[l][r];
        }
    }

    // acc.resize(N + 1, vector<int>(N + 1, 0));
    // for (int l = 1; l <= N; l++) {
    //     for (int r = l; r <= N; r++) {
    //         acc[l][r] = acc[l][r - 1] + trains[l][r];
    //     }
    // }
    // for (int l = 1; l <= N; l++) {
    //     for (int r = 1; r <= N; r++) {
    //         acc[l][r] += acc[l - 1][r];
    //     }
    // }
}

int main(void) {
    int N, M, Q;
    cin >> N >> M >> Q;

    trains.resize(N + 1, vector<int>(N + 1, 0));
    for (int i = 0; i < M; i++) {
        int L, R;
        cin >> L >> R;
        trains[L][R]++;
    }

    build_acc(N);

    // for (int l = 0; l <= N; l++) {
    //     for (int r = 0; r <= N; r++) {
    //         cout << acc[l][r] << " ";
    //     }
    //     cout << endl;
    // }

    for (int i = 0; i < Q; i++) {
        int p, q;
        cin >> p >> q;
        // printf("[%d, %d]\n", p, q);
        p--;

        cout << acc[q][q] - acc[p][q] - acc[q][p] + acc[p][p] << endl;
    }

    return 0;
}


Measured memory_bytes: 2944
from fractions import gcd
N,X = map(int,input().split())
Y = list(map(int,input().split()))
Y.append(X)
Z = [b-a for a,b in zip(Y,Y[1:])]
g = Z[0]
for z in Z:
    g = gcd(g,z)
print(abs(g))

Measured memory_bytes: 16284
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin);
#define f first
#define int long long
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
const int MOD=1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
inline int modinv(int a){return powerexp(a,MOD-2,MOD);}
inline int lcm(int a,int b){int g=__gcd(a,b);return a/g*b;}
void solve(){
    int x,a;
    cin>>x>>a;
    cout<<(x<a?"0":to_string(10))<<endl;
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll x, n;
    cin >> x >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    ll mn = 1000, ans = 0;
    for(int i = -105; i <= 105; i++){
        ll flag = 1;
        for(int j = 0; j < n; j++){
            if(v[j] == i) flag = 0;
        }
        if(flag and (mn > abs(x - i))) mn = abs(x - i), ans = i;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
deque<bool> q;
int main()
{
	string s;
	cin>>s;
	int len=s.length();
	for(int i=0;i<len;++i)
	{
		switch(s[i])
		{
			case '0':
				q.push_back(0);
				break;
			case '1':
				q.push_back(1);
				break;
			case 'B':
				if(!q.empty()) q.pop_back();
				break;	
		}
	}
	while(!q.empty())
	{
		cout<<q.front();
		q.pop_front();
	}
	cout<<endl;
	return 0;
 } 

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $n, $c);

$sushi = [];
for ($i = 0; $i < $n; $i++) {
	fscanf(STDIN, "%d %d", $x, $y);
	$sushi[] = [$x, $y];
}

//戻って進む
$sumConsume = 0;
$sumGain = 0;
$highScore = 0;
$revMemo = [[0, 0, 0, 0, 0]];
$gainMemo = [[0, 0, 0, 0, 0]];

for ($rev = 0; $rev < $n; $rev++) {
	$revConsume = $c - $sushi[$n - 1 - $rev][0];
	$revGain = $revMemo[$rev][1] + $sushi[$n - 1 - $rev][1];
	$revMemo[$rev + 1] = [
		$revConsume,
		$revGain,
		$revGain - $revConsume,
		$revGain - $revConsume * 2,
		max($revMemo[$rev][4], $revGain - $revConsume)
	];
}
for ($i = 0; $i < $n; $i++) {
	$consume = $sushi[$i][0];
	$gain = $gainMemo[$i][1] + $sushi[$i][1];
	$gainMemo[$i + 1] = [
		$consume,
		$gain,
		$gain - $consume,
		$gain - $consume * 2,
		max($gainMemo[$i][4], $gain - $consume)
	];
}
for ($rev = 0; $rev < $n; $rev++) {
	if ($revMemo[$rev][3] < 0) {
		continue;
	}
	$rest = $n - $rev;
	if ($rest < 1) {
		$highScore = max($highScore, $revMemo[$rev][3]);
	}
	//echo "rest", $rest,"highScore",$highScore,"rev", $revMemo[$rev][3],"memo",$gainMemo[$rest-2][4], "\n";

	$highScore = max ($highScore, $revMemo[$rev][3] + $gainMemo[$rest][4]);
}
for ($rev = 0; $rev < $n; $rev++) {
	if ($gainMemo[$rev][3] < 0) {
		continue;
	}
	$rest = $n - $rev;
	if ($rest < 1) {
		$highScore = max($highScore, $gainMemo[$rev][3]);
	}
	//echo "rest", $rest,"highScore",$highScore,"rev", $gainMemo[$rev][3],"memo",$revMemo[$rest-2][4], "\n";
	$highScore = max ($highScore, $gainMemo[$rev][3] + $revMemo[$rest][4]);
}

//var_dump($revMemo, $gainMemo);
echo $highScore, "\n";

Measured memory_bytes: 127468
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vl a,b,c;

int main(){
	cin>>n;
	a=b=c=vl(n);
	for(int i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];
	for(int i=0;i<=100;i++) for(int j=0;j<=100;j++){
		ll L=0,R=inf;
		for(int k=0;k<n;k++){
			ll t=c[k]+abs(i-a[k])+abs(j-b[k]),l,r;
			if(c[k]) l=t,r=t;
			else l=0,r=t;
			L=max(L,l);
			R=min(R,r);
		}
		if(L<=R){
			cout<<i<<' '<<j<<' '<<L<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define MSB(x) (31 - __builtin_clz(x))
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 1 << 19, mod = 1000000007;

template <class T1, class T2> inline void addMod(T1& a, T2 b)	{   a = (a + b) % mod;  }
template <class T1, class T2> inline void multMod(T1& a, T2 b)	{   a = a * b % mod;    }

long long qpow(long long a, long long b)
{
    long long res0 = 1;
    for (; b!=0; b>>=1)
    {
        if (b & 1)  multMod(res0, a);
        multMod(a, a);
    }
    return res0;
}

long long H[maxN], T[maxN];

void solve()
{
	char in[42];
	scanf ("%s", in);
	int n =strlen(in);
	bool res = true;
	if (n % 2 == 1)
		res = false;
		
	FOR(i, 0, n)
	{
		if (i % 2 == 0 and in[i] != 'h')
			res = false;
		if (i % 2 == 1 and in[i] != 'i')
			res = false;
	}
	
	printf("%s\n", res ? "Yes " : "No");
} 

 
int main()
{
    int t;
    t=1;//scanf ("%d", &t);
    while (t--)
    	solve();
    return 0;    
}


Measured memory_bytes: 256
//
//  main.cpp
//  Atcode_Beginner_Contest_66_B
//
//  Created by lee on 2017/7/14.
//  Copyright © 2017年 lee. All rights reserved.
//

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


int isStringEvenAfterProcess(string s) {
    
    string newString, newString2;
    newString.assign(s, 0, (s.length()-2)/2);
    newString2.assign(s, (s.length()-2)/2, (s.length()-2)/2 );
    if(newString == newString2) {
        return static_cast<int>(s.length() - 2);
    } else {
        string newStringToPass;
        newStringToPass.assign(s, 0, s.length()-2);
        return isStringEvenAfterProcess(newStringToPass);
    }
    
    return true;
}

int main() {
    
    string s;
    cin >> s;
    
    cout << isStringEvenAfterProcess(s);
    
    return 0;
}

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

int main()
{
    int n;
    vector<string> S;
    int use[50][26] = {0};

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        S.push_back(s);
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < S[i].size(); j++)
        {
            use[i][S[i][j] - 'a']++;
        }
    }

    // for (int i = 0; i < n; i++)
    // {
    //     for (int j = 0; j < 26; j++)
    //     {
    //         cout << use[i][j] << ", ";
    //     }
    //     cout << endl;
    // }

    string ans = "";
    for (int i = 0; i < 26; i++)
    {
        int cnt = use[0][i];
        for (int j = 1; j < n; j++)
        {
            if (use[j][i] < cnt)
            {
                cnt = use[j][i];
            }
        }

        for (int k = 0; k < cnt; k++)
        {
            char c = 'a' + i;
            ans += c;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;

	int ans = 0;
	for (int i = a; i <= b; i++) {
		int s = i / 10000;
		int t = (i / 1000) % 10;
		int u = (i % 100) / 10;
		int v = i % 10;
		
		
		if (s == v && t == u)ans++;
	}

	cout << ans << endl;
	

	return 0;
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

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

    cout << max(a * b, c * d) << endl;

    return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/arc081/submissions/9271251
n = gets.to_i
nums = gets.split.map(&:to_i)
edges = []
nums_cnt = Hash.new(0)
nums.each { |i| nums_cnt[i] += 1 }
nums_cnt.keys.sort.reverse.each do |k|
  v = nums_cnt[k]
  next if v < 2
  edges << k
  edges << k if v >= 4
  break if edges.size >= 2
end
puts edges.size >= 2 ? edges[0] * edges[1] : 0


Measured memory_bytes: 17280