akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

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

  //  cout << "a" << a << "b" << b << "c" << c << endl;

  if( a < b && b < c)
    {cout << "Yes" << endl;}
  else
    {cout << "No" << endl;}

  return 0;

}


Measured memory_bytes: 3112
//@source : 
//@create : 19:13:29 Saturday 27/06/2020
//@author : nghethuat102
//@status : 
#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<long long> a(n);
    vector<long long> b(m);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (i) {
            a[i] += a[i - 1];
        }
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
        if (i) {
            b[i] += b[i - 1];
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] <= k) {
            ans = max(ans, i + 1);
        }
    }
    for (int i = 0; i < m; ++i) {
        if (b[i] <= k) {
            ans = max(ans, i + 1);
        }
    }
    int ia = n - 1;
    for (int ib = 0; ib < m; ++ib) {
        while (ia >= 0 && a[ia] + b[ib] > k) {
            --ia;
        }
        if (ia >= 0) {
            ans = max(ans, ib + 1 + ia + 1);
        }
    }
    cout << ans << "\n";
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    while (t--) {
        solve();
    }
  //  cerr << fixed << setprecision(5) << double(clock()) * 1000 / CLOCKS_PER_SEC << " ms\n";
    return 0;
}

Measured memory_bytes: 6360
use proconio::input;

