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

using namespace std;

#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define mp make_pair
#define pb push_back
#define eps 1e-9
#define PI acos(-1.0)
typedef long long ll;
typedef long double ld;
const int MAX_N = 1e3 + 5;
const int MOD = 1e9 + 7;

// const ll INF = 1e18L + 5;


template <typename T> void add_max(T &a, T b)
{
    a += b;
    if(a >= MOD)
        a -= MOD;
}
char grid[MAX_N][MAX_N];
int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio (0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i)    
        cin >> grid[i];
    
    std::vector<std::vector<int>> dp(n, std::vector<int>(m));
    dp[0][0] = 1;
    for (int r = 0; r < n; ++r)
    {
        for (int c = 0; c < m; ++c)
        {
            for(int row :
                    {
                        r, r + 1
                    })
            {
                int col = c;
                if(row == r)
                    col++;
                if(row < n && col < m && grid[row][col] == '.')
                    add_max(dp[row][col], dp[r][c]);
            }
        }
    }
    cout << dp[n - 1][m - 1];
    return 0;
}


Measured memory_bytes: 5248
def resolve():
	s = list(input())
	b = -1
	e = -1
	for i in range(len(s)):
		if s[i] == 'A' and b < 0:
			b = i
		if s[i] == 'Z':
			e = i
	if b == -1 or e == -1:
		print(0)
	else:
		print(e-b+1)
resolve()

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

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    vector<int> hist(N + 1, 0);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        hist[A[i]]++;
    }
    sort(hist.begin(), hist.end());
    int num = 0;
    for (int i = 0; i <= N; i++) {
        if (hist[i] != 0) {
            num++;
        }
    }

    if (num <= K) {
        cout << 0 << endl;
    } else {
        long long ans = 0;
        for (int i = 0; i <= N; i++) {
            if (hist[i] == 0) {
                continue;
            }

            ans += hist[i];
            num--;
            if (num <= K) {
                break;
            }
        }
        cout << ans << endl;
    }
}


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

int main() {
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>>table(H,vector<char>(W));

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> table.at(i).at(j);
    }
  }
  
  vector<bool> x(H,false);
  vector<bool> y(W,false);
  
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(table.at(i).at(j)=='#'){
        x[i]=true;
        y[j]=true;
      }
    }
  }
  for(int i=0;i<H;i++){
    if(x[i]){
      for(int j=0;j<W;j++){
        if(y[j]){
          cout << table.at(i).at(j);
        }
      }
      cout << endl;
    }
  }
}



Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
const int maxn = 1e5+100;
int n,a[maxn],b[maxn],m;
map<int,int> mps;

bool check(){
    if(n%3){
        for(int i=0;i<n;++i)
            if(a[i]) return false;
        return true;
    }

    mps.clear(); m=0;
    for(int i=0;i<n;++i){
        if(!mps[a[i]]) b[m++]=a[i];
        mps[a[i]]++;
    }

    if(m==1) return (b[0]==0);
    else if(m==2) return (mps[0]*3==n);
    else if(m==3) return (mps[b[0]]==mps[b[1]]&&mps[b[1]]==mps[b[2]]&&(b[0]^b[1])==b[2]);
    else return false;
}

int main(){
    scanf("%d",&n);
    for(int i=0;i<n;++i) scanf("%d",&a[i]);
    if(check()) printf("Yes\n");
    else printf("No\n");
    //for(int i=0;i<m;++i) printf("%d ",b[i]);
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
    string s;
    cin>>s;
    s.at(5)=' ';
    s.at(13)=' ';
    cout<<s<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;


struct UnionFind{
    
    vector<int> M_par;
    vector<int> M_rank;
    vector<int> M_size;

private:
    void init(int n = 1){
        M_par.resize(n);
        M_rank.resize(n);
        M_size.resize(n);
        for(int i = 0; i < n; i++){
            M_par[i] = i;
            M_rank[i] = 0;
            M_size[i] = 1;
        }
    }

public:

    UnionFind(size_t n = 1){
        init(n);
    }

    size_t find(size_t x){
        if(M_par[x] == x) return x;
        size_t r = find(M_par[x]);
        return M_par[x] = r;
    }
    
    bool same(size_t x, size_t y){
        return find(x) == find(y);
    }

    bool unite(size_t x, size_t y){
        x = find(x);
        y = find(y);
        if(x == y) return false;
        if(M_rank[x] < M_rank[y]) swap(x, y);
        if(M_rank[x] == M_rank[y]) M_rank[x]++;
        M_par[y] = x;
        M_size[x] = M_size[x] + M_size[y];
        return true;
    }

    size_t size(size_t x){
        return M_size[find(x)];
    }

};


signed main(){
    

    int n, m; cin >> n >> m;
    UnionFind uf(n);

    for(int i = 0; i < m; i++){
        int a, b, c; cin >> a >> b >> c;
        a--;
        b--;
        uf.unite(a, b);
    }

    set<int> s;
    for(int i = 0; i < n; i++) s.insert(uf.find(i));
    cout << s.size() << endl;
    return 0;
}



Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    map<string,int>b;
    map<string,int>::iterator it;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        b[s]++;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        string s;
        cin>>s;
        b[s]--;
    }
    int mx=0;
    for(it=b.begin();it!=b.end();it++)
    {
        mx=max(mx,it->second);
    }
    cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 256
