akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll popcount(ll n){
    ll ret=0;
    while(n>0){
        ret+=n%2;
        n/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll bit[800010];
ll u;
void bitinit(ll n){
    ll y=1;
    rep(i,0,69){
        
        if(y>=n){
            u=y;
            break;
        }
        y*=2;
    }
    fill(bit,bit+u+10,0);
}
void add(ll n,ll x){
    ll i=n;
    bit[i]+=x;
    bit[i]%=mod;
    while(i<u){
        i+=i&(-i);
        bit[i]+=x;
        bit[i]%=mod;
    }
}
ll sum(ll n){
    ll i=n;
    ll ret=0;
    while(i>0){
        ret+=bit[i];
        i-=i&(-i);
        ret%=mod;
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n,d,a;cin>>n>>d>>a;
    ll x[n],h[n];
    vector<pll> v;
    rep(i,0,n){
        cin>>x[i]>>h[i];
        ll t=h[i]/a;
        if(h[i]%a!=0)t++;
        h[i]=t;
        v.push_back({x[i],h[i]});
    }
    sort(v.begin(),v.end());
    //rep(i,0,n)cout<<v[i].second<<endl;
    vector<ll> w;
    rep(i,0,n)w.push_back(v[i].first-d);
    bitinit(n+10);
    ll ans=0;
    rep(i,0,n){
        ll ss=sum(i+1);
        ll r=v[i].second+ss;
        if(r<=0)continue;
        ll y=lower_bound(w.begin(),w.end(),v[i].first+d+1)-w.begin();
        ans+=r;
       // cout<<y<<" "<<r<<endl;
        add(i+1,-r);
        add(y+1,r);
    }
    cout<<ans<<endl;
}



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

#define ll long long

const int mxK = 100;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    if (k>mxK)
        k = mxK;
    vector<int> a(n);
    for (int i=0; i!=n; ++i)
        cin >> a[i];
    while (k--) {
        vector<int> b(n+1, 0);
        for (int i=0; i!=n; ++i) {
            int l=max(0,i-a[i]), r=min(n-1, i+a[i]);
            ++b[l];
            --b[r+1];
        }
        for (int i=0; i!=n; ++i)
            b[i+1]+=b[i];
        a=b;
    }
    for (int i=0; i!=n; ++i)
        cout << (i==0?"":" ") << a[i];
    return 0;
}


Measured memory_bytes: 5560
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll A, ll B, ll C) {
  ll g = __gcd(A, B);
  cout << (C % g == 0) << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll A;
	ll C;
	ll B;
	scanf("%lld", &A);
	scanf("%lld", &B);
	scanf("%lld", &C);
	solve(A, B, C);
	return 0;
}


Measured memory_bytes: 256
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

A, B, N = MAP()

left, right = 0, N

def f(x):
    return int(A*x/B) - A*int(x/B)


# while right-left > 1:
#     mid1 = (left + right)*1// 3
#     mid2 = (left + right)*2// 3

#     if f(mid1) < f(mid2):
#         if left == mid1:
#             break
#         left = mid1
#     else:
#         if right == mid1:
#             break
#         right = mid2

# ans = f(left)
# for i in range(left, right+1):
#     ans = max(ans, f(i))
# print(ans)
# ans = 0
# # whilefor i in range(1, N+1):
# #     ans = max(ans, f(i))
# # print(ans)

# x = N//2
# if f(x) <= f(x)
# direc = "R"

ans = 0
if B > N:
    ans = f(N)
else:
    ans = f(B-1)

print(ans)

Measured memory_bytes: 9204
L,R=map(int,input().split())
_min=2018
if L==0:
  _min=0
elif R-L>=2019:
  _min=0
else:
  for l in range(L,R):
    for r in range(L+1,R+1):
      mm=(l*r)%2019
      if mm==0:
        _min=0
        break
      elif _min>mm:
        _min=mm
print(_min)    



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll MAX = 10000000;
int main(){
	int n,W;
	cin>> n >> W;
	int w[110];
	int v[110];
	vector<int>a;
	vector<int>b;
	vector<int>c;
	vector<int>d;
	for(int i=0; i<n; i++){
		cin>>w[i]>>v[i];
	}
	a.push_back(v[0]);
	for(int i=1; i<n; i++){
		if(w[0]==w[i])a.push_back(v[i]);
		if(w[0]+1==w[i])b.push_back(v[i]);
		if(w[0]+2==w[i])c.push_back(v[i]);
		if(w[0]+3==w[i])d.push_back(v[i]);
    }   	
    sort(a.rbegin(),a.rend());
	sort(b.rbegin(),b.rend());
	sort(c.rbegin(),c.rend());
	sort(d.rbegin(),d.rend());
	ll sum_a[110],sum_b[110],sum_c[110],sum_d[110];
	sum_a[0]=0,sum_b[0]=0,sum_c[0]=0,sum_d[0]=0;
	for(int i=0; i<a.size(); i++){
		sum_a[i+1]=sum_a[i]+a[i];
	}
	for(int i=0; i<b.size();  i++){
		sum_b[i+1]=sum_b[i]+b[i];
	}
	for(int i=0; i<c.size(); i++){
		sum_c[i+1]=sum_c[i]+c[i];
	}
	for(int i=0; i<d.size(); i++){
		sum_d[i+1]=sum_d[i]+d[i];
	}
	ll sum_weight;
	ll sum_value;
	vector<ll>answer;
	for(ll i=0; i<=a.size(); i++){
		for(ll j=0; j<=b.size(); j++){
			for(ll k=0; k<=c.size(); k++){
				for(ll l=0; l<=d.size(); l++){
					sum_weight=w[0]*i+(w[0]+1)*j+(w[0]+2)*k+(w[0]+3)*l;
					if(sum_weight>W){continue;}
					sum_value=sum_a[i]+sum_b[j]+sum_c[k]+sum_d[l];
					answer.push_back(sum_value);
   				}
			}
		}
	}
	sort(answer.rbegin(),answer.rend());
	cout<<answer[0]<<endl;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
#ifdef KEV
#define DE(i, e) cerr << #i << ' ' << i << e
void debug(auto L, auto R) { while (L < R) cerr << *L << " \n"[L+1==R], ++L; }
#else
#define DE(...) 0
void debug(...) {}
#endif
const int maxn = 300010, p = 1e9+7;
ll pf[maxn], a[maxn], n;
signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	for (int i = 1;i <= n;++i)
		cin >> a[i], pf[i] = pf[i-1] + a[i], pf[i] %= p;
	ll res = 0;
	for (int i = 2;i <= n;++i)
		res = (res + a[i] * pf[i-1]) % p;
	cout << res << '\n';
}



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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

#define clr(a,i) memset((a), (i) ,sizeof(a))

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int len(int x){
	int r = 0;
	while(x) r++, x /= 10;
	return r;
}
int main(){
	int n;
	cin >> n;
	int ans = 0;
	for(int i = 1; i <= n; i++){
		if(len(i)&1) ans++;
	}
	cout << ans << endl;
	return 0;
}


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

int32_t main(){
	ios::sync_with_stdio(false); cin.tie(0);
	int n, k;
	cin >> n >> k;
	int max = (n-1)*(n-2)/2;
	if(k > max){
	    cout << "-1\n";
	    return 0;
	}
	cout << n-1+(max-k) << '\n';
	for(int i = 2; i <= n; ++i)
	    cout << "1 " << i << '\n';
	int dif = max - k;
	for(int i = 2; i <= n; ++i){
	    for(int j = i+1; j <= n; ++j){
	        if(dif--)
	            cout << i << ' ' << j << '\n';
	        else return 0;
	    }
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#define N 500005
#define fi(a, b, c) for(int a = (b); a < (c); a++)
#define FI(a, b, c) for(int a = (b); a <= (c); a++)
using namespace std;

int n, last, ans, dp[N][4];
char s[N];
vector<int> v;

void calc(){
	int n = v.size();
	
	if(v[1] == 1){
		dp[1][3] = dp[1][1] = 0;
		dp[1][2] = -1e9;
		dp[1][0] = v[0];
	}else{
		dp[1][3] = 0;
		dp[1][2] = v[0];
		dp[1][1] = v[1] - 1;
		dp[1][0] = v[1];
	}
	
	fi(i, 2, n){
		// ltr
		dp[i][0] = max(dp[i - 1][3], max(dp[i - 1][1], dp[i - 1][2])) + v[i];
		dp[i][1] = dp[i][0] - 1;
		
		// rtl
		if(v[i] > 1) {
			dp[i][2] = 0;
			dp[i][2] = max(dp[i][2], dp[i - 1][3] + v[i - 1]);
			dp[i][2] = max(dp[i][2], dp[i - 1][2] + v[i - 1] - 1);
			dp[i][2] = max(dp[i][2], dp[i - 1][1] + 1);
		}else{
			dp[i][2] = -1e9;
			dp[i][0] = max(dp[i][0], dp[i - 1][3] + v[i - 1]);
			dp[i][0] = max(dp[i][0], dp[i - 1][2] + v[i - 1] - 1);
			dp[i][0] = max(dp[i][0], dp[i - 1][1] + 1);
		}
		
		dp[i][3] = max(max(dp[i - 1][0], dp[i - 1][1]), max(dp[i - 1][2], dp[i - 1][3]));
	}
	
	ans += max(max(dp[n - 1][2], dp[n - 1][3]), max(dp[n - 1][0], dp[n - 1][1]));
}

int main(){
	scanf("%d %s", &n, s);
	
	fi(i, 0, n){
		if(s[i] == '0'){
			if(i && s[i - 1] == '0'){
				if(v.size() > 1) calc();
				v.clear();
			}else{
				if(last) v.push_back(last);
				last = 0;
			}
		}else{
			last++;
		}
	}
	
	if(last) v.push_back(last);
	if(v.size() > 1) calc();
	
	printf("%d\n", ans);
}

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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  sort(v.begin(), v.end());

  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n; j++) {
      for (int k = j+1; k < n; k++) {
        int x = v.at(i);
        int y = v.at(j);
        int z = v.at(k);
        if (x != y && y != z && z != x && (x+y) > z) {
          ans++;
        }
      }
    }
  }

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

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


using namespace std;


#define ll long long
#define mk make_pair
#define pb push_back
#define ff first
#define sc second
#define all(x) x.begin(), x.end()
#define sz(x) (x).size()

ll gcd(ll a, ll b);

ll sum(int n);

void go(){
   int a,b;cin>>a>>b;
   if(a>12) {
      cout << b;
   }else if(a>5&&a<13) {
      cout << b/2;
   }else {
      cout << 0;
   }
}
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}