fn main() {
    input!(n:i32,a:[i64;n]);
    let mut ans = 1i128;
    let f = a.iter().all(|e|*e != 0);
    if !f {println!("0");return;}
    for i in a.iter() {
        ans *= *i as i128;
        if ans > 1_000_000_000_000_000_000 {
            println!("-1");
            return;
        }
    }
    println!("{}",ans);
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int n, m; cin >> n >> m;
    V<int> l(m), r(m);
    for(int i = 0; i < m; i++) cin >> l[i] >> r[i];

    sort(ALL(l));
    sort(ALL(r));

    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(l[m - 1] <= i && i <= r[0]){
            ans++;
        }
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 4044
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<map>
#include<queue>
#include<vector>
#include<stack>
#include<set>
#include<cctype>
#define pa pair<int,int>
#define INF 0x3f3f3f3f
#define inf 0x3f
#define fi first
#define se second
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define pb push_back

using namespace std;

inline ll read()
{
	long long f=1,sum=0;
	char c=getchar();
	while (!isdigit(c)) {if (c=='-') f=-1;c=getchar();}
	while (isdigit(c)) {sum=sum*10+c-'0';c=getchar();}
	return sum*f;
}
const int MAXN=110;
int a[MAXN];
int main()
{
	int n=read(),sum=0;
	for (int i=1;i<=n;i++) a[i]=read(),sum+=a[i];
	double b=1.0*sum/n;
	double minn=1e18;
	for (int i=1;i<=n;i++)
		minn=min(minn,(double)abs(b-a[i]));
	for (int i=1;i<=n;i++)
	{
		if ((double)abs(b-a[i])==minn)
		{
			cout<<i-1;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 764
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500 * i + 100 * j + 50 * k == X:
                ans += 1

print(ans)


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


int main(){
    int N,T; cin >> N >> T;
    vector<int> t(N);
    rep(i,N) cin >> t[i];

    ll l=0,r=0;
    bool on = false;
    ll res = 0;
    rep(i,N){
        if(t[i]<=r) on = true;
        else on = false;

        if(!on){
            res += r-l;
            l=t[i]; r=t[i]+T;
            on = true;
        }else{
            r=t[i]+T;
        }
    }
    res += r-l;
    cout << res << endl;
}

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

using namespace std;

template <typename T>
std::map<T, T> factorint(T n) {
    std::map<T, T> pfac;

    if (n <= 0) return pfac;

    if (n % 2 == 0) {
        n /= 2;
        pfac[2] = 1;
        for (; n % 2 == 0; n /= 2) {
            ++pfac[2];
        }
    }

    T p = 3;
    while (n >= p * p) {
        if (n % p == 0) {
            n /= p;
            pfac[p] = 1;
            for (; n % p == 0; n /= p) {
                ++pfac[p];
            }
        }
        p += 2;
    }

    if (n != 1) {
        pfac[n] = 1;
    }

    return pfac;
}

template <typename T>
T powi(T b, T e) {
    T ans = 1;
    for (; e != 0; e >>= 1) {
        if (e & 1) {
            ans *= b;
        }
        b *= b;
    }
    return ans;
}

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

    long long n, p;
    cin >> n >> p;

    auto pfac = factorint(p);

    long long prod = 1;
    for (auto& pexp : pfac) {
        prod *= powi(pexp.first, pexp.second / n);
    }

    cout << prod << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MAX 1000000007
#define MAXN 100005
bool sortby1column(vector<ll> &v1,vector<ll> &v2){
 return v1[0]<v2[0];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
    int t=1;
    //cin>>t;
    for(int cc=1;cc<=t;cc++){
        //cout<<"Case #"<<cc<<":\n";
        string s;
        cin>>s;
        if(s[0]=='7'||s[1]=='7'||s[2]=='7')
            cout<<"Yes\n";
        else
            cout<<"No\n";
                
    }
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

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

int main(){
  int k;
  cin >> k;
  ll num = 0;
  ll ans = -1;
  rep(i, 1100000){
    num += 7 * modPow(10, i, k);
    num %= k;
    if (num == 0){
      ans = i+1;
      break;
    }
  }
  cout << ans << endl;
  
  return 0;
}

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

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}

int main() {
    long long n, m, a;
    cin >> n >> m;
    map<int, int> cnt;
    vector<int> ks(n);
    for (int i = 0; i < n; i++) {
        cin >> ks[i];
        for (int j = 0; j < ks[i]; j++) {
            cin >> a;
            cnt[a]++;
        }
    }
    int ans = 0;
    for (int i = 1; i <= m; i++) {
        // cout << cnt[i] << endl;
        if (cnt[i] == n) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

ll g(ll n) {
  return (n * (n + 1)) / 2;
}

int main() {
  ll N;
  cin >> N;

  ll ans = 0;

  for (ll n = 1; n <= N; ++n) {
    ans += n * g(N / n);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main {
	public static void main(String[] args) {
		
		Scanner scin = new Scanner(System.in);
		int num_list_length = Integer.parseInt(scin.nextLine());
		int[] searchable_nums = new int[num_list_length];
		String[] unparsed_nums = scin.nextLine().split(" ");
		for (int i = 0; i < unparsed_nums.length; i++) {
			searchable_nums[i] = Integer.parseInt(unparsed_nums[i]);
		}
		
		num_list_length = Integer.parseInt(scin.nextLine());
		int[] query = new int[num_list_length];
		unparsed_nums = scin.nextLine().split(" ");
		for (int i = 0; i < unparsed_nums.length; i++) {
			query[i] = Integer.parseInt(unparsed_nums[i]);
		}
		
		System.out.println(searchNumsLinear(searchable_nums, query));
	}
	
	public static int searchNumsLinear(int[] nums, int[] query) {
		boolean[] found = new boolean[query.length];
		for (int i = 0; i < nums.length; i ++) {
			int tgtnum = nums[i];
			for (int j = 0; j < query.length; j++) {
				if (found[j]) {
					continue;
				}
				if (query[j] == tgtnum){
					found[j] = true;
				}
			}
		}
		
		int ct = 0;
		for (int i = 0; i < found.length; i++) {
			if (found[i]) {
				ct += 1;
			}
		}
		return ct;
	}
}


Measured memory_bytes: 30276
#include <iostream>

using namespace std;

int n;
bool is_prime[1000000];

int solve()
{
    int result = 0;
    for (int i = 0; i <= n; ++i)
    {
        is_prime[i] = true;
    }

    for (int i = 2; i <= n; ++i)
    {
        if (!is_prime[i])
        {
            continue;
        }
        ++result;
        for (int j = i * 2; j <= n; j += i)
        {
            is_prime[j] = false;
        }
    }
    return result;
}

int main()
{
    while (cin >> n)
    {
        cout << solve() << endl;
    }
    return 0;
}

Measured memory_bytes: 4048
/*
 * 16-10-29_AGC006_A.cpp
 *
 *  Created on: 2016/10/29
 *      Author: ryoma
 */

#include<iostream>
#include<string>

using namespace std;

int N;
string s,t;
int main(){
	cin >> N >> s >> t;
	int cnt=0;
	for(int i=1;i<=N;i++)
		if(s.substr(N-i,i) == t.substr(0,i)){
			cnt=i;
		}
	cout << 2*N-cnt<<endl;
	return 0;
}




Measured memory_bytes: 256
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	ll n, a, b; cin >> n >> a >> b;
	ll res = 0;
	res += (n / (a + b))*a;
	n %= (a + b);
	res += min(a, n);
	cout << res << endl;
}

Measured memory_bytes: 256
/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>
int getGcd(int, int);

int getGcd(int a, int b){
    if(a==0 || a==b){
        return b;
    }
    if(a>=b){
        return getGcd(a%b, b);
    }
    return getGcd(b, a);
}

int main()
{
    
    int n, k, a, max_num, gcd;
    
    scanf("%d", &n);
    scanf("%d", &k);

    gcd = 0;
	max_num = 0;
    for(int i=0;i<n;i++){
        scanf("%d", &a);
        gcd = getGcd(gcd, a);
        if(max_num<=a){
			max_num = a;
		}
    }
	
	//Can we get the number k by performing subtractions with the n numbers
	if(k%gcd == 0 & gcd>0 & max_num >= k){
		printf("POSSIBLE");	
	}
	else{
		printf("IMPOSSIBLE");
	}
    return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
import sys
from itertools import chain
import numpy as np

# from itertools import combinations as comb
# form bisect import bisect_left, bisect_right, insort_left, insort_right
# from collections import Counter


def solve(N: int, A: "List[int]"):
    check = np.zeros(max(A) + 1, dtype=np.uint8)
    for ai in A:
        if check[ai] == 0:
            check[ai::ai] += 1
        else:
            check[ai] = 2

    answer = 0
    for ai in A:
        if check[ai] == 1:
            answer += 1

    return answer


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    # N, A = map(int, line.split())
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    answer = solve(N, A)
    print(answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 50364
#include <bits/stdc++.h>
 
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;++i)
#define rap(i,n,N) for(int i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define piii pair<int,pii>
#define piiii pair<pii,pll>
#define psi pair<string,int>
#define endl '\n'
const int MAX = 1e3+5;
const ll MAX2 = 11;
const ll MOD = 1010205047;
const ll MOD2 = 1000005329;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 200;

ll n,nw,sm;
string ans;
 
int main(){
//	cout<<fixed<<setprecision(10);
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n;
    nw = 1;
    while(nw*26<n)nw*=26, n-= nw;
    --n;
    while(nw)ans.pb(n/nw+'a'), n-= n/nw*nw, nw/=26;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
int main(void)
{
 int a,b,c,x;
 scanf("%d",&a);
 scanf("%d",&b);
 scanf("%d",&c);
 if(a > b){
  x = a;
  a = b;
  b = x;
 }
 if(b > c){
  x = b;
  b = c;
  c = x;
 }
 if(a > b){
  x = a;
  a = b;
  b = x;
 }
 printf("%d %d %d\n",a,b,c);
 return 0;
}
  

Measured memory_bytes: 596
const config = {
    input: '/dev/stdin',
    newline: '\n'
};

const line = require('fs').readFileSync(config.input, 'utf-8').split(config.newline);

const data = {
    pond : [],
    stack : []
};

const results = line[0].split('').reduce((acc, x, i) => {
    if (x === '\\') {
        acc.stack.push(i);
    } else if (x === '/' && acc.stack.length > 0) {
        const k = acc.stack.pop();
        const hd = acc.pond.filter(xs => xs[0] >= k);
        const tl = acc.pond.filter(xs => xs[0] < k);

        const sum = [k, hd.map(xs => xs[1]).reduce((acc, x) => acc + x, 0) + (i - k)];
        tl.push(sum);
        acc.pond = tl;
    }

    return acc;
}, data);

const sum = results.pond.reduce((acc, x) => acc + x[1], 0);
const l = results.pond.length;

console.log(sum);
console.log(`${l}${l > 0 ? ' ' + results.pond.map(x => x[1].toString()).join(' ') : ''}`);



Measured memory_bytes: 25404
#include<bits/stdc++.h>
#define ll      long long
#define pii     pair<int, int>
#define f       first
#define s       second
#define read	freopen("input.txt", "r", stdin)
#define write	freopen("output.txt", "w", stdout)
#define mx      5e12

using namespace std;
ll dp[3010][3010];
int main()
{
    string s, t, ans;
    cin>>s;
    cin>>t;

    int n = s.size(), m = t.size();
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i-1] == t[j-1]){
                dp[i][j] = dp[i-1][j-1] + 1;
            }
            else{
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }

//    cout<<dp[n][m];

    for(int i=n, j=m; i>0 && j>0;){
        if(dp[i][j]!=dp[i-1][j] && dp[i][j]!=dp[i][j-1]){
            ans = s[i-1] + ans;
            i--;
            j--;
        }
        else if(dp[i][j] == dp[i][j-1]){
            j--;
        }
        else
            i--;
    }

    cout<<ans;
}




Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}




long mod = 1000000007;
/* C++の構造体 メンバがpublicなclass */
typedef struct mint
{
    ll x;
    mint(ll x = 0) : x(x % mod) {} //コンストラクタ
    /* 演算子オーバーロード */
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += 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
    {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const
    {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const
    {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll 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
    {
        mint res(*this);
        return res /= a;
    }
} mint_t;

ll intpow(mint_t m, int n)
{
    if (n == 0) return 1;
    mint_t ans(1);
    while (n >= 1)
    {
        if ((n % 2) == 0){
            m *= m.x;
            n /= 2;
        }else {
            ans *= m.x;
            n -= 1;
        }
    }
    return ans.x;
}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


int main()
{
    int n;
    cin >> n;
    vector<int> a;
    rep(i, n){ int tmp; cin >> tmp; a.push_back(tmp);}
    sort(a.begin(), a.end());

    bool isok = true;
    if (n%2 == 0){
        //113355
        rep(i, n){
            if (a[i] != ((i/2)*2 + 1)){
                isok = false;
            }
        }
    } else {
        //02244
        rep(i, n){
            if (a[i] != ((i+1)/2)*2){
                isok = false;
            }
        }
    }
    mint x(2);
    if (isok) cout << x.pow(n/2).x << endl;
    else cout << 0 << endl;
}




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

int a[2][110];
int warp[2][110];

int dist[2][110];
const int INF = 1 << 25;

struct S {
	int b, h, d;
};

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

	int n;
	while(cin >> n, n) {
		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < n; j++) {
				cin >> a[i][j];
			}
		}

		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < n; j++) {
				warp[i][j] = j;
				if(a[i][j] == 1) {
					int c = j;
					while(c + 1 < n && a[i][c + 1] == 1) c++;
					warp[i][j] = c;
				}
				if(a[i][j] == 2) {
					int c = j;
					while(c > 0 && a[i][c] == 2) c--;
					warp[i][j] = c;
				}
			}
		}

		queue<S> q;
		q.push({ 0, warp[0][0], 0 });
		q.push({ 1, warp[1][0], 0 });

		fill((int*)begin(dist), (int*)end(dist), INF);
		dist[0][warp[0][0]] = dist[1][warp[1][0]] = 0;

		while(q.size()) {
			int b = q.front().b, h = q.front().h, d = q.front().d;
			q.pop();
			if(dist[b][h] < d) continue;
			for(int x = 0; x <= 2 && h + x < n; x++) {
				int nb = 1 - b;
				int nh = warp[nb][h + x];
				if(dist[nb][nh] > d + 1) {
					dist[nb][nh] = d + 1;
					q.push({ nb, nh, d + 1 });
				}
			}
		}

		int ans = INF;
		ans = min({ ans, dist[0][n - 1], dist[1][n - 1] });

		if(ans == INF) {
			cout << "NA" << endl;
		}
		else {
			cout << ans << endl;
		}
	}
}

Measured memory_bytes: 3144
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();

        if (input[2] >= input[0] && input[2] <= input[1])
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}
// End of template code!
int main() 
{
    buff();
    pii s, t;
    int k;
    cin >> s.first >> s.second;
    cin >> t.first >> t.second;
    cin >> k;
    int delta = (t.first * 60 + t.second) - (s.first * 60 + s.second);
    cout << delta - k << '\n';
    return 0;
}



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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> product(N);
  int sum = 0;
  for(int i=0; i<N; i++){
    int a;
    cin >> a;
    product.at(i)=a;
    sum+=a;
  }
  int count = 0;
  for(int i=0; i<N; i++){
    if(product.at(i) > (sum-1)/(4*M)){
      count++;
    }
    else{
      continue;
    }
  }
  if(count>=M){
    cout << "Yes" << endl;
  }
  if(count<M){
    cout << "No" << endl;
  }
}


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

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

    int sum = 0;
    int t = N;
    while (t > 0) {
        sum += (t % 10);
        t /= 10;
    }

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

Measured memory_bytes: 256
a=list(map(int,input().split()))
x3= (-1)*a[3]+a[2]+a[1]
y3= (-1)*a[0]+a[2]+a[3]
x4= (-1)*a[3]+a[0]+a[1]
y4= (-1)*a[0]+a[1]+a[2]
print(x3,y3,x4,y4)

Measured memory_bytes: 3060
// Vicfred
// https://atcoder.jp/contests/abc152/tasks/abc152_a
// simulation
import std.stdio;

void main() {
    int n, m;
    readf("%s %s\n", &n, &m);

    if(n == m) {
        writefln("%s", "Yes");
    } else {
        writefln("%s", "No");
    }
}



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

int main () {
	int n,k,i;
	cin >> n >> k;
	int a[n];
	for (i=0;i<n;++i) {
		cin >> a[i];
	}
	sort(a,a+n);
	int min=a[k-1]-a[0];
	for (i=1;i<=n-k;++i) {
		if (min>a[i+k-1]-a[i]) min=a[i+k-1]-a[i];
	}
	cout << min << endl;
}

Measured memory_bytes: 640
def partition(A,p,r):#A[p]〜A[r-1]までのリストをpartitionする
    x=A[r-1]
    i=p-1
    for j in range(p,r-1):
        if(A[j] <= x):
            i+=1
            A[j],A[i]=A[i],A[j]
    A[i+1],A[r-1]=A[r-1],A[i+1]
    return i+1


n=int(input())
data=list(map(int,input().split()))

partition_ind=partition(data,0,n)


data=list(map(str,data))
data[partition_ind]="["+data[partition_ind]+"]"
print(" ".join(data))


Measured memory_bytes: 16388
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
struct node{
	ll a;
	ll b;
}no[maxn];
int cmp(node a,node b)
{
	return a.a<b.a;	
}
int main()
{
	ll n,m;
	cin>>n>>m;
	ll temp=m;
	for(int i=1;i<=n;i++)
		cin>>no[i].a>>no[i].b;
	sort(no+1,no+1+n,cmp);
	ll sum=0,Count=0;
	for(int i=1;i<=n;i++)
	{
		if(Count+no[i].b<=m)
		{
			Count+=no[i].b;
			sum+=no[i].b*no[i].a;
		}
		else
		{
			sum+=(m-Count)*no[i].a;
			break;
		}
	}
	cout<<sum<<endl;
	return 0;
}

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

using namespace std;

int main() {

	int n;
	cin >> n;
	
	int x;
	int counter = 0;
	for (int i = 0; i < n; i++) {
		cin >> x;
		int ccounter = 0;
		for (int j = 1; j <= int(sqrt(x)); j++) {
			if (x%j == 0) { ccounter++;  }
		}
		if (ccounter == 1) { counter++; }
	}
	cout << counter << endl;
}


Measured memory_bytes: 3084
import std.algorithm, std.conv, std.range, std.stdio, std.string;

const mod = 10 ^^ 9 + 7;
alias mint = FactorRing!mod;

void main()
{
  auto rd = readln.split.to!(int[]), n = rd[0], m = rd[1];
  if (n < m) swap(n, m);

  if (n - m > 1) {
    writeln(0);
    return;
  }

  auto fm = mint(1);
  foreach (i; 1..m+1) fm *= i;

  auto fn = mint(1);
  foreach (i; 1..n+1) fn *= i;

  writeln(fm*fn*(n == m ? 2 : 1));
}

struct FactorRing(int m, bool pos = false)
{
  version(BigEndian) {
    union { long vl; struct { int vi2; int vi; } }
  } else {
    union { long vl; int vi; }
  }

  @property int toInt() { return vi; }
  alias toInt this;

  this(int v) { vi = v; }
  this(int v, bool runMod) { vi = runMod ? mod(v) : v; }
  this(long v) { vi = mod(v); }

  ref FactorRing!(m, pos) opAssign(int v) { vi = v; return this; }

  pure auto mod(int v) const
  {
    static if (pos) return v % m;
    else return (v % m + m) % m;
  }

  pure auto mod(long v) const
  {
    static if (pos) return cast(int)(v % m);
    else return cast(int)((v % m + m) % m);
  }

  static if (m < int.max / 2) {
    pure auto opBinary(string op: "+")(int rhs) const { return FactorRing!(m, pos)(mod(vi + rhs)); }
    pure auto opBinary(string op: "-")(int rhs) const { return FactorRing!(m, pos)(mod(vi - rhs)); }
  } else {
    pure auto opBinary(string op: "+")(int rhs) const { return FactorRing!(m, pos)(mod(vl + rhs)); }
    pure auto opBinary(string op: "-")(int rhs) const { return FactorRing!(m, pos)(mod(vl - rhs)); }
  }
  pure auto opBinary(string op: "*")(int rhs) const { return FactorRing!(m, pos)(mod(vl * rhs)); }

  pure auto opBinary(string op)(FactorRing!(m, pos) rhs) const
    if (op == "+" || op == "-" || op == "*") { return opBinary!op(rhs.vi); }

  static if (m < int.max / 2) {
    auto opOpAssign(string op: "+")(int rhs) { vi = mod(vi + rhs); }
    auto opOpAssign(string op: "-")(int rhs) { vi = mod(vi - rhs); }
  } else {
    auto opOpAssign(string op: "+")(int rhs) { vi = mod(vl + rhs); }
    auto opOpAssign(string op: "-")(int rhs) { vi = mod(vl - rhs); }
  }
  auto opOpAssign(string op: "*")(int rhs) { vi = mod(vl * rhs); }

  auto opOpAssign(string op)(FactorRing!(m, pos) rhs)
    if (op == "+" || op == "-" || op == "*") { return opOpAssign!op(rhs.vi); }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

double menseki(double a,double b,double c){
    double s=(a+b+c)/2;
    return(sqrt(s*(s-a)*(s-b)*(s-c)));
}

int waku(double ax,double ay,double bx,double by,double cx,double cy,double px,double py){
    if((ax==cx&&ay==cy)||(bx==cx&&by==cy))
        return(1);
    else if(fmin(ax,bx)<=px&&px<=fmax(ax,bx)&&fmin(ay,by)<=py&&py<=fmax(ay,by)&&(py-ay)==((by-ay)/(bx-ax))*(px-ax))
        return(1);
    else if(fmin(cx,bx)<=px&&px<=fmax(cx,bx)&&fmin(cy,by)<=py&&py<=fmax(cy,by)&&(py-by)==((by-cy)/(bx-cx))*(px-bx))
        return(1);
    else if(fmin(ax,cx)<=px&&px<=fmax(ax,cx)&&fmin(ay,cy)<=py&&py<=fmax(ay,cy)&&(py-cy)==((cy-ay)/(cx-ax))*(px-cx))
        return(1);
    return(0);
}

int main(int argc, const char * argv[]) {
    double x1,y1,x2,y2,x3,y3,d12,d23,d31,xp,yp,dp1,dp2,dp3;
    int flag=0;
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
        d12=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
        d23=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
        d31=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
        dp1=sqrt((x1-xp)*(x1-xp)+(y1-yp)*(y1-yp));
        dp2=sqrt((xp-x2)*(xp-x2)+(yp-y2)*(yp-y2));
        dp3=sqrt((x3-xp)*(x3-xp)+(y3-yp)*(y3-yp));
        flag=0;
        
        if(waku(x1,y1,x2,y2,x3,y3,xp,yp)==1){
            flag=1;
        //printf("waku:%d\n",flag);
        }else if(menseki(d12,d23,d31)-(menseki(d12,dp1,dp2)+menseki(d23,dp2,dp3)+menseki(d31,dp3,dp1))<-0.001)
            flag=1;
        //printf("menseki:%d\n",flag);
        //printf("%lf %lf %lf %lf %lf",menseki(d12,d23,d31),menseki(d12,dp1,dp2),menseki(d23,dp2,dp3),menseki(d31,dp3,dp1),menseki(d12,dp1,dp2)+menseki(d23,dp2,dp3)+menseki(d31,dp3,dp1));
        
        if(flag==0)
            printf("YES\n");
        else if(flag==1)
            printf("NO\n");
        
    }
    return 0;
    
}

Measured memory_bytes: 616
N = int(input())
pt, px, py = 0, 0, 0
for _ in range(N):
    ct, cx, cy = map(int, input().split())
    diff_t = ct - pt
    diff_x = cx - px
    diff_y = cy - py

    diff_xy = abs(diff_x+diff_y)
    if diff_xy > diff_t:
        print('No')
        exit()
    if (diff_xy + diff_t) % 2 != 0:
        print('No')
        exit()

    px = cx
    py = cy
    pt = ct

print('Yes')

Measured memory_bytes: 3064
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
const ll  inf=(1e18);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main(){
    int n;
    cin>>n;
     vector<vector<ll>> a(n,vector<ll>(10));
    for(int i=0;i<n;i++)for(int j=0;j<10;j++)cin>>a.at(i).at(j);
    vector<vector<ll>> p(n,vector<ll>(11));
    for(int i=0;i<n;i++)for(int j=0;j<11;j++)cin>>p.at(i).at(j);
    ll tmp=0,res=0,ans=-inf;
    for(int bit=1;bit<(1<<10);bit++){
        tmp=0;
        for(int i=0;i<n;i++){
        for(int j=0;j<10;j++){
            if(bit&(1<<j)){
                res+=a.at(i).at(j);
            }
        }
        tmp+=p.at(i).at(res);
        res=0;
        }
          chmax(ans,tmp);
    }
    cout<<ans<<endl;
}

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

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

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);


int main(){
  ll x,y;
  cin >> x >> y;
  cout << (abs(x-y)<=1 ? "Brown" : "Alice") << endl;
}



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

using namespace std;
typedef pair<int,int> pii;
typedef long long int lli;

int main()
{
	int a, b, c;
	scanf("%d %d %d",&a,&b,&c);

	swap( a , b );
	swap( a , c );

	printf("%d %d %d\n",a,b,c);
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        while(true){
            int h = sc.nextInt(), w = sc.nextInt();
            
            if(h == 0 && w == 0)  break; 
            
            for (int i = 0; i < h; i++){
                
                if(i % 2 == 0){
                    for(int n = 0; n < w; n++){
                        if(n % 2 == 0){
                            System.out.print("#");
                        }else{
                            System.out.print(".");
                        }
                    }
                }else{
                    for(int n = 0; n < w; n++){
                        if(n % 2 == 0){
                            System.out.print(".");
                        }else{
                            System.out.print("#");
                        }
                    }
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;
const int INF = 1e9;
int n;

int main() {
  cin >> n;
  vector<int> a(n + 1);
  vector<int> b(n + 1);
  rep(i, n) cin >> a[i + 1];
  int cnt = 0;

  for (int i = n; i >= 1; i--) {
    int sum = 0;
    for (int j = i + i; j <= n; j += i) {
      sum ^= b[j];
    }
    b[i] = sum ^ a[i];
  }

  vector<int> ans;
  for (int i = 1; i <= n; ++i) {
    if (b[i]) ans.push_back(i);
  }
  cout << ans.size() << endl;
  rep(i, ans.size()) {
    printf("%d%c", ans[i], i + 1 == ans.size() ? '\n' : ' ');
  }
  return 0;
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937 mt32(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt32);
}
/*--------Library Zone!--------*/

int dp[3005][3005];
string s,t;
signed main() {
	cin>>s>>t;
	rep(i,s.size()){
		rep(j,t.size()){
			if(s[i]==t[j]){
				chmax(dp[i+1][j+1],dp[i][j]+1);
			}else {
				chmax(dp[i+1][j+1],max(dp[i+1][j],dp[i][j+1]));
			}
		}
	}
	string ans;
	int now_x=s.size(),now_y=t.size();
	while(now_x&&now_y){
		if(dp[now_x-1][now_y]==dp[now_x][now_y])now_x--;
		else if(dp[now_x][now_y-1]==dp[now_x][now_y])now_y--;
		else {
			ans+=s[now_x-1];
			now_x--;now_y--;
		}
	}
	reverse(all(ans));
	cout<<ans<<endl;
}


Measured memory_bytes: 70656
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

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

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using ul = unsigned long long;
using Bint = mp::cpp_int;
ll mod = 1000000007;

int main() {
source:
    ll n, m;
    cin >> n >> m;
    vector<vector<ll>> g(n);
    rep(i, m) {
        ll u, v;
        cin >> u >> v;
        g[u - 1].push_back(v - 1);
    }

    ll s, t;
    cin >> s >> t;
    vector<vector<bool>> judge(n, vector<bool>(3, false));
    s--;
    t--;
    judge[s][0] = true;

    queue<pair<ll, ll>> q;
    q.push(make_pair(s, 0));
    while (!q.empty()) {
        auto now = q.front();
        q.pop();
        for (ll next_num : g[now.first]) {
            ll next_length = now.second + 1;
            int next_mod = next_length % 3;
            if (judge[next_num][next_mod]) {
                continue;
            } else {
                judge[next_num][next_mod] = true;
                if (next_num == t && next_mod == 0) {
                    cout << next_length / 3 << endl;
                    return 0;
                }
                q.push(make_pair(next_num, next_length));
            }
        }
    }
    cout << -1 << endl;

    return 0;
}



Measured memory_bytes: 12928
#include <stdio.h>

int main(void) {
	int count,max;
	int maxseisuu;
	int minseisuu;
	int i,j;
	char seisuu[10],temp;
	scanf("%d",&max);
	for(count=0;count<max;count++) {
		scanf("%s",seisuu);
		for(i=7;i>0;i--) {
			for(j=0;j<i;j++) {
				if(seisuu[j]>seisuu[j+1]) {
					temp=seisuu[j];
					seisuu[j]=seisuu[j+1];
					seisuu[j+1]=temp;
				}
			}
		}
		maxseisuu=0;minseisuu=0;
		for(i=0;i<8;i++) {
			minseisuu=minseisuu*10+seisuu[i]-'0';
			maxseisuu=maxseisuu*10+seisuu[7-i]-'0';
		}
		printf("%d\n",maxseisuu-minseisuu);
	}
	return 0;
}

Measured memory_bytes: 0
#C
#len(A) = n
#len(b) = n-1
#b[i] >= max(a[i],a[i+1])
#b[1] = max(a[1], a[2])
#b[i] = max(a[i],a[i+1])
#b[i+1] = max(a[i+1], a[i+2])
n = int(input())
b = list(map(int, input().split()))
l = [b[0]]
for i in range(0,n-2):
    l.append(min(b[i], b[i+1]))
l.append(b[-1])
print(sum(l))


#0 153 10 160 23
#0 0 10 10 23 23
#0 153 10 10 23
#0 0 10 10 10 23
#?,0,  153,10,160,23
#?,0,  10, 10,160,23
#0,0,  10, 10,10 ,23


Measured memory_bytes: 2940
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    
    const N    = ~~arg[0].split(" ")[0];
    const v    = arg[1].split(" ").map(n=>~~n);
    
    let even = [];
    let odd  = [];
    
    for(let i=0; i<N; i++) {
        const h = v[i];
        let a = (i % 2 ? odd : even)[h];
        
        a = a || {val:h, count: 0};
        a.count++;
        
        if(i % 2) {
            odd[h] = a;
        } else {
            even[h] = a;
        }
    }
    
    even = even.sort((a,b)=>a.count-b.count).reverse().filter(a=>a);
    odd  = odd.sort((a,b)=>a.count-b.count).reverse().filter(a=>a);
  
    if(even[0].val!=odd[0].val){
        console.log(N - even[0].count - odd[0].count);
        return;
    }
    
    // 全て同じ値のとき
    if(!even[1] && !even[2]){
        console.log(N/2);
        return;
    }
    
    // 偶数番目のみ全て同じ値のとき
    if(!even[1]){
        console.log(N - even[0].count - odd[1].count);
        return;
    }
    
    // 奇数番目のみ全て同じ値のとき
    if(!odd[1]){
        console.log(N - even[1].count - odd[0].count);
        return;
    }
    
    console.log(Math.min(
        N - even[0].count - odd[1].count,
        N - even[1].count - odd[0].count
    ));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

int main(){
    
    int N;
    std::cin >> N;
    
    std::vector< std::vector< std::vector< int > > >  vec;
    vec.resize(4);
    for(int i=0; i<vec.size(); i++){ 
        vec[i].resize(3); 
        for(int j=0; j<vec[i].size(); j++){
            vec[i][j].resize(10); 
            for(int k=0; k<vec[i][j].size(); k++){
                vec[i][j][k] = 0;
            }
        }
    }
    
    int b, f, r, v = 0;
    while(N--){
        std::cin >> b >> f >> r >> v;
        vec[b-1][f-1][r-1] += v;
    }
    
    for(int i=0; i<vec.size(); i++){
        if(i!=0) std::cout << "####################" << "\n";
        for(const auto x : vec[i]){
            for(const auto y : x){
                std::cout << " " << y;
            }
            std::cout << std::endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{
    speed_up;
    int n, cnt = 0, st = 0, mx, i, j, mx2;
    cin>>n;
    int a[n];
    int b[n] = {};
    for(i = 0; i<n; i++)
    {
        cin>>a[i];
    }
    mx = *max_element(a, a+n);
    //cout<<mx<<endl;
    //cout<<endl;
    j = 0;
   while(j<=mx)
   {st = 0;
    for(i = 0; i<n; i++)
    {
        if(b[i]<a[i])
        {
            b[i]++;
            if(st == 0)
            {
                cnt++;
                st = 1;
            }
        }
        else if(b[i]>=a[i]) st = 0;
    }
    //cout<<cnt<<endl<<endl;
    j++;
    //for(i = 0; i<n; i++) cout<<b[i]<<endl;
   //cout<<endl;
   //cout<<cnt<<endl;
   //cout<<endl;
   }

   cout<<cnt<<endl;




  return 0;
}



Measured memory_bytes: 3636
#!/usr/bin/env python3
import sys


def solve(N: int, S: str):
    ret = 0
    for i in range(1, N):
        l = set(S[:i])
        r = set(S[i:])
        count = 0
        for c in l:
            if c in r:
                count += 1
        ret = max(ret, count)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
n,a,b=map(int,input().split())
count=0
for j in range(1,n+1):
  sumn=0
  J=str(j)
  for i in range(0,len(J)):
    sumn+=int(J[i])
    #print(sumn)
  if a<=sumn<=b:
    count+=j
print(count)

Measured memory_bytes: 3060
# sys.stdin.readlineの練習
# __main__の練習
def main():
    import sys
    input = sys.stdin.readline
    n = int(input())
    a = list(map(int, input().split()))
    print(1.0/sum(list(map(lambda x: 1.0 / x, a))))

if __name__ == '__main__':
    main()



Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(int i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 5206


signed main(){
	int a,b,c,d,k,t=1;
	cin>>t>>k;
	vector<int> v;
	For(i,0,t){
		cin>>a;	v.pb(a);
	}
	int dp[t];
	if(t==2)
		cout<<v[1]-v[0];
	else{
		dp[0]=0;
		dp[1]=abs(v[1]-v[0]);
		For(j,2,t){
			d=INF;
			For(op,1,k+1){
				if(j-op<0)
					break;
				d=min(dp[j-op]+abs(v[j]-v[j-op]),d);
			}
			dp[j]=d;
		}
		cout<<dp[t-1];
	}

}

Measured memory_bytes: 1908
#include<iostream>
#include<string>
#include<list>

using namespace std;

int main(){
    string s;
    list<char> l;
    list<char>::iterator itr;
    cin >> s;
    int i;
    for (i=0; i<s.length(); i++){
        if (s[i] == '0'){
            l.push_back(s[i]);
        }else if (s[i] == '1'){
            l.push_back(s[i]);
        }else if (s[i] == 'B' && !l.empty()){
            l.pop_back();
        }
    }

    for (itr=l.begin(); itr!=l.end(); itr++){
        cout << *itr;
    }
    return 0;
}

Measured memory_bytes: 3588
import java.util.*;
import java.math.*;
public class Main {
    static final int MOD = 1_000_000_007; // 10^9+7
    //static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ary = new int[n];
        for(int i = 0;i < n;i++){
            ary[i] = sc.nextInt();
        }
        Arrays.sort(ary);
        System.out.println(ary[n/2]-ary[n/2-1]);
    }       
}






Measured memory_bytes: 51148
#include <iostream>
#include <utility>
#include <algorithm>

#define int long long

using namespace std;

int32_t main () {
    
    int N, M;
    
    int ans = 0;
    
    cin >> N >> M;
    
    pair <int, int> store[N];
    
    for (int i=0; i<N; i++) {
        int x, y;
        cin >> x >> y;
        store[i].first = x;
        store[i].second = y;
    }
    
    sort(store, store+sizeof(store)/sizeof(store[0]));
    
    int x = 0;
    
    while (M-->0) {
        if (store[x].second>0) {
            store[x].second--;
            ans+=store[x].first;
        } else {
            x++;
            M++;
        }
    }
    
    cout << ans;
    
    return 0;
    
}


Measured memory_bytes: 1792
def main():
    N, K = input().split(" ")

    D = list(input().split(" "))
    use_num = list(set([str(i) for i in range(10)]) - set(D))

    N = int(N)
    i = N
    while True:

        if not set(str(i)) <= set(use_num) and i >= N:
            i += 1
        else:
            print(i)
            break

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>

namespace IO {
    template <typename _T>
    inline bool read (_T& x) {
        x = 0;
        _T y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return false;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        x *= y;
        return true;
    }

    template <typename _T>
    inline _T input () {
        _T x = 0, y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return 0;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        x *= y;
        return x;
    }
};
using namespace IO;

#define reg register
#define MAX_N 300007
#define FIN(s) freopen(s, "r", stdin)
#define FOUT(s) freopen(s, "w", stdout)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, l, r) for(int i = l; i <= r; ++i)
#define lep(i, l, r) for(int i = l; i < r; ++i)
#define irep(i, r, l) for(int i = r; i >= l; --i)
#define ilep(i, r, l) for(int i = r; i > l; --i)
typedef long long ll;

int N, M, rt[MAX_N];
std::vector<int> L[MAX_N];

struct node { int ls, rs, sum; };

struct chTree {
    int siz;
    node t[MAX_N * 20];
    
    chTree () : siz(0) {}

    void build (int &x, int y, int l, int r, int pos) {
        t[x = ++siz] = t[y];
        t[x].sum++;
        if (l == r) return;
        int mid = l + r >> 1;
        if (pos <= mid) build(t[x].ls, t[y].ls, l, mid, pos);
        else build(t[x].rs, t[y].rs, mid + 1, r, pos);
    }

    int query (int x, int y, int l, int r, int ql, int qr) {
        // printf("%d %d %d %d %d %d\n", l, r, ql, qr, t[x].sum, t[y].sum);
        if (ql <= l && r <= qr) return t[y].sum - t[x].sum;
        int mid = l + r >> 1, ans = 0;
        if (ql <= mid) ans += query(t[x].ls, t[y].ls, l, mid, ql, qr);
        if (mid < qr) ans += query(t[x].rs, t[y].rs, mid + 1, r, ql, qr);
        return ans;
    }
}tr;

inline void init () {
    rep (i, 1, M) {
        rt[i] = rt[i - 1];
        for (int l: L[i])
            tr.build(rt[i], rt[i], 1, M, l);
    }
}

inline int work (int d) {
    int now = d * 2, res = 0;
    for (; now <= M; now += d) {
        res += tr.query(rt[now - d - 1], rt[now - 1], 1, M, 1, now - d);
    }
    now -= d;
    res += tr.query(rt[now - 1], rt[M], 1, M, 1, now);
    return res;
}

inline void solve () {
    rep (i, 1, M) printf("%d\n", work(i));
}

int main () {
#ifdef LOCAL
    FIN("in");
#endif
    read(N), read(M);
    int l, r;
    rep (i, 1, N) {
        read(l), read(r);
        L[r].push_back(l);
    }
    init();
    solve();
    return 0;
}


Measured memory_bytes: 75776