akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ok cout<<"ok"<<endl
#define dbg(x) cout<<(#x)<<" is "<<x<<endl
using namespace std;
typedef long long ll;
const int N=2*100009;
int vis[N],ar[N];
ll ans[N][2];
ll nc2(ll n)
{
   ll a;
   if(n<2) return 0;
   a=(n*(n-1))/2;
   return a;
}
int main()
{
  int i,j,n,r;
  ll sum=0,a;
  scanf("%d",&n);
  for(i=1; i<=n; i++)
  {
     scanf("%d",&r);
     ar[i]=r;
     vis[r]++;
  }
  
  for(i=1; i<=n; i++)
  {
     if(vis[i])
     {
        ans[i][0]=nc2(vis[i]);
        ans[i][1]=nc2(vis[i]-1);
        sum+=ans[i][0];
     }
  }

  for(i=1; i<=n; i++)
  {
     r=ar[i];
     a=sum-ans[r][0]+ans[r][1];
     printf("%lld\n", a);
  }
  return 0;
}

Measured memory_bytes: 6272
#include<iostream>
#include<algorithm>
#include<math.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, n) for (int i = a; i <= (n); ++i)
#define yorn(f) puts((f) ? "Yes" : "No")
#define YORN(f) puts((f) ? "YES" : "NO")

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main() {
    int N; cin >> N;
    int L; cin >> L;
    string S[110]; rep(i, N) cin >> S[i];

    sort(S, S+N);

    string res = "";
    rep(i, N) res += S[i];

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 380
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <string>
#include <math.h>
#include <time.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
int main() {
	int n, x, mn=1e9, ans=0, m;
	cin >> n >> x;
	for (int i = 0; i < n; ++i) {
		cin >> m;
		mn = min(mn, m);
		x -= m;
		++ans;
	}
	ans += x / mn;
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 10056
#define mod2 20071027
//#define mod 1000074259
#define base 139
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case %lld:\n", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
const ll N=300010;
string s, t;
int main()
{
    cin>>s>>t;
    cout<<t+s<<endl;
    return 0;
}
/*

*/


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	int[] k = new int[101];
	public void kami() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 100){
			for(int x = 1; x <= n; x++){
				 k[x] = sc.nextInt();
			}

			for(int i = n; i >= 2; i--){
				System.out.print(k[i] + " ");
			}
			System.out.print(k[1]);
		}
		System.out.println();
	}

	public static void main(String[] args) {

		new Main().kami();
	}

}

Measured memory_bytes: 19080
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int n,v[105],d[105];
vector<int>m[105];
void bfs(int s)
{
    v[s]=true;
    d[s]=0;
    queue<int>q;
    q.push(s);
    while(!q.empty())
    {
        int u=q.front();q.pop();
        for(auto i:m[u])
        {
            int vv=i;
             if(!v[vv])
            {
                d[i]=d[u]+1;
                v[i]=true;
                q.push(i);
            }
        }
    }
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)d[i]=-1;
    for(int i=1;i<=n;i++)
    {
        int u,v,k;
        cin>>u>>k;
        for(int j=0;j<k;j++)
        {
            cin>>v;
            m[u-1].push_back(v-1);
        }
    }
    bfs(0);
    for(int i=0;i<n;i++)cout<<i+1<<' '<<d[i]<<endl;
    return 0;
}



Measured memory_bytes: 3092
S = int(input())
MOD = 10 ** 9 + 7

dp = [0] * (S + 1)
dp[0] = 1
for i in range(1, S + 1):
    for j in range((i - 3) + 1):
        dp[i] += dp[j]
        dp[i] %= MOD
print(dp[S] % MOD)


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

