akhauriyash/Code-Regression huggingface dataset:
using System;
class a
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');

                int n = int.Parse(str[0]);
        int d = int.Parse(str[1]);

        int[,] x = new int[n, d];


        for (int i = 0; i < n; i++)
        {
            string[] str0 = Console.ReadLine().Split(' ');
            for (int j = 0; j < d; j++)
            {
                x[i, j] = int.Parse(str0[j]);
               
            }
        }
        int count1 = 0;
        for (int i = 0; i < n-1; i++)
        {
            for (int j = i + 1; j < n; j++)
            {
                int count = 0;
                for (int k = 0; k < d; k++)
                {
                    count += (x[i, k] - x[j, k]) * (x[i, k] - x[j, k]);
                }

                for (int l = 1; l < 130; l++)
                {
                    if (count == l * l)
                    {
                        count1++;
                    }
                }
            }

        }
        Console.WriteLine(count1);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>

int L[2000];
int n;

int main()
{
    std::ios_base::sync_with_stdio(0);
    int n;
    int64_t result = 0;
    std::cin >> n;
    for (int i=0;i<n;++i) std::cin >> L[i];
    std::sort(L, L+n);
    for (int i=2;i<n;++i)
    {
        int l=0;
        int r=i;
        while (l < r)
        {
            --r;
            while (l < r && L[l]+L[r] <= L[i]) ++l;
            if (l < r) result += r-l;
        }
    }
    std::cout << result;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7;
ll GCD(ll x, ll y) {if (x % y == 0) return y;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x * y / GCD(x, y);}

int main(){
  string s; cin>>s; ll t=0;
  for(int i=0; i<s.size()-1;i++){
  if(s[i]==s[i+1]){
    t++; i+=2; 
  }
  }
  
cout<<s.size()-t<<endl;
  
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d", &tmp);v.push_back(tmp);}}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  llong x, y, z, k;
  cin >> x >> y >> z >> k;
      
  vector<llong> a(x), b(y), c(z);
  REP(i,x){
    cin >> a[i];
  }
  REP(i,y){
    cin >> b[i];
  }
  REP(i,z){
    cin >> c[i];
  }

  vector<llong> aa;
  REP(i,x){
    REP(j,y){
      aa.pb(a[i]+b[j]);
    }
  }
  sort(ALL(aa), greater<llong>());
  vector<llong> bb;
  REP(i,min(x*y,k)){
    bb.pb(aa[i]);
  }

  vector<llong> ans;
  REP(i,bb.size()){
    REP(j,z){
      ans.pb(bb[i]+c[j]);
    }
  }
  
  sort(ALL(ans), greater<llong>());
  REP(i,k){
    cout << ans[i] << endl;
  }
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

int main() {
    int n;
    cin >> n;
    set<char> bag;
    rep(i, n) {
        char s;
        cin >> s;
        bag.insert(s);
    }

    cout << (bag.size() == 3 ? "Three" : "Four") << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll A,B,C,D;
ll mo=1000000007;

bool cmp(pair<ll,ll>& L,pair<ll,ll>& R) {
	return L.first*R.second < L.second*R.first;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B>>C>>D;
	
	vector<pair<ll,ll>> V;
	for(i=0;i<=D+1;i++) {
		if(i&&i<A) V.push_back({i,A});
		if(A-1-i>0) V.push_back({A-1-i,A});
		if(i&&i<B) V.push_back({i,B});
		if(B-1-i>0) V.push_back({B-1-i,B});
		if(i&&i<C) V.push_back({i,C});
		if(C-1-i>0) V.push_back({C-1-i,C});
	}
	sort(ALL(V),cmp);
	V.erase(unique(ALL(V)),V.end());
	
	ll ret=min(D+1,A)*min(D+1,B)%mo*min(D+1,C)%mo;
	ll a[3]={};
	FORR(v,V) {
		ll b[3]={a[0],a[1],a[2]};
		FOR(i,3) 
		a[0]=v.first*A/v.second;
		a[1]=v.first*B/v.second;
		a[2]=v.first*C/v.second;
		
		ll dx=min(A-1,b[0]+D)-max(0LL,b[0]-D)+1;
		ll dy=min(B-1,b[1]+D)-max(0LL,b[1]-D)+1;
		ll dz=min(C-1,b[2]+D)-max(0LL,b[2]-D)+1;
		
		if(a[0]+D<A) ret+=(a[0]-b[0])*dy%mo*dz%mo;
		if(a[1]+D<B) ret+=(a[1]-b[1])*dx%mo*dz%mo;
		if(a[2]+D<C) ret+=(a[2]-b[2])*dy%mo*dx%mo;
		ret%=mo;
	}
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 10604
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int main(){
    int n,k,s;
    cin >> n >> k >> s;
    vector<int> ans(n);
    if(s<(int)1e9){
        rep(i,k){
            ans[i] = s;
        }
        for(int i=k;i<n;i++){
            ans[i] = s+1;
        }
    }else{
        rep(i,k){
            ans[i] = s;
        }
        for(int i=k;i<n;i++){
            ans[i] = 1;
        }
    }
    rep(i,n) printf("%d%c",ans[i],i==n-1?'\n':' ');
    return 0;
}

Measured memory_bytes: 1664
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll L_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;
// const double PI = M_PI;

int N, W;
vector<int> v, w;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> W;
  v.resize(N);
  w.resize(N);
  for (int i = 0; i < N; i++) {
    int vi, wi;
    cin >> vi >> wi;
    v[i] = vi;
    w[i] = wi;
  }

  int dp[W + 1];
  fill(dp, dp + W + 1, -1);
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= W; j++) {
      if (dp[j] != -1 && j + w[i] <= W) {
        dp[j + w[i]] = max(dp[j + w[i]], dp[j] + v[i]);
      }
    }
  }

  int ans = 0;
  for (int i = 0; i <= W; i++) {
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int K; cin >> K;
    string S; cin >> S;
    if (S.size() <= K) {
        cout << S << endl;
    } else {
        cout << S.substr(0, K) << "...\n";
    }
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
string s[60];
int h,w,l,x,y;
char t;
bool used[60][60][200],vis[60][60];
void dig(){
  int sum=0;
  while(1){
    if(used[y][x][t]){
      cout<<(-1)<<endl;
      return;
    }
    if(!vis[y][x])sum++;
    used[y][x][t]=1;
    vis[y][x]=1;
    if(s[y][x]=='G')break;
    if(t=='^'){
      if(s[y-1][x]=='#')t='<';
      else if(s[y-1][x+1]!='#')t='>',y--;
      else y--;
    }
    else if(t=='>'){
      if(s[y][x+1]=='#')t='^';
      else if(s[y+1][x+1]!='#')t='v',x++;
      else x++;
    }
    else if(t=='v'){
      if(s[y+1][x]=='#')t='>';
      else if(s[y+1][x-1]!='#')t='<',y++;
      else y++;
    }
    else{
      if(s[y][x-1]=='#')t='v';
      else if(s[y-1][x-1]!='#')t='^',x--;
      else x--;
    }
  }
  cout<<sum<<endl;
}
main(){
  cin>>h>>w;
  r(i,h)cin>>s[i+1];
  r(i,w+2)s[0]+='#',s[h+1]+='#';
  r(i,h)s[i+1]='#'+s[i+1]+'#';
  r(i,h+2)r(j,w+2)if(s[i][j]!='#'&&s[i][j]!='.'&&s[i][j]!='G')x=j,y=i,t=s[i][j];
  dig();
}

Measured memory_bytes: 3808
#[allow(non_snake_case)]

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let A = iter.next().unwrap().parse::<isize>().unwrap();
    let B = iter.next().unwrap().parse::<isize>().unwrap();
    let C = iter.next().unwrap().parse::<isize>().unwrap();

    let mut list = vec![A, B, C];
    list.sort();
    for item in &list {
        print!("{}", item);
        if item != list.last().unwrap() {
            print!(" ");
        }
    }
    println!("");
}



Measured memory_bytes: 5024
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    char c;
    cin>>c;
    if(c == 'A') cout<<"T\n";
    if(c == 'T') cout<<"A\n";
    if(c == 'C') cout<<"G\n";
    if(c == 'G') cout<<"C\n";
    return 0;
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 

ll mod = 1e9 + 7;

#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()
// cout<<endl;


int main()
{
	fastio();
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b+c >= 22)
		cout<<"bust\n";
	else
		cout<<"win\n";
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

template<class T> inline bool chmin(T& a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}
vector<bool> seen;
void dfs(const Graph &G, int v){
    seen[v] = true; // vを訪問済みにする
    
    for(auto next_v: G[v]){
        if(seen[next_v]) continue; // next_vが探索済みならスルー
        dfs(G, next_v); // 再帰的に探索
    }
}

int main(){

    ll a, b, k;
    cin >> a >> b >> k;

    if(a <= k){
        k -= a;
        a = 0;
        b -= k;
    }
    else{
        a -= k;
    }
    if(b < 0) b = 0;
    cout << a << " " << b << 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);
        int n = Integer.parseInt(sc.next());
        int l = Integer.parseInt(sc.next());
        int data[] = new int[n];
        int sum = 0;
        int min = Integer.MAX_VALUE;
        for(int i = 0;i<n;i++){
            data[i] = l + i;
            sum += data[i];
            if(Math.abs(min) > Math.abs(data[i])){
                min = data[i];
            }
        }
        System.out.println(sum - min);
    }
}