import qualified Data.IntMap as M
import Data.List

main :: IO ()
main = do
    [_, m] <- readInts
    as <- readInts
    print $ solve m as

readInts :: IO [Int]
readInts = map read . words <$> getLine

solve :: Int -> [Int] -> Int
solve m =  M.foldr (\x y -> (x * (x - 1) `div` 2) + y) 0
     . foldr (M.alter $ return . maybe 1 succ)  M.empty
     . map (`mod` m)
     . scanl' (+) 0


Measured memory_bytes: 36220
#include<iostream>
using namespace std;
int main(){
    string O,E;

    cin >> O >> E;

    int N = O.length() + E.length();

    string ans;

    for(int i = 0;i < N; i++){
      if( i%2 == 0 ){
        ans += O[i/2];
      }
      else {
        ans += E[i/2];
      }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <stack>
#include <cmath>
#include <utility>

int main()
{
    using namespace std;

    int n;
    cin >> n;
    vector<int> a(n);
    for (auto& e : a)
        cin >> e;

    int all{3};
    for (int i = 1; i < n; ++i)
    {
        all *= 3;
    }

    int notSimullar{1};
    for (auto e : a)
    {
        if (e % 2 == 0)
            notSimullar *= 2;
    }

    cout << all - notSimullar << endl;

    return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){
  
  int n,m;
  cin >> n >> m;
  ll res = 0;
  if(n == 1 && m == 1){
    res = 1;
  }else if(n == 1 || m == 1){
    res = 1ll*n*m-2;
  }else{
    n -= 2;
    m -= 2;
    res = 1ll*n*m;
  }
  cout << res << endl;


  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx,avx2,fma")
using namespace std;

#define _ << ": " <<
#define watch1(var1) (cerr << (#var1) _ var1 << '\n')
#define watch2(var1, var2) cerr << (#var1) _ var1 << ", " << (#var2) _ var2 << '\n'
#define watch3(var1, var2, var3) cerr << (#var1) _ var1 << ", " << (#var2) _ var2 << ", " << (#var3) _ var3 << '\n'
#define wloop(size, arr) cerr << (#arr) << ": "; for (int i = 0; i < size; i++) cerr << arr[i] << " \n"[i+1 == size]

template<typename... Args>
void read(Args&... args) { ((cin >> args), ...); }

template<typename... Args>
void show(Args... args) { ((cout << args << " "), ...); }

#define ints(a...) int a; read(a)
#define longs(a...) int64_t a; read(a)
#define IN(a) for (auto &it : a) cin >> it

const int N = 1e6 + 1;

void solve() {
    ints(n);
    vector<int> v(n);
    vector<int> fq(N);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        fq[v[i]]++;
    }
    int cnt = 0;
    for (int i = 1; i < N; i++) {
        if (fq[i] == 1) cnt++;
        if (fq[i]) for (int j = i + i; j < N; j += i) fq[j] = 0;
    }
    show(cnt);
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1; 
    // cin >> T;
    while (T--) solve();
    return 0;
}




Measured memory_bytes: 7960
S = input()
S_list = list(set(S))
string = "qazwsxedcrfvtgbyhnujmikolp"
str_list = list(string)
str_list.sort()
for a in S_list:
    str_list.remove(a)
if str_list == []:
    print("None")
else:
    print(str_list.pop(0))

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	sc.close();
    	if(n % 2 == 0){
    		System.out.println(n / 2);
    	}else{
    		System.out.println((n + 1) / 2);
    	}
    }
}

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