int main(){
  string a;
  cin>>a;
  int b=a.size(),c=0,d=0;
  for(int i=0;i<b;i++){
    if(a.at(i)=='0')
      c++;
    else
      d++;
  }
  cout<<b-abs(c-d)<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = (int)1e6+7;

int N;
ll K;
ll A[MAXN],F[MAXN],ned[MAXN];

bool OK(ll mn) {
    ll res = 0;
    rep(i,1,N) {
        ned[i] = mn/F[i];
        res += max(0LL,A[i]-ned[i]);
    }
    return res <= K;
}

int main()
{
    scanf("%d %lld",&N,&K);
    rep(i,1,N) scanf("%lld",&A[i]);
    rep(i,1,N) scanf("%lld",&F[i]);
    sort(F+1,F+1+N);
    sort(A+1,A+1+N,greater<int>());
    ll l = 0,r = 1e12;
    while (l <= r) {
        ll m = l+r>>1;
        if (OK(m)) r = m-1;
        else       l = m+1;
    }
    printf("%lld\n",l);
}


Measured memory_bytes: 9984
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int N,M;
int acc[100010];

int main ()
{
    cin >> N >> M;
    REP(i,M) {
        int L,R;
        cin >> L >> R;
        acc[L]++;
        acc[R + 1]--;
    }

    REP(i,100005) {
        acc[i + 1] = acc[i + 1] + acc[i];
    }

    int ans = 0;
    for (int i = 1; i <= N; i++) {
        if (acc[i] == M) {
            ans++;
        }
    }

    for (int i = 1; i <= N; i++) {
        cerr << acc[i] << " ";
    }
    cerr << endl;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, L, R, H, W;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int num[2000000] = {};
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> L >> R;
		for (int j = L; j <= R; j++) {
			M++;
		}
	}
	cout << M << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
const int N=1e5+5;
int n,m,ans;
struct ufSet {
    int fa[N+5];
    inline void init()
	{
		for(int i=1;i<=n;i++)fa[i]=i;
	}
    int find(int x)
	{
		return x!=fa[x]?fa[x]=find(fa[x]):x;
	}
    inline void merge(int x,int y)
	{
		fa[find(x)]=find(y);
	}
} s;
int main()
{
	n=read();m=read();
	s.init();
	for(int i=1;i<=m;i++)
	{
		int u=read(),v=read(),w=read();
		s.merge(u,v);
	}
	for(int i=1;i<=n;i++)
		if(s.fa[i]==i)ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
//nomura2020_a.cpp
//Sun Jul  5 19:33:32 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int h1,m1,h2,m2,k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;

	int total = (h2-h1)*60;
	if (m2>=m1){
		total+=m2-m1;
	}else {
		total-=m1-m2;
	}
	cout << max(total - k,0) << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define F(a,b,c,d) for (register int a=b;a<=c;a+=d)
#define FD(a,b,c,d) for (register int a=b;a>=c;a-=d)
using namespace std;
const int M=1100;
long long a[M],b[M],c[M],a1[M],b1[M],c1[M],f[M],ans=-10000000000000;
int n,m;
int main(){
	
	cin>>n>>m;
	for (int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
for (int i=1;i<=m;i++)
	{
		f[i]=-30000000000000+100;
	}
	for (int i=1;i<=n;i++)
	{
		a1[i]=a[i]*1;
		b1[i]=b[i]*1;
		c1[i]=c[i]*1;
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=m;j>0;j--)
		{
			f[j]=max(a1[i]+b1[i]+c1[i]+f[j-1],f[j]);
		}
	}
	ans=max(ans,f[m]);
	//cout<<f[m]<<" "<<f[1]<<endl;
for (int i=1;i<=m;i++)
	{
		f[i]=-30000000000000+100;
	}
	for (int i=1;i<=n;i++)
	{
		a1[i]=a[i]*-1;
		b1[i]=b[i]*1;
		c1[i]=c[i]*1;
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=m;j>0;j--)
		{
			f[j]=max(a1[i]+b1[i]+c1[i]+f[j-1],f[j]);
		}
	}
	ans=max(ans,f[m]);
	//cout<<f[m]<<endl;
for (int i=1;i<=m;i++)
	{
		f[i]=-30000000000000+100;
	}
	for (int i=1;i<=n;i++)
	{
		a1[i]=a[i]*1;
		b1[i]=b[i]*-1;
		c1[i]=c[i]*1;
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=m;j>0;j--)
		{
			f[j]=max(a1[i]+b1[i]+c1[i]+f[j-1],f[j]);
		}
	}
	ans=max(ans,f[m]);
	//cout<<f[m]<<endl;
for (int i=1;i<=m;i++)
	{
		f[i]=-30000000000000+100;
	}
	for (int i=1;i<=n;i++)
	{
		a1[i]=a[i]*1;
		b1[i]=b[i]*1;
		c1[i]=c[i]*-1;
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=m;j>0;j--)
		{
			f[j]=max(a1[i]+b1[i]+c1[i]+f[j-1],f[j]);
		}
	}
	ans=max(ans,f[m]);
	//cout<<f[m]<<endl;
for (int i=1;i<=m;i++)
	{
		f[i]=-30000000000000+100;
	}
	for (int i=1;i<=n;i++)
	{
		a1[i]=a[i]*-1;
		b1[i]=b[i]*-1;
		c1[i]=c[i]*1;
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=m;j>0;j--)
		{
			f[j]=max(a1[i]+b1[i]+c1[i]+f[j-1],f[j]);
		}
	}
	ans=max(ans,f[m]);
	//cout<<f[m]<<endl;
for (int i=1;i<=m;i++)
	{
		f[i]=-30000000000000+100;
	}
	for (int i=1;i<=n;i++)
	{
		a1[i]=a[i]*1;
		b1[i]=b[i]*-1;
		c1[i]=c[i]*-1;
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=m;j>0;j--)
		{
			f[j]=max(a1[i]+b1[i]+c1[i]+f[j-1],f[j]);
		}
	}
	ans=max(ans,f[m]);
	//cout<<f[m]<<endl;
for (int i=1;i<=m;i++)
	{
		f[i]=-30000000000000+100;
	}
	for (int i=1;i<=n;i++)
	{
		a1[i]=a[i]*-1;
		b1[i]=b[i]*1;
		c1[i]=c[i]*-1;
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=m;j>0;j--)
		{
			f[j]=max(a1[i]+b1[i]+c1[i]+f[j-1],f[j]);
		}
	}
	ans=max(ans,f[m]);
	//cout<<f[m]<<endl;
	for (int i=1;i<=m;i++)
	{
		f[i]=-30000000000000+100;
	}
	for (int i=1;i<=n;i++)
	{
		a1[i]=a[i]*-1;
		b1[i]=b[i]*-1;
		c1[i]=c[i]*-1;
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=m;j>0;j--)
		{
		 f[j]=max(a1[i]+b1[i]+c1[i]+f[j-1],f[j]);
		}
	}
	ans=max(ans,f[m]);
	//cout<<f[m]<<endl;
	cout<<ans<<endl;
	return 0;
}





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