Measured memory_bytes: 22612
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int w, h, t, a, b, m, res;
pair<int,int> p[200200];

signed main() {
	cin >> w >> h;
	a = w+1, b = h+1;
	rep(i,w) {
		cin >> t;
		p[i] = {t,0};
	}
	rep(i,h) {
		cin >> t;
		p[w+i] = {t,1};
	}
	sort(p,p+w+h);
	while (a && b) {
		res += p[m].first * (p[m].second ? a : b);
		(p[m++].second ? b : a)--;
	}
	cout << res << endl;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,a,b;
    scanf("%lld%lld%lld",&n,&a,&b);
    ll x = a+b;
    ll ans = 0;
    ans += (n/x)*a;
    n %= x;
    if (n <= a) ans += n;
    else ans += a;
    printf("%lld",ans);
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

int main() {
    ll N;
    cin >> N;
    vel p(N);
    rep(i, N) {
        cin >> p[i];
        p[i]--;
    }
    ll cnt = 0;
    rep(i, N ) {
      if(i==N-1 && p[i]==i){
        cnt++ ;
        continue ;
      }
        if (p[i] == i) {
            swap(p[i], p[i + 1]);
            cnt++;
        }
    }
    cout << cnt << endl;
}

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

#define mp make_pair
#define pb push_back
#define x first
#define y second
#define all(a) (a).begin(), (a).end()

template<class A, class B>
void chkmin(A& a, const B& b) {
    if (a > b)
        a = b;
}

template<class A, class B>
void chkmax(A& a, const B& b) {
    if (a < b)
        a = b;
}

int len(int L, int R) {
    return max(0, R - L);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].x >> a[i].y;
        a[i].y++;
    }
    sort(all(a));
    vector<int> suf(n);
    suf[n - 1] = a[n - 1].y;
    for (int i = n - 2; i >= 0; --i)
        suf[i] = min(suf[i + 1], a[i].y);
    int ans = 0, mn = 1e9, mx = -1e9;
    for (int i = 0; i < n - 1; i++) {
        int L1 = a[n - 1].x, L2 = a[i].x;
        int R1 = suf[i + 1], R2 = a[i].y;
        if (i == 0)
            chkmax(ans, len(L1, R1) + len(L2, R2));
        else {
            chkmax(ans, len(L1, R1) + len(L2, min(R2, mn)));
            chkmax(ans, len(L1, min(R1, mn)) + len(L2, R2));
        }
        if (i >= 2) {
            chkmax(ans, len(L1, min(R1, mx)) + len(L2, min(R2, mn)));
            chkmax(ans, len(L1, min(R1, mn)) + len(L2, min(R2, mx)));
        }
        mn = min(mn, a[i].y);
        mx = max(mx, a[i].y);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 4500
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int s[] = new int[n];

		for(int i = 0; i < k; i++ ) {
			int d = sc.nextInt();
			for(int j = 0; j < d; j++) {
				int tmp = sc.nextInt();
				s[tmp - 1] = 1;
			}
		}

		int ans = 0;
		for(int i = 0; i < n; i++) {
			if(s[i] == 0) {
				ans += 1;
			}
		}
		System.out.println(ans);
	}
}


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

