akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
long connect[100][100];
long ii,jj,kk;

bool isGo(ll n,ll m){
  //1.
  long used[n];
  set<long> s;
  set<long> cur,next;

  cur.insert(0);
  s.insert(0);
  memset(used,0,sizeof(used));
  
  while(true){

    next.clear();

    for(auto c : cur){

      used[c] = 1;
      
      for(ii=0;ii<m;ii++){
	if(connect[c][ii] == 1 && used[ii] == 0){
	  next.insert(ii);
	}
      }
      
    }
    
    cur = next;
    if(next.size() == 0){
      break;
    }    
  }
  //1.1からいける位置を探す
  //  探した位置が探索済みでなければ、次の位置を探す
  //  探索済みなら終了

  //探した位置が全ての位置をあるならOK
  //
  for(ii=0;ii<n;ii++){
    if(used[ii] == 0){
      return false;
    }
  }
  return true;

}

int main(){
  ll n,m,ii,bNum = 0;
  cin >> n >> m;
  vector<ll> a,b;
  a.resize(m);
  b.resize(m);
  for(ii=0;ii<m;ii++){
    cin >> a[ii] >> b[ii];
    a[ii]--;
    b[ii]--;
  }
  for(jj=0;jj<m;jj++){
    memset(connect,0,sizeof(connect));

    for(ii=0;ii<m;ii++){
      if(ii != jj){
	connect[a[ii]][b[ii]] = 1;
	connect[b[ii]][a[ii]] = 1;
      }
    }
    if(isGo(n,m)){
      //cout << "true" << endl;
    }
    else{
      //cout << "false" << endl;
      bNum ++;
    }
  }
  

  cout << bNum << endl;
 
  //1.辺を取り除いた時に、全ての頂点に行けるか確認する
  return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}
void _main();
int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); return 0;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

