akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const maxBuf = 300100

var buf []byte = make([]byte, maxBuf)
var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Buffer(buf, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	a := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}

	sum := make([][]int, n+1)
	sum[0] = make([]int, 20)
	for i := 0; i < n; i++ {
		sum[i+1] = make([]int, 20)
		num := make([]int, 20)
		for j := 0; j < 20; j++ {
			if (a[i] & (1 << uint(j))) != 0 {
				num[j] = 1
			}
		}
		for j := 0; j < 20; j++ {
			sum[i+1][j] = sum[i][j] + num[j]
		}
	}

	ans := 0
	for i := 0; i < n; i++ {
		ans += lowerBound(sum, i)
	}
	fmt.Println(ans)

}

func lowerBound(sum [][]int, l int) int {
	n := len(sum) - 1
	ok, ng := l, n
	for ok+1 < ng {
		//fmt.Println(ok, ng)
		mid := (ng + ok) / 2
		num := make([]int, 20)
		flag := true
		for j := 0; j < 20; j++ {
			num[j] = sum[mid+1][j] - sum[l][j]
			if num[j] >= 2 {
				flag = false
			}
		}
		if flag {
			ok = mid
		} else {
			ng = mid
		}
	}
	return ok + 1 - l
}


Measured memory_bytes: 40320
N = int(input())
T = list(map(int, input().split()))
M = int(input())
PX = [list(map(int, input().split())) for _ in range(M)]
for i in range(M):
    sum_t = sum(T)
    idx = PX[i][0] - 1
    if T[idx] >= PX[i][1]:
        sum_t -= (T[idx] - PX[i][1])
    else:
        sum_t += PX[i][1] - T[idx]
    print(sum_t)


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

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	ll n;
	cin >> n;

	ll a[n];
	rep(i,n) cin >> a[i];
	
	ll S = 0;
	rep(i,n) S += a[i];
	
	bitset<4000010>b;
	b.reset();
	b.set(0);
	rep(i,n) b |= (b << a[i]);

	for (ll i=(S + 1) / 2; i <= S; i++){
		if (b[i]){
			cout << i << endl;
			break;
		}
	}
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    int N, D;
    cin >> N >> D;
    int ans = 0;
    int kanshi = D*2+1;
    cout << (!(N%kanshi) ? N/kanshi: N/kanshi+1) << endl;
    return 0;
}


Measured memory_bytes: 3596
m[5][65536],i,j,l,L,p,c;main(n){for(;~scanf("%d\n",&n);L=n&&!printf("%d\n",L))for(p=256,i=-~n*n;i--;p++)for(c=m[j=4][p]=getchar();j--;L=l>L?l:L)l=m[j][p]=c-49?0:m[j][p-(j?n+j-1:1)]+1;}

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

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cout << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cout<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 2e5 + 10;

int main()
{
    fast;
    ll n, m, k;
    cin >> n >> m >> k;
    vl a(n+1), b(m+1);

    a[0] = 0, b[0] = 0;
    cin >> a[1];
    f(i,2,n+1)
    {
        cin >> a[i];
        a[i] += a[i-1];
    }

    cin >> b[1];
    f(i,2,m+1)
    {
        cin >> b[i];
        b[i] += b[i-1];
    }

//    show(a,n);
//    show(b,m);
    ll mx = 0;
    f(i,0,n+1)
    {
        if(a[i] > k)
            break;
        ll rem = k - a[i];

        ll low = 1, high = m, ans = 0;
        while(low <= high)
        {
            ll mid = (low + high)/2;

            if(b[mid] <= rem)
            {
                ans = mid;
                low = mid + 1;
            }
            else
                high = mid - 1;
        }
        mx = max(mx, i+ans);
    }

    cout << mx;
}


Measured memory_bytes: 6336
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
#include<vector>
#include<tuple>

using namespace std;
int main(){
  int a,b,x=0;
  int i=0;
  cin >> a >> b;
  while(i<2){
  i += 1;
  if(a>=b){
    x += a;
    a -= 1;
  }else{
    x += b;
    b -= 1;
  }
}
  cout << x;
}


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

def block(a,b,c):
    blocksum=a*b*c
    if a%2==0 or b%2==0 or c%2==0:
        print(0)
        return
    else:
        al=[]
        al.append(a*b)
        al.append(b*c)
        al.append(a*c)
        al=sorted(al)
        print(al[0])
block(a,b,c)

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

const int mxN = 1e2;
int a[mxN];
int n;
int main()
{
	cin >> n;
	int cnt = 0;
	for(int i =0; i < n; i++){
		cin >> a[i];
		if((i+1)&1 && a[i]&1){
			cnt++;
		}
	}
	cout << cnt;
	return 0;
}