import numpy as np

H, W = map(int, input().split())

masu = []
res = []
str1 = '.' * W

for i in range(H):
	str2 = input()
	if str1 != str2:
		masu.append(str2)

l = ['.'] * len(masu)
for i in range(W):
	tmp = [k[i] for k in masu]
	if tmp != l:
		res.append(tmp)

ww = len(res[0])
hh = len(res)
for i in range(ww):
	for j in range(hh):
		print(res[j][i], end='')
	print('')

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

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

int main() {
  int N = 0;
  string S;
  
  cin >> N;
  
  for (int i; i < N; i++){
    cin >> S;
    
    if (S == "Y") {
      cout << "Four" << endl;
      break;
    }
    
    if (i == N - 1) {
      cout << "Three" << endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
  fastIO;
  vector<int> time(5);
  rep(i, 5) cin >> time.at(i);

  int sum = 0, diff = 0;
  for(auto t: time) {
    sum += t;
    int mod = 10 - t % 10;
    if(mod != 10) {
      sum += mod;
      diff = max(diff, mod);
    }
  }

  cout << sum - diff << endl;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    ll ans = 0;
    int pre = a[0];
    for (int i = 1; i < n; ++i) {
        ans += max(0, pre - a[i]);
        pre = max(pre, a[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4028
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <numeric>
#include <functional>
#include <cmath>
#include <cassert>
#include <string>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll MOD = 1000000007;
const int mod = 1000000007;
ll INF = 1LL << 60;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
   for (auto &v : vec)
      is >> v;
   return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec)
{
   os << "[";
   for (auto v : vec)
      os << v << ",";
   os << "]";
   return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &vec)
{
   os << "deq[";
   for (auto v : vec)
      os << v << ",";
   os << "]";
   return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &vec)
{
   os << "{";
   for (auto v : vec)
      os << v << ",";
   os << "}";
   return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &vec)
{
   os << "{";
   for (auto v : vec)
      os << v << ",";
   os << "}";
   return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &vec)
{
   os << "{";
   for (auto v : vec)
      os << v << ",";
   os << "}";
   return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &vec)
{
   os << "{";
   for (auto v : vec)
      os << v << ",";
   os << "}";
   return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{
   os << "(" << pa.first << "," << pa.second << ")";
   return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &mp)
{
   os << "{";
   for (auto v : mp)
      os << v.first << "=>" << v.second << ",";
   os << "}";
   return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp)
{
   os << "{";
   for (auto v : mp)
      os << v.first << "=>" << v.second << ",";
   os << "}";
   return os;
};
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val)
{
   fill((T *)array, (T *)(array + N), val);
}

ll dp[(1LL << 21) + 100],a[30][30];
int solve()
{
   ll n;
   cin >> n;
   for(int i=0; i < n; i++){
      for(int j=0; j < n; j++){
         cin >> a[i][j];
      }
   }
   dp[0] = 1;
   for(int i=0; i < (1 << n); i++){
      int t = __builtin_popcount(i);
      for(int j=0; j < n; j++){
         if(!(i & (1 << j))){
            if(a[t][j]){
               dp[i|1<<j] += dp[i];
               dp[i | 1 << j] %= MOD;
            }
         }
      }
   }

   cout << dp[(1 << n) - 1] << endl;


   return 0;
}
int main()
{
   //cout.precision(10)
   ios::sync_with_stdio(false);
   cin.tie(0);

   solve();
}

Measured memory_bytes: 16640
n = int(input())
numbers = list(map(int, input().split()))

count = 0
for i in range(1, n-1):
  a = numbers[i]
  if (a > numbers[i-1] and a < numbers[i+1]) or (a > numbers[i+1] and a < numbers[i-1]):
    count += 1
    
print(count)

Measured memory_bytes: 3060
a, b = map(int, input().split())
if a < 0 and b < 0:
    if (b-a+1) % 2 == 0:
        print('Positive')
    else:
        print('Negative')
elif (a < 0 and b >= 0) or a == 0:
    print('Zero')
else:
    print('Positive')


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000009
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;





int main()
{
int x,t;
cin>>x>>t;

cout<<max(0,x-t)<<endl;


 return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int f(ll a, ll b){
    int keta1 = 0;
    int keta2 = 0;
    while(a){
        a /= 10;
        keta1++;
    }
    while(b){
        b /= 10;
        keta2++;
    }
    int res = max(keta1, keta2);
    return res;
}

int main(){
    ll n; cin >> n;
    int ans = 1001001001;
    for(ll i = 1; i * i <= n; i++){
        if(n % i == 0){
            ll a = i;
            ll b = n / i;
            ans = min(ans, f(a,b));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define read(x) scanf("%d",&x)
using namespace std;
const int maxn = 1e5 + 10;

int n;
ll a[maxn];
int zero[64], tot;
ll p[64];

void insert(ll x){
	for(int i=0;i<tot;i++){
		if((x>>zero[i])&1){  
			if(!p[i]){
				p[i] = x;
				break;
			}else{
				x^=p[i];
			}
		}
	}
}

int main()
{   
	read(n);
	ll sum = 0;
	tot = 0;
	for(int i=0;i<n;i++) cin>>a[i],sum^=a[i];
	for(int i=60;i>=0;i--) 
		if(!((sum>>i)&1)) zero[tot++] = i;
	for(int i=0;i<n;i++) insert(a[i]);  //构造线性基
	ll res = 0;
	for(int i=0;i<tot;i++){
		if(!((res>>zero[i])&1)) res ^= p[i];
 	}
	cout<<(sum^res)+res<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
 int n,m;
  cin>>n>>m;
  vin a(n);
  rep(i,0,n) cin>>a[i];
  priority_queue<int> pq;
  rep(i,0,n) pq.push(a[i]);
  rep(i,0,m){
    int b=pq.top();  //最高価格
    b/=2;
    pq.pop();
    pq.push(b);
  }
  ll ans=0;
  rep(i,0,n){
   ans+=pq.top(); 
    pq.pop();
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 4260
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+:---test
7 1 3 6 7
.#..#..
---+/
/+:---test
7 1 3 7 6
.#..#..
---+/
/+:---test
15 1 3 15 13
...#.#...#.#...
---+/
/+:---test
6 1 2 6 5
..#...
---+/
/+---test
8 1 2 8 6
...#..#.
---+/

void main(string[] args) {
  long N, A, B, C, D;
  readf(" %d %d %d %d %d ", &N, &A, &B, &C, &D);
  --A; --B; --C; --D;

  const S = readln.chomp;

  auto F(long st, long last) {
    long[] M;
    long l;
    foreach (i, s; S[st..last+1]~'|') {
      if (S[st+l] != s) {
        M ~= (i-l) * (S[st+l] == '#'? -1: 1);
        l  = i;
      }
    }
    return M;
  }

  long ans = F(A, C).all!(x => x >= -1) && F(B, D).all!(x => x >= -1);
  if (D < C) {
    ans = ans && F(B-1, D+1).any!(x => x >= 3);
  }
  (ans? "Yes": "No").writeln;
}


Measured memory_bytes: 4092
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int A,B,K;
  cin>>A>>B>>K;
  for(int i=0;i<K;i++){
    if(i%2==0){
      if(A%2==1) A--;
      B+=A/2;
      A-=A/2;
    }
    
    else if(i%2==1){
      if(B%2==1) B--;
      A+=B/2;
      B-=B/2;
    }
  }
  cout<<A<<" "<<B<<endl;
}



Measured memory_bytes: 256
using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        string s = io.r<string>();
        int n = io.r<int>();
        string[][] cmd = io.r<string>(n, ' ');
        for (int i = 0; i < n; i++)
        {
            int st = util.parse<int>(cmd[i][1]);
            int ed = util.parse<int>(cmd[i][2]);
            if (cmd[i][0] == "replace")
            {
                s = s.Substring(0, st) + cmd[i][3] + s.Substring(ed + 1, s.Count() - ed - 1);
            }
            else if (cmd[i][0] == "reverse")
            {
                s = s.Substring(0, st) + new String(s.Substring(st, ed - st + 1).Reverse().ToArray()) + s.Substring(ed + 1, s.Count() - ed - 1);
            }
            else if (cmd[i][0] == "print")
            {
                io.w(s.Substring(st, ed - st + 1));
            }
        }
        io.wflush();
    }
}

namespace LIB
{
    public class io
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T r<T>() { return util.parse<T>(r()); }
        public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); }
        public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; }
        public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; }
        private static string r() { return Console.ReadLine(); }
        public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } }
        public static void wflush() { Console.Write(S.ToString()); S.Length = 0; }
    }
    public class util
    {
        public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); }
    }
    public class memo<Key, Result>
    {
        private Dictionary<Key, Result> R;
        public memo() { R = new Dictionary<Key, Result>(); }
        public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; }
    }
}