ll gcd(ll a, ll b){     
   if(b == 0) return a;
   
   return gcd(b, a % b);
}

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n,m;
LL f[55],g[55];
map<int,int> mp;

LL solve(LL n,LL l,LL r,LL ql,LL qr) {
	if (ql<=l && r<=qr) return g[n];
	if (n==1) {
		LL res=0; mp.clear();
		for (LL x=l+1;x<=r-1;x++) mp[x]=1;
		for (LL x=l;x<=qr;x++) res+=mp[x];
		return res;
	}
	LL mid=l+r>>1;
	LL res=0;
	if (ql<=mid-1) res+=solve(n-1,l+1,mid-1,ql,qr);
	if (qr>=mid+1) res+=solve(n-1,mid+1,r-1,ql,qr);
	if (ql<=mid && mid<=qr) res++;
	return res;
}

int main()
{
	cin>>n>>m;
	f[0]=g[0]=1; 
	for (int i=1;i<=n;i++) {
		f[i]=f[i-1]*2+3;
		g[i]=g[i-1]*2+1;
	}
	
	cout<<solve(n,1,f[n],1,m);	
	return 0;
} 

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

using namespace std;

typedef long long ll;

void solve() {
	string s;
	cin >> s;
	if (s == "SSS")
		cout << 0;
	else if (s == "RRR")
		cout << 3;
	else if (s == "SRR")
		cout << 2;
	else if (s == "RRS")
		cout << 2;
	else 
		cout << 1;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		cout << endl;
	}
}