Measured memory_bytes: 3636
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = nextInt()
	}

	m := nextInt()
	p, x := make([]int, m), make([]int, m)
	for i := 0; i < m; i++ {
		p[i] = nextInt()
		x[i] = nextInt()
	}

	s := 0
	for i := 0; i < n; i++ {
		s += t[i]
	}

	for i := 0; i < m; i++ {
		fmt.Println(s - t[p[i]-1] + x[i])
	}
}


Measured memory_bytes: 640
def main():
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    seats = [0]*(10**5+2)
    LR = [[int(i) for i in input().split()] for j in range(N)]
    for li, ri in LR:
        seats[li] += 1
        seats[ri+1] -= 1
    from itertools import accumulate
    S = list(accumulate(seats))
    print(sum(S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 45936
#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	char s[100001];
	
	scanf("%s",s);
	
	if(strlen(s)%2==1)
	{
		printf("No");
		return 0;
	}
	for(int i=0,j=strlen(s)-1;i<j;i++,j--)
	if(abs(s[i]-s[j])>2||s[i]==s[j]) 
	{
		printf("No");
		return 0;
	}
	printf("Yes"); 
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    double r;
    double s, l;
    double pi = 3.141592653589793238;
    scanf("%lf", &r);
    s = r * r * pi;
    l = 2.000000 * pi * r;
    printf("%.6f %.6f\n", s, l);
    return 0;
}

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

signed main() {
    int N;
    cin >> N;
    vector<ll> A(400100);

    rep (i, N) {
        ll a;
        cin >> a;
        A[(i*2)+0] = a;
        A[(i*2)+1] = a;
    }

    sort(A.begin(), A.end(), greater<ll>());
    ll sum = A[0];
    if (N != 2) {
        rep (i, N-2) sum += A[i+2];
    }
    cout << sum << endl;

}


Measured memory_bytes: 6384
N, K = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))
L = []
S = set()
for i in range(N):
    if i in S:
        continue
    L.append([C[i]])
    S.add(i)
    tmp = i
    Next = P[i] - 1
    while Next != tmp:
        S.add(Next)
        L[-1].append(C[Next])
        Next = P[Next] - 1

ans = 0