Measured memory_bytes: 10640
#![allow(unused_imports)]
#![allow(unused_variables)]
use proconio::input;
use proconio::marker::*;
use std::cmp::{min, max};
use std::collections::{HashSet, HashMap, BinaryHeap};

fn main() {
    input! {
        s: u32,
        w: u32,
    }
    let ans = if s > w {"safe"} else {"unsafe"};
    println!("{}", ans);
}


Measured memory_bytes: 2120
n = int(input())

arr = []

while n:
    arr.append(n % 26)
    n = n // 26

for i in range(len(arr) - 1):
    if arr[i] <= 0:
        arr[i] += 26
        arr[i + 1] -= 1

# print(arr)

name = ""
for i in arr[::-1]:
    if i > 0:
        name = name + chr(96+i)
print(name)


Measured memory_bytes: 9184
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

template <class T>
class EdgeBase
{
public:
    int to;
    T cost;
    EdgeBase(){};
    EdgeBase(int to0, T cost0){to = to0; cost = cost0;}
};
typedef EdgeBase<long long> Edge;

template<class T>
void shortestPath(const vector<vector<EdgeBase<T> > >& edges, int start, vector<T>& dist)
{
    const T INF = numeric_limits<T>::max();
    const T EPS = static_cast<T>(1.0e-10);

    dist.assign(edges.size(), INF);
    dist[start] = 0;
    priority_queue<pair<T,int>, vector<pair<T,int> >, greater<pair<T,int> > > q;
    q.push(make_pair(0, start));

    while(!q.empty()){
        pair<T, int> p = q.top();
        q.pop();
        int v = p.second;
        if(dist[v] < p.first - EPS)
            continue;
        for(unsigned i=0; i<edges[v].size(); ++i){
            EdgeBase<T> e = edges[v][i];
            if(dist[v] + e.cost < dist[e.to] - EPS){
                dist[e.to] = dist[v] + e.cost;
                q.push(make_pair(dist[e.to], e.to));
            }
        }
    }
}

