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

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね

//ここから編集する


int main() {
    int N;
    cin >> N;
    vector<int> A(N),B(N),C(N);
    REP(i,0,N) cin >> A[i];
    REP(i,0,N) cin >> B[i];
    REP(i,0,N) cin >> C[i];

    sort(all(A));
    sort(all(B));
    sort(all(C));
    ll ans = 0LL;
    REP(i,0,N){
        ans += (lower_bound(A.begin(),A.end(),B[i]) - A.begin()) * (C.end() - upper_bound(all(C),B[i]));
    }

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


Measured memory_bytes: 1408
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){

    double a, b, C;
    cin >> a >> b >> C;

    C *= M_PI / 180; // ラジアンに変換

    double area = (a * b * sin(C)) / 2 ;
    double len = a + b + sqrt(pow(a, 2) + pow(b, 2) - 2*a*b*cos(C));
    double height = b * sin(C);

    cout << fixed << setprecision(12);
    cout << area << endl;
    cout << len << endl;
    cout << height << endl;

    return 0;
}


Measured memory_bytes: 3508
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll X;
  cin >> X;
  if (X <= 599) {
    cout << 8 << "\n";
  }
  else if (X < 800) {
    cout << 7 << "\n";
  }
  else if (X < 1000) {
    cout << 6 << "\n";
  }
  else if (X < 1200) {
    cout << 5 << "\n";
  }
  else if (X < 1400) {
    cout << 4 << "\n";
  }
  else if (X < 1600) {
    cout << 3 << "\n";
  }
  else if (X < 1800) {
    cout << 2 << "\n";
  }
  else {
    cout << 1 << "\n";
  }
}


Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<set>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	set<int> s1,s2;
	int n,m,a,b;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>a>>b;
		if(a==1){
			s1.insert(b);
		}
		if(b==1) s1.insert(a);
		if(a==n) s2.insert(b);
		if(b==n) s2.insert(a);
 	}
 	int f=0;
 	for(set<int>::iterator it=s1.begin() ;it!=s1.end();it++)
    {
        if(s2.find(*it)!=s2.end()){
			cout<<"POSSIBLE"<<endl;
			f=1;
			break;
        }
    }
 	if(f==0){
		cout<<"IMPOSSIBLE"<<endl;
 	}

return 0;
}


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

using namespace std;

#define ll long long

int
main(void){
	int n; cin >> n;
	vector<ll> vec1(n), vec2(n), vec3(n);
	
	for(int i = 0; i < n; i++) cin >> vec1[i];
	for(int i = 0; i < n; i++) cin >> vec2[i];
	for(int i = 0; i < n; i++) cin >> vec3[i];
	
	sort(vec1.begin(), vec1.end());
	sort(vec2.begin(), vec2.end());
	sort(vec3.begin(), vec3.end());
	
	vector<ll> sum(n);
	for(int i = 0; i < n; i++){
		int x = vec2[i];
		vector<ll> :: iterator it = upper_bound(vec3.begin(), vec3.end(), x);
		sum[i] = vec3.end() - it;
	}
	
	for(int i = 1; i < n; i++) sum[i] += sum[i - 1];
	
	ll ans = 0;
	for(int i = 0; i < n; i++){
		int x = vec1[i];
		vector<ll> :: iterator it = upper_bound(vec2.begin(), vec2.end(), x);
		int pos = it - vec2.begin();
		if(pos == 0) ans += sum[n - 1];
		else ans += sum[n - 1] - sum[pos - 1];
	}
	cout << ans;
	
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
const int N = 1e5 + 1000;
vector<int> a(N, 0), b(N, 0), c(N, 0);
signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= n + 1; i++) {
        b[i] = b[i - 1] + abs(a[i] - a[i - 1]);
    }
    for (int i = n ; i >= 0; i--) {
        c[i] = c[i + 1] + abs(a[i] - a[i + 1]);
    }
    for (int i = 1; i <= n; i++) {
        cout << b[i - 1] + c[i + 1] + abs(a[i + 1] - a[i - 1]);
        cout << "\n";
    }
}

Measured memory_bytes: 3584
#pragma GCC optimize ("Ofast","unroll-loops")
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define MP make_pair
#define F first
#define S second
#define MEM(a,b) memset(a,b,sizeof a)
#define Tie ios::sync_with_stdio(0),cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int n,m,w;

int main()
{
	cin>>n>>m>>w,m--,w--;
	cout <<	(n-m)*(n-w)<<'\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
    int i,j;
    int w;
    string s;
    cin>>s>>w;
    rep(i,s.size())if(i%w==0)cout<<s[i];
    cout<<endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define fore(x, a) for(auto &x : a)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
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; }
template<class T>void show(const vector<T> &a) { for (int i = 0; i < (int)a.size(); ++i) cout << a[i] << (i != (int)a.size()-1 ? " " : "\n"); }
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};