for l in L:
    score = 0
    k = len(l)
    SUM = sum(l)
    l = [0] + l + l
    if SUM > 0:
        score = SUM * (K // k)
        m = K % k
        for i in range(2 * k):
            l[i+1] += l[i]
        for i in range(k):
            for j in range(i+1, i+m+1):
                ans = max(ans, score + l[j] - l[i])
        if K // k >= 1:
            score = SUM * (K // k - 1)
            m = k
            for i in range(k):
                for j in range(i+1, i+m+1):
                    ans = max(ans, score + l[j] - l[i])
    else:
        m = k
        for i in range(2 * k):
            l[i+1] += l[i]
        for i in range(k):
            for j in range(i+1, i+m+1):
                ans = max(ans, score + l[j] - l[i])

if ans == 0:
    ans = max(C)

print(ans)

Measured memory_bytes: 69484
from itertools import combinations_with_replacement as cwr

N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]

def calc_score(A):
  score = 0
  for a, b, c, d in abcd:
    if A[b-1] - A[a-1] == c:
      score += d
  return score

ans = 0
for A in cwr([i for i in range(1, M+1)], N):
  ans = max(ans, calc_score(A))

print(ans)

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

int main()
{
    int N, K;
    int ans = 1;
    cin >> N >> K;

    for(int i = 0;i < N;i++)
    {
        if(2*ans<=ans+K) ans = ans*2;
        else ans+=K;
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

ll twostone(string str){
    rep(i, str.size()){
        if(i == 0) continue;
        if(str[i] == '#' && str[i-1] == '#') return i;
    }
    return 10000000;
}


ll threespace(string str, ll B){
    for(ll i = B-2; i < str.size()-2; i++){
        if(i < 0) continue;
        if(str[i] == '.' && str[i+1] == '.' && str[i+2] == '.')return i;
    }
    return 10000000;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N , A, B, C, D;
    string S;
    cin >> N  >> A >> B >> C >> D;
    cin >> S;
    
    // 1. 3つ以上のスペースあればA,B位置交換可能
    // 2. 2以上の岩あればNo
    
    ll twoidx = twostone(S);
    if((twoidx < C || twoidx < D )&& (A < twoidx || B < twoidx)) {
        cerr << "two stone during the road" << endl;
        cout << "No" << endl;
        return 0;
    }
    
    if(C < D){
        cerr << "without tow stone, only one road" << endl;
        cout << "Yes" << endl;
    }else{// D < C
        
        ll idx = threespace(S, B);
        idx ++;
        
        if(idx < D && idx >= (B-1)){
            cerr << "a three space during B and D" << endl;
            cout << "Yes" << endl;
        }
        else {
            cerr << "B: [" << B  << "]  threestone: [" << threespace(S,B) << "]  D: [" << D << "]" << endl;
            cerr << " A < B and  C > D and without three space during B and D" << endl;
            cout << "No" << endl;
        }
    }
    
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}



Measured memory_bytes: 720
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int H = Integer.parseInt(sc.next());
        int W = Integer.parseInt(sc.next());
        
        
        ArrayList<String> s_list = new ArrayList<String>();
        for(int i=0; i<H; i++){
            s_list.add(sc.next());
        }
        
        for(int i=0; i<H*2; i++){
            System.out.println(s_list.get(i/2));
        }
        
    }
}

Measured memory_bytes: 22252
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int k;
    cin >> s >> k;
    set<string> myVec;
    for(int i = 0;i < s.length();i++)
    {
        string temp;
        for(int j = i;j < s.length() && j < i+10;j++)
            temp.push_back(s[j]),myVec.insert(temp);
    }
    k--;
    while(k--)
        myVec.erase(myVec.begin());
    cout << *myVec.begin();
}


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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll N, K;
vector<ll> A;

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


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

  cin >> N >> K;
  //mint ans;
  ll ans = 0;
  for (ll i = K; i <= N+1; ++i) {
    //ll l = (i-1)*i/2;
    //ll r = (N+N-i+1)*i/2;
    ans += ((N-i+1)*i)%mod + 1;
  }
  cout << ans%mod<< endl;
  return 0;
}


Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(x)-1; i >= (int)(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 INF 1e9
using ll = int64_t;
#define waru 1000000007

void Main() {
	int n;
	std::cin >> n;

	int ans = 0;

	repf(i, 1, n + 1) {
		string tmp = to_string(i);
		if (tmp.size() % 2) {
			ans++;
		}
	}

	std::cout << ans << '\n';

	return;
}

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


Measured memory_bytes: 256
import itertools
import math
n=int(input())
X=[list(map(int,input().split())) for _ in range(n)]
P=[i for i in range(n)]
total=0
for j in itertools.permutations(P,n):
  candi=list(j)
  for k in range(len(candi)-1):
    dis1=(X[candi[k]][0]-X[candi[k+1]][0])**2
    dis2=(X[candi[k]][1]-X[candi[k+1]][1])**2
    total+=(dis1+dis2)**(1/2)
print(total/math.factorial(n))      
  

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define lc "\n"
#define fast_io ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define int long long
#define c(a,n) for(int i = 0; i < n; i++) cin >> a[i];
#define ffor(n) for(int i = 0; i < n; i++)
 
typedef vector<int> vi;
typedef vector<float> vf;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef map<string,int> msi;
typedef map<int,int> mii;
typedef unordered_map<string,int> umsi;
 
 
int32_t main()
{
    fast_io;
    int n,w;
    cin>>n>>w;
    vii dp(n,vi(w+1,LLONG_MIN));
    vector<pair<int,int>>it(n);
    for(int i=0;i<n;i++)cin>>it[i].first>>it[i].second;
    int ans=LLONG_MIN;
    for(int i=0;i<n;i++)dp[i][0]=0; 
    for(int i=0;i<n;i++)
    {
        dp[i][it[i].first]=it[i].second;
        for(int wj=it[i].first;wj<=w;wj++)
        {

            
            int add=LLONG_MIN;
            for(int j=0;j<i;j++)
            {
                add=max(add,dp[j][wj-it[i].first]);
            }
            if(add!=LLONG_MIN)
            dp[i][wj]=it[i].second+add;
            ans=max(ans,dp[i][wj]);
        }
    }
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 82276
n,k = map(int, input().split())
d = []
a_remain = [i for i in range(1,n+1)]
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))

for i in range(len(a)):
    for j in range(len(a[i])):
        if a[i][j] in a_remain:
            a_remain.remove(a[i][j])

print(len(a_remain))




Measured memory_bytes: 67596
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int a = sc.nextInt();
        if (a < 1200) {
            System.out.println("ABC");
        } else if (a < 2800) {
            System.out.println("ARC");
        } else {
            System.out.println("AGC");
        }
    }
}