int main()
{
    int n;
    cin >> n;
    vector<vector<Edge> > edges(n+1);
    for(int i=0; i<n-1; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        edges[a].push_back(Edge(b, c));
        edges[b].push_back(Edge(a, c));
    }

    int q, k;
    cin >> q >> k;
    vector<long long> dist;
    shortestPath(edges, k, dist);

    while(--q >= 0){
        int x, y;
        cin >> x >> y;
        long long ans = dist[x] + dist[y];
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 11120
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int mod = 1000000007;
int n, k;
int a[200000];
vector<int> sei; //正の値の絶対値
vector<int> fu;	 //負の値の絶対値

signed main() {
	int i;
	
	cin >> n >> k;
	rep(i, n) {
		cin >> a[i];
		if (a[i] >= 0) sei.push_back(a[i]);
		else fu.push_back(-a[i]);
	}
	
	//答えが負になるケース
	if ((sei.size() == 0 && k % 2 == 1) || (n == k && fu.size() % 2 == 1)) {
		sort(fu.begin(), fu.end());
		int ans = 1;
		rep(i, min((int)fu.size(), k)) {
			ans *= fu[i];
			ans %= mod;
		}
		rep(i, max(0LL, k - (int)fu.size())) {
			ans *= sei[i];
			ans %= mod;
		}
		cout << (mod - ans) % mod << endl;
		return 0;
	}
	
	//答えが正（負からは偶数個取る）
	//kが奇数→seiから最大値を1個取る
	//kが偶数→どちらからも偶数個取る. 2個ずつ積でまとめ、大きい方から貪欲.
	sort(sei.begin(), sei.end(), greater<int>());
	sort(fu.begin(), fu.end(), greater<int>());
	
	int ans = 1;
	if (k % 2 == 1) {
		ans *= sei[0];
	}
	
	vector<int> vec;
	for (i = k % 2; i + 1 < sei.size(); i += 2) {
		vec.push_back(sei[i] * sei[i + 1]);
	}
	for (i = 0; i + 1 < fu.size(); i += 2) {
		vec.push_back(fu[i] * fu[i + 1]);
	}
	sort(vec.begin(), vec.end(), greater<int>());
	
	rep(i, k / 2) {
		int res = vec[i] % mod;
		ans *= res;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8236
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
# from pprint import pprint


N = int(sys.stdin.readline().rstrip())
li = [int(x) for x in sys.stdin.readline().rstrip().split()]

# print(li)

flag = True
count = 0
while flag:
  r = 0
  for i in li:
    r = r + int(i%2)

  if r > 0:
    break
  
  count = count + 1

  li = [x/2 for x in li]

print(count)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int n;
    cin>>n;
    
    int sum = 0;
    
    rep(i,n){
        int a,b;
        cin>>a>>b;
        sum+=b-a+1;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
class UnionFind():
 def __init__(self, n):
  self.n = n
  self.parents = [-1] * n

 def find(self, x):
  if self.parents[x] < 0:
   return x
  else:
   self.parents[x] = self.find(self.parents[x])
   return self.parents[x]

 def union(self, x, y):
  x = self.find(x)
  y = self.find(y)

  if x == y:
   return

  if self.parents[x] > self.parents[y]:
   x, y = y, x

  self.parents[x] += self.parents[y]
  self.parents[y] = x

 def size(self, x):
  return -self.parents[self.find(x)]
 def same(self, x, y):
  return self.find(x) == self.find(y)

N,M,K = map(int,input().split())
uf = UnionFind(N)
lst=[0]*(N)
ans=[0]*(N)
for i in range(M):
 A,B=map(int,input().split())
 uf.union(A-1,B-1)
 lst[A-1]+=1
 lst[B-1]+=1
for i in range(K):
 A,B=map(int,input().split())
 if uf.same(A-1,B-1):
  lst[A-1]+=1
  lst[B-1]+=1
for i in range(N):
 ans[i]=uf.size(i)-lst[i]-1
L=[str(a) for a in ans]
L=' '.join(L)
print(L)

Measured memory_bytes: 100056
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize,
        k: usize,
        q: usize,
        a_s: [usize; q],
    }
    let start = k as i64 - q as i64;
    let mut v = vec![start; n];
    for a in a_s {
        v[a - 1] += 1;
    }
    let ans = v
        .iter()
        .map(|x| if *x <= 0 { "No" } else { "Yes" })
        .collect::<Vec<_>>()
        .join("\n");
    println!("{}", ans);
}


Measured memory_bytes: 8444
x = input()
N, a, b = x.split()
N, a, b = int(N), int(a), int(b)
a, b    = min(a,b), max(a, b)

if (a + b) % 2 == 0:
    #easy part
    steps = (b-a)//2
else:
    if a - 1 < N - b:
        #when smaller is nearer at the 1th table
        steps = a - 1
        b = b - (a - 1)
        a = 1
        #print(steps, a, b)
        steps += 1
        b -= 1
        #print(steps, a, b)
    else:
        steps = N - b
        a = a + N - b
        b = N
        #print(steps, a, b)
        steps += 1
        a += 1
        #print(steps, a, b)
    steps = steps + abs(b-a)//2
    #print(steps, a, b)
print(steps)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AtCoder solver = new AtCoder();
        solver.solve(1, in, out);
        out.close();
    }

    static class AtCoder {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.nextLine();
            int left = s.indexOf("A");
            int right = s.lastIndexOf("Z");

            out.println(right - left + 1);
        }

    }
}