int main()
{
  int H, N;
  int a;
  int sum = 0;

  cin >> H >> N;

  for (int i = 0; i < N; i++)
  {
    cin >> a;
    sum += a;
  }

  if (H - sum <= 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
// 基本テンプレート

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) { a = max(a, b); }
template<typename T> void chmin(T &a, T b) { a = min(a, b); }
template<typename T> void chadd(T &a, T b) { a = a + b; }

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = { 0, 0, 1, -1 };
int dy[] = { 1, -1, 0, 0 };
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int dp[50][100001];

struct Elem {
	int sum, mod, val;
	bool operator<(const Elem &a) const {
		return dp[sum][mod] > dp[a.sum][a.mod];
	}
};

signed main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int K; cin >> K;
	rep(i, 0, 50) rep(j, 0, 100001) dp[i][j] = INF;
	dp[0][0] = 0;

	// sum, mod
	priority_queue<Elem> q;
	q.push(Elem{ 0, 0, 0 });
	while (!q.empty()) {
		Elem cur = q.top(); q.pop();
		if (dp[cur.sum][cur.mod] < cur.val)continue;
		rep(x, 0, 10) {
			int nsum = cur.sum + x;
			int nmod = (cur.mod * 10 + x) % K;
			if (nsum > 45) continue;
			if (dp[nsum][nmod] > dp[cur.sum][cur.mod] + 1) {
				dp[nsum][nmod] = dp[cur.sum][cur.mod] + 1;
				q.push(Elem{ nsum, nmod, dp[nsum][nmod] });
			}
		}
	}
	rep(i, 1, 50) {
		if (dp[i][0] != INF) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 90596
#pragma GCC optimize("O3")

#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz(x) (int)x.size()
#define f first
#define s second

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin >> n;
    cout << (n*(n-1))/2;

    return 0;
}


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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};

int main( void ){
	initialize();
	ll N, K;
	cin >> N >> K;
	int ans =0;
	while(N >= K){
		ans++;
		N /= K;
	}
	cout << ans + 1 << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
	cin.tie( 0 );
	ios::sync_with_stdio( false );
}


Measured memory_bytes: 256
f = ["" for i in range(6)]
n = int(raw_input())
for i in range(n):
    h = float(raw_input())
    if   h < 165.0: f[0] += "*"
    elif h < 170.0: f[1] += "*"
    elif h < 175.0: f[2] += "*"
    elif h < 180.0: f[3] += "*"
    elif h < 185.0: f[4] += "*"
    else          : f[5] += "*"

for i in range(6):
    print "%d:%-s"%(i+1,f[i])

Measured memory_bytes: 4244
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

    ($next:expr, i321) => {
        read_value!($next, i32) - 1
    };

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

//
// # Examples
//
// # integers
// input! { n: i32, m: i32, ... }
//
// # array
// input! { n: i32, v: [i32; n], }
//
// # matrix
// input! { n: i32, m: i32, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: i32,
//     w: i32,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: i32, b: i32, c: i32,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}
fn main() {
    input! { m: usize }
    println!("{}", 48-m);
}

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