Measured memory_bytes: 21844
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <math.h>
#include <utility>
#include <map>
#include <queue>
#include <stack>
#include <set>

using namespace std;

#define INF 210000000
#define int long long

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

int lcm(int a, int b) { return a * b / gcd(a, b); }

signed main() {
    int n,m;
    cin >> n >> m;
    if(n != 1) cout << m * (int)(pow(m - 1,n - 1));
    else cout << m;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)

void solve(){
	int a, b;
	cin>>a>>b;
	int cnt  = 0;
	rep(i,a,b+1){
		string s = to_string(i);
		string t = s;
		reverse(all(t));
		if(s==t) cnt++;
	}
	cout<<cnt<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
import java.util.*
import java.io.PrintWriter
import java.math.*

val pw = PrintWriter(System.out)
val MOD = 1000000007L
val INF = 2147483647
val LINF = 9223372036854775807L

fun main(args: Array<String>){
    solve()
    pw.flush()    
}

fun solve(){
    next()
    val a = nextIntList()
    val map:MutableMap<Int, Long> = mutableMapOf()
    for (num in a) {
        if(map.containsKey(num)){
            map[num] = map[num]!!.plus(1L)
        } else {
            map[num] = 1L
        }
    }
    var sum = 0L
    for (count in map.values) {
        sum += count * (count - 1) / 2
    }
    
    val anslist: MutableList<Long> = mutableListOf()
    for (i in a) {
        val count = map[i]!!.toLong()
        val ans = sum - (count - 1)
        anslist.add(ans)
    }

    println(anslist.joinToString("\n"))

}

// Print
fun println(v: String){
    pw.println(v)
}
fun print(v: String){
    pw.print(v)
}

// Read
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map{ it.toInt() }
fun nextLongList() = next().split(" ").map{ it.toLong() }
fun nextDoubleList() = next().split(" ").map{ it.toDouble() }
fun nextAryln(n: Int) = Array(n){ next() }
fun nextIntAryln(n: Int) = IntArray(n){ nextInt() }
fun nextLongAryln(n: Int) = LongArray(n){ nextLong() }
fun nextDoubleAryln(n: Int) = DoubleArray(n) { nextDouble() }

// Math
fun abs(n: Int) : Int = Math.abs(n)
fun abs(n: Long) : Long = Math.abs(n)
fun abs(n: Double) : Double = Math.abs(n)
fun max(a: Int = -INF, b: Int = -INF, c: Int = -INF, d: Int = -INF, e: Int = -INF): Int = listOf(a, b, c, d, e).max()!!
fun max(a: Long = -LINF, b: Long = -LINF, c: Long = -LINF, d: Long = -LINF, e: Long = -LINF): Long = listOf(a, b, c, d, e).max()!!.toLong()
fun min(a: Int = INF, b: Int = INF, c: Int = INF, d: Int = INF, e: Int = INF): Int = listOf(a, b, c, d, e).min()!!
fun min(a: Long = LINF, b: Long = LINF, c: Long = LINF, d: Long = LINF, e: Long = LINF): Long = listOf(a, b, c, d, e).min()!!.toLong()
fun prime(from: Long, to: Long = from) : List<Long>{
    return (from..to).filter{ i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all{ j -> i % j != 0L}
    }
}
fun gcd(a: Long, b: Long) : Long = if(a % b == 0L) b else gcd(b, (a % b))
fun lcm(a: Long, b: Long) : Long = a / gcd(a, b) * b
fun modpow(a: Long, n: Long, p:Long = MOD) : Long {
    var res = 1L
    var ar = a
    var nr = n
    while(nr > 0){
        if((nr and 1) == 1L) res = res * ar % p
        ar = ar * ar % p
        nr = nr shr 1
    }
    return res
}
fun modinv(a: Long, p: Long = MOD) : Long = modpow(a, p - 2, p)
fun ncr(n: Long, r: Long) : Long {
    var a = 1L
    var b = 1L
    for (i in 1..r) {
        a = a * (n + 1 - i) % MOD
        b = b * i % MOD
    }
    return modinv(b, MOD) * a % MOD
}


Measured memory_bytes: 113096
import Control.Monad
import Text.Printf

height :: Int -> Int -> [[Int]] -> Int
height cx cy ps = if (all (\[x, y, h] -> h == (max 0 (ch - (abs (cx - x)) - (abs (cy - y))))) ps) then ch else 0
  where
    [x0, y0, h0]:_ = filter (\[x, y, h] -> h > 0) ps
    ch = h0 + (abs (cx - x0)) + (abs (cy - y0))

solve :: [[Int]] -> (Int, Int, Int)
solve ps = t
  where
    t:_ = filter (\(x, y, h) -> h > 0) [(cx, cy, height cx cy ps) | cx <- [0 .. 100], cy <- [0 .. 100]]


main :: IO ()
main = do
  n <- readLn :: IO Int
  ps <- replicateM n $ (map (\s -> read s :: Int)) . words <$> getLine
  let (cx, cy, ch) = solve ps in
    printf "%d %d %d\n" cx cy ch


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

using int64 = long long;

const int64 mod = 1e9 + 7;

vector<pair<int, int>> vec[310];    // (l_i, x_i)
int64 dp[310][310][310];

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

    for (int i = 0; i < M; i++) {
        int l, r, x;
        cin >> l >> r >> x;
        vec[r].emplace_back(l, x);
    }

    int64 ans = 0;

    dp[0][0][0] = 1;
    for (int r = 0; r <= N; r++) {
        for (int g = 0; g <= N; g++) {
            for (int b = 0; b <= N; b++) {
                // check
                int end = max({r, g, b});

                for (auto p : vec[end]) {
                    int l = p.first;
                    int x = p.second; 
                    int num = (r >= l) + (g >= l) + (b >= l);
                    if (num != x) dp[r][g][b] = 0;
                }

                if (end == N) {
                    (ans += dp[r][g][b]) %= mod;
                    continue;
                }

                // R
                (dp[end + 1][g][b] += dp[r][g][b]) %= mod;
                // G
                (dp[r][end + 1][b] += dp[r][g][b]) %= mod;
                // B
                (dp[r][g][end + 1] += dp[r][g][b]) %= mod;
            }
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 227584
#include <iostream>
#include<cstdio>
#include<stdio.h>
using namespace std;

void call(int n) {
	for (int i = 1; i <= n; i++) {
		int x = i;
		if (x % 3 == 0) {
			cout << " " << i;
		}
		else {
			x = i;
			do {
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
				x /= 10;
			} while (x);
		}
	}	
	cout << endl;
}


int main() {
	int a;
	cin >> a;
	call(a);
	return 0;
}




Measured memory_bytes: 3088
#include <algorithm>
#include <cassert>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

const long long MM = 1e9 + 7;

int main() {

    string s;
    getline(cin, s); // input a string from stdin
    long long D;     // count all number whose sum of digits % D = 0
    cin >> D;

    long long N = s.size();         // N is string size
    vector<long long> K(N, 0);      // K stores N digits
    vector<long long> cummod(N, 0); // cummulative sum % D

    // digit index 0 ... N-1
    assert('9' - '0' == 9);
    assert('0' - '0' == 0);
    for (long long i = 0; i < N; i++) {
        K[i] = s[i] - '0'; // convert to number
    }

    long long TT = 0;
    for (long long i = 0; i < N; i++) {
        TT += K.at(i);
        TT %= D;
        cummod.at(i) = TT;
    }

    reverse(K.begin(), K.end());
    reverse(cummod.begin(), cummod.end());
    long long myans = (TT % D == 0);

    // F[i, j],  count all numbers with i digits (including 0) such that its sum
    // of digits % D =j
    vector<vector<long long>> F(D, vector<long long>(N, 0));
    for (long long i = 0; i < N; i++) {
        for (long long digit = 0; digit <= 9; digit++) {
            for (long long j = 0; j < D; j++) {
                long long target = (digit + j) % D;
                F.at(target).at(i) +=
                    ((i > 0) ? (F.at(j).at(i - 1)) : ((j == 0) ? 1 : 0)); //
                F.at(target).at(i) %= MM;
            }

            if (digit < K.at(i)) {
                long long res = D - ( (digit + ((i < N - 1) ? (cummod.at(i + 1)) : 0))% D);
                res = res % D;
                myans += (i > 0) ? (F.at(res).at(i - 1)) : ((res == 0) ? 1 : 0);
                myans %= MM;
            }
        }
    }
    cout << (myans - 1 + MM) % MM<< endl;

    return 0;
}

Measured memory_bytes: 8320
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int>x(n), y(n);
	repp(i, 0, n) cin >> x[i] >> y[i];
	int maxv = 0;
	int cnt = 0;
	repp(i, 0, n)repp(j, 0, n) {
		cnt = 0;
		int p = x[i] - x[j]; int q = y[i] - y[j];
		repp(k, 0, n)repp(l, 0, n) {
			if (i == j)continue;
			if (x[k] - x[l] == p && y[k] - y[l] == q)++cnt;
		}
		maxv = max(maxv, cnt);
	}
	cout << n - maxv << endl;
	return 0;
}


Measured memory_bytes: 256
n, q = map(int, input().split())
s = input()
tds = list(tuple(input().split()) for _ in range(q))

left = 0
right = n-1

for t, d in reversed(tds):
    if d=="L":
        if t==s[left]:
            left = left+1
            if left > n-1:
                right = 0
                left = n-1
                break
        if right < n-1 and t==s[right+1]:
            right = min(right+1, n-1)

    if d=="R":
        if t==s[right]:
            right = right-1
            if 0 > right:
                right = 0
                left = n-1
                break
        if left > 0 and t==s[left-1]:
            left = max(left-1, 0)

print(max(right - left + 1, 0))

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

int n, c[10001];

int main() {
	cin >> n;
	for (int x = 1; x < 101; ++x)
		for (int y = 1; y < 101; ++y)
			for (int z = 1; z < 101; ++z) {
				int t = x * x + y * y + z * z + x * y + y * z + z * x;

				if (t <= n)
					++c[t];
			}
	for (int i = 1; i <= n; ++i)
		cout << c[i] << endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60;
#define LLINF 1e12
#define PI 3.14159265359
#define ALL(a) (a).begin(), (a).end()
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int dy8[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dx8[] = {0, 1, 0, -1, 1, 1, -1, -1};
int ny, nx;
typedef long long ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

unsigned GetDigit(unsigned num) { return to_string(num).length(); }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

//素因数分解
vector<ll> decom;

void decompositPrime(ll n)
{
    ll a = 2;
    while (n >= a * a)
    {
        if (n % a == 0)
        {
            decom.push_back(a);
            n /= a;
        }
        else
        {
            a++;
        }
    }
    decom.push_back(n);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int main()
{

    ll N; cin >> N;
    string ans;

    while(N>0){
        N--;
        ans.push_back('a' + N % 26);
        N /= 26;
    }

    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>
#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(){
    int n,ans;
    cin >> n;
    if(n<=999)
        ans =999;
    if(n<=888)
        ans =888;
    if(n<=777)
        ans =777;
    if(n<=666)
        ans =666;
    if(n<=555)
        ans =555;
    if(n<=444)
        ans =444;
    if(n<=333)
        ans =333;
    if(n<=222)
        ans =222;
    if(n<=111)
        ans =111;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
t = list(map(int, input().split()))
a = list(map(int, input().split()))
MOD = 10**9 + 7
t_max = max(t)
for i in range(n):
  if t[i] == t_max:
    max_ind = i
    break
if t[max_ind] != a[max_ind] or t[-1] != a[0]:
  print(0)
else:
  idx = []
  before = 0
  for i in range(n):
    if before == t[i]:
      idx .append(i)
    before = t[i]
  if len(idx) == 0:
    print(1)
  else:
    new_idx = []
    for j in idx:
      if j < n-1 and a[j] == a[j+1]:
        new_idx.append(j)
    if len(new_idx) == 0:
      print(1)
    else:
      ans = 1
      for k in new_idx:
        ans *= min(t[k], a[k])
        ans %= MOD
      print(ans)


Measured memory_bytes: 18752
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  string S;
  cin>>S;
  int a=0;
  if(S.size()%2==1){
    a++;}
  for (int i=0;i<S.size();i+=2){
      if(S.at(i)!='h'){
      a++;
  }}
  for (int i=1;i<S.size();i+=2){
      if(S.at(i)!='i'){
      a++;
  }}
  if(a==0){
  cout<<"Yes"<<endl;}
  else
  cout<<"No"<<endl;}


Measured memory_bytes: 256
import numpy as np

N,K,Q = list(map(int, input().split()))
As = [int(input()) for _ in range(Q)]

res = np.zeros(N)
for a in As:
    res[a-1] += 1
    
for i in range(N):
    if res[i] > (Q - K) :
        print('Yes')
    else:
        print('No')

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

using namespace std;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0); cerr.tie(0);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (i & 1 && a[i] & 1) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  
  int a,b;
  cin >> a >> b;
  
  if (a * b % 2 == 0){
    cout << "Even" << endl;
  }
  else{
    cout << "Odd"<< endl;
  }
  
  
 }

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N), B(N);
  for(int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }
  
  map<int, long long> m;
  for(int i = 0; i < N; i++){
  	//mapのインデックスは全て0になっている
  	m[A[i]] += B[i]; 
  }
  long long ans = 0;
  
  //勝手にソートされる
  for(auto shop : m){
  	long long buy = min((long long)M, shop.second);
  	ans += buy*shop.first;
  	M -= (int)buy;
  }
  cout << ans << endl;
}

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

using ll=long long;

ll fix(ll x,ll k)
{
	return (x+k-1)/k*k;
}

int main()
{
	for(int n;cin>>n&&n;){
		ll x=1,y=1;
		while(n--){
			ll a,b; cin>>a>>b;
			if(fix(x,a)/a*b>=y){
				x=fix(x,a);
				y=x/a*b;
			}
			else{
				y=fix(y,b);
				x=y/b*a;
			}
		}
		cout<<x+y<<endl;
	}
}


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

int main(){
 int n;
  cin>>n;
  vector<int>x(n),y(n);
  rep(i,n) cin>>x[i]>>y[i];
  auto dist=[&](int i,int j){
  	double dx=x[i]-x[j];
    double dy=y[i]-y[j];
    return sqrt(dx*dx+dy*dy);
   };
  vector<int>p(n);
  rep(i,n) p.at(i)=i;
  double len=0;
  int cnt=0;
 do{
  rep(i,n-1){
  	len += dist(p.at(i),p.at(i+1));
  }
   cnt++;
 }while(next_permutation(p.begin(),p.end()));
  double ans=len/cnt;
  printf("%.10f\n",ans);
}

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

int main()
{
    long long n,m,k,x;
    cin>>n>>m>>k;
    vector<long long>s1,s2;
    s1.push_back(0),s2.push_back(0);
    for(int i=0;i<n;i++)
    {
        cin>>x;
        s1.push_back(s1.back()+x);
    }
    for(int i=0;i<m;i++)
    {
        cin>>x;
        s2.push_back(s2.back()+x);
    }
    int j=m,res=0;
    for(int i=0;i<=n;i++)
    {
        while(j>0 && s2[j]+s1[i]>k)
            j--;
        if(s2[j]+s1[i]<=k)
            res=max(res,i+j);
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 7920
#include <iostream>
#include <queue>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define in(v) cin>>v;
#define out(v) cout<<v<<"\n"

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

  priority_queue<int> q;
  q.push(1);
  int n = 2;
  while (n*n <= N) {
    int m = n * n;
    while (m <= N) {
      q.push(m);
      m *= n;
    }
    ++n;
  }
  while (!q.empty()) {
    int p = q.top(); q.pop();
    if (p <= N) {
      out(p);
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,count=1;
  cin >> N;
  vector<int> vec(N);
  
  for(int i;i < N;i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  for(int i;i < N-1;i++){
    if (vec.at(i) < vec.at(i+1)){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
s = raw_input()

def precheck():
    res = ""
    for c in s:
        if c != "x":
            res += c
    if not res:
        return 1
    if res != "".join(reversed(res)):
        return 0
    return res



def calc(ns):
    lf = ""
    rf = ""
    
    vtype = len(ns) % 2

    pos = 0

    cnt = 0
    while cnt < len(ns)/2:
        lf += s[pos]
        if s[pos] == "x":
            pass
        else:
            cnt+=1
        pos+=1
    
    if vtype:
        while s[pos] == "x":
            lf += s[pos]
            pos+=1
        pos+=1
    else:
         while s[pos] == "x":
            pos+=1

   

    rf = "".join(reversed(s[pos:]))


    lx = 0
    rx = 0
    res = 0
    while 1:

        if lx >= len(lf):
            res += len(rf)-rx
            break
        if rx >= len(rf):
            res += len(lf)-lx
            break

        rrr = rf[rx] == "x"
        lll = lf[lx] == "x"

        if rrr and lll:
            rx+=1
            lx+=1
        elif rrr and not lll:
            rx += 1
            res += 1
        elif not rrr and lll:
            lx += 1
            res += 1
        else:
            rx += 1
            lx += 1
    return res

pc = precheck()
if pc == 1:
    print 0
elif not pc:
    print -1
else:
    print calc(pc)


Measured memory_bytes: 3716
/**
 *    author:  tourist
 *    created: 10.01.2020 23:13:17       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    --x; --y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int tt;
  cin >> tt;
  vector<int> v(tt);
  vector<int> d(tt);
  vector<int> c(tt);
  for (int i = 0; i < tt; i++) {
    cin >> v[i] >> d[i] >> c[i];
    --v[i];
  }
  vector<int> color(n, -1);
  vector<int> bound(n, -1);
  for (int it = tt - 1; it >= 0; it--) {
    if (d[it] <= bound[v[it]]) {
      continue;
    }
    vector<int> que(1, v[it]);
    bound[v[it]] = d[it];
    if (color[v[it]] == -1) {
      color[v[it]] = it;
    }
    for (int b = 0; b < (int) que.size(); b++) {
      for (int j : g[que[b]]) {
        if (bound[que[b]] - 1 > bound[j]) {
          que.push_back(j);
          bound[j] = bound[que[b]] - 1;
          if (color[j] == -1) {
            color[j] = it;
          }
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << (color[i] == -1 ? 0 : c[color[i]]) << '\n';
  }
  return 0;
}


Measured memory_bytes: 8944
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  string ans="No";
  int H,N; cin>>H>>N;
  int sum=0;
  rep(i,0,N){
    int X; cin>>X;
    sum+=X;
  }
  if(sum>=H) ans="Yes";
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
//typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
ll INFL = 1LL << 60;//10^18 = 2^60
int INF = 1 << 30;//10^9
ll MOD = 1e9 + 7;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll x, ll y){return x / gcd(x, y) * y % MOD;};


int main(){
  ll N; cin >> N;
  string S; cin >> S;
  vector<ll> cnt(30, 1);
  rep(i, N) cnt[S[i] - 'a']++;
  ll ans = 1;
  rep(i, 30){
    ans *= cnt[i];
    ans %= MOD;
  }
  cout << ans - 1 << endl;




}


Measured memory_bytes: 512
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    Int n, m;
    cin >> n >> m;
    vector<map<int, int>> city(n, map<int, int>{});
    vector<pair<int, int>> c;
    int p, y;
    for (int i = 0; i < m; i++) {
        cin >> p >> y;
        city[p - 1].insert({y, p});
        c.push_back({p, y});
    }

    map<pair<int, int>, int> ans;
    for (int i = 0; i < n; i++) {
        int index = 1;
        for (auto e : city[i]) {
            ans.insert({{e.second, e.first}, index});
            index++;
        }
    }

    for (int i = 0; i < m; i++) {
        cout << setw(6) << setfill('0');
        cout << c[i].first;
        cout << setw(6) << setfill('0');
        cout << ans[c[i]] << endl;
    }

    return 0;
}


Measured memory_bytes: 19444
import scala.io.StdIn._
import scala.math._

object Main extends App with StdInHelper {
  val Array(d, t, s) = readInts
  if (d <= s * t) {
    println("Yes")
  } else {
    println("No")
  }
}

trait StdInHelper {
  def readStrings = readLine.split(" ")
  def readInts = readStrings.map(_.toInt)
  def readLongs = readStrings.map(_.toLong)
  def readDoubles = readStrings.map(_.toDouble)
  def readBigInts = readStrings.map(BigInt.apply(_))
  def readBigDecimals = readStrings.map(BigDecimal.apply(_))
}


Measured memory_bytes: 54700
#include<stdio.h>
int main()
{
	int i,j,k,temp;
	int num[10]={0};
	for(i=0;i<10;i++)
	{
		scanf("%d",&num[i]);
	}
	for(j=0;j<9;j++)
	{
        for(k=j+1;k<10;k++)
        {
            int flag=j;
            if(num[flag]<num[k])
            {
                flag=k;
            }
            if(flag!=j)
            {
                temp=num[j];
                num[j]=num[flag];
                num[flag]=temp;
            }
        }
	}
	for(i=0;i<3;i++)
	{
		printf("%d\n",num[i]);
	}
	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>

int main(void) {
	int h, w, k;
	char cake[301][301] = { 0 };
	int left, temp, bery_cnt = 0;
	int cake_cut[301][301] = { 0 };

	scanf("%d %d %d", &h, &w, &k);
	for (int i = 0; i < h; i++) scanf("%s", cake[i]);

	for (int i = 0; i < h; i++) {
		left = 0, temp = 0;
		for (int j = 0; j <= w; j++) {
			if (cake[i][j] == '#'){
				temp++;
				if (temp >= 2) {
					bery_cnt++;
					for (int k = left; k < j; k++) cake_cut[i][k] = bery_cnt;
					left = j;
				}
			}
			else if (temp >= 1 && j == w ) {
				bery_cnt++;
				for (int k = left; k < j; k++) cake_cut[i][k] = bery_cnt;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		if (cake_cut[i][0]==0) {
			if (i == 0) {
				for (int j = 1; j < h; j++) {
					if (cake_cut[j][0] != 0) {
						temp = j;
						break;
					}
				}
				for (int k = 0; k < w; k++)cake_cut[0][k] = cake_cut[temp][k];
			}
			else {
				for (int k = 0; k < w; k++)cake_cut[i][k] = cake_cut[i - 1][k];
			}
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) printf("%d ", cake_cut[i][j]);
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 1152