Measured memory_bytes: 26052
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	char s[100010];
	while(scanf("%s",s)!=EOF)
	{
		int l=strlen(s);
		int sum=0;
//		int flag=1;
		for(int i = 0; i < l; i++)
		{
//			if(s[i]!='W'||s[i]!='B')
//			{
//				flag=0;
//				break;
//			}
			if(s[i+1]!=s[i])
			sum++;
		}
		printf("%d\n",sum-1);
//		if(flag==1)
//		printf("%d\n",sum-1);
//		else
//		printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int	main(void)
{
	int d, t, s;
	double time;

	scanf("%d %d %d", &d, &t, &s);

	time = (double)d / s;

	if (time <= (double)t)
		printf("Yes\n");
	else
		printf("No\n");

	return (0);
}


Measured memory_bytes: 2064
#include <cstdio>
#include <algorithm>

int n,l,t;
int x[100010],w[100010];

int main(void)
{
    int i,j,k;

    //freopen("x.in","r",stdin);

    scanf("%d %d %d",&n,&l,&t);
    j = 0;
    for(i = 0;i < n;++i)
    {
        scanf("%d %d",&x[i],&w[i]);
        if(w[i] == 2){
            j = (j + (x[i] - t) / l - (x[i] - t <= 0) + ((x[i] - t) % l == 0)) % n;
            x[i] = (x[i] - t % l + l) % l;
        }else{
            j = (j + (x[i] + t) / l) % n;
            x[i] = (x[i] + t) % l;
        }
    }

    std::sort(x,x + n);
    for(i = 0;i < n;++i)
        printf("%d\n",x[(i + j + n) % n]);

    return 0;
}

Measured memory_bytes: 1920
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	x := getNextInt(scanner)
	y := getNextInt(scanner)
	a := getNextInt(scanner)
	b := getNextInt(scanner)
	c := getNextInt(scanner)
	aa := make([]int, a)
	bb := make([]int, b)
	ap := &apples{}
	heap.Init(ap)
	eat := x + y
	for i := 0; i < a; i++ {
		aa[i] = getNextInt(scanner)
	}
	sort.Ints(aa)
	for i := 0; i < x && i < a; i++ {
		heap.Push(ap, aa[a-1-i])
	}
	for i := 0; i < b; i++ {
		bb[i] = getNextInt(scanner)
	}
	sort.Ints(bb)
	for i := 0; i < y && i < b; i++ {
		heap.Push(ap, bb[b-1-i])
	}

	for i := 0; i < c; i++ {
		cc := getNextInt(scanner)
		heap.Push(ap, cc)
	}

	var ans int64
	for i := 0; i < eat; i++ {
		ans += int64(heap.Pop(ap).(int))
	}
	fmt.Fprintln(writer, ans)

}