int n, w[300005], e[300005];
string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> s;
    rep(i, 0, n)
      if (s[i] == 'W') w[i]++;
    eper(i, n-1, 0) 
      if (s[i] == 'E') e[i]++;
    rep(i, 0, n) w[i+1] += w[i];
    eper(i, n-1, 1) e[i-1] += e[i];
    int ans = inf;
    rep(i, 0, n) {
      ans = min(ans, e[i] + w[i] - 1);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 2964
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

int main() {
  int N, T, A;
  cin >> N >> T >> A;
  
  int index = 0;
  int diff = 6000000;
  
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if (abs(1000 * T - x * 6 - A * 1000) < diff) {
      index = i;
      diff = abs(1000 * T - x * 6 - A * 1000);
    }
  }
  
  cout << index + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
import numpy as np
N, M = map(int, input().split())
Abuf = input().split()
A = np.zeros(N+1, dtype=int)
for i in range(N):
	A[i+1] = int(Abuf[i])
A = np.cumsum(A) % M
D = {}
for i in range(A.shape[0]):
	if(A[i] in D):
		D[A[i]] += 1
	else:
		D[A[i]] = 1
r = 0
for k in D.keys():
	n = D[k]
	r += n*(n-1)/2
print(int(r))

Measured memory_bytes: 25188
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
long long n , monster , pos, lempar[200000] , attacks , a;
pair<int , int>katana[200000];

int main(){
	cin >> n >> monster;
	for(int i = 1 ; i <= n ; i++){
		cin >> katana[i].fi >> katana[i].se;
 	}
 	sort(katana + 1 , katana + n + 1);
 	for(int i = n ; i >= 1 ; i--){
 		if(katana[i].fi != katana[i - 1].fi){
 			pos = i;
 			break;
		 }
	 }
 	for(int i = n ; i >= 1 ; i--){
 		if(i == pos || katana[pos].fi >= katana[i].se)continue;
 		a++;
 		lempar[a] = katana[i].se;
	}
	sort(lempar + 1 , lempar + a + 1);
	lempar[0] = 0;
	for(int i = a ; i >= 1 ; i--){
		attacks++;
		if(monster - katana[pos].se <= 0){
			cout << attacks << endl;
			return 0;
		}
		monster -= lempar[i];
		if(monster <= 0){
			cout << attacks << endl;
			return 0;
		}
	}
	monster -= katana[pos].se;
	attacks++;
	if(monster <= 0){
		cout << attacks << endl;
		return 0;
	}
	attacks += monster/katana[pos].fi;
	if(monster % katana[pos].fi != 0)attacks++;
	cout << attacks << endl;
}

Measured memory_bytes: 5144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(int i = (m); i <= (n); i++)
#define zep(i,m,n) for(int i = (m); i < (n); i++)
#define rrep(i,m,n) for(int i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n, d, x; cin >> n >> d >> x;
    zep(i, 0, n){
    	ll a; cin >> a;
    	x += (d+a-1)/a;
    }
    print(x)
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stack>
#include<iostream>
#include<string>
using namespace std;

int n = 0;//pointing at number of line
int u = 0;//number of top
int k[101];//output order(connect)
int v[101][101];//number of top
int Short[101] = { 0 };//Short(d[v])
//into n = 0;//element count
int p = 0;//Pointer
int fptr = 0;
int lptr = 0;
int x1[10000];
int y1[10000];
void Enqueue(int y, int x)
{
	x1[lptr] = x;//top of number
	y1[lptr] = y;//shortest
	lptr = (lptr + 1) % 10000;
}
void bfs(int l) {
	int i;
	while (fptr!=lptr) {
		l=x1[fptr];
		p=y1[fptr];
		fptr = (fptr + 1) % 10000;
		if(Short[l]!=-1){
			continue;
		}
		for(i=0;i<k[l];i++){
			if(v[l][i]){
				Enqueue(p+1,v[l][i]);
			}
		}
		//Enqueue(v[l][in]);
		Short[l]=++p;
	}
}
int main()
{
	int i;
	int j;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> u;
		cin >> k[u];
		for (j = 0; j < k[u]; j++) {
			cin >> v[u][j];
		}
	}
	Enqueue(-1,1);
	for(i=0;i<n+1;i++){
		Short[i]=-1;
	}
	bfs(0);
	
	for (i = 1; i < n + 1; i++) {
		cout << i << " " << Short[i] << endl;
	}
}


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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(c-a) <= d ||(abs(b-a)<=d&&abs(c-b)<=d)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}
    

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

int main() {
  int a,b;
  cin >> a>>b;
  
  vector<int> vec(b);
  vector<int> vecb(b);
  
  for(int i=0;i<b;i++){
    cin>>vec.at(i);
    cin>>vecb.at(i);
  }
  
  sort(vec.begin(),vec.end());
  sort(vecb.begin(),vecb.end());
  
  int l=vecb.at(0)-vec.at(b-1)+1;
  
  cout<<max(l,0)<<endl;
    
}