int N, U, V;
vector< int > tree[100000];
bool v[100000];

void rec(int idx, int step, bool f)
{
  if(step == 0) return;
  if(f) {
    for(int to : tree[idx]) {
      if(v[to]++) continue;
      rec(to, step - 1, f);
      return;
    }
  } else {
    reverse(tree[idx].begin(), tree[idx].end());
    for(int to : tree[idx]) {
      if(v[to]++) continue;
      rec(to, step - 1, f);
      reverse(tree[idx].begin(), tree[idx].end());
      return;
    }
    reverse(tree[idx].begin(), tree[idx].end());
  }
}

int main()
{

  cin >> N >> U >> V;
  --U, --V;
  for(int i = 0; i < N - 1; i++) {
    int A, B;
    cin >> A >> B;
    --A, --B;
    tree[A].push_back(B);
    tree[B].push_back(A);
  }
  if(N == 2) {
    cout << "Yes" << endl;
    exit(0);
  }
  if(N % 2 == 1) {
    cout << "No" << endl;
    exit(0);
  }
  
  for(int i = 0; i < tree[U].size(); i++) {
    for(int j = 0; j < tree[V].size(); j++) {
      for(int k = 0; k < 2; k++) {
        for(int l = 0; l < 2; l++) {
          if(tree[U][i] == tree[V][j]) continue;
          memset(v, false, sizeof(v));
          v[U] = true;
          v[V] = true;
          v[tree[U][i]] = true;
          v[tree[V][j]] = true;

          rec(tree[U][i], N / 2 - 2, k);
          rec(tree[V][j], N / 2 - 2, l);
          if(count(v, v + N, true) == N) {
            cout << "Yes" << endl;
            exit(0);
          }
        }
      }
    }
  }

  cout << "No" << endl;

}

Measured memory_bytes: 10276
#include<stdio.h>

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


    scanf("%d%d",&a,&b);

    if(a<b){
        printf("a < b\n");
    }
    else if(a>b){
        printf("a > b\n");
    }
    else if(a==b){
        printf("a == b\n");
    }
    return 0;
}



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

const int ind = 1e5 + 5;





int main () {
    
    int arr[ind];
    memset(arr, 0, sizeof arr);
    int n, x;
    cin >> n;

    long long ans = 0;

    for (int i = 0; i < n; i++) {
        cin >> x;
        ans += x;
        arr[x]++;
    }

    int q;
    cin >> q;
    int a, b;
    while (q--) {
        cin >> a >> b;

        int temp = arr[a];
        arr[a] = 0;
        arr[b] += temp;

        ans += temp * (b - a);

        cout << ans << "\n";

    }
    return 0;
}

Measured memory_bytes: 3984
#include <stdio.h>
int main() {
    int a, b, d, r;
    double f;
    scanf("%d %d", &a, &b);
    d = a / b;
    r = a%b;
    f = (double)a / (double)b;
    printf("%d %d %f\n", d, r, f);
    return 0;
}

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

#define INF 99999999
int main() {
	int N;
	cin >> N;
	vector<int> d(N);
	for (int i = 0; i < N; i++) {
		cin >> d[i];
		d[i] /= 10;
	}
	int dmax = d[0];
	bool flag = false;
	for (int i = 1; i <= dmax; i++) {
		if (i + d[i] > dmax) dmax = i + d[i];
		if (dmax >= N - 1) {
			flag = true;
			break;
		}
	}
	if (flag == false) {
		cout << "no" << endl;
		return 0;
	}

	reverse(d.begin(), d.end());
	dmax = d[0];
	flag = false;
	for (int i = 1; i <= dmax; i++) {
		if (i + d[i] > dmax) dmax = i + d[i];
		if (dmax >= N - 1) {
			flag = true;
			break;
		}
	}
	if (flag == false) {
		cout << "no" << endl;
		return 0;
	}
	cout << "yes" << endl;
	return 0;
}


Measured memory_bytes: 3816
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int> p;
	for (int i = 0;i < n;i++)
	{
		int num;
		cin >> num;
		p.push_back(num);
	}
	int oper;
	cin >> oper;
	while (oper--)
	{
		int head, end;
		cin >> head >> end;
		if (end >= n)
		{
			vector<int>::iterator p1 = p.end();
			p1--;
			int temp = *p1;
			reverse(&p[head], &p[end - 1]);
			p.pop_back();
			p.insert(p.begin()+head, temp);
		}
		else
		{
			reverse(&p[head], &p[end]);
		}
	}
	vector<int>::iterator pp = p.begin();
	while (pp != p.end())
	{
		cout << *pp;
		if (++pp == p.end())cout << endl;
		else cout << " ";
	}
}