type apples []int

func (h apples) Len() int           { return len(h) }
func (h apples) Less(i, j int) bool { return h[i] > h[j] }
func (h apples) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }
func (h *apples) Push(x interface{}) {
	*h = append(*h, x.(int))
}
func (h *apples) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


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

int main(){
  int n;
  cin >> n;
  int a[n];
  int s = 0;
  rep(i,n) {
    cin >> a[i];
    s += a[i];
  }
  ll ans = 1;
  rep(i,n) (ans *= 3) %= mod;
  vector<vector<ll>> dp(n+1,vector<ll>(s+1,0)), dph(n+1,vector<ll>(s+1,0));
  dp[0][0] = 1;
  dph[0][0] = 1;
  rep(i,n) {
    rep(j,s+1) {
      (dp[i+1][j] += dp[i][j] * 2) %= mod;
      (dph[i+1][j] += dph[i][j]) %= mod;
      if(j + a[i] <= s) {
        (dp[i+1][j+a[i]] += dp[i][j]) %= mod;
        (dph[i+1][j+a[i]] += dph[i][j]) %= mod;
      }
    }
  }
  ll ex = 0;
  if(s % 2 == 0) ex += (dp[n][s/2] - dph[n][s/2]) * 3 % mod;
  for(int i = s/2 + 1; i <= s; i++) (ex += 3*dp[n][i]) %= mod;
  ans = ((ans - ex) % mod + mod) % mod;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 423744
n = int(input())
s = input()
one = [False for _ in range(10)]
two = [False for _ in range(100)]
three = [False for _ in range(1000)]
for i in range(n):
	x = int(s[i])
	for j in range(100):
		if three[j*10+x]:
			continue
		if two[j]:
			three[j*10+x] = True
	for j in range(10):
		if two[j*10+x]:
			continue
		if one[j]:
			two[j*10+x] = True
	one[x] = True
print(sum(three))

Measured memory_bytes: 3064