Measured memory_bytes: 3648
S = input()
sr = ''
for i in S:
    sr = i + sr
lista = ['remaerd','resare','esare','maerd']
c = 0
while c == 0:
    c = 1
    for i in lista:
        
        if sr[0:len(i)] == i:
            sr = sr[len(i):]
            c = 0

if sr == '':
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3440
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr> () -> T {
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    let mut A: Vec<i64> = Vec::new();
    for _ in 0..N {
        A.push(read::<i64>());
    }
    let maxval = A.iter().max().unwrap();
    let minval = A.iter().min().unwrap();
    println!("{}", (maxval-minval).abs());
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define print(x) cout<<(x)<<'\n'
using ll=long long;
using pl=pair<ll,ll>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vs=vector<string>;

void solve() {
    string s;
    cin >> s;
    ll len = s.size();
    string sub = s.substr(2, len-3);
    ll cnt_lower = 0;
    for(char c:s){
        cnt_lower += islower(c)?1:0;
    }
    bool ok = s[0]=='A' && count(sub.cbegin(),sub.cend(),'C')==1 && cnt_lower==(len-2);
    print(ok?"AC":"WA");
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}


Measured memory_bytes: 3560
a,b,c,d = (int(i) for i in input().split())
x,y = c-a,d-b
print("R"*x+"U"*y+"L"*x+"D"*(y+1)+"R"*(x+1)+"U"*(y+1)+"L"+"U"+"L"*(x+1)+"D"*(y+1)+"R")

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cstring>

using namespace std;
int main(){
	 string a[105];
	 int n,m,x1[105],y1[105];
	 memset(x1,0,sizeof(x1));
	 memset(y1,0,sizeof(y1));
	 cin>>n>>m;
	 for(int i = 0;i < n;i++){
			 string s;
			 cin>>s;
			 a[i] = s;
 	}
	for(int i = 0;i < n;i++){
		int flag = 1;
		for(int j =0;j < m;j++){
			if(a[i][j] != '.'){
				flag = 0;
			}
		}
		if(flag){
			x1[i] = 1;
		}
	}
	for(int i = 0;i < m;i++){
		int flag = 1;
		for(int j = 0;j < n;j++){
			if(a[j][i] != '.'){
				flag = 0;
			}
		}
		if(flag){
			y1[i] = 1;
		}
	}
	for(int i = 0;i < n;i++){
		if(x1[i]) continue;
		for(int j = 0; j < m;j++){
			if(y1[j]) continue;
			cout<<a[i][j];
		}
		cout<<'\n';
	}
} 

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

int d = 1;
bool D[10001];
int H[10001], topo[10001];
pair<int, int> E[20002];
void dfs(int A) {
	if (!D[A]) {
		D[A] = true;
		topo[A] = d;
		d++;
		for (int i = H[A]; i; i = E[i].second) {
			dfs(E[i].first);
		}
	}
}

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 8 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	for (int i = 2; i < 2 * N; i += 2) {
		int a = getint(), b = getint();
		E[i] = mp(a, H[b]);
		H[b] = i;
		E[i + 1] = mp(b, H[a]);
		H[a] = i + 1;
	}

	int C[10000];
	int goukei = 0;
	rep(i, N) {
		C[i] = getint();
		goukei += C[i];
	}
	sort(C, C + N);

	dfs(1);

	const int dm = 1 << 17;
	char dn[dm], * di = dn;
	int X = goukei - C[N - 1];
	int keta = 0;
	char c[10];
	while (X) {
		*(c + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(c + i));
	*di++ = '\n';
	rep1(i, N) {
		X = C[N - topo[i]];
		keta = 0;
		while (X) {
			*(c + keta) = '0' + X % 10;
			X /= 10;
			keta++;
		}
		for (int i = keta - 1; i >= 0; i--)* di++ = (*(c + i));
		*di++ = ' ';
	}

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string t;
  cin>>t;
  
  int sum=700;
  if(t.at(0)=='o') sum=sum+100;
  if(t.at(1)=='o') sum+=100;
  if(t.at(2)=='o') sum+=100;
  cout<<sum<<endl;

}


Measured memory_bytes: 256
N, A, B = gets.chomp.split(" ").map(&:to_i)

output = 0

if A == 1 && B == 1 && N == 10000
  output = N
end

(1..N).each do |n|
  nn = n

  a = n / 1000
  n = n - a * 1000

  b = n / 100
  n = n - b * 100

  c = n / 10
  d = n - c * 10

  sum = a + b + c + d
  if sum.between?(A, B)
    output += nn
  end
end

puts output


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<ll>
#define mem(a) memset((a),0,sizeof(a))
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=55,mod=1e9+7;
const ll mod2=(ll)mod*mod*8;
ll dp[N][N],c[N][N];
inline void add(ll &a,ll b){
	a+=b; if(a>=mod2)a-=mod2;
}
int main(){
	int n=read();
	For(i,0,n)For(j,c[i][0]=1,i)c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	dp[1][0]=dp[1][1]=1;
	For(i,1,n-1)For(j,0,i)if(dp[i][j]){
		dp[i][j]%=mod;
		For(k,max(1,j),n-i){
			int jb=(k-j)/2;
			if((k-j)%2)continue; 
			ll x=dp[i][j]*c[i+k][i]%mod; 
			For(o,0,k)add(dp[i+k][abs(o-jb)],x*c[k][o]);
		}
	}
	cout<<dp[n][0]%mod<<endl;
}

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

using namespace std;

typedef long long ll; 
typedef long double ld;

int main() {
	
	// make input and output more efficient
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	
	
	// to read whole line
	//string s;
	//getline(cin, s);
	
	
	int N;
	
	cin >> N;
	
	int a[N];
	
	int x = 0;
	
	for(int i = 0; i<N; i++) {
		cin >> a[i];
		x ^= a[i];
	}
	
	for(int i = 0; i<N; i++) {
		a[i] ^= x;
		cout << a[i] << (i==N-1?"\n":" ");
	}
	return 0;
}

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

int H, W, a[502][502];
vector<int> ans;
int main(){
	scanf("%d %d", &H, &W);
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	for (int i = 0; i < H; i++) {
		if (i == H - 1) {
			for (int j = 0 ; j < W - 1; j++) {
				if (a[i][j] % 2 == 1) {
					a[i][j] -= 1;
					a[i][j + 1] += 1;
					ans.push_back(i);
					ans.push_back(j);
					ans.push_back(i);
					ans.push_back(j + 1);
				}
			}
			break;
		}
		for (int j = 0; j < W; j++) {
			if (j == W - 1) {
				if (a[i][j] % 2 == 1) {
					a[i][j] -= 1;
					a[i + 1][j] += 1;
					ans.push_back(i);
					ans.push_back(j);
					ans.push_back(i + 1);
					ans.push_back(j);
				}
				break;
			}
			if (a[i][j] % 2 == 1) {
				if (a[i][j + 1] % 2 == 1) {
					a[i][j] -= 1;
					a[i][j + 1] += 1;
					ans.push_back(i);
					ans.push_back(j);
					ans.push_back(i);
					ans.push_back(j + 1);
				} else {
					a[i][j] -= 1;
					a[i + 1][j] += 1;
					ans.push_back(i);
					ans.push_back(j);
					ans.push_back(i + 1);
					ans.push_back(j);
				}
			}
		}
	}
	printf("%d", (ans.size() + 1)/4);
	for (int i = 0; i < (ans.size() + 1)/4; i++) {
		printf("\n");
		for (int j = 0; j < 4; j++) {
			printf("%d", ans[i*4 + j] + 1);
			if (j != 3) {
				printf(" ");
			}
		}
	}
	/*for (int i = 0; i < H; i++) {
		printf("\n");
		for (int j = 0; j < W; j++) {
			printf("%d ", a[i][j]);
		}
	}*/
	return 0;
}

Measured memory_bytes: 5104
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,n) for(int i=1;i<=n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define len(s)   ((int)s.size())
#define F first
#define S second
#define pb push_back
#define pf push_front
#define mp make_pair
#define PI acos(-1.0)
typedef long long ll;
typedef double db;
typedef vector<ll> ve;
typedef vector< vector <int> >vee;
typedef vector<pair<int,int> >vepa;
typedef set<char>se;
typedef map<ll,ll> mpp;
const int N=1e5+5;
bool f;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
       string s1,s2;
       cin>>s1>>s2;
       s2.pop_back();
       if(s1==s2)
        cout<<"Yes";
       else
        cout<<"No";
go;
}