Measured memory_bytes: 3128
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
using namespace std;
struct Node
{
    int key;
    Node *right,*left,*parent;
};
Node *root,*NIL;

Node *find(Node *u,int k)
{
    while(u!=NIL&&k!=u->key)
    {
        if(k<u->key)u=u->left;
        else u=u->right;
    }
    return u;
}

void insert(int k)
{
    Node *y=NIL;
    Node *x=root;
    Node *z;

    z=(Node *)malloc(sizeof(Node));
    z->key=k;
    z->left=NIL;
    z->right=NIL;

    while(x!=NIL)
    {
        y=x;
        if(z->key<x->key)
        {
            x=x->left;
        }
        else
        {
            x=x->right;
        }
    }
    z->parent=y;
    if(y==NIL)
    {
        root=z;
    }
    else
    {
       if(z->key<y->key)
       {
            y->left=z;
       }
     else
     {
        y->right=z;
     }
    }
}
void inorder(Node *u)
{
    if(u==NIL)return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u)
{
    if(u==NIL)return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}
int main()
{
    int n,i,x;
    string com;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        cin>>com;
        if(com[0]=='f')
        {
            scanf("%d", &x);
            Node *t=find(root,x);
            if(t!=NIL)printf("yes\n");
            else printf("no\n");
        }
        else if(com=="insert")
        {
            scanf("%d",&x);
            insert(x);
        }
        else if(com=="print")
        {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 22000
# vim: set fileencoding=utf-8:


def main():
    N, A, B = map(int, raw_input().split())
    # 10^4なので全探索
    ans = 0

    for i, _ in enumerate(xrange(N), 1):
        n = map(int, str(i))
        if A <= sum(n) <= B:
            ans += i

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2568
def main():
    N = int(input())
    A = list(map(int,input().split()))
    
    SUM = [sum(A)]
    for i in range(1,N):
        SUM.append((SUM[i-1]-A[i-1])%(10**9+7))
    
    ans = 0
    for i in range(N-1):
        ans += A[i]*SUM[i+1]
        ans = ans%(10**9+7)
    
    print(ans)
    
if __name__ == '__main__':
    main()

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N;
vector <Pii> ans;

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

  if (N % 2 == 0){
    for (int i = 1; i <= N; i++){
      for (int j = i + 1; j <= N; j++){
        if (i + j == N + 1) continue;
        ans.push_back({i, j});
      }
    }
  }else{
    for (int i = 1; i < N; i++){
      ans.push_back({i, N});
    }
    for (int i = 1; i < N; i++){
      for (int j = i + 1; j < N; j++){
        if (i + j == N) continue;
        ans.push_back({i, j});
      }
    }

  }


  int M = ans.size();
  cout << M << endl;
  for (int i = 0; i < M; i++){
    cout << ans[i].fi << " " << ans[i].se << endl;
  }

  return 0;
}


Measured memory_bytes: 3728
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

vector<string> solve(int n) {
	vector<string> res;
	if (n == 1) {
		res.pb("a");
	}
	else {
		vector<string> prev = solve(n - 1);
		rep(i, prev.size()) {
			int cnt = 0;
			rep(j, n - 1) {
				int c = prev[i][j] - 'a';
				chmax(cnt, c);
			}
			cnt += 2;
			rep(j, cnt) {
				char c = 'a' + j;
				res.pb(prev[i] + c);
			}
		}
	}
	return res;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n;
	cin >> n;
	vector<string> ans = solve(n);
	for (string s : ans) cout << s << endl;
}

Measured memory_bytes: 10956
N = int(input())

keta = len(str(N))

ans = 0
if keta % 2:
    ans += N + 1 - 10 ** (keta - 1)

for i in range(keta-1):
    if i % 2 == 0:
        ans += 9 * 10 ** i

print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
#define int long long

int32_t main()
{
    int n;cin>>n;
    vector<int> v(n+1);
    v[0]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        v[i]+=v[i-1];
    }
    int x=abs(v[1]-(v[n]-v[1]));
    for(int i=1;i<=n;i++)
    {
        if(abs(v[i]-(v[n]-v[i]))<=x)
        {
            x=abs(v[i]-(v[n]-v[i]));
        }
    }
    cout<<x;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

const long MOD = 1e9 + 7;
int main()
{
  long w,a,b;
  cin >> w >> a >>b ;


	long ans = min(abs(b-a-w),abs(a-b-w));
  
  if (abs(b-a) <= w)ans=0;

  cout << ans << endl;

  return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define INF 1LL<<62
#define inf 1000000007

ll n,m,ans[100010];
vector<ll>ch[100010];
void dep(ll now){
	ll out=-2;
	if(now==0){
		out=-1;
	}
	for(ll i=0;i<ch[now].size();i++){
		ll next=ch[now][i];
		if(ans[next]!=INF){
			continue;
		}
		ans[next]=m+out;
		out--;
		dep(next);
	}
}
int main() {
	cin>>n>>m;
	for(ll i=0;i<n-1;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		ch[x].push_back(y);
		ch[y].push_back(x);
	}
	for(ll i=0;i<n;i++){
		ans[i]=INF;
	}
	ans[0]=m;
	dep(0);
	ll ans2=1;
	for(ll i=0;i<n;i++){
		ans2*=ans[i];
//		cout <<ans[i]<<endl;
		ans2%=inf;
	}
	cout <<ans2;
	return 0;
}

Measured memory_bytes: 13364
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

const int64_t MAX = 1000010;
const int64_t MOD = 1000000007;
int64_t fac[MAX];

void make_fac() {
    fac[0] = fac[1] = 1;
    for (int64_t i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
    }
}

void solve()
{
    int64_t N, M;
    std::cin >> N >> M;

    make_fac();

    int64_t ans;
    if (std::abs(N - M) > 1)
    {
        ans = 0;
    }
    else if (N == M)
    {
        ans = 2 * fac[M] * fac[N] % MOD;
    }
    else {
        ans = fac[M] * fac[N] % MOD;
    }

    std::cout << ans << std::endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}


Measured memory_bytes: 11456
//It doesn't matter how slow you go, Unless you don't stop.
#include<iostream>
#include<algorithm>
#include<bitset>
 
#include<cmath>
#include<cstring>
#include<climits>
 
#include<deque>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
 
#include<fstream>
#include<chrono>
using namespace std;
 
typedef long long LL;
typedef pair<LL,LL> p64;
typedef vector<LL> v64;
typedef map<LL,LL> mp64;
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,s,e) for(long long i=s;i<=e;i++)
#define brep(i,s,e) for(long long i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define DANGER std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
int r[300005],c[300005]; 
void solve()
{
     int n,m,q;cin>>n>>m>>q;
     map<pair<int,int>,int> tgt;
     int mxr=0,mxc=0;
     while(q--){
         int x,y;cin>>x>>y;
         tgt[{x,y}] = 1;
         r[x]++;
         c[y]++;
     }
     for(int i=0;i<=n;i++){
         mxr = max(mxr,r[i]);
     }
     for(int i=0;i<=m;i++){
         mxc = max(mxc,c[i]);
     }
     vector<int> row;
     vector<int> col;
     for(int i=0;i<=n;i++){
         if(mxr==r[i]){
             row.pb(i);
         }
     }
     for(int i=0;i<=m;i++){
         if(mxc==c[i]){ 
             col.pb(i);
         }
     }
     for(int i=0;i<row.size();i++){
         int x = row[i];
         for(int j=0;j<col.size();j++){
             int y = col[j];
             if(tgt[{x,y}]==0){
                 cout<<mxr+mxc<<endl;
                 return;
             }
         }
     }
     cout<<mxr+mxc-1<<endl;
}
 
int main()
{
    DANGER;
    ofstream out("output.txt");
 
    auto start = chrono::high_resolution_clock::now();
    
    LL t = 1;
    // cin>>t;
    rep(test,1,t)
    {
        solve();
    }
    
    auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::milliseconds>(stop - start); 
    // cout << "Time taken by function: " << duration.count() << " milliseconds" << endl;
}

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

const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_c() {
	ll n, m;
	ll k;
	//ll x;
	//ll a;
	string s;
	string s_ans;
	ll l_ans = 0;
	double d_ans = 0;
	
	cin >> n >> m >> k;

	V a(n), b(m);
	V sa(n + 1, 0), sb(m + 1, 0);
	rep(i, n) {
		cin >> a[i];
		sa[i + 1] = sa[i] + a[i];
	}
	rep(i, m) {
		cin >> b[i];
		sb[i + 1] = sb[i] + b[i];
	}

	ll nb;
	rep(i, n + 1) {
		if (sa[i] <= k) {
			if (k - sa[i] > 0) {
				auto itr = upper_bound(ALL(sb), k - sa[i]);
				nb = (ll)(itr - sb.begin()) - 1;
				if (nb < 0) nb = 0;
				l_ans = max(l_ans, i + nb);
			}
			else {
				l_ans = max(l_ans, i);
			}
		}
	}

	cout << l_ans << "\n";
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed;
	cout << setprecision(15);

	solve_abc_c();

	return 0;
}


Measured memory_bytes: 9492
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

typedef
tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
}