int main() {
	float c1[3];
	float c2[3];
	float d;
	
	cin >> c1[0] >> c1[1] >> c1[2];
	cin >> c2[0] >> c2[1] >> c2[2];
	
	d = sqrt(pow(abs(c1[0]-c2[0]), 2) + pow(abs(c1[1]-c2[1]), 2));
	
	if(d > c1[2] + c2[2]){
	    cout << 4 << endl;
	}else if(d == c1[2] + c2[2]){
	    cout << 3 << endl;
	}else if(d < c1[2] + c2[2] && d > abs(c1[2] - c2[2])){
	    cout << 2 << endl;
	}else if(d == abs(c1[2] - c2[2])){
	    cout << 1 << endl;
	}else{
	    cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 3228
PROGRAM-ID.                      ABC_104_A.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 R       PIC 9(4).

PROCEDURE                        DIVISION.
    ACCEPT R.

    IF R < 1200 THEN
        DISPLAY "ABC"
    ELSE
        IF R < 2800 THEN
            DISPLAY "ARC"
        ELSE
            DISPLAY "AGC"
        END-IF
    END-IF.

    STOP RUN.


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

ll solve112d(ll n, ll m){
  if(n==1) return m;
  ll ans=1;
    for(ll i=2; i*i < m; i++){
      if(m%i==0 && i< m/n + 1){
        
        if(m/i < m/n + 1){
          ans=max(ans, max(i, m/i));
        }else{
          ans = max(i, ans);
        }
      }
    }
  return ans;

}
int main(){
  ll n,m; cin >> n >> m;
  cout << solve112d(n,m);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

double a[50];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    sort(a, a + n);
    for (int i = 1; i < n; ++i)
        a[i] = (a[i] + a[i - 1]) / 2;
    cout << a[n - 1];
}


Measured memory_bytes: 256
if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    h = [0] * (max(a) + 2)
    minus = 0
    for i in a:
        h[i] += 1
        h[i + 1] += 1
        if i == 0:
            minus += 1
        else:
            h[i - 1] += 1

    print(max(minus, max(h)))


Measured memory_bytes: 13964
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const int mod = 1e9+7;
const int N = 1e6+5;
//int a[N];

int d[N], m[N], c[N];

int main()

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

    int x;
    set <int> s;

    for (int i = 0; i < 3; i++) {

        cin >> x;
        s.insert(x);
    }

    cout << s.size();

    return 0;
}


//long long vs int
//pow function (+0.5)
//read carefully: overflow, constraints, etc...


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int N, M, Q; cin >> N >> M >> Q; 
  int cnt[500][500] = {};
  rep(i, M){
    int l, r; cin >> l >> r; l--; r--; cnt[l][r]++; 
  }
  rep(i, 500){
    rep(j, 499){
      cnt[i][j+1]+=cnt[i][j];
    }
  }
  rep(i, Q){
    int p, q; cin >> p >> q; p--; q--;
    int ans = 0;
    for(int j=p; j<500; j++){
      ans+=cnt[j][q];
    }
    cout << ans << endl;
  }
}
    


Measured memory_bytes: 1920
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){
  int i, j, n;
  string s;
  vector<int> number;

  while(cin >> s){
    for(i=0; i<s.size(); ++i){
      n = s[i] - 48;
      number.push_back(n);
    }

    for(i=number.size()-1; i>0; --i){
      for(j=0; j<i; j++){
	n = number[j] + number[j+1];
	if(n >= 10) n -= 10;
	number[j] = n;
      }
    }

    cout << number[0] << endl;
    number.clear();
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

int main() {
    long long n, m;
    cin >> n >> m;  
    if (n != 1 && m != 1){
        cout << n * m - (2 * n + 2 * m - 4) << endl;
    }else if (n == 1 && m == 1){
        cout << 1 << endl;
    }else{
        cout << n * m - 2 << endl;
    }
}

Measured memory_bytes: 256
const Main = (input) => {
    const A = input.split(' ')[0];
    const B = input.split(' ')[1];
    console.log(A * B - A - B + 1)
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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


int main(){
    ll H, A;
    cin>>H>>A;
    vector<ll> B(A);
    ll Sum=0;
    for(ll i=0; i<A; i++){
        cin>>B[i];
        Sum+=B[i];
    }
    cout<<(H>Sum?"No":"Yes")<<endl;
}





Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")

#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <random>
#include <iterator>
#include <cstring>
#include <deque>

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

#define ll long long

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: i64 = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };

    let ans = if (1..10).any(|i| N % i == 0 && N / i <= 9 ) { "Yes" } else { "No" };

    println!("{}", ans);
}


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<(n);i++)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> pii;

struct Real{
	ll m;
	int e;
};

void solve(){
	ll N ;cin>>N;
	if(N==0)exit(0);
	string S;cin>>S;
	reverse(ALL(S));
	Real a = {1LL<<52,0};
	REP(i,52){
		if(S[i]=='1')a.m+=(1LL<<i);
	}
	Real ans = a;
	while(N>0){
		ans.m+=a.m;
		if(ans.m>=(1LL<<53)){
			ans.m>>=1;
			ans.e++;
			a.m>>=1;
			a.e+=1;
			N--;
		}
		if(a.m==0)break;
		ll cnt = min(N,((1LL<<53)-ans.m-1)/a.m);
		ans.m+=a.m*cnt;
		N-=cnt;
	}
	cout<<bitset<12>(ans.e)<<bitset<52>(ans.m)<<endl;
}

