akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;
u64 over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  string s;
  cin >> s;
  string c = "CODEFESTIVAL2016";
  int cnt = 0;
  for (int i = 0; i < c.size(); ++i) {
    if (s[i] != c[i]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 1e9
int n,w,a[101][2];
ll dp[101][100005];
ll rec(int i=0,int weight=0)
{
    if(weight>w)
        return -INF;
    if(i==n)
        return 0;
    if(dp[i][weight]+1)
        return dp[i][weight];
    ll pick = a[i][1]+rec(i+1,weight+a[i][0]);
    ll leave = rec(i+1,weight);

    return dp[i][weight] = max(pick,leave);
}



int main()
{
    memset(dp,-1,sizeof(dp));
    cin >> n >> w;
    for(int i=0;i<n;i++)
    {
        cin >> a[i][0] >> a[i][1];
    }
    cout << rec();



    return 0;
}


Measured memory_bytes: 79104
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int a, b;
  string s,t;
  cin >> s ;

for(int i=0; i<s.size();i++){
  s[i]='x';
}
cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<tuple>
#include<set>
#include<utility>
#include<sstream>
#include<map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
#define INF 1000000007
#define MOD 1000000007
#define INF_LONG 1000000000000007
#define MOD_LONG 1000000000000007
int main() {
	int T, t, i, j, k, l, r, a, b, c, d, e, f, g, n, m, x, y, z;
	string s1, s2; vector<string> vs;
	ll xx, yy, zz;
	scanf("%lld%lld",&xx,&yy);
	if (xx%yy==0) {
		printf("-1\n");
	} else {
		for (zz=xx*2; zz%yy==0; zz+=xx);
		printf("%lld\n",zz);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,m,n) for(int i=m;i<n;i++)

int main() {
  int n;
  cin>>n;
  int a[n][n-1];
  rep(i,0,n){
    rep(j,0,n-1){
      int b;
      cin>>b;
      a[i][j]=b-1;
    }
  }
  int cur[n];
  rep(i,0,n) cur[i]=0;
  queue<int> q;
  rep(i,0,n) q.push(i);
  int p=n;
  int ans=0;
  while(p<n*n){
    int k=q.size();
    if(k==0) break;
    set<int> f;
    rep(i,0,k){
      int c=q.front();
      q.pop();
      if(!f.count(c)){
        int d=a[c][cur[c]];
        if(a[d][cur[d]]==c){
          p+=2;
          f.insert(d);
          if(cur[c]!=n-2){
            q.push(c);
          }
          if(cur[d]!=n-2){
            q.push(d);
          }
        }
      }
    }
    ans++;
    queue<int> r=q;
    while(r.size()){
      int e=r.front();
      r.pop();
      cur[e]++;
    }
  }
  if(p==n*n) cout<<ans<<endl;
  else cout<<-1<<endl;
}


Measured memory_bytes: 4224
package main

import (
	"fmt"
)

func main() {
	var s, moto string
	var ans int = 0
	moto = "CODEFESTIVAL2016"
	fmt.Scan(&s)
	for i := range s {
		if s[i] != moto[i] {
			ans++
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
using namespace std;
const int N=1e6+5;
typedef long long ll;
int n,m;
bool vis[N];
struct node{
    int v,nxt;
}edge[N*2];
int head[N],mcnt;
void add_edge(int u,int v){
    mcnt++;
    edge[mcnt].v=v;
    edge[mcnt].nxt=head[u];
    head[u]=mcnt;
}
map<int,int>f[N];
int dist[N];
int fa[N];
int cnt;
inline int find_father(int x){
    if(x==fa[x]) return x;
    return fa[x]=find_father(fa[x]);
}
void bfs(){
    queue<int>q;
    for(int i=1;i<=cnt;i++)
        dist[i]=-1,vis[1]=0;
    q.push(1);
    vis[1]=1;
    dist[1]=0;
    while(!q.empty()){
        int u=q.front();
        q.pop();
        for(int i=head[u];i;i=edge[i].nxt){
        //for(int i=0,sz=edge[u].size();i<sz;i++){
            int v=edge[i].v;
            //int v=edge[u][i];
            v=find_father(v);
            if(!vis[v]){
                dist[v]=dist[u]+1;
                q.push(v);
                vis[v]=1;
            }
        }
    }
}
void Read(int &x){
    char ch = getchar();x = 0;
    for (; ch < '0' || ch > '9'; ch = getchar());
    for (; ch >='0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
}
int main()
{
    while(~scanf("%d%d",&n,&m)){
        cnt=0;
        for(int i=1;i<=n;i++){
            f[i].clear();
            f[i][0]=++cnt;
        }
        for(int i=1;i<=n;i++)
            fa[i]=i;
        for(int i=1;i<=m;i++){
            int u,v,w;
            //scanf("%d%d%d",&u,&v,&w);
            Read(u),Read(v),Read(w);
            if(f[u].find(w)==f[u].end()){
                f[u][w]=++cnt;
                fa[cnt]=cnt;
            }
            u=f[u][w];
            u=find_father(u);
            if(f[v].find(w)==f[v].end()){
                f[v][w]=++cnt;
                fa[cnt]=cnt;
            }
            v=f[v][w];
            v=find_father(v);
            fa[fa[u]]=v;
        }
        mcnt=0;
        for(int i=1;i<=cnt;i++)
            head[i]=0;
        for(int i=1;i<=n;i++)
            for(map<int,int>::iterator it=f[i].begin();it!=f[i].end();it++){
                int j=it->second;
                j=find_father(j);
                //edge[i].push_back(j);
                //edge[j].push_back(i);
                add_edge(i,j);
                add_edge(j,i);
            }
        bfs();
        if(dist[n]==-1)
            puts("-1");
        else
            printf("%d\n",dist[n]/2);
    }
}


Measured memory_bytes: 92032
#include<bits/stdc++.h>
using namespace std;
#define int long long
#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 P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
void cmps(vector<int>&v,int &i){
	i=lower_bound(all(v),i)-v.begin();
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

map<int,int>mp;
int ans;
signed main(){
	int N;
	cin>>N;
	rep(i,N){
		int a;cin>>a;
		ans+=mp[i-a];
		mp[i+a]++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 26200
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;
 
using namespace std;
 
int ans, cnt;
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	string S;
	cin >> S;
 
	deque<char> deq;
	rep(i, S.size()) {
		deq.push_back(S[i]);
	}
 
 
	int Q;
	cin >> Q;
 
	bool revflg = true; // true:普通 false:逆方向
 
	rep(i, Q) {
		int t;
		cin >> t;
		if (t == 1) {
			revflg = !revflg;
		}
		else {
			int f;
			cin >> f;
 
			char c;
			cin >> c;
 
			if (f == 1) {
				if (revflg) {
					deq.push_front(c);
				}
				else {
					deq.push_back(c);
				}
 
			}
			else {
				if (revflg) {
					deq.push_back(c);
				}
				else {
					deq.push_front(c);
				}
 
			}
		}
	}
 
	if (revflg) {
		while (!deq.empty()) {
			cout << deq.front();
			deq.pop_front();
		}
	}
	else {
		while (!deq.empty()) {
			cout << deq.back();
			deq.pop_back();
		}
	}
 
	cout << "\n";
 
	return 0;
}

Measured memory_bytes: 976
#include<iostream>

using namespace std;
int main(){
	int n,m;
	while(cin>>n>>m&&n&&m){
		int d1[100];
		int d2[100];
		int s1=0,s2=0;
		for(int i=0;i<n;i++){cin>>d1[i];s1+=d1[i];}
		for(int i=0;i<m;i++){cin>>d2[i];s2+=d2[i];}
		int a1=-1,a2=-1;
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if((s1-d1[i]+d2[j]==s2-d2[j]+d1[i])){
					if(a1==-1 || a1+a2>d1[i]+d2[j]){
						a1=d1[i];
						a2=d2[j];
					}
				}
			}
		}
		if(a1!=-1)cout<<a1<<" "<<a2<<endl;
		else cout<<-1<<endl;
	}
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(){
  int n,a,b[4]={};
  scanf("%d",&n);
  while(n--){
    scanf("%d",&a);
    b[a%4]++;
  }
  if(b[1]+b[3]+b[0]==0)printf("%s\n",b[2]>1?"Yes":"No");
  else{
    if(b[2])b[1]++;
    printf("%s\n",b[1]+b[3]<b[0]+2?"Yes":"No");
  }
  return 0;
}
  


Measured memory_bytes: 128
N = int(input())
goods = list(map(int, input().split()))
if N == 2:
    print(sum(goods)/2)
else:
    while len(goods) > 2:
        goods = sorted(goods)
        a = goods.pop(0)
        b = goods.pop(0)
        goods.append((a+b)/2)
    print(sum(goods)/2)

        
        

Measured memory_bytes: 38512
#include<bits/stdc++.h>
#define title "title"
#define ll long long
#define ull unsigned ll
#define fix(x) fixed<<setprecision(x)
#define pii pair<int,int>
#define vint vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define red(i,a,b) for(int i=(a);i>=(b);i--)
#define db double
#define ld long db
using namespace std;
void Freopen(){
	freopen(title".in","r",stdin);
	freopen(title".out","w",stdout);
}
int read(){
	int g=0,f=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch&&ch<='9'){g=g*10+ch-'0';ch=getchar();}
	return g*f;
}
const int N=1e5+5;
int n,a[N],vis[N],maxn1,maxn2,maxn3,maxn4,k1,k2,ans;
signed main(){
	//freopen("a","r",stdin);
	n=read();
	rep(i,1,n)a[i]=read();
	for(int i=1;i<=n;i+=2){vis[a[i]]++;if(maxn1<vis[a[i]])maxn1=vis[a[i]],k1=a[i];}
	memset(vis,0,sizeof(vis));
	for(int i=2;i<=n;i+=2){vis[a[i]]++;if(maxn2<vis[a[i]])maxn2=vis[a[i]],k2=a[i];}
	if(k1^k2)return cout<<n-maxn1-maxn2,signed();
	memset(vis,0,sizeof(vis));
	for(int i=1;i<=n;i+=2){vis[a[i]]++;if(a[i]^k1)maxn3=max(maxn3,vis[a[i]]);}
	ans=n-maxn2-maxn3;
	memset(vis,0,sizeof(vis));
	for(int i=2;i<=n;i+=2){vis[a[i]]++;if(a[i]^k1)maxn4=max(maxn4,vis[a[i]]);}
	ans=min(ans,n-maxn1-maxn4);
	return cout<<ans,signed();
}

Measured memory_bytes: 4380
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

ll p[N], used[N];
int main()
{
	ll n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; i ++)
	{
		cin >> p[i];
	}
	int cur = 1;
	deque<int> v;
	used[1] = 1;
	v.pb(1);
	cur = p[cur];
	while(1 > 0)
	{
		if(used[cur])
		{
			while(v[0] != cur)
			{
				k --;
				if(k < 0)
					return cout << v.front() << '\n',0;
				v.pop_front();
			}
			break;
		}
		used[cur] = 1;
		v.pb(cur);
		cur = p[cur];
	}
	ll o = v.size();
	k %= o;
	cout << v[k];


	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 7436
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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; }

typedef long long ll;

using namespace std;
struct ed{int a,b,c;};
using P=pair<int,int>;
ll cal(int a,int b){return ((ll)a<<31)+b+1;}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,m;
  cin>>n>>m;
  vector<vector<int>>com(n);
  unordered_map<ll, int>num(n);
  vector<ed>es(m);
  if(m==0){cout<<-1<<endl;return 0;}

  rep(i,m)
  {
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;c--;
    es[i]={a,b,c};
    com[a].push_back(c);
    com[b].push_back(c);
  }
  int cnt=0;
  rep(i,n)
  {
    num[cal(i,-1)]=cnt++;
    sort(all(com[i]));
    com[i].erase(unique(all(com[i])),com[i].end());
    rep(j,com[i].size())
    {
      num[cal(i,com[i][j])]=cnt++;
    }
  }
  vector<int>dist(cnt+2,-1);
  vector<vector<P>>edge(cnt+2);
  rep(i,n)rep(j,com[i].size())
  {
    int t=num[cal(i,-1)];
    int tn=num[cal(i,com[i][j])];
    edge[t].push_back({1,tn});
    edge[tn].push_back({0,t});
  }
  rep(i,m)
  {
    int to=num[cal(es[i].a,es[i].c)],from=num[cal(es[i].b,es[i].c)];
    edge[to].push_back({0,from});
    edge[from].push_back({0,to});
  }
  int start=0,end=num[cal(n-1,-1)];
  priority_queue<P,vector<P>,greater<P>>q;
  q.push({0,start});
  while(!q.empty())
  {
    P tp=q.top();q.pop();
    if(dist[tp.second]!=-1)continue;
    dist[tp.second]=tp.first;
    for(P nn:edge[tp.second])
    {
      if(dist[nn.second]!=-1)continue;
      q.push({nn.first+tp.first,nn.second});
    }
  }
  cout<<dist[end]<<endl;
  //rep(i,dist.size())cout<<i<<" "<<dist[i]<<endl;
  //cout<<end<<endl;
  /*
  rep(i,edge.size())rep(j,edge[i].size())
  {
    cout<<i<<" "<<edge[i][j].first<<" "<<edge[i][j].second<<endl;
  }
*/


  return 0;

}


Measured memory_bytes: 66024
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int N, K, val[100000], mxs[100000], mns[100000];
vector<vector<int>> e;

void rec(int c, int p, int d, int &mx, int &mn, int &flag){
	
	if(val[c] != -1){
		if(flag == -1) flag = (val[c] ^ d) & 1;
		else if(flag != ((val[c] ^ d) & 1)){
			cout << "No" << endl;
			exit(0);
		}
	}
	
	int nmx = 1e9, nmn = -1e9;
	for(int i : e[c]) if(i != p){
		int tmx, tmn;
		rec(i, c, d + 1, tmx, tmn, flag);
		nmx = min(nmx, tmx + 1);
		nmn = max(nmn, tmn - 1);
	}
	if(val[c] != -1){
		nmx = min(nmx, val[c]);
		nmn = max(nmn, val[c]);
	}

	if(nmx < nmn){
		cout << "No" << endl;
		exit(0);
	}
	mns[c] = mn = nmn;
	mxs[c] = mx = nmx;
}
void pro(int c, int p){
	if(c == p) val[c] = mns[c];
	else{
		if(val[p] + 1 <= mxs[c]) val[c] = val[p] + 1;
		else{
			assert(val[p] - 1 >= mns[c]);
			val[c] = val[p] - 1;
		}
	} 
	for(int i : e[c]) if(i != p) pro(i, c);
}


int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	cin >> N;
	e.resize(N);
	rep(i, N - 1){
		int a, b; cin >> a >> b; a--; b--;
		e[a].push_back(b);
		e[b].push_back(a);
	}
	rep(i, N) val[i] = -1;
	cin >> K;
	rep(i, K){
		int v, p; cin >> v >> p; v--;
		val[v] = p;
	}
	int mx, mn, flag = -1;
	rec(0, 0, 0, mx, mn, flag);
	pro(0, 0);
	cout << "Yes" << endl;
	rep(i, N) cout << val[i] << endl;
	return 0;
}

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

using namespace std;
typedef long long unsigned int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main(void){
    string s; cin >> s;
    int dig = 0;
    REP(i, 4){
        if (s[i] == '+') {
            dig++;
        } else {
            dig--;
        }
    }
    cout << dig << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	int n;
	ll k;
	cin >> n >> k;
	ll* a = new ll[n];
	rep(i, n) cin >> a[i];
	sort(a, a + n);

	ll l = 0, r = a[n - 1] + 1, mid;
	while (l + 1 != r) {
		mid = (l + r) / 2;

		int p = upper_bound(a, a + n, mid) - a;
		ll sum = 0;
		REP(i, p, n) {
			sum += a[i] / mid + (a[i] % mid == 0 ? 0 : 1) - 1;
		}

		if (sum <= k) r = mid;
		else l = mid;
	}

	cout << r << "\n";

	return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  if ((A*B*1) % 2 !=0) {
    cout << "Yes" << endl;
    return 0;
  }
  if ((A*B*2) % 2 !=0) {
    cout << "Yes" << endl;
    return 0;
  }
  if ((A*B*3) % 2 !=0) {
    cout << "Yes" << endl;
    return 0;
  } 
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	if((a+b)==c||(a+c)==b||(b+c)==a) cout << "Yes" <<endl;
	else cout << "No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
using namespace std;
const int MAX = 1e5 + 10; //N
const ll MOD = 1e9 + 7;
int N, M, K, Q;
int A[MAX];

int main()
{
	int i, j;
	scanf("%d%d", &N, &K);
	int mini = INF;
	int minidx = -1;
	for (i = 1; i <= N; ++i) {
		scanf("%d", &A[i]);
		if (mini > A[i]) {
			mini = A[i];
			minidx = i;
		}
	}
	if (N == K) {
		printf("1");
		return 0;
	}
	int lcnt, rcnt;
	K--;
	mini = INF;
	for (i = 0; i <= K; ++i) {
		lcnt = max(minidx - i - 1, 0);
		rcnt = max(N - (minidx + K - i), 0);
		int tmp = (lcnt + K - 1) / K + (rcnt + K - 1) / K + 1;
		mini = min(mini, tmp);
	}
	printf("%d", mini);
}

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

int calc_digit(ll x){
    int res = 0;
    while(x > 0){
        x /= 10;
        res++;
    }
    return res;
}
int main()
{
    ll n; cin >> n;
    int res = calc_digit(n);
    
    //cout << res << endl;
    for(ll i=2;i*i <= n;i++){
        if(n % i == 0){
            res = min(res,calc_digit(n/i));
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long int
#define FIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(in) in.begin(), in.end()

int main(){
    FIO;
    string s;
    cin >> s;
    for(ll i = 0 ; i < s.size() ; i++){
        if(s[i] == 'R' && i%2 == 1){
            cout << "No" << endl;
            return 0;
        }else if(s[i] == 'L' && i%2 == 0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)
C = N.times.map{|i| B[i] - A[i] }

minus, plus = C.partition{|c| c<0 }
minus, plus = minus.inject(0,:+), plus.map{|p| p&~1 }.inject(0,:+)
explus = plus + 2*minus

puts(explus<0?'No':'Yes')


Measured memory_bytes: 3196
#include <iostream>
using namespace std;

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

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

	return 0;
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,b) FOR(i,0,b)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,b) ROF(i,0,b)

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define MOD(x,m) ((x)%(m)+(m))%(m)

const int maxm = 1e5+10, maxn = 5e4+10;

int n, m, t, x[maxm], y[maxm];
bitset<maxn> b[maxn], B;
bool dir[maxm];
int pos[maxn], cnt[maxn];

void print() {
	F0R(i,m) putchar(dir[i]?'v':'^');
}

void print1(int z) {
	B.reset();
	B.set(z);
	R0F(i,m) {
		dir[i] = B[y[i]];
		B[x[i]]=B[y[i]]=B[x[i]]|B[y[i]];
	}
	print();
}
void solve1() {
	F0R(i,n) b[i].set(i);
	R0F(i,m) b[x[i]] = b[y[i]] = (b[x[i]]|b[y[i]]);
//	F0R(i,n) cout << b[i] << endl;
	b[n].set();
	F0R(i,n) b[n] &= b[i];
	F0R(i,n) if (b[n].test(i)) { print1(i); return; }
	cout << -1 << endl;
}

void solve2() {
	if (n == 2) {
		cout << -1 << endl;
		return;
	}
	F0R(i,n) cnt[pos[i]=i]++;
	R0F(i,m) {
		if (pos[x[i]] != pos[y[i]]) {
			if (cnt[pos[x[i]]] > 1) {
				cnt[pos[x[i]]]--, cnt[pos[y[i]]]++;
				dir[i] = 1;
				pos[x[i]] = pos[y[i]];
			} else {
				cnt[pos[y[i]]]--, cnt[pos[x[i]]]++;
				dir[i] = 0;
				pos[y[i]] = pos[x[i]];
			}
		}
	}
	print();
}

int main() {
	cin >> n >> m >> t;
	F0R(i,m) {
		cin >> x[i] >> y[i];
		x[i]--, y[i]--;
	}
	if (t == 1) solve1();
	else solve2();
}


Measured memory_bytes: 306688
#include <iostream>
#include <map>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;
const int N = 3;
const int N2 = 9;
const int x[4] = {0, 0, 1, -1};
const int y[4] = {-1, 1, 0, 0};
const char ch[4] = {'l', 'r', 'd', 'u'};

class node{
public:
	int f[N2];
	int space;
	string str;
	bool operator< (const node& n) const
	{
		for (int i = 0; i < N2; ++i)
		{
			if (n.f[i] == f[i])
				continue;
			return f[i] > n.f[i];
		}
		return false;
	} 
};

bool Is_Return(const node& n)
{
	for (int i = 0; i < N2; ++i)
	{
		if (n.f[i] != i + 1)
			return false;
	}
	return true;
}

string bfs(node& n)
{
	queue<node> Q;
	map<node, bool> ans;
	Q.push(n);
	ans[n] = true;
	while (!Q.empty())
	{
		node u = Q.front();
		Q.pop();
		if (Is_Return(u))
			return u.str;
		int tx = u.space / N;
		int ty = u.space % N;
		for (int i = 0; i < 4; ++i)
		{
			int sx = tx + x[i];
			int sy = ty + y[i];
			if (sx < 0 || sy < 0 || sx >= N || sy >= N)
				continue;
			node v = u;
			swap(v.f[v.space], v.f[sx * N + sy]);
			v.space = sx * N + sy;
			if (!ans[v])
			{
				ans[v] = true;
				v.str += ch[i];
				Q.push(v);
			}
		}
	}
	return "unsolvable";
}

int main()
{
	node n;
	for (int i = 0; i < N2; ++i)
	{  
		cin >> n.f[i];
		if (n.f[i] == 0)
		{
			n.space = i;
			n.f[i] = N2;
		}
	}
	string s = bfs(n);
	cout << s.length() << endl;
	return 0;
}


Measured memory_bytes: 30628
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



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

  if(n == 1) cout << "Hello World"  << endl;
  if(n == 2){
    int a,b;
    cin >> a >> b;
    cout << a+b << endl;
  }
  return 0;
}


Measured memory_bytes: 3608
from itertools import accumulate
from bisect import bisect_left

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
acc_A = [0] + list(accumulate(A))
acc_B = [0] + list(accumulate(B))
res = 0
for i, a in enumerate(acc_A):
    if a > K:
        break
    idx = bisect_left(acc_B, K - a)
    idx = min(idx, M)
    if acc_B[idx] > K - a:
        idx -= 1
    res = max(res, i + idx)
print(res)

Measured memory_bytes: 50492
# C - *3 or /2

N = int(input())
A = list(int(a) for a in input().split())

def devide2(x):
    if x%2:
        return 0
    else:
        ret = 0
        while True:
            ret += 1
            x //= 2
            if x%2:
                return ret

ans = 0
for a in A:
    ans += devide2(a)
    
print(ans)

Measured memory_bytes: 10032
#include <stdio.h>

int main(void) {
  double n;
  scanf("%lf", &n);

  int ans;
  for (int i=1; i< n+1; i++) {
    if (i % 2 != 0) {
      ans++;
    }
  }

  printf("%lf\n", ans / n);
  return 0;
}

Measured memory_bytes: 128
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            var a = cin.ReadInt();
            var b = cin.ReadInt();
            WriteLine((a + b + (a + b) % 2) / 2);
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}

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

using namespace std;

using int64 = long long;

constexpr int MAX_VALUE = 200000;

constexpr int DEBUG = 0;

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

  int n; int64 k;
  cin >> n >> k;
  vector<int> xs(n);
  for (int i = 0; i < n; i++) cin >> xs[i];

  vector<vector<int>> value_to_positions(MAX_VALUE + 1);
  for (int i = 0; i < n; i++) {
    value_to_positions[xs[i]].push_back(i);
  }
  vector<int> position_to_per_value_position(n);
  for (int v = 0; v <= MAX_VALUE; v++) {
    for (int i = 0; i < value_to_positions[v].size(); i++) {
      position_to_per_value_position[value_to_positions[v][i]] = i;
    }
  }

  int current_position = 0;
  int64 current_turn = 0;
  vector<int64> first_turn(n, -1);
  bool found_loop = false;
  while (current_turn < k - 1) {
    if (!found_loop) {
      if (first_turn[current_position] >= 0) {
        int64 cycle = current_turn - first_turn[current_position];
        found_loop = true;

        current_turn = (k - 2 - current_turn) / cycle * cycle;
      } else {
        first_turn[current_position] = current_turn;
      }
    }


    int value = xs[current_position];
    int per_value_position = position_to_per_value_position[current_position];

    per_value_position++;
    if (per_value_position >= value_to_positions[value].size()) {
      per_value_position = 0;
      current_turn++;
    }

    int next_position = value_to_positions[value][per_value_position] + 1;
    if (next_position == n) {
      next_position = 0;
      current_turn++;
    }

    current_position = next_position;

    if (DEBUG) {
      cout << "current_turn: " << current_turn
          << " current_position: " << current_position << endl;
    }
  }

  if (DEBUG) {
    cout << "current_turn: " << current_turn
         << " current_position: " << current_position << endl;
  }

  if (current_turn == k) {
    if (current_position != 0) {
      cerr << "This case should not happen!" << endl;
      exit(1);
    }
    return 0;  // Output an empty list.
  }
  
  // current_turn == k - 1
  vector<int> stack;
  vector<int> in_stack(MAX_VALUE + 1);
  for (int i = current_position; i < n; i++) {
    if (in_stack[xs[i]]) {
      while (true) {
        int v = stack.back();
        stack.pop_back();
        in_stack[v] = 0;
        if (v == xs[i]) break;
      }
    } else {
      stack.push_back(xs[i]);
      in_stack[xs[i]] = 1;
    }
  }

  for (int i = 0; i < stack.size(); i++) {
    if (i > 0) cout << " ";
    cout << stack[i];
  }
  cout << endl;
}


Measured memory_bytes: 17272
N, M = map(int, input().split())
matches = []
i = 1
l = N // 2 - 1 if N % 2 == 0 else N // 2
while len(matches) < M:
    if l <= 0:
        i = N // 2 + 1 if N % 2 == 0 else N // 2 + 2
        l = N // 2 - 2 if N % 2 == 0 else N // 2 - 1
        continue
    matches.append((i, i+l))
    i += 1; l -= 2
for a, b in matches: print(a, b)

Measured memory_bytes: 21168
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define MOD 1000000007
#define all(c) c.begin(), c.end()
#define peek(v)      \
	for (auto i : v) \
		cout << i << ' ';
#define rep(i, begin, end) \
	for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

void solve()
{
	int K, S;
	cin >> K >> S;
	int count = 0;
	rep(i, 0, K + 1)
	{
		rep(j, 0, K + 1)
		{
			int x = S - i - j;
			if (x >= 0 && x <= K)
			{
				count += 1;
			}
		}
	}
	cout << count;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	solve();
	cerr << "\n\n~" << 500 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
}

Measured memory_bytes: 3616
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <cstdlib>
#include <memory>
#include <queue>
#include <cassert>
#include <cmath>
#include <ctime>
#include <complex>
#include <bitset>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <numeric>

using namespace std;

#define ws ws_____________________
#define y1 y1_____________________
#define y0 y0_____________________
#define left left_________________
#define right right_______________
#define next next_________________
#define prev prev_________________
#define hash hash_________________

#define pb push_back
#define fst first
#define snd second
#define mp make_pair 
#define sz(C) ((int) (C).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define ford(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define all(C) begin(C), end(C)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef long double ld;
typedef complex<double> cd;

#ifdef LOCAL
#define eprintf(args...) fprintf(stderr, args), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define FILE_NAME "a"

int n, m;
vvi a;

bool read() {
	if  (scanf("%d", &m) < 1) {
		return 0;
	}
	n = 2;
	a.assign(n, vi(m, -1));
	forn(i, n) {
		forn(j, m) {
			scanf("%d", &a[i][j]);
		}
	}
	return 1;
}

void remax(int& x, int y) {
	if  (x < y) {
		x = y;
	}
}

int solve() {
	vvi dp(n, vi(m, 0));
	dp[0][0] = a[0][0];
	forn(j, m) {
		forn(i, n) {
			if  (i + 1 < n) {
				remax(dp[i + 1][j], dp[i][j] + a[i + 1][j]);
			}
			if  (j + 1 < m) {
				remax(dp[i][j + 1], dp[i][j] + a[i][j + 1]);
			}
		}
	}
	return dp[n - 1][m - 1];
}

int main() {
#ifdef LOCAL
	freopen(FILE_NAME ".in", "r", stdin);
	// freopen(FILE_NAME ".out", "w", stdout);
#endif

	while (read()) {
		printf("%d\n", solve());
	}

#ifdef LOCAL
	eprintf("Time: %.10f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


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

using namespace std;

vector<string> BubbleSort(vector<string> vec)
{
  for(int i=0; i<vec.size(); i++) {
    for(int j=vec.size()-1; j>i; j--) {
      if(vec[j][1]-'0' < vec[j-1][1]-'0') swap(vec[j], vec[j-1]);
    }
  }
  
  return vec;  
}

vector<string> SelectionSort(vector<string> vec)
{
  for(int i=0; i<vec.size(); i++) {
    int mini = i;
    for(int j=i; j<vec.size(); j++) {
      if(vec[j][1]-'0' < vec[mini][1]-'0') mini = j;
    }
    swap(vec[i], vec[mini]);
  }
  
  return vec;
}

int main()
{
  int N; cin >> N;
  vector<string> raw(N);
  for(int i=0; i<N; i++) cin >> raw[i];
  
  vector<string> bSorted = BubbleSort(raw);

  for(int i=0; i<bSorted.size(); i++) {
    if(i) cout << " ";
    cout << bSorted[i];
  }
  cout << "\nStable" << endl;
  
  vector<string> selSorted = SelectionSort(raw);
  
  bool ok = true;
  for(int i=0; i<bSorted.size(); i++)
    ok = ok && (bSorted[i] == selSorted[i]);
  
  for(int i=0; i<selSorted.size(); i++) {
    if(i) cout << " ";
    cout << selSorted[i];
  }
  cout << endl;
  
  if(ok) cout << "Stable" << endl;
  else   cout << "Not stable" << endl;
  
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

const ll MOD = (1e9 + 7);

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

ll mpow(ll base, ll n)
{
    if (n == 0)
    {
        return 1ll;
    }
    ll prev = mpow(base, n / 2);
    if (n % 2 == 0)
    {
        return (prev * prev) % MOD;
    }
    else
    {
        return (((prev * prev) % MOD) * base) % MOD;
    }
}

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

map<ll, int> fact(ll n, vector<ll> &p)
{
    int i = 0;
    map<ll, int> ret;
    while (p[i] * p[i] <= n)
    {
        if (n % p[i] == 0)
        {
            while (n % p[i] == 0)
            {
                ret[p[i]]++;
                n /= p[i];
            }
        }
        i++;
    }
    ret[n]++;
    return ret;
}

bool isprime(ll n)
{
    ll c = 2;
    while (c * c < n)
    {
        if (n % c == 0)
            return false;
        c++;
    }
    return true;
}
int main(int argc, char const *argv[])
{

    vector<ll> prime;
    rep(i, 2, 1e6)
    {
        if (isprime(i))
        {
            prime.push_back(i);
        }
    }
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    map<int, int> l;

    rep(i, n)
    {
        auto ret = fact(a[i], prime);
        for (auto x : ret)
        {
            l[x.first] = max(l[x.first], x.second);
        }
    }
    ll l2 = 1;
    for (auto x : l)
    {
        l2 *= mpow(x.first, x.second);
        l2 %= MOD;
    }
    ll ans = 0;
    rep(i, n)
    {
        ans += l2 * mpow(a[i], MOD - 2);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1400
/* C++標準ヘッダファイル */
/* 文字列ライブラリ */
#include <string>

/* コンテナライブラリ */
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>

/* アルゴリズムライブラリ */
#include <algorithm>

/* 数値演算ライブラリ */
#include <cmath>
#include <math.h>

/* 入出力ライブラリ */
#include <iostream>

/* std使用<-namespace */
using namespace std;

/* define */
#define rpt(i, n) for(ll i = 0; i < (n); i++)  // リピート
#define PI (acos(-1))  // 円周率pi

/* typedef */
// long long
typedef long long ll;

// pair
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef pair<double, double> d_d;

/* main関数 */
int main(void) {
	string s;
	cin >> s;
	vector<string> l;
	l.push_back("none");
	l.push_back("SAT");
	l.push_back("FRI");
	l.push_back("THU");
	l.push_back("WED");
	l.push_back("TUE");
	l.push_back("MON");
	l.push_back("SUN");
	rpt(i, 8) {
		if (s == l[i]) {
			cout << i;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	double w,h,x,y,t;
	double s;
	while(cin>>w>>h>>x>>y)
	{
		s=w*h/2;
		if(w==x*2 && h==y*2)
			t=1;
		else
			t=0;
			printf("%.6lf ",s);
			cout<<t<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>

using namespace std;


int N, T, S;
int A[100000], B[100000];
int dp[3001][3001] = {};

int main() {
	cin >> N >> T >> S;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
	}

	for (int i = 1; i <= N; i++) {

		for (int j = 1; j <= T; j++) {
			dp[i][j] = dp[i][j - 1];
			dp[i][j] = max(dp[i][j], dp[i - 1][j]);

			if (j - B[i - 1] >= 0) {
				if (!(j > S && j - B[i - 1] < S)) {
					dp[i][j] = max(dp[i][j], dp[i - 1][j - B[i - 1]] + A[i - 1]);
				}
			}
		}
	}

	int ans = 0;
	for (int i = 1; i <= N; i++) {
		ans = max(ans, dp[i][T]);
	}

	cout << ans << endl;


	return 0;
}



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

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

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

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

ll mop(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}

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

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n;

signed main() {
	cin >> n;
	if (n==3) return cout << "2 5 63" << ln, 0;
	// N<=20000で、
	// 1) 30000以下の異なる正の整数のみからなる数列
	// 2) Sの全ての要素を割り切れる整数は存在しない -> 1個でも互いに素なペアがあればいい
	// 3) どのiについてもa[i]と(Σa)-a[i]のGCDは1でない
	// 2の倍数と3の倍数が[1,30000]の範囲に合わせて2万個ある
	// それをただ並べるだけじゃ3を満たさない
	// 2+4, 8+10, 14+16, ...は3の倍数 5000組10000数字
	// 3*1+3*3, 3*5+3*7, 3*9+3*11, ...は2の倍数 2500組5000数字
	// これら2グループをうまく足し合わせて調整 片方のみ使うのはダメ
	// 6の倍数で足りない部分を補う
	vi r;
	vpii a, b;
	vi c;
	
	for (int i = 8; i+2 <= 30000; i += 6) a.pb({i,i+2});
	for (int i = 15; i+6 <= 30000; i += 12) b.pb({i,i+6});
	for (int i = 6; i <= 30000; i += 6) c.pb(i);
	
	r.pb(2), r.pb(4), r.pb(3), r.pb(9);
	n -= 4;
	each(i,a) {
		if (n<=1) break;
		r.pb(i.fi), r.pb(i.se);
		n -= 2;
	}
	each(i,b) {
		if (n<=1) break;
		r.pb(i.fi), r.pb(i.se);
		n -= 2;
	}
	each(i,c) {
		if (n==0) break;
		r.pb(i);
		n -= 1;
	}
	rep(j,r.size()) cout << r[j] << bln(j,r.size());
}

Measured memory_bytes: 640
#include <stdio.h>

int main()
{
	int x, y;

	scanf("%d %d", &x, &y);

	int ans = 0;

	if (x <= 3) ans += 100000 * (4 - x);
	if (y <= 3) ans += 100000 * (4 - y);
	if (x == 1 && y == 1) ans += 400000;

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 128
import bisect
n = int(input())
p = [int(input()) for _ in range(n)]
idx = dict()
for i in range(n):
    idx[p[i]] = i
c = 0
cnt = 1
for i in range(1, n):
    if idx[i + 1] > idx[i]:
        cnt += 1
    else:
        c = max(c, cnt)
        cnt = 1
c = max(c, cnt)
print(n - c)


Measured memory_bytes: 35140
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
n = int(input())

n100 = (int)(n / 100)
if n100 == 1:
    n100 = 9
else:
    n100 = 1

n10 = (int)(n / 10) % 10
if n10== 1:
    n10 = 9
else:
    n10 = 1
    
n1 = n % 10
if n1 == 1:
    n1 = 9
else:
    n1 = 1
    
result = n100 * 100 + n10 * 10 + n1
print(result)


Measured memory_bytes: 3060
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)
const long double PI = (acos(-1));

int main() {

	int k;
	vector<int> a(5);
	
	rep(i, 0, 5) cin >> a[i];
	cin >> k;

	int ans = 0;

	rep(i, 0, 4) {
		rep(j, i, 5) {
			if (a[j] - a[i] > k) ans = 1;
		}
	}

	if (ans == 1) cout << ":(" << endl;
	else cout << "Yay!" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <unordered_map>
#include <vector>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
  ll k, x;
  cin >> k >> x;

  if (k * 500 >= x) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
/*input
3 3 1
2 1 2 3
.@.
.@.
.@.
*/
/*

**************************
*						 *
* AUTHOR :: knight_coder *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rrep(i,m,n)	for(lld i=m;i>=n;i--)
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
//change null_type to get ordered_map
#define N  100005
lld h,w,k;
bool check(lld x,lld y){
	if(x<0 or x>=h or y<0 or y>=w){
		return false;
	}
	return true;
}
void solve()
{
	cin >> h >> w >> k;
	lld x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	x1--,y1--,x2--,y2--;
	char c[h][w];
	rep(i,0,h){
		rep(j,0,w){
			cin >> c[i][j];
		}
	}
	bool vis[h][w];
	rep(i,0,h){
		rep(j,0,w){
			vis[i][j]=false;
		}
	}
	lld dst[h][w];
	rep(i,0,h){
		rep(j,0,w){
			dst[i][j]=1e18;
		}
	}
	priority_queue <pair<lld,pii>> pq;
	pq.push({0,{x1,y1}});
	while(!pq.empty()){
		pair<lld,pii> p=pq.top();
		pq.pop();
		lld X=p.S.F,Y=p.S.S;
		dst[X][Y]=-p.F;
		if(X==x2 && Y==y2){
			cout << -p.F << endl;
			return;
		}
		rep(i,1,k+1){
			if(check(X+i,Y) && !vis[X+i][Y] && c[X+i][Y]=='.'){
				vis[X+i][Y]=true;
				pq.push({p.F-1,{X+i,Y}});				
			}
			else if(!check(X+i,Y) or c[X+i][Y]=='@'){
				break;
			}
			if(dst[X+i][Y]<dst[X][Y]+1){
				break;
			}
		}
		rep(i,1,k+1){
			if(check(X-i,Y) && !vis[X-i][Y] && c[X-i][Y]=='.'){
				vis[X-i][Y]=true;
				pq.push({p.F-1,{X-i,Y}});				
			}
			else if(!check(X-i,Y) or c[X-i][Y]=='@'){
				break;
			}
			if(dst[X-i][Y]<dst[X][Y]+1){
				break;
			}
		}
		rep(i,1,k+1){
			if(check(X,Y+i) && !vis[X][Y+i] && c[X][Y+i]=='.'){
				vis[X][Y+i]=true;
				pq.push({p.F-1,{X,Y+i}});				
			}
			else if(!check(X,Y+i) or c[X][Y+i]=='@'){
				break;
			}
			if(dst[X][Y+i]<dst[X][Y]+1){
				break;
			}
		}
		rep(i,1,k+1){
			if(check(X,Y-i) && !vis[X][Y-i] && c[X][Y-i]=='.'){
				vis[X][Y-i]=true;
				pq.push({p.F-1,{X,Y-i}});				
			}
			else if(!check(X,Y-i) or c[X][Y-i]=='@'){
				break;
			}
			if(dst[X][Y-i]<dst[X][Y]+1){
				break;
			}
		}
	}
	cout << -1 << endl;
	return;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}


Measured memory_bytes: 16088
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n; cin >> n;
    cout << n / 3 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] A = new int[N];
    int check =0;
    for (int i =0; i<K; i++) {
      int d = sc.nextInt();
      for (int j =0; j<d; j++) {
        A[sc.nextInt() - 1]++;
      }
    }
    for (int i =0; i<N; i++) {
      if (A[i] == 0) {
        check++;
      }
    }
    System.out.println(check);
  }
}

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

using ll = int64_t;

constexpr ll COM_MAX = (ll)1e5;
constexpr long long MOD = (1e9+7);
vector<ll> fac(COM_MAX),finv(COM_MAX),inv(COM_MAX);
// 前処理
void comb_init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<COM_MAX;++i){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}
// 二項係数計算
ll comb(ll n,ll k){
  if(n<k)return 0;
  if(n<0||k<0)return 0;
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
// 重複組み合わせ
ll nHk(ll n,ll k){
  return comb(n+k-1,n-1);
}

template<ll MOD=ll(1e9+7)>
ll mod_pow(ll n,ll p){
  ll ans=1LL;
  while(p){
    if(p&1)ans*=n;
    n*=n;
    p>>=1;
    ans%=MOD;
    n%=MOD;
  }
  return ans;
}

signed main(){

  comb_init();
  ll n,k;
  cin>>n>>k;
  cout<<comb(k,n)<<endl;

}


Measured memory_bytes: 5048