void solve() {
    string s;
    cin >> s;
    ll ans = 0;
    int n = s.length();
    forn(mask, 1 << (n - 1)){
        ll x = 0;
        forn(j, n - 1){
            x = 10 * x + (s[j] - '0');
            if (mask & (1 << j)){
                ans += x;
                x = 0;
            }
        }
        x = 10 * x + s[n - 1] - '0';
        ans += x;
    }
    cout << ans << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

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

int main() {
    std::string S, T;
    std::cin >> S >> T;

    int ans = 0;
    for (size_t i = 0; i < S.size(); ++i) {
        if (S[i] != T[i]) {
            ++ans;
        }
    }


    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3824
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

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

#define all(a) (a).begin(), (a).end()

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

    int n, k; cin>>n>>k;

    ll head = 0, tail = 0;
    for(int i=0; i<k; i++) head += i, tail += n - i;

    ll ans = tail - head + 1;

    for(int i=k; i<=n; i++){
        head += i, tail += n - i;
        ans += tail - head + 1;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3656
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <map>

struct Hoge {
  int y, p;
  size_t i;
  int x=0;
  Hoge() {}
  Hoge(int y, int p, size_t i): y(y), p(p), i(i) {}

  bool operator <(const Hoge& other) const {
    return y < other.y;
    // if (y != other.y) return y < other.y;
    // if (p != other.p) return p < other.p;
    // return i < other.i;
  }
};

int main() {
  size_t N, M;
  scanf("%zu %zu", &N, &M);

  std::vector<Hoge> h;
  for (size_t i=0; i<M; ++i) {
    int p, y;
    scanf("%d %d", &p, &y);
    h.emplace_back(y, p, i);
  }

  std::sort(h.begin(), h.end());
  std::map<int, int> id;
  for (size_t i=0; i<M; ++i) {
    int y=h[i].y;
    int p=h[i].p;
    h[i].x = ++id[p];
  }

  std::vector<Hoge> res(M);
  for (size_t i=0; i<M; ++i) {
    res[h[i].i] = h[i];
  }
  for (size_t i=0; i<M; ++i) {
    printf("%06d%06d\n", res[i].p, res[i].x);
  }
}


Measured memory_bytes: 11376
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define ll long long
const ll  maxn=1e3+10;
map<string,int>mp,vis;
string s[maxn];
string str[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,q;

    cin>>n;
    rep(i,1,n)
    {
      cin>>s[i];
      mp[s[i]]++;
    }
    cin>>q;
    rep(i,1,q)
    {
        cin>>str[i];
        vis[str[i]]++;
    }
    int res=0;
    rep(i,1,n)
    {
        res=max(res,mp[s[i]]-vis[s[i]]);
    }
    cout<<res<<endl;

}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

const int S = 60;
int dp[S+10][2];
 
signed main() {
    int N, K; cin >> N >> K;
    vector<int> info(S);

    for(int i=0; i<N; i++) {
        int val; cin >> val;
        for(int k=0; k<S; k++) {
            info[k] += (val >> k & 1);
        }
    }
    reverse(info.begin(), info.end());

    string s = "";
    for(int i=0; i<S; i++) {
        s += (char)('0' + (K >> i & 1));
    }
    reverse(s.begin(), s.end());

    fill(dp[0], dp[S+1], -1);
    dp[0][0] = 0;
    for(int i=0; i<S; i++) {
        for(int f=0; f<2; f++) {
            if(dp[i][f] < 0) continue;
            int lim = f ? 1 : s[i] - '0';
            // fprintf(stderr, "i = %lld, f = %lld, lim = %lld\n", i, f, lim);
            for(int x=0; x<=lim; x++) {
                int val = (1LL << (S - i - 1));
                int add = (x == 0 ? info[i] : N - info[i]) * val;
                int nf = f || x < lim;
                chmax(dp[i+1][nf], dp[i][f] + add);
            }
        }
    }
    cout << max(dp[S][0], dp[S][1]) << endl;
    return 0;
}


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

int main() {
    int M, D;
    cin >> M >> D;
    int d1 = D % 10;
    int d10 = D / 10;

    int count = 0;
    for(int i = 1;i <= M; i++)
    {
        for(int j = 1; j <= D; j++)
        {
            int m = i;
            int d1 = j % 10;
            int d10 = j / 10;

            if(d1 >= 2 && d10 >= 2 && d1 * d10 == m)count++;
        }
    }

    cout << count << endl;
    return 0;  

}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

clock_t time_p = clock();

void rtime() {
    time_p = clock() - time_p;
    cerr << "Time Taken : " << (float) 1000 * (time_p) / CLOCKS_PER_SEC << "\n";
}

#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int INF=1e15;
const int MOD=1e9+7;
const int N=2e5+10;

void solve() {
    int n,k;
    cin>>n>>k;
    int cnt[n+1];
    memset(cnt,0,sizeof(cnt));
    for(int i=1;i<=k;i++) {
        int x;
        cin>>x;
        for(int j=1;j<=x;j++) {
            int y;
            cin>>y;
            cnt[y]++;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++) {
        ans+=(cnt[i]==0)?1:0;
    }
    cout<<ans<<"\n";
}

signed main() {
//#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//#endif
    IOS;
    int t = 1;
//    cin >> t;
    for(int i=1;i<=t;i++) {
//        cout<<"Case #"<<tc<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<string>

using namespace std;

	struct item{
		
		long long wei,val;
		
	} ITEMS[109];
	long long dp[100090];

int main(){

	int n; cin >> n;
	long long w; cin >> w;
	long long sol = 0;
	for(int i = 0; i < n; i++){
		cin >> ITEMS[i].wei >> ITEMS[i].val;
		
		for(int j = w; j >= 0; j--){
			if(j + ITEMS[i].wei > w) continue;
			dp[j + ITEMS[i].wei] = max(dp[j + ITEMS[i].wei] , dp[j] + ITEMS[i].val);
		}
	}
	for(int j = w; j >= 0; j--){
		sol = max(dp[j],sol);
	}	 cout << sol;
	
		





	return 0;
}


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

int main()
{
   int l,r,d;
   cin>>l>>r>>d;
   if(l%d==0)
   {
     cout<<((r/d)-(l/d)+1);
   }
  else
  {
    cout<<(r/d)-(l/d);
  }
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

int main() {
	vi v;
	int i = 2, n, max=-1,ans;
	cin >> n;
	v.push_back(i);
	while (i*2<=100) {
		i *= 2;
		v.push_back(i);
	}
	if (n < 2) {
		cout << 1 << endl;
		return 0;
	}
	for (int j = 0; j < v.size();j++) {
		if (n < v[j]) {
			cout << v[j - 1] << endl;
			return 0;
		}
	}
	cout << 64 << endl;
}


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

int main() {
  double a, b, x;
  cin >> a >> b >> x;

  double ans;
  if ((x / a) >= (a * b) / 2) {
    ans = 90 - (atan(1 / ((2 * b / a) - (2 * x / (a * a * a)))) * 180 / M_PI);
  } else {
    ans = atan((a * b * b) / (2 * x)) * 180 / M_PI;
  }

  cout << setprecision(12) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma warning (disable :4996)
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const double PI = cos(-1.0);
const double eps = 1e-8;
#define For(i,n,m) for(ll i=n;i<=m;++i)

ll a[1000001], b[10000001];
ll n;
ll cnt;
void merge(ll le, ll mid, ll ri) {
	ll i = le, j = mid + 1, t = le;
	while (i <= mid && j <= ri) {
		if (a[i] <= a[j]) b[t++] = a[i++], ++cnt;
		else b[t++] = a[j++], ++cnt;
	}
	while (i <= mid) b[t++] = a[i++], ++cnt;
	while (j <= ri) b[t++] = a[j++], ++cnt;
	For(i, le, ri) a[i] = b[i];
}
void mergesort(ll le, ll ri) {
	if (le < ri) {
		ll mid = (le + ri) / 2;
		mergesort(le, mid);
		mergesort(mid + 1, ri);
		merge(le, mid, ri);
	}
}
int main() {
	ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
	cin >> n;
	For(i, 1, n) cin >> a[i];
	mergesort(1, n);
	For(i, 1, n) { if (i != 1) cout << " "; cout << a[i]; }
	cout << "\n" << cnt << "\n";
}


Measured memory_bytes: 10916
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

n,d = readints()

ans = 0
for i in range(n):
    x,y = readints()
    if x**2+y**2<=d**2:
        ans+=1
print(ans)

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

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  string str;
  cin >> str;
  vector<bool> ans(N);
  int decided=0;
  int h=0;
  for(int i=0; i<N; i++){
    if(str[i]=='c'){
      ans[i]=false;
    }
    else if(str[i]=='a' && decided<A+B){
      ans[i]=true;
      decided++;
    }
    else if(str[i]=='b' && decided<A+B){
      h++;
      if(h<=B){
        ans[i]=true;
        decided++;
      }
      else ans[i]=false;
    }
    else ans[i]=false;
  }
  for(int i=0; i<N; i++){
    if(ans[i]) cout << "Yes" <<endl;
    else cout << "No" <<endl;
  }
}

Measured memory_bytes: 896
import io,sys
sys.setrecursionlimit(10**6)


def main():
    a,v = map(int,sys.stdin.readline().rstrip().split())
    b,w = map(int,sys.stdin.readline().rstrip().split())
    t = int(input())

    l = abs(a-b)
    p = v-w

    if p > 0 and l/p <= t:
        print("YES")
    else:
        print("NO") 
main()

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

long long mygcd(long long a,long long b)
{
	return b?mygcd(b,a%b):a;
}

void mokou()
{
	long long a,b,c,d;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	if(a<b || d<b)
	{
		puts("No");
		return;
	}
	a%=b;
	if(c>=b-1)
	{
		puts("Yes");
		return;
	}
	long long e=mygcd(b,d);
	//cout<<a<<" "<<b<<" "<<c<<" "<<e<<endl;
	puts((b-a-1)/e==(c-a)/e && a<=c?"Yes":"No");
}

int main()
{
	int t;
	scanf("%d",&t);
	for(int i=0;i<t;i++)
	{
		mokou();
	}
	return 0;
}

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

struct UnionFind {
	const int V;
	// par[x] := xのroot
	vector<int> par;
	// sz[x] := xを含む集合のサイズ
	vector<int> sz;
	UnionFind(const int V) :
		V(V),
		par(vector<int>(V)),
		sz(vector<int>(V, 1))
		{
			for(int i = 0; i < V; ++i) par[i] = i;
		}
	bool unite(int x, int y) {
		x = root(x), y = root(y);
		if(same(x, y)) return false;
		if(y < x) swap(x, y);
		par[y] = x;
		sz[x] += sz[y];
		return true;
	}
	int root(int x) {
		if(par[x] == x) return x;
		return (par[x] = root(par[x]));
	}
	bool same(int x, int y) {
		return (root(x) == root(y));
	}
	int size(int x) {
		return sz[root(x)];
	}
};

struct BipartiteGraph {
	struct Edge {
		const int from;
		const int to;
		Edge(const int from, const int to) :
			from(from),
			to(to)
			{}
	};
	const int V;
	vector<vector<Edge>> G;
	vector<int> color;
	BipartiteGraph(const int V) :
		V(V),
		G(vector<vector<Edge>>(V, vector<Edge>())),
		color(vector<int>(V, -1))
		{}
	void addEdge(const int from, const int to) {
		G[from].emplace_back(from, to);
		G[to].emplace_back(to, from);
	}
	bool dfs(const int from, const int col) {
		color[from] = col;
		bool ret = true;
		for(Edge e : G[from]) {
			if(color[e.to] == -1) {
				ret &= dfs(e.to, col ^ 1);
			}
			if(color[e.to] == col) {
				return false;
			}
		}
		return ret;
	}
	int bipart() {
		if(not dfs(0, 0)) throw "NOT Bipartite Graph";
		int ret = 0;
		for(int i : color) ret += i;
		return ret;
	}
};

int main() {
	int n, m; cin >> n >> m;
	bool g[n][n] = {};
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < n; ++j) {
			if(i == j) continue;
			g[i][j] = true;
		}
	}
	while(m--) {
		int a, b; cin >> a >> b;
		--a; --b;
		g[a][b] = g[b][a] = false;
	}
	UnionFind uf(n);
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < n; ++j) {
			if(g[i][j]) {
				uf.unite(i, j);
			}
		}
	}
	set<int> v[n];
	for(int i = 0; i < n; ++i) {
		v[uf.root(i)].insert(i);
	}
	set<int> S = {0};
	for(int i = 0; i < n; ++i) {
		int nn = v[i].size();
		if(nn == 0) continue;
		map<int, int> mp;
		int cnt = 0;
		for(int x : v[i]) {
			mp[x] = cnt;
			++cnt;
		}
		BipartiteGraph bg(nn);
		for(int x : v[i]) {
			for(int y : v[i]) {
				if(g[x][y]) {
					bg.addEdge(mp[x], mp[y]);
				}
			}
		}
		try {
			int s = bg.bipart();
			set<int> tmp;
			for(int ss : S) {
				tmp.insert(s + ss);
				tmp.insert((nn - s) + ss);
			}
			S = tmp;
		}
		catch(...) {
			cout << -1 << '\n';
			return 0;
		}
	}
	int ans = 1e9;
	for(int s : S) {
		int t = n - s;
		int tmp = s * (s - 1) / 2 + t * (t - 1) / 2;
		ans = min(ans, tmp);
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 11648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,i,j;
  string str;
  str="No";
  cin>>n;
  for(i=1; i<10; i++){
    for(j=0; j<10; j++){
      if(n==i*j){
        str="Yes";
      }
    }
  }
  cout<<str;
}

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

using namespace std;

#define MAX 30
#define INF (1<<29)
typedef pair<int,int> pii;
typedef pair<pii,int> piii;

int H,W,sx,sy,gx,gy,cnt;
char field[MAX][MAX];
const int dx[] = {-1,0,0,1};
const int dy[] = {0,-1,1,0};

struct State{
  int x,y,S;
  State(){}
  State(int x,int y,int S) : x(x),y(y),S(S) {}
};

bool isValid(int x,int y){
  if(x < 0 || x >= W || y < 0 || y >= H) return false;
  if(field[y][x] == '#') return false;
  return true;
}

int solve(){
  queue<State> Q;
  Q.push(State(sx,sy,0));
  map<piii,int> dist;
  dist[piii(pii(sx,sy),0)] = 0;

  while(!Q.empty()){
    State now = Q.front(); Q.pop();
    int x = now.x, y = now.y, S = now.S;
    piii pp = piii(pii(x,y),S);
    
    if(x == gx && y == gy){
      return dist[pp];
    }
    for(int i = 0 ; i < 4 ; i++){
      int nx = x + dx[i], ny = y + dy[i];
      if(!isValid(nx,ny)) continue;
      piii cp = piii(pii(nx,ny),S);

      if(islower(field[ny][nx])){
        int p = field[ny][nx]-'a';
        int nS = S;
        if((S >> p) & 1){
          nS -= (1<<p);
        }else{
          nS |= (1<<p);
        }
        cp.second = nS;
        if(dist[pp] + 1 < dist[cp] || dist[cp] == 0){
          dist[cp] = dist[pp] + 1;
          Q.push(State(nx,ny,nS));
        }
      }else if(isupper(field[ny][nx])){
        int p = field[ny][nx]-'A';
        if((S >> p) & 1){
          if(dist[pp] + 1 < dist[cp] || dist[cp] == 0){
            dist[cp] = dist[pp] + 1;
            Q.push(State(nx,ny,S));
          }
        }
      }else{
        if(dist[pp] + 1 < dist[cp] || dist[cp] == 0){
          dist[cp] = dist[pp] + 1;
          Q.push(State(nx,ny,S));
        }
      } 
    }
  }
  return -1;
}

int main(){
  while(cin >> W >> H,(W | H)){
    for(int i = 0 ; i < H ; i++){
      for(int j = 0 ; j < W ; j++){
        cin >> field[i][j];
        if(field[i][j] == '@'){
          field[i][j] = '.';
          sx = j; sy = i;
        }else if(field[i][j] == '<'){
          gx = j; gy = i;
          field[i][j] = '.';
        }
      }     
    }
    cout << solve() << endl;
  }
  return 0;
}

Measured memory_bytes: 13720