signed main() {
	//test();
	while(true)solve();
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using P = pair<ll,ll>;
int INF = 1e9+7;

int main() {
    int N,M;
    cin >> N >> M;
    int A[31][31];
    for (int i = 0; i < 31; i++) {
        for (int j = 0; j < 31; j++) {
            A[i][j] = 0;
        }
    }

    for (int i = 0; i < N; i++) {
        int K;
        cin >> K;
        for (int j = 0; j < K; j++) {
            int a;
            cin >> a;
            A[i][a] = 1;
        }
    }


    int count = 0;
    for (int i = 0; i <= M; i++) {
        for (int j = 0; j < N; j++) {
            if (A[j][i] == 0)
                break;
            if (j == N-1) count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
 int a=0;
 int W,H,x,y,r=0;
 scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(x-r>=0&&x+r<=W){
    if(y-r>=0&&y+r<=H){
     a=1;
    }
  }
  else{
  a = 0;
 }
  if(a==1){
  printf("Yes\n");
 }
 else if(a==0){
 printf("No\n");
}

 return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

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

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}

};

int main() {
	string s;
	cin >> s;
	if (s.size() == 3) {
		reverse(all(s));
	}
	cout << s << endl;
}


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


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	lli r;
	cin >> r;

	cout << r * r << endl;

	return 0;
}

Measured memory_bytes: 256
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

  
n = gets
puts n.split("").include?("7")? "Yes" : "No"


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N; cin >> N;
  VI xs(N);
  REP(i,N){
	cin >> xs[i];
	--xs[i];
  }

  LL ans = 0;
  REP(i,N){
	if(i < xs[i] && xs[xs[i]] == i) ++ans;
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 640
MOD=1000000007

def dfs(total,arr):
    if total==0:
        return [arr]
    ret = []
    for i in range(1,total+1):
        ret += dfs(total-i,arr+[i])
    return ret

N,X,Y,Z=map(int,input().split())
xx,yy,zz=[dfs(n,[]) for n in [X,Y,Z]]

NN=2**(X+Y+Z)
NS=2**(X+Y+Z-1)
isxyz = [False]*NN

for x in xx:
    for y in yy:
        for z in zz:
            tmp=0
            for a in x+y+z:
                tmp = tmp << a
                tmp += (2**(a-1))
            isxyz[tmp]=True
            #print(x+y+z, bin(tmp))

dp=[[0]*NS for _ in range(N+1)]
dp[0][0]=1

mask1=NN-1
mask2=NS-1

for i in range(N):
    for src in range(NS):
        for k in range(1,11):
            if dp[i][src]==0: continue
            state = ((src<<k)+(2**(k-1)))&(mask1)
            
            if isxyz[state] is False:
                dst = state&mask2
                dp[i+1][dst] = (dp[i+1][dst]+dp[i][src])%MOD

ans = 0
for v in dp[N]:
    ans = (ans+v)%MOD
total = (10**N)%MOD
print((total-ans+MOD)%MOD)


Measured memory_bytes: 65372
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k):
    l = [0] * (n + 1)
    for j in range(n):
        l[max(0, j - a[j])] += 1
        l[min(n, j + a[j] + 1)] -= 1
    for j in range(n - 1):
        l[j + 1] += l[j]
    a = l
    if a.count(n) == n:
        break
print(*a[:n])

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

using namespace std;


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    long long ans = 0;
    for(int i = 0; i < n - 1; i++) {
        int h = (i + 1) / 2;
        ans += a[n-h-1];
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4036
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
#define INF 2000'000'000

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	//freopen("in", "r", stdin);
	int n, k;
	cin >> n >> k;
	vector < int > v(n);		
	for(int & i : v)
		cin >> i;
	for(int i = k; i < n; i++){
		cout << (v[i] > v[i-k] ? "Yes" : "No") << "\n";
	}
	return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int A,B,C,X,cnt=0;
  cin>>A>>B>>C>>X;
  for(int i=0;i<=A;i++){
    for(int j=0;j<=B;j++){
      for(int k=0;k<=C;k++){
        if(500*i+100*j+50*k==X) cnt++;
      }
    }
  }
  cout<<cnt<<endl;
  
}	

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    s = [int(input()) for _ in range(N)]
    ans = sum(s)
    if ans % 10:
        print(ans)
        return
    s = [x for x in s if x % 10]
    if len(s) == 0:
        print(0)
    else:
        print(ans - min(s))

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int k, a, b;
    cin >> k >> a >> b;
    for(int i = a; i <= b;i++){
        if(i%k==0){
            cout << "OK";
            return 0;
        }
    }
    cout << "NG";
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
vi a;
int n,m;
vi dp(100010,-1);
int f(int t){
	if(dp[t]+1)return dp[t];
	int w=m-a[t];
	int ma=0;
	if(t&&a[t-1]>a[t])ma=max(ma,f(t-1));
	if(t!=n-1&&a[t]<a[t+1])ma=max(ma,f(t+1));
	return dp[t]=w+ma;
}
int main(){
	cin>>n>>m;
	a=vi(n);
	rep(i,n)cin>>a[i];
	int out=0;
	rep(i,n)out=max(out,f(i));
	cout<<out<<endl;
}

Measured memory_bytes: 4092
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
int n;
int max=0;
int min=9999;
int a[101];
scanf("%d",&n);
for(int count=0;count<n;count++){
scanf("%d",&a[count]);
}

for(int count=0;count<n;count++){
if(min>=a[count]){min=a[count];}
if(max<=a[count]){max=a[count];}
}

printf("%d",max-min);

}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 998244353LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}
};
ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x %mod;
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}
typedef vector<vector<Edge>> Graph;