Measured memory_bytes: 1024
from collections import Counter

N = int(input())
A = tuple(map(int, input().split()))
mod = 10 ** 9 + 7

U = N + 10
fact = [1] * (U + 1)
inv = [1] * (U + 1)

for i in range(1, U + 1):
    fact[i] = fact[i - 1] * i % mod

inv[U] = pow(fact[i], mod - 2, mod)
for i in range(U, 0, -1):
    inv[i - 1] = inv[i] * i % mod


def comb(N, r):
    if r < 0 or r > N:
        return 0
    res = fact[N] * inv[r] % mod
    res = res * inv[N - r] % mod
    return res


X = Counter(A).most_common()[0][0]
left = A.index(X)
right = A[::-1].index(X)
LR = left + right

for i in range(1, N + 2):
    ans = comb(N+1, i)-comb(LR, i-1)
    ans = (ans + mod) % mod
    print(ans)


Measured memory_bytes: 29920
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    string s; int k; cin >> s >> k; int n = s.size();
    vector<string> v;
    rep(i, n){
        repn(j, k){
            if(i + j > n) continue;
            string t = s.substr(i, j);
            v.push_back(t);
        }
    }
    sort(all(v));
    v.erase(unique(all(v)), v.end());
    cout << v[k-1] << endl;
}

Measured memory_bytes: 1160
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
    int N;
    cin >> N;
    vector<string> v;
    for(int i = 0; i < N; i++){
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        v.push_back(s);
    }
    v.push_back("zzzzzzzzzzzzzz");
    sort(v.begin(), v.end());
    long long int ans = 0;
    long long int cnt = 1;
    for(int i = 0; i < N; i++){
        if(v[i] == v[i + 1]){
            cnt += 1;
        }else{
            ans += cnt * (cnt - 1) / 2;
            cnt = 1;
        }
    }
    cout << ans << endl;
    return 0;
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=(res*x)%MOD;y=y>>1;x=(x*x)%MOD;}return res%MOD;} // modular exponent
ll inv(ll x)
{
  return power(x,MOD-2);
}
int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans=power(2,n);
    ans-=1ll;
    ans+=MOD;
    ans%=MOD;
    // calculate product x and y;
    ll x=1ll;
    repA(i,n-a+1,n)
    {
      x*=i;
      x%=MOD;
    }
    ll y=1ll;
    repA(i,1,a)
    {
      y*=i;
      y%=MOD;
    }
    y=inv(y);
    ans-=((x*y)%MOD);
    ans+=MOD;
    ans%=MOD;
    x=1ll;
    repA(i,n-b+1,n)
    {
      x*=i;
      x%=MOD;
    }
    y=1ll;
    repA(i,1,b)
    {
      y*=i;
      y%=MOD;
    }
    y=inv(y);
    ans-=((x*y)%MOD);
    ans+=MOD;
    ans%=MOD;
    cout<<ans<<'\n';
    return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!


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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int a,b,c;
    cin>>a>>b>>c;
    bool eq2=a==b||a==c||b==c;
    bool eq3=a==b&&b==c;
    cout<<(eq2&&!eq3?"Yes":"No");
}


Measured memory_bytes: 256
d, g = map(int, input().split( ))
p = [0]
c = [0]

for _ in range(d):
    P,C = map(int, input().split( ))
    p.append(P)
    c.append(C)
ans = sum(p)