Measured memory_bytes: 3612
(defn input []
  (->> (repeatedly 2 read-line)
    (into [] (comp (mapcat #(clojure.string/split % #"\s"))
               (map #(Integer/parseInt %))))))

(defn TravelingAtCoDeer [[N & As]]
  (loop [As' (sort As)  result (int 0)]
    (if (= 1 (count As'))
      result
      (recur (rest As') (int (+ result (- (second As') (first As'))))))))

(->> (input)
  TravelingAtCoDeer
  println)

Measured memory_bytes: 68200
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')




# for _ in range(ii()):
    
s=si()
if 97<=ord(s)<=122:
    print('a')
else:
    print('A')



















Measured memory_bytes: 67308
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
  int n,m,l;
  double p;
  int t,v;
  double time[100][51],prob[100][51];

  cin >> n >> m >> l;
  for(int i=0;i<n;i++){
    cin >> p >> t >> v;
    p /= 100;
    for(int j=0;j<=m;j++)time[i][j] = (double)l/v + t*j;
  
    if(abs(p-1.0)<1e-10){
      for(int j=0;j<m;j++)prob[i][j] = 0.0;
      prob[i][m] = 1.0;
    }else{
      prob[i][0] = pow(1-p,m);
      for(int j=1;j<=m;j++){
	prob[i][j] = ( prob[i][j-1] * p * (m-j+1) ) / ( (1-p)*j );
      }
    }
  }
  
  for(int i=0;i<n;i++){
    double ans = 0.0;
    for(int j=0;j<=m;j++){
      double tmp = 1.0;
      for(int k=0;k<n;k++){
	if(k!=i){
	  double hoge = 0.0;
	  for(int l=m;l>=0;l--){
	    if(time[k][l] > time[i][j]){
	      hoge += prob[k][l];
	    }else break;
	  }
	    tmp *= hoge;
	}
      }
      ans += tmp*prob[i][j];
    }
    printf("%.8lf\n",ans);
  }
}

Measured memory_bytes: 1060
#include <bits/stdc++.h>
using namespace std;
const int N=1e2+5, M = 5e5+5, OO = 0x3f3f3f3f;
typedef long long ll;
#define PI 3.14159265358979323846
#define MOD 1000000007
bool prime[100005];
void seive(){
    memset(prime,1,sizeof prime);
    for (ll i=2; i*i<=100005; ++i){
        if (prime[i]){
            for (ll j=i*i; j<=100005; j+=i){
                prime[j]=0;
            }
        }
    }
}
int main()
{
    seive();
    int n; cin>>n;
    for (int i=n; i<=100005; ++i) if (prime[i]) return cout<<i,0;
   return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
ll t;
t=1;
//cin>>t;
while(t--){
ll n,k;
cin>>n>>k;
ll p[n+1], c[n+1];
ll ki=k;
for(int i=1; i<=n;i++)
cin>>p[i];

for(int i=1; i<=n;i++)
cin>>c[i];

ll ans=-9000000000000000000;

for(int i=1; i<=n;i++){
    
    k = ki;
    bool vis[n+1];
    memset(vis,0,sizeof(vis));
    ll j=i;
    ll temp=0;
    ll co=0;;
    while(vis[p[j]]!=1){
        j = p[j];
         vis[j]=1;
        temp+=c[j];
        co++;
        ans=max(temp,ans);
        //cout<<c[j]<<' ';
         if(co==k){
        ans=max(temp,ans);
            break;
         }
         
    }

   // cout<<temp<<endl;
    
   if(co==k)
   continue;
    
    if(k%co==0){
        temp= temp*(k/co-1);
        k=co;
    }else {
    temp= temp*(k/co);
    k= k%co;
    }
    while(k){
     ans=max(temp,ans);
       j = p[j];
        vis[j]=1;
        temp+=c[j];
        k--;
    }
ans=max(temp,ans);
}
cout<<ans;
}

}

Measured memory_bytes: 3676
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (b / a > c) P(c);
  else P(b / a);
  return 0;

}

Measured memory_bytes: 256
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((int64_t *)a) < *((int64_t *)b) ? -1 : 1;
}

int compare_f2(const void *a, const void *b) {
	return *((uint64_t *)a) > *((uint64_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

#define MOD_VAL (UINT64_C(1000000007))

#define LAST_POS_NONE ((size_t)1000000)

static uint64_t dp[200000];
static size_t lastPos[200000];

int main(void) {
	for (size_t i = 0; i < 200000; i++) {
		lastPos[i] = LAST_POS_NONE;
	}

	size_t N;
	size_t prevC = 0;

	scanf("%zu\n", &N);
	for (size_t i = 0; i < N; i++) {
		size_t C;

		scanf("%zu", &C);
		if (i < N - 1) {
			scanf("\n");
		}

		C--;
		
		if (i == 0) {
			dp[0] = 1;
		}
		else {
			if (lastPos[C] == LAST_POS_NONE) {
				dp[i] = dp[i - 1];
			}
			else {
				if (C == prevC) {
					dp[i] = dp[i - 1];
				}
				else {
					dp[i] = (dp[i - 1] + dp[lastPos[C]]) % MOD_VAL;
				}
			}
		}

		lastPos[C] = i;

		prevC = C;
	}

	printf("%"PRIu64, dp[N - 1]);

	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>

bool IsPalindrome(const std::string& target)
{
    std::string reverse = target;
    std::reverse(reverse.begin(), reverse.end());
    return (target.compare(reverse) == 0);
}

int main()
{
    std::string input;
    std::cin >> input;

    if (!IsPalindrome(input))
    {
        std::cout << "No";
        return 0;
    }

    const auto length = input.size();
    if (!IsPalindrome(input.substr(0, (length - 1) / 2)))
    {
        std::cout << "No";
        return 0;
    }

    const auto startPos = (length + 1) / 2;
    if (!IsPalindrome(input.substr(startPos)))
    {
        std::cout << "No";
        return 0;
    }

    std::cout << "Yes";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fr(i,n) for(ll i = 0 ; i < n ; ++i)
#define vi vector<ll>
#define pb push_back
#define mp make_pair
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	ll n,k;cin>>n>>k;
	ll ans = log(n)/log(k);
	cout<<++ans<<'\n';
}

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

using namespace std;

const int md = (int) 1e9 + 7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> f(n + 1);
  f[0] = 1;
  for (int i = 3; i <= n; i++) {
    for (int j = 3; j <= i; j++) {
      (f[i] += f[i - j]) %= md;
    }
  }
  cout << f[n] << endl;
  return 0;
}


Measured memory_bytes: 3620
#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; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    if(n >= k) n %= k;
    if(n > abs(n-k)) n = abs(n-k);
    cout << n << endl;
    return 0;
}


Measured memory_bytes: 3580
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#define N 1002
int main() {
	char card[N] = "", tmp[N], *p1, *p2 = "";
	int i, h, m, num, j;
	while (1) {
		tmp[0] = '\0';
		scanf("%s", tmp);
		if (strcmp(tmp, "-") == 0) break;
		scanf("%d", &m);
		for (i = 0; i < m; i++) {
			p1 = tmp;
			card[0] = '\0';
			p2 = card;
			scanf("%d", &h);
			strcat(p2, p1 + h);
			*(p1 + h) = '\0';
			strcat(p2, p1);
			*p1 = '\0';
			strcat(tmp, p2);
		}
		printf("%s\n", p2);
	}
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
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; }
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向


int n;
int h[101];

void input(){
    cin >> n;
    for(int i=0;i<n;i++) cin >> h[i];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    int cnt = 0;
    for(int l=0;l<n;l++){
        while(h[l] > 0){
            int r;
            for(r=l+1;r<n;r++){
                if (h[r] == 0) break; 
            }
            for(int x=l;x<r;x++) h[x]--;
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search;
#define lower(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Lower value search;
#define max3(a,b,c) max(max(a,b),c)//maximum value find three value;
#define min3(a,b,c) min(min(a,b),c)//minimum value find three value;
#define rep(i,intial,n) for(int i=intial; i<(n) ; i++)
#define REP(i,intial,n) for(int i=intial; i<=(n) ; i++)
#define PI acos(-1.0)//PI Calculation
#define LL long long
#define MP make_pair
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define MX 1000005
#define MOD 1000000007
template<typename T> T POW(T b,T p)          //Pow calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b);
        b=(b*b);
        p>>=1;
    }
    return r;
}

LL big_mod(LL n, LL p)
{
    if(p==0) return 1;
    if(!(p&1))
    {
        LL r = big_mod(n,p/2) % MOD;
        return ( (r%MOD) * (r%MOD) ) % MOD;
    }
    else return ( ( n%MOD) * (big_mod(n,p-1) %MOD)) % MOD;
}
long long gcd(long long a, long long b) {
  while (b != 0) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}

//||--------------------------->||Main_Code_Start_From_Here||<---------------------------------||
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    int n;
    while(cin>>n)
    {
        int ans;
        int maximum=0;
        int cnt;
        if(n==1)
        {
            cout<<"1"<<endl;
            continue;
        }
        for(int i=1;i<=n;i++)
        {
            int keep=i;
            cnt=0;
            while(keep%2==0)
            {
                cnt++;
                keep/=2;
            }
            if(maximum<cnt)
            {
                ans=i;
            maximum=max(maximum,cnt);
            }
        }
        cout<<ans<<endl;
    }


}



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

int main() {
    int c[3];
    for (int i = 0; i < 3; ++i) {
        cin >> c[i];
    }

    int M = max(c[0], c[1]);
    M = max(c[2], M);

    int p = 0;
    while (!(c[0] == c[1] && c[1] == c[2] && c[2] == c[0])) {
        vector<int> nonZero;
        int dA = M - c[0];
        if (dA != 0) {
            nonZero.push_back(0);
        }
        int dB = M - c[1];
        if (dB != 0) {
            nonZero.push_back(1);
        }
        int dC = M - c[2];
        if (dC != 0) {
            nonZero.push_back(2);
        }
        if (nonZero.size() == 1) {
            int x = nonZero.at(0);
            c[x] += 2;
        } else {
            for (auto x : nonZero) {
                c[x] += 1;
            }
        }
        M = max(c[0], c[1]);
        M = max(c[2], M);
        p++;
    }
    cout << p << endl;

    return 0;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> ans(n);
  for(int i=0; i<m; ++i){
    int a, b;
    cin >> a >> b;
    --a; --b;
    ++ans[a];
    ++ans[b];
  }
  for(int i=0; i<n; ++i){
    if(ans[i]%2){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 3796
def remov(n,a):

    mod=10**9+7

    k=[1]*(n+1)
    gk=k[:]
    kb1=k[:]

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

    gk[n]=pow(k[n],mod-2,mod)
    for i in range(n,0,-1):
        gk[i-1]=gk[i]*i%mod

    for i in range(1,n+1):
        kb1[i]=gk[i]*k[i-1]%mod

    kerui=[0]*(n+1)
    for i in range(1,n+1):
        kerui[i]=(kerui[i-1]+kb1[i])%mod

    ans=0
    for i in range(n):
        ans+=a[i]*(kerui[i+1]+kerui[n-i]-1)%mod
        ans%=mod
    ans*=k[n]

    return ans%mod

print(remov(int(input()),[int(i) for i in input().split()]))

Measured memory_bytes: 23184
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-26 15:24:07
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

using graph = std::vector<std::vector<int>>;

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

  int n, m; cin >> n >> m;
  graph g(n);
  for (int i = 0; i < m; ++i) {
    int a, b; cin >> a >> b;
    --a; --b;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }

  vector<int> order(n);
  iota(all(order), 0);

  int ans = 0;

  vector<int> visited(n, 0);

  do {
    if (order[0] != 0) break;
    visited.assign(n, 0);
    int cur = 0;
    bool flag = true;

    for (int i = 1; i < n; ++i) {
      if (find(all(g[cur]), order[i]) == g[cur].end()) {
        flag = false;
      } else {
        cur = order[i];
      }
    }
    if (flag) ++ans;
  } while (next_permutation(all(order)));

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = None

n = i_in()
ans = int(not n)

print(ans)


Measured memory_bytes: 9104
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] a = new int[N];
		
		long best = 0;
		for(int i=0; i<N; i++) {
			a[i] = sc.nextInt();
			best += Math.max(0, a[i]);
		}
		
		long addSum = 0;
		long subSum = 0;
		for(int i=0; i<K; i++) {
			addSum += Math.max(0, a[i]);
			subSum += Math.min(0, a[i]);
		}
		long minLoss = Math.min(addSum, -subSum);
	
		for(int i=K; i<N; i++) {
			addSum += Math.max(0, a[i]) - Math.max(0, a[i-K]);
			subSum += Math.min(0, a[i]) - Math.min(0, a[i-K]);
			minLoss = Math.min(minLoss, addSum);
			minLoss = Math.min(minLoss, -subSum);
		}
		
		System.out.println(best - minLoss);
		sc.close();
	}
}


Measured memory_bytes: 33416
s = input()
i = 0
p = []
tmp =[]
n = len(s)
while i<n-1:
    if(s[i]=="A" or s[i:i+2]=="BC"):
        if s[i]=="A":
            
            tmp.append(1)
            i+=1
        else:
            tmp.append(0)
            i+=2

    else:
        p.append(tmp)
        tmp = []
        i+=1
p.append(tmp)
res = 0
for i in range(len(p)):
    anum = 0
    bcnum = 0
    for j in range(len(p[i])):
        if p[i][j]:anum+=1
        else:
            res += (anum)
print(res)


Measured memory_bytes: 17896
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

int main()
{ 
    LL sum=0;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        if(i%5!=0&&i%3!=0){sum=sum+i;}
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
//m-time limit error,n-m-normal
int putere(int x,int y){
    if(y==0){
        return 1;
    }
    else{
        return x*putere(x,y-1);
    }
}
    int n,m;
    int main(){
        cin>>n>>m;
        cout<<putere(2,m)*((n-m)*100+m*1900)<<endl;
    }

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

using namespace std;

int findsum(int m){
	int sum = 0;
	while(m>0){
		sum += m%10;
		m /= 10;
	}
	return sum;
}

int main(){
	int n,a,b,l;
	cin >> n >> a >> b;
	int count = 0;

	for(int i=1;i<=n;i++){
		l = findsum(i);
		if(l>=a && l<=b) count += i;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "3", "2", "3" ].parse.expand.solve == 2 );
	assert( [ "100", "1", "1" ].parse.expand.solve == 10000 );
	assert( [ "5", "4", "2" ].parse.expand.solve == 8 );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto h = input.front.to!( long );
	input.popFront;
	auto w = input.front.to!( long );
	input.popFront;
	return tuple( n, h, w );
}

auto solve( long n, long h, long w )
{
	return ( n - h + 1 ) * ( n - w + 1 );
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

signed main(){
    ll n,k;
    string s;
    cin >> n >> s >> k;

    rep(i,0,n){
        if(s[i] != s[k-1]){
            cout << "*";
        }
        else cout << s[i];
    }
    cout << endl;
    return 0;
}


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

using namespace std;

#define INF 1000000000
#define INFLL 0x3f3f3f3f3f3f3f3fLL 
#define EPS 10e-9
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define st first
#define nd second
#define sz(v) int(v.size())
#define all(X) (X).begin(), (X).end()
#define FOR(I, A, B) for(int I = A; I < B; I++)
#define RFOR(I, A, B) for(int I = A; I >= B; I--)

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<iii> viii;
typedef vector<ll> vll;

int main(){
	ll a, b, c;
	scanf("%lld", &a);
	scanf("%lld.%lld", &b, &c);	
	b*=100;
	b+=c;
	printf("%lld\n", (a*b)/100);
	return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
int n, m;
const int N = 500;
const int M = 200000;
int xi[M], yi[M];
int f[N][N], GG[N], ans;
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= m; ++ i)
        cin >> xi[i] >> yi[i];
    for (int i = 1; i <= n; ++ i)
    {
        f[i][i] = 1;
        for (int j = m; j >= 1; -- j)
        {
            if (f[i][xi[j]] + f[i][yi[j]] == 2)
                GG[i] = 1;
            if (f[i][xi[j]] + f[i][yi[j]] == 0)
                continue;
            f[i][xi[j]] = f[i][yi[j]] = 1;
        }
    }
    for (int i = 1; i <= n; ++ i) if (!GG[i])
        for (int j = i + 1; j <= n; ++ j) if (!GG[j])
        {
            int cnt = 1;
            for (int k = 1; k <= n; ++ k)
                if (f[i][k] && f[j][k])
                    cnt = 0;
            ans += cnt;
        }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repri(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define repr(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define reprs(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define LF "\n"

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;
typedef vector<int> VI;
typedef vector<ll> VL;

ll N, Y;

void Main() {
	cin >> N >> Y;
	rep(x,N+1) {
		rep(y,N-x+1) {
			int z = N-x-y;
			if (10000*x + 5000*y + 1000*z == Y) {
				cout << x << " " << y << " " << z << LF;
				return;
			}
		}
	}
	cout << "-1 -1 -1\n";
	return;
}

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

Measured memory_bytes: 764
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  int price[3][2];
  for (int j = 0; j < 2; j++) {
    for (int i = 0; i < 3; i++) {
      cin >> price[i][j];
    }
  }
  int m = 0;
  {
    vector<int> dp(n + 1);
    for (int i = 0; i < 3; i++) {
      for (int d = 0; d + price[i][0] <= n; d++) {
        dp[d + price[i][0]] = max(dp[d + price[i][0]], dp[d] + price[i][1] - price[i][0]);
      }
    }
    for (int i = 0; i <= n; i++) {
      m = max(m, i + dp[i]);
    }
  }
  long long ans = 0;
  {
    vector<long long> dp(m + 1);
    for (int i = 0; i < 3; i++) {
      for (int d = 0; d + price[i][1] <= m; d++) {
        dp[d + price[i][1]] = max(dp[d + price[i][1]], dp[d] + price[i][0] - price[i][1]);
      }
    }
    for (long long i = 0; i <= m; i++) {
      ans = max(ans, i + dp[i]);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 195584