signed main(void) {
	ll n;
	cin >> n;
	ll nas = 0;
	rep(i, 1, sqrt(n) + 1) {

		if (n % i != 0) continue;

		if(n/i-1 > i)
			nas += n / i - 1;

	}
	cout << nas << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] lines = line.split(" ", 0);

        int num = Integer.parseInt(lines[0]);
        int make = Integer.parseInt(lines[1]);
        int time = Integer.parseInt(lines[2]);

        int ret = time * (int)(Math.ceil(1.0 * num / make));
        
        System.out.println(ret);
    }
}


Measured memory_bytes: 35628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    string s,ans="";cin>>s;
    ll k;cin>>k;
    ll n=s.size(),cur=0;
    while(cur<n){
        ans+=s[cur];
        cur+=k;
    }
    cout<<ans;
}

Measured memory_bytes: 256
N=input()
N=list(N)
N=map(lambda x: int(x),N)
if sum(N)%9==0:
    print("Yes")
else:
    print("No")
















    

                
            





    









        

    









    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














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

#define INF 1e9
using namespace std;

int main() {

    int N; cin >> N;

    vector<pair<pair<string, int>, int>> p(N);

    for (int i = 0; i < N; ++i) {
        string S; cin >> S;
        int P; cin >> P;

        p[i] = make_pair(make_pair(S, -P), i);
    }

    sort(p.begin(), p.end());

    for (int i = 0; i < N; ++i) {
        cout << p[i].second + 1 << endl;
    }
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())
# /a+/b</c
# a+2/a/b+b<c
# 4ab<(c-a-b)**2

print(("No","Yes")[4*a*b<(c-a-b)**2 and c-a-b>0])
# print(a**0.5,b**0.5,a**0.5+b**0.5,c**0.5)
# print(("No","Yes")[a**0.5+b**0.5<c**0.5])

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ll n,a,b,ans=0;
    cin>>n>>a>>b;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=1;i<n;i++){
        ll x=abs(arr[i]-arr[i-1])*a;
        ans+=min(x,b);
    }
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3988
A, B, K = map(int, input().split())

print(A)

max_A = A

for _ in range(1, K):
    max_A += 1
    if max_A > B:
        break
    print(max_A)

min_B = B - K + 1
if min_B < max_A:
    min_B = max_A
if min_B > max_A:
    print(min_B)

while min_B < B:
    min_B += 1
    if min_B > max_A:
        print(min_B)


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

int main(void){
	
	char num_str[1002];
	int num;
	long sum = 0;
	int i;
	char tmp;
	
	while (1)
	{
		fgets(num_str,sizeof(num_str),stdin);
		
		if(num_str[0] == '0') break;
		
		for(i = 0;i < strlen(num_str)-1; i++)
		{
			tmp = num_str[i];
			num = atoi(&tmp);
			sum = sum + num;
		}
		printf("%ld\n",sum);
		
		sum = 0;
		memset(num_str, 1002, 0);
		
	}
	return 0;
}

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

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

    vector<int> vec;
    for (int i = 0; i < n; i++)
    {
        int num;
        cin >> num;
        vec.push_back(num);
    }

    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    cout << vec.size() << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <cstdio>