for i in range(2**d):
    comp = []
    non_comp = []
    cnt = [0]*(d+1)
    sm = 0

    for j in range(1,d+1):
        if i>>(j-1) & 1 == 0:
            comp.append(j)
        else:
            non_comp.append(j)
        non_comp.reverse()
    for j in comp:
        sm += p[j]*j*100 + c[j]
        cnt[j] = p[j]
    for j in non_comp:
        if sm >= g:
            break
        cnt[j] = min(p[j]-1, (g - sm)//(j*100) + 1)
        sm += cnt[j]*j*100
        if sm - j*100>=g:
            cnt[j] -= 1
    tot = sum(cnt)
    if sm >=g:
        ans = min(ans, tot)
        #print(cnt)

print(ans)


Measured memory_bytes: 3064
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 15;
const int maxm = 1005;
const int mod = 1000000007;

string s[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n,m,K;
  cin>>n>>m>>K;
  for(int i=0;i<n;i++)cin>>s[i];
  int ret = n + m;
  for(int mask=0;mask<(1<<(n-1));mask++){
    int ch = 0;
    for(int i=0;i<(n-1);i++)if(mask&(1<<i))ch++;
    bool canit = true;
    int cw = 0;
    vector<int>cc = vector<int>(1+ch, 0);
    for(int i=0;i<m;i++){
      int idx=0, sum = 0;
      vector<int>tt = vector<int>(1+ch, 0);
      for(int j=0;j<n;j++){
        if(s[j][i]=='1')sum++;
        if(j==n-1||(mask&(1<<j))){
          tt[idx] = sum;
          sum = 0;
          idx++;
        }
      }
      int mx = 0;
      bool can = 1;
      for(int j=0;j<tt.size();j++){
        if(tt[j]+cc[j]>K)can = false;
        mx = max(mx, tt[j]);
      }
      if(mx>K){
        canit = false;
        break;
      }
      if(can){
        for(int j=0;j<tt.size();j++){
          cc[j]+=tt[j];
        }
      } else {
        cw ++;
        cc = tt;
      }
    }
    if(canit){
      ret = min(ret, ch +cw);
    }
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	int n;
	while (n = readln.chomp.to!int, n) {
		int cnt;
		foreach (i; 1..n) {
			int sum;
			foreach (j; i..n) {
				sum += j;
				if (sum == n) {
					cnt++;
					break;
				}
			}
		}
		cnt.writeln;
	}
}

Measured memory_bytes: 1044
l, r = input().split()
l, r = int(l), int(r)

if r > l + 2019:
    print(0)
else:
    m = 2019
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            m = min(m, (i*j)%2019)
    print(m)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
bool flag = true;
bool flag2 = true;

//繰り返し二乗法
ll mod_pow(ll x,ll n){
	ll res = 1;
	while(n > 0){
		if(n & 1){
			res = res * x % mod;
		}
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

ll mod_fact(ll n){
	if (n != 1LL){
		return (mod_fact(n - 1LL) * n) % mod;
	}
	else{
		return 1LL;
	}
}

ll mod_comb(ll n,ll r){
	ll a = 1LL;
	for(ll i = 1LL; i <= r; i++) {
		a *= (n - i + 1LL);
		a %= mod;
	}
	ll b = mod_pow(mod_fact(r),mod - 2);//r!の逆元（フェルマーの小定理）

	return (a * b) % mod;
}



int main(){
	ll n,a,b;cin>>n>>a>>b;
	ll c1 = mod_comb(n,a);
	ll c2 = mod_comb(n,b);
	
	ll ans = mod_pow(2,n) - 1LL;
	ans -= c1; 
	ans %= mod;
	if (ans < 0LL){
		ans += mod;
	}
	ans -= c2; 
	ans %= mod;
	if (ans < 0LL){
		ans += mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
    #define ll long long
    using namespace std;
     
    vector<int> buf;
     
    int main()
    {
        ll A, B, C, K, c = 0, ans = 0;
        cin >> A >> B >> C >> K;
     
        if (K > A)
        {
            ans = A;
            c = K - A;
        }
        else
        {
            ans += K;
        }
        if (K >= A + B)
        {
            c -= B;
            if (C >= c && c >= 0)
            {
                ans -= c;
            }
        }
     
        cout << ans << endl;
        return 0;
    }

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

int main() {
  int A,B,T;
  cin >> A >> B >> T;
  
  int cookie = 0;
  //int time = 0;  

  for(int time = A ; time < T+1 ; time += A){
  	cookie += B;
  }
  
  cout << cookie << endl;
  
  return 0;
  
 }


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define INF 1e9
#define MOD 1000000007
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

ll hp(ll H){
    if(H==1)return 1;
    return hp(H/2)*2+1;
}
int main(void){
    ll H;cin>>H;
    cout<<hp(H)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector> 
#include <stdio.h>
#include <string>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)

using namespace std;

int main(){

	std::string x;
  
  	cin >> x;
  
    if("SUN" == x) cout << 7 << endl;
    if("MON" == x) cout << 6 << endl;
    if("TUE" == x) cout << 5 << endl;
    if("WED" == x) cout << 4 << endl;
    if("THU" == x) cout << 3 << endl;
    if("FRI" == x) cout << 2 << endl;
    if("SAT" == x) cout << 1 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main()
{
  ll a, b, n;
  cin >> a >> b >> n;
  
  ll x;
  
  int ans = 0;
  
  if(b > n){
    x = n;
  }
  else
    x = b - 1;
  
  ans = floor(a * x / b) - a * floor(x / b);
  
  printf("%d", ans);
}

int main()
{
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Measured memory_bytes: 3764
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <map>
using namespace std;

int main() {
	int S;
	int W;
	cin >> S >> W;
	if (W >= S)cout << "unsafe" << endl;
	else cout << "safe" << endl;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define INF 0x3f3f3f3f
#define LL long long
using namespace std;
char S[500010];
int main(){
	scanf("%s", S);
	int n = strlen(S);
	LL s = 0;
	int l = 0, g = 0;
	for(int i = 0; i < n; i++){
		if(S[i] == '>') g++;
		else l++;
		if(i + 1 < n && S[i] == '>' && S[i+1] == '<'){
			int a = min(l, g), b = max(l, g);
			s += b*1LL*(b+1)/2 + a*1LL*(a-1)/2;
			l = 0; g = 0;
		}
	}
	int a = min(l, g), b = max(l, g);
	s += b*1LL*(b+1)/2 + a*1LL*(a-1)/2;
	printf("%lld\n", s);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <map>
#include <set>
#include <stdlib.h>
#include <ctype.h>
#include <stack>
using namespace std;
#define ull unsigned long long
#define ll long long
stack<int> s;
string str;
int main(void){
	cin>>str;
	int ans=0;
	for(int i=0;i<str.length();++i)
		if(!s.empty()&&(s.top()^(str[i]-'0')))
			s.pop(),ans+=2;
		else s.push(str[i]-'0');
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main () {
    int k = 1;
    int a, b;
    cin >> a >> b;
    for (int i = 0;; i++) {
        if (k >= b) {
            cout << i << endl;
            return 0;
        }
        k--;
        k+=a;
    }
}

Measured memory_bytes: 256
N,K = map(int,input().split())
s = input()
ls = []
i = 0
c = 0
while i < N and s[i] == "1":
    c += 1
    i += 1
if i==N:
    print(N)
    exit()
while i < N:
    l = c
    c = 0
    while i < N and s[i] == "0":
        c += 1
        i += 1
    m = c
    c = 0
    while i < N and s[i] == "1":
        c += 1
        i += 1
    r = c
    ls.append((l,m,r))
K = min(K, len(ls))
from itertools import accumulate
acc = list(accumulate([0]+ls, lambda x,y:x+y[1]+y[2]))
ans = 0
for i in range(len(ls)-K+1):
    ans = max(ans, acc[i+K]-acc[i]+ls[i][0])
print(ans)

Measured memory_bytes: 14944
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int H, W;
  cin >> H >> W;
  char a[H][W];
  for(int i=0; i<H; i++) for(int j=0; j<W; j++) cin >> a[i][j];
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      bool dis_row = false;
      for(int k=0; k<W; k++) if(a[i][k] == '#') {dis_row = true; break;}
      bool dis_col = false;
      for(int k=0; k<H; k++) if(a[k][j] == '#') {dis_col = true; break;}

      if(dis_row && dis_col) cout << a[i][j];
      if(dis_row && j == W-1) cout << endl;
    }
  }
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
    int r,d,x;
    cin>>r>>d>>x;
    for (int i=1; i<=10; i++) {
        cout<<r*x-d<<endl;
        x = r*x-d;
    }
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
h = list(map(int, input().split()))

dp = [0] * N

dp[0] = 0
dp[1] = abs(h[1] - h[0])

for n in range(2, N):
	#print(dp)
	dp[n] += min(abs(h[n] - h[n - 2]) + dp[n - 2], \
		abs(h[n] - h[n - 1]) + dp[n - 1])

#print(dp)
print(dp[N - 1])

Measured memory_bytes: 13980
from collections import defaultdict
from string import ascii_lowercase

s = input()
if s == 'zyxwvutsrqponmlkjihgfedcba' :
    print(-1)
elif len(s) < 26 :
    s = list(s)
    d = defaultdict(int)
    for c in s :
        d[c] += 1
    for c in ascii_lowercase :
        if d[c] == 0 :
            s.append(c)
            print(''.join(s))
            break
elif len(s) == 26 :
    s = list(s)
    d = defaultdict(int)
    for i in range(25, 0, -1) :
        if s[i-1] < s[i] :
            d[s[i]] = 1
            for c in ascii_lowercase :
                if d[c] == 1 and s[i-1] < c :
                    ans = s[0:i-1]
                    ans = ans + [c]
                    print(''.join(ans))
                    exit()
        elif s[i-1] > s[i] :
            d[s[i]] = 1


Measured memory_bytes: 3960
n = int(input())
W = [input() for i in range(n)]

if len(W) != len(set(W)):
  print("No")
  exit()
else:
  for i in range(len(W)-1):
    if W[i][len(W[i])-1] !=  W[i+1][0]:
      print("No")
      exit()
    
print("Yes")

Measured memory_bytes: 3060
// #include <iostream>
// #include <fstream>
// #include <cstdio>
// #include <set>
// #include <vector>
// #include <algorithm>
// #include <cmath>
// #include <cstdlib>
// #include <queue>
// #include <string>
// #include <map>
// #include <unordered_map>
// #include <cstring>
// #include <numeric>
// #include <stack>
// #include <iomanip>
// #include <chrono>

#include<bits/stdc++.h>
using namespace std;

#define sd(mark) scanf("%d",&mark)
#define ss(mark) scanf("%s",mark)
#define clr(mark) memset(mark,0,sizeof(mark))
#define setinf(mark) memset(mark,0x3f,sizeof(mark))
#define setneg(mark) memset(mark,-1,sizeof(mark))



#ifndef strange
#define trace(...)
// #define endl '\n'
#define start_routine() 
#define end_routine()
#endif
typedef long long ll;   
//__gcd


const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
#define PI 3.141592653589793238
#define mod 1000000007


#define F first 
#define S second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define trav(a,x) for(auto &a:x)
#define pii pair<int,int>

#define pb push_back
#define int long long

#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)

#define sz(x) (int)(x).size()
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<vi> vii;
#define vp vector <pii>
int x;

int power(int x,  int y) 
{ 
    int res = 1;   
  
    x = x % mod;  
   
    if (x == 0) return 0; 

    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % mod;  
  
          
        y = y>>1; 
        x = (x*x) % mod;  
    }  
    return res;  
}

bool cmp(pii a,pii b){
    return a.S<b.S;
}
// int dp[2005];
void solve(){
    int n;
    cin>>n;
    // vector<vp> quad(4);
    //first quadrant second and so on
    int x,y;
    vi a;vi b;
    rep(i,0,n){
        cin>>x>>y;
        a.pb(x+y);
        b.pb(x-y);
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    int ans=max(a[n-1]-a[0],b[n-1]-b[0]);
    cout<< ans;


}


signed main(){
    int t=1;
    start_routine();
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(NULL);
    cout<<fixed<<setprecision(10);
    
    
    // cin>>t;
    
    fr(i,1,t) {
		// cout<<"Case #"<<i<<": ";
		solve();
	}

    end_routine();
    return 0;
}

Measured memory_bytes: 6668
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  int N; cin>>N;
  vector<int> a(N);
  for(int i = 0; i < N ; i++) cin>>a[i];
  sort(a.begin(), a.end());
  cout << abs(a[N-1] - a[0]) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    rep(i, n) {
        ll t, x, y;
        cin >> t >> x >> y;
        if(t < x+y) {
            out("No");
            re0;
        }
        if(t%2 != (x+y)%2) {
            out("No");
            re0;
        }
    }
    
    out("Yes");
    re0;
}

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

struct Edge{
   public int s { get; set; }
   public int e { get; set; }
}

class Atcoder{
   public static int[] cins() {
      string[] ss = Console.ReadLine().Split(' ');
      int[] Res = new int[ss.Length];
      for (int i = 0; i<ss.Length; i++) {
         Res[i]=int.Parse(ss[i]);
      }
      return Res;
   }
   public static void Main(string[] args) {
      List<Edge> Net = new List<Edge>();
      int[] k = cins();
      int N = k[0], M = k[1];
      for (int i = 0; i<M; i++) {
         k=cins();
         Net.Add(new Edge { s=k[0]-1,e=k[1]-1 });
      }
      for (int i = 0; i<N; i++) {
         Console.WriteLine(Net.Where(j=>j.s==i||j.e==i).Count());
      }
      Console.ReadLine();
   }
}

Measured memory_bytes: 13396
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final int K = sc.nextInt();
		if(N % K == 0) {
			System.out.println("0");
		} else {
			System.out.println("1");
		}
	}
}


Measured memory_bytes: 23124
package main

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

func main() {
	sc := NewScanner()

	n := sc.ReadInt()
	m := sc.ReadInt()
	q := sc.ReadInt()
	abcds := make([]ABCD, q)
	for i := 0; i < q; i++ {
		a := sc.ReadInt()
		b := sc.ReadInt()
		c := sc.ReadInt()
		d := sc.ReadInt()
		abcds[i] = ABCD{a, b, c, d}
	}

	edits := make([]editSeqA, 0, 200000)
	for a := m; a >= 1; a-- {
		edits = append(edits, editSeqA{0, a})
	}

	cur := make([]int, n)
	maxScore := 0
	for len(edits) > 0 {
		edit := edits[len(edits)-1]
		edits = edits[:len(edits)-1]

		cur[edit.pos] = edit.value

		if edit.pos == n-1 {
			score := computeScore(abcds, cur)
			if score > maxScore {
				maxScore = score
			}
		} else {
			for v := m; v >= edit.value; v-- {
				edits = append(edits, editSeqA{edit.pos + 1, v})
			}
		}
	}

	fmt.Println(maxScore)
}

func computeScore(abcds []ABCD, seqA SeqA) int {
	totalD := 0
	for _, abcd := range abcds {
		if seqA[abcd.B-1]-seqA[abcd.A-1] == abcd.C {
			totalD += abcd.D
		}
	}
	return totalD
}

type editSeqA struct {
	pos   int
	value int
}

type SeqA []int

type ABCD struct {
	A int
	B int
	C int
	D int
}

// util
// *   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base int, exponent uint) int {
	answer := 1
	for i := uint(0); i < exponent; i++ {
		answer *= base
	}
	return answer
}

// *   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 1872
#include <iostream>
#include <algorithm>
#include <cstring>

constexpr int MAX=(int)1e5;

using P=std::pair<int,int>;

int n,m;

int bit[MAX+2];

P sec[MAX*3];

bool used[MAX*3];

void add(int k,int x) {
	for(int i=k;i<=m;i+=(i&-i))
		bit[i]+=x;
}

int sum(int k) {
	int res=0;
	for(int i=k;i>0;i-=(i&-i))
		res+=bit[i];
	return res;
}

int main() {
	std::cin>>n>>m;
	int l,r;
	for(int i=0;i<n;++i){
		std::cin>>l>>r;
		sec[i].first=r-l+1;
		sec[i].second=l;
	}
	std::sort(sec,sec+n);
	int c=0;
	for(int i=1;i<=m;++i) {
		while(c<n&&sec[c].first<i) {
			add(sec[c].second,1);
			add(sec[c].second+sec[c].first,-1);
			++c;
		}
		int ans=n-c;
		for(int j=0;j<=m;j+=i)
			ans+=sum(j);
		std::cout<<ans<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 3712
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
int s[501];
int main() {
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	if (H%h == 0 && W%w == 0) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	if (W%w) {
		s[0] = 0;
		for (int i = w; i <= W; i+=w) {
			s[i] = s[i - w] - 1;
		}
		for (int i = 1; i < w; i++) {
			s[i] = W;
			for (int j = i + w; j <= W; j += w) s[j] = s[j - w] - 1;
		}
		for (int i = 1; i <= H; i++) {
			for (int j = 1; j <= W; j++) {
				int A = s[j] - s[j - 1];
				cout << A << " ";
			}
			cout << endl;
		}
	}
	else {
		s[0] = 0;
		for (int i = h; i <= H; i += h) {
			s[i] = s[i - h] - 1;
		}
		for (int i = 1; i < h; i++) {
			s[i] = H;
			for (int j = i + h; j <= H; j += h) s[j] = s[j - h] - 1;
		}
		for (int i = 1; i <= H; i++) {
			for (int j = 1; j <= W; j++) {
				int A = s[i] - s[i - 1];
				cout << A << " ";
			}
			cout << endl;
		}
	}
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <string.h>

int main() {
	
	char s[101];
	int k;
	scanf("%d",&k);
	getchar();
	scanf("%[^\n]", &s);
	
	if (strlen(s) > k ){
		for(int i = 0; i < k; i++){
			printf("%c", s[i]);
		}
		printf("...\n");
	}else{
		for(int i = 0; i < strlen(s); i++){
			printf("%c", s[i]);
		}
	}

	
	
	
	return 0;
}


Measured memory_bytes: 1660
#include <stdio.h>

int main(void){
	int rest,n;
	scanf("%d",&n);
	rest=n%10;
	if(rest == 3 ){
		printf("bon");
	}
	else if(rest == 0 || rest == 1 || rest == 6 || rest == 8){
		printf("pon");
	}
	else{
		printf("hon");
	}
	return 0;
}


Measured memory_bytes: 1688
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String s=br.readLine();
        int max=0,cnt=0;
        for(int i=0;i<s.length();i++)
        {
            if(s.charAt(i)=='R')
            cnt++;
            else
            cnt=0;
            max=Math.max(max,cnt);
        }
        pw.println(max);
        pw.flush();
        pw.close();
    }
}

Measured memory_bytes: 32844
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#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;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 998244353//1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   vi a(n);
   rep(i,0,n)cin>>a[i];
   int s=0;
   rep(i,0,n)s^=a[i];
   for(int i=0;i<n;i++)
   {
       cout<<(s^a[i])<<" ";
   }

}


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

int main (){
    int H,W;
    cin >> H >> W;
    char a[H][W];
    int c[H][W]={0};
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> a[i][j];
            c[i][j]=0;
            if(a[i][j]=='#') c[i][j]=-1;
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(a[i][j]=='#'){
                for(int s=-1;s<=1;s++){
                    for(int t=-1;t<=1;t++){
                        if(a[i+s][j+t]=='.'&&(i+s)>=0&&(i+s)<H&&(j+t)>=0&&(j+t)<W){
                            c[i+s][j+t]++;
                        }
                    }
                }
            }
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(c[i][j]==-1) cout << a[i][j];
            else cout << c[i][j];
        }
    cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(x) begin(x),end(x)
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define pb push_back
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
//const int inf = 2e9+9;
const int mod = 1e9+7;
string s;
int main(){
    fast,cin>>s;
    if(s[0] == '7' || s[1] == '7' || s[2] == '7'){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3608
// parameter "input" gets all data
function Main(input) {
   // the first line is assigned to input[0], the second line is assigned to input[1] similarly.
    input = input.split("\n");
var f=[]
    let tmp = input[0].split(' ')
    const [n,m]=tmp
    let p=[]
    for (let i=1;i<=Number(m);i++){
        let [l,r]=input[i].split(' ')
        l=Number(l)
        r=Number(r)
      if (p[l]){
        p[l].push(r)
      } else {
        p[l]=[r]
      }
      if (p[r]){
        p[r].push(l)
      } else {
        p[r]=[l]
      }
    }
    f[1]=1
    let tot=0
    let ans=[1]
    let check=(index)=>{
        f[index] && tot++
        for (let j of p[index]){
            !f[j] && (f[j] = index) && ans.push(j)
        }
    }
while (ans.length>0){
    check(ans[0])
    ans.shift()
}

  console.log(tot === Number(n)?'Yes':'No')
  if (tot === Number(n)){
    for (let i=2;i<=Number(n);i++){
        console.log(f[i])
    }  
  }

}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;

int tab[3005][3005];

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

    string a, b;

    cin>>a>>b;

    for(int i=0; i<a.size(); i++){
        for(int j=0; j<b.size(); j++){

            if(a[i]==b[j]){
                tab[i+1][j+1]=tab[i][j]+1;
            }
            else{
                tab[i+1][j+1]=max(tab[i][j+1], tab[i+1][j]);
            }

        }
    }

   vector<char> w;

    int q=tab[a.size()][b.size()];


    int i=a.size()-1;
    int j=b.size()-1;

    while(i>=0 && i>=0){

        if(a[i]==b[j]){
            w.push_back(a[i]);
            i--;
            j--;
        }
        else{
            if(tab[i][j+1]>tab[i+1][j]){
                i--;
            }
            else{
                j--;
            }
        }
    }

    for(int i=q-1; i>=0; i--){
        cout<<w[i];
    }

    return 0;
}


Measured memory_bytes: 35456
num = int(input())
if num < 10:
  print(num)
elif num < 100:
  print(9)
elif num < 1000:
  print(num -90)
elif num < 10000:
  print(909)
elif num < 100000:
  print(num - 9090)
elif num == 100000:
  print(90909)

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

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

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

int main(){
  int A, B;
  cin >> A >> B;
  if (A == 0){
    A = 1;
  }else if (A == 1){
    A = 100;
  }else{
    A = 10000;
  }
  if (B == 100)
  {
    cout << A * (B + 1) << endl;
  }else{
    cout << A * B << endl;
  }
  return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST

main = getLine >>= print . solve . map read . words
solve :: [Int] -> Int
solve (n:k:_) = n - k + 1

Measured memory_bytes: 508
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;


int main() {
    int A, B;
    cin >> A >> B;

    int X = max(A + B, max(A - B, A * B));

    cout << X << endl;
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

const int p = 2019;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    vector<int> d(n+1, 0);
    int ten = 1;
    for(int i = n-1; i >= 0; i--){
        int a = (s[i] - '0') * ten % p;
        d[i] = (d[i+1] + a) % p;
        ten = (ten * 10) % p;
    }
    vector<int> cnt(p, 0);
    ll ans = 0;
    for(int i = n; i >= 0; i--){
        ans += cnt[d[i]]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4356
#include <stdio.h>

int rec( int i, int sum, int* A, int l ){

    int res;
    int a, b;
    

    // nothing to add
    if( i > l ){ res = 0;
    }


    // no more space
    else if( sum == 0 ){ res = 1;
    }

    else if( sum < A[i] ) res = rec( i+1, sum, A, l );

    //
    else {

        a = rec( i+1, sum-A[i], A, l );
        b = rec( i+1, sum, A, l );
        res = b + a;

    }
        
    return res;

}



int main(){

    int i;
    int n, q;
    int A[21], M[201];
    int sum;

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

    for( i=0; i<q; i++ ){
        if(rec( 0, M[i], A, n)>0)
            printf( "yes\n" );
        else
            printf( "no\n" );

    }
           
    return 0;
}


Measured memory_bytes: 2044
#include <stdio.h>
int main() {
  int N;
  scanf("%d", &N);
  if(N==1){
    printf("1\n");
  }
  else if(N%2==0){
    printf("0.5\n");    
  }
  else if(N%2==1){
    printf("%f\n",(((N-1.0)/2.0)+1.0)/N);    
  }
  
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

class Main {

    int n;
    int k;
    int[] d;

    Main(int n, int k, int[] d) {
        this.n = n;
        this.k = k;
        this.d = d;
    }

    boolean check(int m, int[] d) {
        int tmp = m;
        while (tmp != 0) {
            int r = tmp % 10;
            tmp /= 10;
            for (int di : d) {
                if (r == di) {
                    return false;
                }
            }
        }
        return true;
    }

    int solve() {

        int ans = n;

        while (!check(ans, d)) {
            ans++;
        }

        return ans;
    }

    public static void main(String args[]) {
        // input
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int d[] = new int[k];
        for (int i = 0; i < k; i++) {
            d[i] = sc.nextInt();
        }
        sc.close();

        // solve
        int ans = new Main(n, k, d).solve();

        // display
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124