void _main(){
  int N,K;
  cin >> N >> K ;
  vl a(N),s(N+1);
  rep(i,N) cin >> a[i] ;
  rep(i,N) s[i+1] = s[i] + a[i];
  ll ans = 0;
  int bmax = 39;
  rrep(b,bmax){
    int cnt = 0;
    rep(i,N) REP(j,i,N){
      ll temp = s[j+1] - s[i];
      // dump(i,j,temp);
      if((ans&temp)!=ans) continue;
      if(((temp>>b)&1LL)==1LL) cnt++;
    }
    // dump(cnt);
    if(cnt>=K) ans ^= (1LL<<b);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
static const int INF = 1e+9+7;
ll n,m,l;
string s,t;
int d[200010],dp[1010][1010];
double w[1000],v[1000];
double box[200010];

int main(){
  while(1){
    cin >> n >> l;
    if(n == 0 && n == l)break;
    clr(d,0);
    m = 0;
    int mx = l;
    while(1){
      bool f = false;
      rep(i,0,n){
        if(!l){
          l += d[i];
          d[i] = 0;
          continue;
        }
        l--; d[i]++;
        if(d[i] == mx){
          m = i;
          f = true;
          break;
        }
      }
      if(f)break;
    }
    print(m);
  }
  return 0;
}


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

typedef long long int LL;
#define REP(n) for(LL i = 0; i < n; i++)

int main(){
    string s, sub;
    cin >> s;
    int keeper, ans = 114514, s2i;
    for(int i = 0; i < s.size()-2; i++){
        sub = s.substr(i, 3);
        s2i = stoi(sub);
        keeper = abs(753-s2i);
        ans = min(keeper, ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
h= []
w= []
while True:
	a,b= map(int,input().split())
	if(not(a==0 or b==0)):
		h.append(a)
		w.append(b)
	elif(a==b==0):
		break
n= 0
for x in h:
	print('#'*w[n])
	if(x>= 3):
		for j in range(x-2):
			if(w[n]>= 3):
				print('#'+'.'*(w[n]-2)+'#')
			else:
				print('#'*w[n])
	if(x>= 2):
		print('#'*w[n])
	n+= 1
	print()

		

Measured memory_bytes: 7676
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}
int main()
{
	map<int,bool> M;
	int n,x;
	scanf("%d%d",&n,&x);
	M[x]=true;
	for(int i=0;i<n;i++){
		scanf("%d",&x);
		M[x]=true;
	}
	x=M.begin()->first;
	M.erase(M.begin());
	int y=M.begin()->first;
	M.erase(M.begin());
	int g=y-x;
	while(!M.empty()){
		int z=M.begin()->first;
		g=gcd(g,z-y);
		y=z;
		M.erase(M.begin());
	}

	printf("%d\n",g);
	return 0;
} 

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << x
#define print(x) cout << x << '\n'
#define debug(x) cerr << #x << ": " << x << '\n'
ll gcd(ll a, ll b){
    return b != 0 ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b){
    return a * b / gcd(a, b);
}
ll third(ll x){
    return x * x * x;
}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s, t;
vll dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n >> m){
        if(m % 2){
            print(third(n / m));
        }else{
            print(third(n / m) + third(n / (m / 2) - n / m));
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll power(ll n, ll k);
ll inv(ll n);
ll genfact(ll n, ll k);
ll fact(ll n);
ll nck(ll n, ll k);

#define N 100000
int visited[2*N];
vector<vector<int>> edge(2*N, vector<int>(0));

pair<ll, ll> dfs(int cur){
  if (visited[cur] == 1)
    return pair<int, int>(0, 0);

  visited[cur] = 1;

  ll xs = 0, ys = 0;
  for (int i = 0; i < edge[cur].size(); i++){
    pair<int, int> a = dfs(edge[cur][i]);
    xs += a.first;
    ys += a.second;
  }

  if (cur >= N)
    return pair<int, int>(xs, ys + 1);
  else
    return pair<int, int>(xs + 1, ys);
}


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

  int x, y;
  for (int i = 0; i < n; i++){
    cin >> x >> y;
    x--; y--;
    edge[x].push_back(N + y);
    edge[N + y].push_back(x);
  }


  ll sum = 0;
  for (int i = 0; i < 2*N; i++){
    pair<ll, ll> p = dfs(i);
    sum += p.first * p.second;
  }

  cout << sum - n << endl;

  return 0;
}


ll power(ll n, ll k){
  ll res = 1;
  while(k > 0){
    if (k & 1) 
      res = res * n % MOD;
    n = n * n % MOD;
    k >>= 1;
  }
  return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

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

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}


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

int main() {
  int X;
  cin >> X;

  if (30 <= X)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

const int mod=1000000007;

int modPow(int a, int n) {
    if(n==0)return 1;
    if(n==1)return a%mod;
    if (n%2==1)return(a*modPow(a,n-1))%mod;
    int t=modPow(a,n/2);
    return (t*t)%mod;
}

int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    else return gcd(b,a%b);
}

int N;
int A[200005],B[200005];
int C;
map<PI,PI> mp;

signed main(){
    cin>>N;
    for(int i=0;i<N;++i){
        cin>>A[i]>>B[i];
        if(A[i]==0&&B[i]==0)C++;
        else if(A[i]==0){
            mp[PI(0,0)].first++;
        }
        else if(B[i]==0){
            mp[PI(0,0)].second++;
        }
        else {
            if(B[i]<0)A[i]=-A[i],B[i]=-B[i];
            int g=gcd(abs(A[i]),abs(B[i]));
            A[i]/=g,B[i]/=g;
            if(A[i]<0)mp[PI(B[i],-A[i])].first++;
            else mp[PI(A[i],B[i])].second++;
        }
    }
    int ans=1;
    for(auto m:mp){
        int cnt=modPow(2,m.second.first)+modPow(2,m.second.second)-1;
        ans*=cnt;
        ans%=mod;
    }
    cout<<(ans+C-1+mod)%mod<<endl;
}

Measured memory_bytes: 22136
#include<stdio.h>

int main(){
	
	int m_high[10],i,j,temp;
	
	
	for(i=0;i<10;i++)
	{
		scanf("%d",&m_high[i]);
	}
	
	for (i=0;i<9;i++){
		for(j=9;j>i;j--){
			if (m_high[j-1] < m_high[j]){
				temp = m_high[j];
				m_high[j] = m_high[j-1];
				m_high[j-1]= temp;
			}
		}
	}
	
	for(i=0;i<3;i++)
	{
		printf("%d\n",m_high[i]);
	}
	
    return 0;
}

Measured memory_bytes: 600
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main()
{
    int n;
    string p;
    cin >> n >> p;
    if (n >= p.size())cout << p << endl;
    else {
        p = p.substr(0, n);
        cout << p << "..." << endl;
    }
    return 0;

}

Measured memory_bytes: 3620
N, T = [ int(x) for x in input().split() ]
cts = [[ int(x) for x in input().split() ] for _ in range(N)]

cands = list(map(lambda ct: ct[0], filter(lambda ct: ct[1] <= T, cts)))
if len(cands) == 0:
    ans = "TLE"
else:
    ans = min(cands)

print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int [] P = new int[N];
        int count = 1;
        for(int i = 0; i<N; i++){
            P[i] = scanner.nextInt();
        }
        
        int min = P[0];
        
        for(int j =1; j<N; j++){
            if(min>P[j]){
                count++;
                min = P[j];
            }
        }
        
        System.out.println(count);
        
    }    
}

Measured memory_bytes: 86848
A,B,M = [int(x) for x in input().split()]
A_list = [int(x) for x in input().split()]
B_list = [int(y) for y in input().split()]
discount = []
min = 200000
for _ in range(M):
  case = [int(x) for x in input().split()]
  discount.append(case)
 
min_a = sorted(A_list)[0]
min_b = sorted(B_list)[0]
 
for i in range(M):
  temp = A_list[discount[i][0]-1] + B_list[discount[i][1]-1] - discount[i][2]
  if temp < min:
    min = temp
    
if min_a + min_b > min:
  print(min)
else:
  print(min_a + min_b)

Measured memory_bytes: 33772
#include<bits/stdc++.h>
using namespace std;
typedef pair<long, long> p;
int main(){
  int N,K;
  long ans=3999999996100000001;
  cin>>N>>K;
  vector<p> v;
  for(int i=0;i<N;i++){
    long x,y;
    cin>>x>>y;
    v.push_back(p(x,y));
  }
  sort(v.begin(),v.end());

  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      vector<long> y;
      long mn=min(v[i].second,v[j].second);
      long mx=max(v[i].second,v[j].second);
      for(int k=i;k<=j;k++){
          y.push_back(v[k].second);
      }
      sort(y.begin(),y.end());

      if(y.size()>=K){
        for(int a=0;a<y.size();a++){
          for(int b=a+K-1;b<y.size();b++){
            if(y[b]>=mx&&y[a]<=mn){
              long s=(y[b]-y[a])*(v[j].first-v[i].first);
              if(ans>s) ans=s;
            }
          }
        }
      }

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


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

int main()
{
	int n,y;
	cin >> n >> y;
	int a,b,c;
	for(a=0;a<=n;a++)
	{
		for(b=0;b<=n;b++)
		{
			c=n-a-b;
			if(c>=0&&a*10000+b*5000+c*1000==y&&a+b+c==n)
			{
				cout << a << ' ' << b << ' ' << c;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1";
	return 0;
}

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

#define mp make_pair
#define pb push_back
#define f first
#define s second 
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define int long long
#define forn(i, x, y) for(int i = x; i <= y; i++)
#define forev(i, y, x) for(int i = y; i >= x; i--)

using namespace std;

const int maxn = (int)3e5 + 100;
const int mod = (int)1e9 + 7;
const int P = (int)1e6 + 7;
const int inf = (int)1e9 + 7;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef long double ld;

using namespace std;

int n, x;
double cur;
main () {
	cin >> n;
	forn(i, 1, n){
		cin >> x;
		cur += (1.0) / (x+0.0);
	}
	cout<<fixed<<setprecision(5)<<(1.0)/cur;
}

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

int main(int argc, const char * argv[]) {
    int N;
    unsigned long H;
    unsigned long W;
    unsigned long heights[1000];
    unsigned long widths[1000];
    
    cin >> N >> H >> W;
    for (int i = 0; i < N; i++) {
        cin >> heights[i] >> widths[i];
    }
    
    int counter = 0;
    for (int i = 0; i < N; i++) {
        if ((heights[i] >= H && widths[i] >= W)) {
            counter++;
        }
    }
    
    cout << counter << endl;
    
    return 0;
}

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

int main(){
    int n, m;
    std::cin >> n >> m;

    std::vector<std::string> a(n);
    for(int i = 0; i < n; ++i){
        std::cin >> a.at(i);
    }

    std::vector<std::string> b(m);
    for(int i = 0; i < m; ++i){
        std::cin >> b.at(i);
    }

    int counter;
    bool flg = false;
    for(int i = 0; i <= n - m; ++i){
        for(int j = 0; j <= n - m; ++j){
            counter = 0;
            for(int k = i; k < i + m; ++k){
                for(int l = j; l < j + m; ++l){
                    if(a.at(k).at(l) == b.at(k - i).at(l - j)){
                        ++counter;
                    }
                }
            }
            
            if(m*m == counter){
                flg = true;
                break;
            }
        }
        
        if(m*m == counter){
            flg = true;
            break;
        }
    }

    if(flg){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }

    return 0;
}



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

using namespace std;

int main(){
    int n;
    cin >> n;
    double cnt = 0;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        cnt += 1. / a;
    }
    cout << setprecision(12) << 1. / cnt << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define mii map<int,int>
#define mll map<long long int,long long int>
#define mci map<char,int>
#define umii unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define umci unordered_map<char,int>
#define F first
#define S second
#define pb push_back
#define endl '\n'
    
using namespace std;

void solve(){
    string s;
    cin >> s;
    s[1] = 'B'+'R'-s[1];
    cout << s << endl;
}
int main(){
    IOS;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    //cin >> t;
    for(int i=1;i<t+1;i++){
        //cout << "Case #" << i << ": ";
        solve();    
    }
 
    #ifndef ONLINE_JUDGE
        cout << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
 
    return 0;
}   


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
#define rd() abs((int)rng())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 1e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
string s;
int n;
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    cin >> s;
    n = sz(s);
    for(int len = 2; len <= 5; len++)
    {
        for(int i = 0; i + len - 1 < n; i++)
        {
            map<char, int>mp;
            for(int j = i; j < i + len; j++)
            {
                if(++mp[s[j]] > len / 2)
                {
                    cout << i + 1 << " " << i + len << "\n";
                    return 0;
                }
            }
        }
    }
    cout << "-1 -1\n";
    return 0;
}


Measured memory_bytes: 512
n,m=map(int, input().split()) 
s=[list(map(int, input().split()))  for i in range(m)]
s1=sum(s,[])

    
ans=[]
for i in range(n):
    ans.append(s1.count(i+1))

for i in range(n):
    print(ans[i])
    
            
    
        

        
    


Measured memory_bytes: 38256
#include <iostream>
using namespace std;
int main(void){
    
    
    int a,b,n=0;
    cin>>a>>b;
    
    for(int i=1;i<=999;i++){
        if((b-a)==i){
            cout<<n-a<<endl;
            break;
        }
        n+=i;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  int N; cin>>N;
  string A,B,C; cin>>A>>B>>C;
  int cnt = 0;
  for(int i=0; i<N; i++) {
    if((A[i] != B[i]) && (A[i] != C[i]) && (B[i] != C[i])) {
      cnt += 2;
    } else if(A[i] != B[i] || A[i] != C[i] || B[i] != C[i]) {
      cnt++;
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 256
K,N=map(int,input().split())

A=list(map(int,input().split()))

B=[]

s=0

for i in range(N):
    if i==N-1:
        s=K-A[i]+A[0]
    else:
        s=A[i+1]-A[i]
    B.append(s)
B.sort()

print(sum(B)-max(B))

Measured memory_bytes: 26060
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <climits>
using namespace std;
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repb(i,r,l) for(int i=r;i>l;i--)
#define ll long long
#define ull unsigned long long
#define ve vector
#define umap unordered_map
#define iter iterator
const int MxN=1e5+1;
int ar[MxN];
void solve() {
    int n; cin>>n;
    for(int i=1;i<=n;i++) {
        cin>>ar[i];
    }
    int i=1, res=0;
    while(i!=-1 && i!=2) {
        int temp = ar[i];
        ar[i] = -1;
        i = temp;
        res++;
    }
    if(i==-1) cout<<-1<<endl;
    else cout<<res<<endl;
}

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

Measured memory_bytes: 640
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <cstring>
#include <math.h>
using namespace std;


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

Measured memory_bytes: 256
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    s = input()
    # 奇数番目を黒くするか，偶数番目を黒くするかを考えればよく，片方を調べるともう片方も求めることができる
    n = len(s)
    # odd
    cnt = 0
    for i in range(n):
        if i%2 == 1 and s[i] == '1':
            cnt += 1
        if i%2 == 0 and s[i] == '0':
            cnt += 1
    print(min(cnt, n-cnt))
    return

if __name__ == '__main__':
    main()

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

using namespace std;

int main(){
	int n,d;
	scanf("%d%d",&n,&d);
	int p[n][d];
	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++){
			scanf("%d",&p[i][j]);
		}
	}
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			int sum=0;
			for(int k=0;k<d;k++){
				sum+=(p[i][k]-p[j][k])*(p[i][k]-p[j][k]);
			}
			long double sr=sqrt(sum);
			if(sr-floor(sr)){
				continue;
			}
			ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
using System;
 
public class Program
{
    public static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var d = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
		
		long min = Math.Abs(d[0]);
		long cnt = 0;
		long sum = 0;
		long ans;
		
		for(int i = 0; i < n; i++){
		
			if(d[i] < 0) cnt++;
			
			min = Math.Min(min, Math.Abs(d[i]));
			sum += Math.Abs(d[i]);
		
		}
		
		ans = (cnt%2) == 1 ? sum-(min*2) : sum;
		
		
 
        Console.WriteLine(ans);
    }
 
}

Measured memory_bytes: 29404
#include <stdio.h>

int main()
{
	int N, t, x, y;
	int tt, xx, yy;
	int i;
	int c = 0;

	scanf("%d", &N);

	for(i=0; i<N; i++){
		tt = t;
		xx = x;
		yy = y;
		scanf("%d%d%d", &t, &x, &y);
		
		if(i == 0 && t < x + y){
			continue;
		}

		if(i != 0 && t - tt < (x - xx) + (y - yy)){
			continue;
		}

		if((t - (x + y)) % 2 != 0){
			continue;
		}
		
		c++;
	}


	if(c == N){
		printf("Yes");
	}
	else{
		printf("No");
	}


return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
int main() {
  int n, l;
  cin >> n >> l;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  bool yes = false;
  int knot = -1;
  for(int i=0;i<n-1;i++) {
    if(a[i] + a[i+1] >= l) {
      yes = true;
      knot = i+1;
      break;
    }
  }
  if(yes) {
    cout << "Possible" << endl;
  }
  else {
    cout << "Impossible" << endl;
    return 0;
  }
  for(int i=1;i<knot;i++) cout << i << endl;
  for(int i=n-1;i>knot;i--) cout << i << endl;
  cout << knot << endl;
  return 0;
}


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

int main()
{
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] != t[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3620
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { //Where were you during the damn contest!!!!!!!!!!!
 
	public static void main(String[] args) { 
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int H = I.nextInt();
		int W = I.nextInt();
		int N = I.nextInt();
		int max = Math.max(H,W);
		int ans = N/max;
		if (N%max!=0) ans++;
		O.pln(ans);
	}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}


Measured memory_bytes: 25624
c = str(input())
alpha =["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
ind = int(alpha.index(c))
ind1 = ind + 1
res = alpha[ind1]
print(res)

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

int main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	char ch; cin >> ch;
	if(ch >= 'a' && ch <= 'z') cout << 'a' << endl;
	else cout << 'A' << endl;
}

Measured memory_bytes: 3636
<?php



fscanf(STDIN, "%d%d", $N, $M);

$map = array_fill(1,$N,[]);
for($i=0;$i<$M;$i++){
    $tmp = explode(" ", trim(fgets(STDIN)));
    $map[$tmp[0]][$tmp[1]] = $tmp[2];
    $map[$tmp[1]][$tmp[0]] = $tmp[2];
}
$ans = 0;
for($i=1;$i<=$N;$i++) {
    if(isset($ans_map[$i])) {
        continue;
    }
    $start = $i;
    $queue = [];
    $q = 0;
    $ans++;
    $ans_map[$i] = $ans;
    if(count($map[$start]) === 0){
        $ans_map[$i] = $ans;
    }
//初期キューの登録
    getQueue($map[$start], $ans);
    while (isset($queue[$q])) {
        getQueue($map[$queue[$q][0]], $queue[$q][1]);
        unset($queue[$q]);
        $q++;
    }
}
//回答出力
echo $ans;


/**
 * @param array $array
 * @param int $last_vec
 * @param int $count
 * @return int
 */
function getQueue(array $array, int $color)
{
    global $queue, $ans_map;
    foreach ($array as $key => $value) {
        if (!isset($ans_map[$key])) {
            $ans_map[$key] = $color;
            $queue[] = [$key, $color];
        }
    }

    return 0;

}



Measured memory_bytes: 96120
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'

int f(int x){
  int a = 0;
  while(x){
    a += x % 10;
    x /= 10;
  }
  return a;
}

void solve(){
  int n, a, b;
  cin >> n >> a >> b;
  ll ans = 0;
  rep(x, 1, n+1){
    if (f(x) >= a and f(x) <= b) ans += (ll)x;
  }
  cout << ans;
}

int main() {
  ios::sync_with_stdio(false);
  // cin.tie(0); cout.tie(0);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 


*/

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main(){
  int m,f,b;
  cin >> m >> f >> b;
  if(b<=m){
    b=0;
    cout << b << endl;
  }else{
    b=b-m;
    if(f>=b){
      cout << b <<endl;
    }else{
      cout << "NA" << endl;
    }
  }
  return (0);
}



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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int32 in[212345] = {};

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int32 N;
	fill(in, in+212345, 0);
	cin >> N;
	vector<int32> P(N);
	REP(i, N) cin >> P[i];
	int32 res = 0;
	REP(i, N){
		in[P[i]] = in[P[i]-1]+1;
		res = max(res, in[P[i]]);
	}
	cout << N-res << endl;
}

Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
#include <cstdlib>

using namespace std;

int shortest[2001] = { 0, };

int main()
{
	int n, x, y;
	cin >> n >> x >> y;

	int mn = 2001;
	for (int i = 1; i <= n - 1; i++)
		for (int j = i + 1; j <= n; j++)
		{
			mn = min(abs(x - i) + 1 + abs(j - y), j - i);
			shortest[mn] += 1;
		}

	for (int i = 1; i < n; i++)
		cout << shortest[i] << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int n;
    cin >> n;
    vi a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int idx = 1;
    for (int i = 0; i < n; ++i) {
        if (a[i] == idx) {
            idx++;
        }
    }
    if (idx == 1) {
        cout << -1 << "\n";
    } else {
        cout << n - (idx - 1) << "\n";
    }
    return 0;
}

Measured memory_bytes: 1024
n = int(input())
if n < 10:
  print(n)
  exit()
if n >= 10 and n < 100:
  print(9)
  exit()
if n >= 100 and n < 1000:
  #print(9 + (int(str(n)[-2:])) + 1)
  print(9 + (n-100) + 1)
  exit()
if n >= 1000 and n < 10000:
  print(909)
  exit()
if n >= 10000 and n < 100000:
  print(909 + (n-10000) + 1)
  exit
if n == 100000:
  print(90909)


Measured memory_bytes: 3060
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    int L, R;
    int iMod, jMod;
    int ans;

    cin >> L >> R;

    if(R - L > 2019){
        ans = 0;
    }else{
        ans = 2019;
        for(int i = L; i < R; i++){
            for(int j = i + 1; j < R + 1; j++){
                iMod = i % 2019;
                jMod = j % 2019;
                if(ans > (iMod * jMod) % 2019){
                    ans = (iMod * jMod) % 2019;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 1000010
#define INF 0x3FFFFFFF
using namespace std;
int n,v,logv;
int x[MAXN];
int f1[MAXN],f2[MAXN];
int l[22][MAXN],r[22][MAXN],cnt[22];
int find_l(int x,int pos){
	pos++;
	int now=upper_bound(l[x]+1,l[x]+1+cnt[x],pos)-l[x];
	now--;
	if(now<=0)
		return pos;
	return max(r[x][now],pos-1);	
}
int find_r(int x,int pos){
	pos--;
	int now=lower_bound(r[x]+1,r[x]+1+cnt[x],pos)-r[x];
	if(now>cnt[x])
		return pos;
	return min(l[x][now],pos+1);	
}
int ans[MAXN];
int main(){
	memset(f2,0x3f3f3f3f,sizeof f2);
	SF("%d%d",&n,&v);
	for(int i=1;i<=n;i++)
		SF("%d",&x[i]);	
	x[0]=-INF;
	x[n+1]=INF;
	for(logv=0;(1<<logv)<=v;logv++);
	logv++;
	for(int i=0;i<logv;i++){
		int v1=v>>i;
		cnt[i]=1;
		l[i][cnt[i]]=1;
		for(int j=1;j<=n;j++)
			if(x[j+1]-x[j]>v1){
				r[i][cnt[i]]=j;
				cnt[i]++;
				l[i][cnt[i]]=j+1;	
			}
		cnt[i]--;
	}
	if(cnt[0]>logv){
		for(int i=1;i<=n;i++)
			PF("Impossible\n");
		return 0;	
	}
	f1[0]=0;
	f2[0]=n+1;
	for(int mask=0;mask<(1<<logv);mask+=2)
		for(int i=1;i<logv;i++)
			if((mask&(1<<i))!=0){
				f1[mask]=max(f1[mask],find_l(i,f1[mask^(1<<i)]));
				f2[mask]=min(f2[mask],find_r(i,f2[mask^(1<<i)]));	
			}
	for(int i=1;i<=cnt[0];i++){
		int lft=l[0][i];
		int rit=r[0][i];
		for(int mask=0;mask<(1<<logv);mask+=2){
			int mask2=((1<<logv)-2)^mask;
			if(f1[mask]>=lft-1&&f2[mask2]<=rit+1){
				ans[i]=1;
				break;
			}
		}
	}
	int las=1;
	for(int i=1;i<=n;i++){
		if(i>r[0][las])
			las++;
		if(ans[las]==0)
			PF("Impossible\n");
		else
			PF("Possible\n");
	}
}

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    string s, t;
    cin >> s >> t;
    int ans=1001;
    for(int i=0;i<=s.length()-t.length();i++){
        int cnt=0;
        REP(j,t.length()){
            if(s[i+j]==t[j]){
                cnt++;
            }
        }
        ans=min(ans,(int)t.length()-cnt);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), S = cin.getStr();
    const W = ".", B = "#";
    let stones = new Array(N+2).fill(0).map(() => { return {".":0, "#":0} });
    for (let n = 0; n < N; n++) stones[n+1][S.charAt(n)]++;
    for (let n = 0; n < N; n++) stones[n+1][B] += stones[n][B];
    for (let n = N+1; n > 1; n--) stones[n-1][W] += stones[n][W];
    let ans = Number.MAX_SAFE_INTEGER;
    for (let n = 0; n <= N; n++) ans = Math.min(ans, stones[n][B] + stones[n+1][W]);
    console.log(ans);
}
class Inputer{constructor(t){this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 33228
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#define N 5000005
typedef long long ll;
using namespace std;
ll x;
int a[10];
int main()
{
    int i=0;
    cin>>x;
    int ww=x;
    while (x!=0)
    {
        a[i++]=x%10;
        x/=10;
    }

    int ans=0;
    for (int j=0;j<i;j++)
        ans+=a[j];
    if (ww%ans==0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,arr[110000],a;
    cin>>n;
    int cnt=0;
    for(int i=0;i<n;i++)
       {
           cin>>a;
           if(a%2!=0)
            cnt++;
       }
    if(cnt%2!=0)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool chmax(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

  int N,A,B;
  cin>>N>>A>>B;
  int ct=0;
  reps(i,1,N+1){
    int x=i;
    int keta=0;
    rep(j,5){
      keta+=x%10;
      x/=10;
    }
    if(keta>=A and keta<=B) ct+=i;
  }
  cout<< ct<<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
struct edge {
  int la,b;
} con[N<<3];
int tot,fir[N];
void add(int from,int to) {
  con[++tot] = (edge) {fir[from],to};
  fir[from] = tot;
}
void addbk(int u,int v) {
  add(u<<1,v<<1|1);
  add(u<<1|1,v<<1);
  add(v<<1,u<<1|1);
  add(v<<1|1,u<<1);
}
int dfn[N],low[N],sta[N],col[N],top,cnt,n,x[N],y[N];
void dfs(int pos) {
  sta[dfn[pos] = low[pos] = ++top] = pos;
  for (int i = fir[pos] ; i ; i = con[i].la) {
    if (col[con[i].b]) continue;
    if (!dfn[con[i].b]) dfs(con[i].b);
    low[pos] = min(low[pos],low[con[i].b]);
  }
  if (low[pos] == dfn[pos]) {
    ++ cnt;
    while (top >= dfn[pos])
      col[sta[top--]] = cnt;
  }
}
struct data {
  int id,v;
  bool operator < (const data& x) const {
    return v < x.v;
  }
} tmp[N];
int cur,bas;
bool solve() {
  for (int i = 1 ; i <= bas ; ++ i)
    if (!dfn[i]) dfs(i);
  int res = 1;
  for (int i = 1 ; i <= cur ; ++ i)
    res &= (col[i<<1] != col[i<<1|1]);
  return res;
}
void build(int x=1,int lp=1,int rp=n<<1) {
  if (lp == rp) {
    add(x+bas,tmp[lp].id<<1);
    return;
  }
  int mid = (lp + rp) >> 1;
  build(x<<1,lp,mid);
  build(x<<1|1,mid+1,rp);
  add(x+bas,(x<<1)+bas);
  add(x+bas,(x<<1|1)+bas);
}
void modify(int l,int r,int p,int x=1,int lp=1,int rp=n<<1) {
  if (lp > r || rp < l) return;
  if (lp >= l && rp <= r) {
    add(p<<1|1,x+bas);
    return;
  }
  int mid = (lp + rp) >> 1;
  modify(l,r,p,x<<1,lp,mid);
  modify(l,r,p,x<<1|1,mid+1,rp);
}
void init() {
  memset(fir,0,sizeof fir);
  tot = 0;
  cnt = 0;
  memset(dfn,0,sizeof dfn);
  memset(low,0,sizeof low);
  memset(col,0,sizeof col);
}
bool check(int d) {
  init();
  build();
  int l,r;
  for (int i = 1 ; i <= cur ; ++ i) {
    l = lower_bound(tmp+1,tmp+cur+1,(data) {0,tmp[i].v-d+1}) - tmp;
    r = upper_bound(tmp+1,tmp+cur+1,(data) {0,tmp[i].v+d-1}) - tmp - 1;
    if (l != i) modify(l,i-1,tmp[i].id);
    if (r != i) modify(i+1,r,tmp[i].id);
  }
  for (int i = 1 ; i <= n ; ++ i)
    addbk(i,i+n);
  return solve();
}
int main() {
  scanf("%d",&n);
  for (int i = 1 ; i <= n ; ++ i) {
    scanf("%d%d",&x[i],&y[i]);
    tmp[i] = (data) {i,x[i]};
    tmp[i+n] = (data) {i+n,y[i]};
  }
  sort(tmp+1,tmp+(n<<1)+1);
  cur = n<<1;
  bas = cur<<1|1;
  int l = 1, r = tmp[n<<1].v, ans = 0, mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid)) l = mid+1, ans = mid;
    else r = mid-1;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 14592
#include<stdio.h>

int main()
{
    int n;
    int p[21];

    int i;

    scanf("%d",&n);

    for(i=0;i<n;i++)
        scanf("%d",&p[i]);

    int ans = 0;

    for(i=1;i<n-1;i++)
    {
    if(p[i-1]<p[i]&&p[i]<p[i+1])  
     ans++;  
      if(p[i-1]>p[i]&&p[i]>p[i+1])  
     ans++;  
    }

    printf("%d\n",ans);

}

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

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))

#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define concat(xs, ys) (xs).insert((xs).end(), (ys).begin(), (ys).end())

const int mod = 1000000007;

int cnts[100005];

struct mint {
    ll x;
    mint(ll x=0):x(x%mod){}

    mint& operator+=(const mint a) {
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint& operator-=(const mint a) {
        if (x < a.x) {
          x += mod;
        }
        x -= a.x;
        return *this;
    }

    mint& operator*=(const mint a) {
        x = (x * a.x) % mod;
        return *this;
    }

    mint& operator/=(const mint a) {
        *this *= a.inv();
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    mint pow(ll n) const {
        mint a(*this);
        mint res = 1;
        while (n > 0) {
            if (n & 1) res *= a;
            a *= a;
            n >>= 1;
        }
        return res;
    }

    mint inv() const {
        return pow(mod - 2);
    }
};

const int MAX_V = 100005;

mint fac[MAX_V];
mint inv[MAX_V]; 

void initFact() {
  fac[0] = 1;
  inv[0] = 1;
  for (int i = 1; i <= MAX_V; i++) {
    fac[i] = (fac[i - 1] * i);
    inv[i] = fac[i].inv();
  }
}

mint combi(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * inv[k] * inv[n - k];
}

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

  long n;
  cin >> n;

  cout << n*n << endl;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef complex<double> P;

#define EPS (1e-7)

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

bool is_parallel(P const& a1, P const& a2, P const& b1, P const& b2) {
  return abs(cross(a2-a1, b2-b1)) < EPS;
}

bool is_orthogonal(P const& a1, P const& a2, P const& b1, P const& b2) {
  return is_parallel(a1, a1+(a2-a1)*P(0, 1), b1, b2);
}

int main () {
  
  int q; cin >> q;
  for(;q--;) {
    P a1, a2, b1, b2;
    cin >> a1.real() >> a1.imag() >> a2.real() >> a2.imag();
    cin >> b1.real() >> b1.imag() >> b2.real() >> b2.imag();
    if(is_parallel(a1, a2, b1, b2)) {
      cout << 2 << endl;
    }
    else if(is_orthogonal(a1, a2, b1, b2)) {
      cout << 1 << endl;
    }
    else {
      cout << 0 << endl;
    }

  }
  return 0;
}

Measured memory_bytes: 1232
#include<iostream>

using namespace std;

int main(){
	int n,a,i,min,ans;
	cin >> n >> a;
	min = a;
	ans = -1e9-1;
	for(int i = 0;i<n-1;i++){
		cin >> a;
		if(a - min > ans)
			ans = a - min;
		if(a < min)
			min = a;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3112
#coding:utf-8
#1_4_C 2015.3.29
while True:
    data = input().split()
    if data[1] == '?':
        break
    elif data[1] == '+':
        print(int(data[0]) + int(data[2]))
    elif data[1] == '-':
        print(int(data[0]) - int(data[2]))
    elif data[1] == '*':
       print(int(data[0]) * int(data[2]))
    elif data[1] == '/':
       print(int(data[0]) // int(data[2]))

Measured memory_bytes: 6724
import java.util.*;

public class Main {
	Scanner sc;
	long L, R;
	
	private static long MOD = 1000000007L;
	
	public Main() {
		sc = new Scanner(System.in);
	}
	
	private void calc() {
		L = sc.nextLong();
		R = sc.nextLong();
		
		System.out.println(count(0, 0, 63));
		System.out.flush();
	}
	
	private long count(long x, long y, int maskn) {
		if ( (x|y) != 0 && (y>>>1) >= x) return 0L;
		if (R < x || R < y) return 0L;
		long mask = (1L << maskn) - 1L;
		if ((y | mask) < L || (x | mask) < L) return 0L;
		if (L <= x && (y | mask) <= R) {
			if (maskn == 0) return 1L;
			return (3 * count(x, y | mask, maskn-1))%MOD;
		}
		maskn--;
		long nextBit = (mask >>> 1)+1L;
		long su = count(x | nextBit, y | nextBit, maskn);
		long sl = count(x, y, maskn);
		long sm = -1;
		if (x != y)
			if ( L < x ) sm = su;
			else if ( (y | mask) < R) sm = sl;
		if (sm == -1) sm = count(x, y | nextBit, maskn);
		return (sl+sm+su) % MOD;
	}
	public static void main(String[] args) {
		new Main().calc();
	}

}

Measured memory_bytes: 23764