#include <numeric>

using namespace std;

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

int main()
{
	int n;

	cin >> n;
	long ans = 0;

	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= n; ++j)
		{
			for (int k = 1; k <= n; ++k)
			{
				ans += gcd(i, gcd(j, k));
			}
		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  long long K;
  cin>>S>>K;
  for(int i=0;i<min((long long)S.size(),K);i++){
    if(S.at(i)=='1') continue;
    else{
      cout<<S.at(i)<<endl;
      return 0;
    }
  }
  cout<<'1'<<endl;
  
  
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int n = in();
  int ans = 0;
  rep(i,1,n+1){
    int d = in();
    if((i&1) and (d&1))++ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3688
import string

count = {x: 0 for x in string.ascii_lowercase}
lines = ""

while True:
    try:
        lines += input().lower()
    except EOFError:
        break
        
for c in lines:
    if 'a' <= c <= 'z':
        count[c] += 1

for key, in string.ascii_lowercase:
    print("{0} : {1}".format(key, count[key]))

Measured memory_bytes: 8032
//#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N,P;
	string S;
	scan(N>>P>>S);
	int tenth[200001];
	tenth[0]=1;
	rep(i,N){
		tenth[i+1]=tenth[i]*10%P;
	}
	if(P==2||P==5){
		ll ans=0;
		rep(i,N){
			if((S[i]-'0')%P==0) ans+=i+1;
		}
		prin(ans);
	}
	else{
		int dp[200001]={};
		ll cnt[10001]={};
		cnt[0]++;
		brep(i,N){
			dp[i]=(dp[i+1]+tenth[N-i-1]*(S[i]-'0'))%P;
			cnt[dp[i]]++;
		}
		ll ans=0;
		rep(i,N+1){
			debug(dp[i]);
		}
		rep(i,P){
			ans+=cnt[i]*(cnt[i]-1)/2;
		}
		prin(ans);
	}


	return 0;
}


Measured memory_bytes: 2180
/*    ####################  */
/*   # I_LOVE_THUY_LINH #  */
/*  ####################  */
#include <bits/stdc++.h>
#define ll long long
#define db double
#define ld long double
#define ii pair<int,int>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vii vector<ii>
#define matrix vector<vector<ll>>
#define fir first
#define sec second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
#define uni(a) (a).erase(unique(all(a)),(a).end())
#define sz(a) int((a).size())
#define ms(s,val) memset(s,val,sizeof(s))
#define bitcount(n) __builtin_popcountll(n)
#define getbit(s,k) ((s >> k)&1)
#define turnbit(s,k) (s | (1<<k))
#define offbit(s,k) (s & ~(1<<k))
#define flipbit(s,k) (s ^ (1<<k))
#define prec(n) fixed<<setprecision(n)
#define sqr(x) (ll)(x)*(ll)(x)
#define lcm(a,b) ((ll)a/__gcd((ll)a,(ll)b)*(ll)(b))
#define gcd(a,b) __gcd(a,b)
using namespace std;
const int INF = int(1e9);
const ll Mod = 998244353;
int N, S;

// dp[i][s] la so luong subset ket thuc tai i va tong la s
// dp[i][s] = sum dp[j][s - ai] (j < i)
// dat sumdp[i][j] = dp[i][j] + sumdp[i - 1][j]
// => dp[i][s] = sumdp[i - 1][s - a[i]]
//  voi dp[i][s] => thi dp[i][s] nam trong (N - i + 1) day

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> N >> S;
    vector<int> a(N + 1);
    for (int i = 1; i <= N; i++) cin >> a[i];

    vector<vector<ll>> dp(N + 1,vector<ll> (S + 1));
    vector<vector<ll>> sumdp(N + 1,vector<ll> (S + 1));
    for (int i = 0; i <= N; i++) dp[i][0] = 1;

    sumdp[0][0] = 1;
    for (int i = 1; i <= N; i++){
        for (int j = 0; j <= S; j++){
            if (j >= a[i]) dp[i][j] = sumdp[i - 1][j - a[i]];
            sumdp[i][j] = (sumdp[i - 1][j] + dp[i][j]) % Mod;
        }
    }

    ll ans = 0;
    for (int i = 1; i <= N; i++) ans = (ans + (ll)(N - i + 1)*dp[i][S])  % Mod;
    cout << ans;
    return 0;
}

Measured memory_bytes: 141184