akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N;
int64 a[MAXN],s;
void Solve() {
    read(N);
    for(int i = 1 ; i <= N ; ++i) {
    	read(a[i]);
    	s += a[i];
    }
    int64 all = 1LL * N * (N + 1) / 2;
    if(s % all != 0) {puts("NO");return;}
    int64 k = s / all;
    int64 cnt = k;
    for(int i = 2 ; i <= N ; ++i) {
    	if(a[i] - a[i - 1] == k) continue;
    	int64 t = k - (a[i] - a[i - 1]);
    	if(t % N != 0 || t < 0) {puts("NO");return;}
    	cnt -= t / N;
    	if(cnt < 0) {puts("NO");return;}
    }
    puts("YES");
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
int w,h,x,y,r;
scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
if(x<=0||x>=w||x+r>w||x-r<0||y<=0||y>=h||y+r>h||y-r<0){
printf("No\n");
}else{
printf("Yes\n");}
return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
int main()
{
    int n;
    cin >> n;

    int count = 0;
    for(int i=1; i<=n/2; i++){
        int tmp = n -i;
        if(i != tmp){
            count++;
        }
    }   
    cout << count;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
using namespace std;

struct Node{
    int k;
    Node *p,*l,*r;
};

Node *root;

void insert(int k){
    Node *y=NULL;
    Node *x=root;
    Node *z;
    z=(Node*)malloc(sizeof(Node));
    z->k=k;
    z->l=NULL;
    z->r=NULL;
    while(x!=NULL){
        y=x;
        if(z->k<x->k){
            x=x->l;
        }
        else{
            x=x->r;
        }
    }
    z->p=y;
    if(y==NULL){
        root=z;
    }
    else if(z->k<y->k){
        y->l=z;
    }
    else{
        y->r=z;
    }
}

bool find(Node *v,int k){
    if(v==NULL)return false;
    if(k==v->k)return true;
    if(k<v->k)return find(v->l,k);
    return find(v->r,k);
}

void inorder(Node* v){
    if(v==NULL)return;
    inorder(v->l);
    cout<<" "<<v->k;
    inorder(v->r);
}

void preorder(Node* v){
    if(v==NULL)return;
    cout<<" "<<v->k;
    preorder(v->l);
    preorder(v->r);
}

signed main(){
    int n;
    cin>>n;
   rep(i,n){
       string s;
       cin>>s;
       if(s=="insert"){
           int k;
           cin>>k;
           insert(k);
       }
       else if(s=="find"){
           int k;
           cin>>k;
           cout<<(find(root,k)?"yes":"no")<<endl;
       }
       else{
           inorder(root);
           cout<<endl;
           preorder(root);
           cout<<endl;
       }
   }
    return 0;
}


Measured memory_bytes: 21908
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace ABC92_2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            string[] s = ReadLine().Split(' ');
            int D = int.Parse(s[0]);
            int X = int.Parse(s[1]);
            int S = 0;
            for (int i = 0; i < N; i++)
            {
                int A = int.Parse(ReadLine());
                if (D % A != 0)
                {
                    S += D / A + 1;
                }
                else
                {
                    S += D / A;
                }
            }
            WriteLine(S + X);
        }
    }
}


Measured memory_bytes: 11220
from collections import deque
n=int(input())
l=[0]*n
d={}
for i in range(n-1):
    a,b,c=map(int,input().split())
    a-=1
    b-=1
    if a in d:
        d[a].add((b,c))
    else:
        d[a]={(b,c)}
    if b in d:
        d[b].add((a,c))
    else:
        d[b]={(a,c)}
q,k=map(int,input().split())
k-=1
p=deque([k])
while len(p):
    w=p.popleft()
    for i in d[w]:
        if (l[i[0]]==0 and i[0]!=k) or (l[i[0]]!=0 and l[i[0]]>l[w]+i[1]):
            l[i[0]]=l[w]+i[1]
            p.append(i[0])

for i in range(q):
    x,y=map(int,input().split())
    print(l[x-1]+l[y-1])


Measured memory_bytes: 102812
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
  int N;
  cin >> N;
  long long int X;
  cin >> X;
  vector<long long int> x(N);
  for (int i = 0; i < N; i++)
  {
    cin >> x.at(i);
  }
  x.push_back(X);
  sort(x.begin(), x.end());
  vector<long long int> distance(N);
  for (int i = 1; i < N + 1; i++)
  {
    distance.at(i - 1) = x.at(i) - x.at(i - 1);
  }
  long long int ans = distance.at(0);
  for (int i = 1; i < N; i++)
  {
    ans = __gcd(distance.at(i), ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define INF 1000000
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class edge{
public:
	int to,cap,cost,rev;
	edge(){}
	edge(int tt,int cc,int co,int rr){
		to=tt;
		cap=cc;
		cost=co;
		rev=rr;
	}
};

int V;
vector<edge> G[1000];
int dist[1000];
int h[1000];
int prevv[1000],preve[1000];

void add_edge(int from,int to,int cap,int cost){
	G[from].push_back(edge(to,cap,cost,G[to].size()));
	G[to].push_back(edge(from,0,-cost,G[from].size()-1));
}

int min_cost_flow(int s,int t,int f){
	int res=0;
	fill(h,h+V,0);
	while(f>0){
		priority_queue<P,vector<P>,greater<P> > que;
		fill(dist,dist+V,INF);
		dist[s]=0;
		que.push(P(0,s));
		while(que.size()){
			P p=que.top();
			que.pop();
			int v=p.second;
			if(dist[v]<p.first)continue;
			for(int i=0;i<G[v].size();i++){
				edge &e=G[v][i];
				if(e.cap>0 && dist[e.to]>dist[v]+e.cost+h[v]-h[e.to]){
					dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
					prevv[e.to]=v;
					preve[e.to]=i;
					que.push(P(dist[e.to],e.to));
				}
			}
		}
		if(dist[t]==INF){
			return -1;
		}
		for(int v=0;v<V;v++){
			h[v]+=dist[v];
		}
		int d=f;
		for(int v=t;v!=s;v=prevv[v]){
			d=min(d,G[prevv[v]][preve[v]].cap);
		}
		f-=d;
		res+=d*h[t];
		for(int v=t;v!=s;v=prevv[v]){
			edge &e=G[prevv[v]][preve[v]];
			e.cap-=d;
			G[v][e.rev].cap+=d;
		}
	}
	return res;
}

int n,m,k;
int a[101];
int b[101][101];
int T[101];

int main(void){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){
			scanf("%d",&b[i][j]);
		}
	}
	for(int i=0;i<m;i++){
		scanf("%d",&T[i]);
	}
	int s=n+m+1,t=s+1;
	V=t+1;
	for(int i=0;i<n;i++){
		add_edge(s,i,1,0);
		add_edge(i,t,1,100-a[i]);
		for(int j=0;j<m;j++){
			add_edge(i,n+j,1,100-b[j][i]);
		}
	}
	for(int i=0;i<m;i++){
		add_edge(n+i,n+m,T[i],0);
	}
	if(m>0)add_edge(n+m,t,n-k,0);
	printf("%d\n",n*100-min_cost_flow(s,t,n));
	return 0;
}

Measured memory_bytes: 3436
#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for(int i=(l); i<(r); ++i)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */


const int MAX = 1000005;
//const int mod = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < 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;
    }

}
long long COM(int n, int k){
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

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

    int n; cin >> n;
    vector<int> a(n+1);
    map<int, int> mp;
    rep(i, 0, n+1) { cin >> a[i]; ++mp[a[i]]; }

    int x;
    rep(i, 1, n+1) if(mp[i]==2) x = i;

    ll l=-1, r=-1;
    rep(i, 0, n+1) if(a[i]==x) {
        if(l==-1) l = i;
        else r = n-i;
    }

    COMinit();
    rep(k, 1, n+2){
        ll ans = COM(n+1, k) - ((l+r<k-1)? 0:COM(l+r, k-1));
        chmod(ans);
        cout << ans << '\n';
    }
    
    return 0;
}

Measured memory_bytes: 29696
//It will be AC.I'm sure.
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long k,ba=100;
	cin>>k;
	for(long long t=1;;t++)
	{
		ba=ba+ba/100;
		//cout<<ba<<" ";
		if(ba>=k)
		{
			cout<<t;
			return 0;
		}
	}
	return 0;
} 

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

int main(){
  list<char> s,t;
  string a,b;
  cin >> a >> b;
  for(int i=0;i<a.size();i++){
    s.push_back(a[i]);
    t.push_back(b[i]);
  }
  for(int i=0;i<a.size();i++){
    s.push_front(s.back());
    s.pop_back();
    if(s==t){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
   int a,n,i,min=1000000,max=-1000000;
   long long sum=0;
   scanf("%d",&n);
   for(i=0;i<n;i++){
       scanf("%d",&a);
       sum=sum+a;
       if(min>a)
           min=a;
       if(max<a)
           max=a;
   }
   printf("%d %d %lld\n",min,max,sum);
   return 0;
}


Measured memory_bytes: 2108
n=int(input())
xy=[[[]] for _ in range(n)]
for i in range(n):
    a=int(input())
    xy[i]=[list(map(int,input().split())) for _ in range(a)]
ans=0
for i in range(2**n):
    tmp=[0]*n
    flag1=True
    for j in range(n):
        if (i>>j)&1:
            tmp[j]=1
    for k in range(n):
        flag2=True
        if tmp[k]==1:
            for x,y in xy[k]:
                if tmp[x-1]!=y:
                    flag1=False
                    flag2=False
                    break
        if not flag2:
            break
    if flag1:
        ans=max(ans,sum(tmp))
print(ans)

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

int main() {
	for( ;; ) {
		int H, W;
		cin >> H >> W;

		if( H == 0 && W == 0 ) {
			break;
		}

		for( int i = 0; i < H; ++i ) {
			for( int j = 0; j < W; ++j ) {
				cout.put( '#' );
			}
			cout << endl;
		}

		cout << endl;
	}
}



Measured memory_bytes: 3108
#include<stdio.h>
#define ll long long
ll n,m,tmp,i,c;
int main()
{
	scanf("%lld%lld",&n,&m);
	for (i=1;i<=m;++i) 
	{
		scanf("%lld",&tmp);
		c+=tmp;
	}
	n-=c;
	if (n<0) printf("-1");
	else printf("%lld",n);
}

Measured memory_bytes: 1728
/*
Character Drawing Adapted from FAKEUPDATE.NET
		   _    _____         _
		   \`,""   ,'7"r-..__/ \
		  ,'\ `, ,',','    _/   \
		 /   \, 7 / /     (   \ |
		J     \/ j  L______\  / |
		L   __JF"""/""\"\_,    /
		L,-"| O|  f O |  L_  _/
		F   \_ /  \__/   `-  j|
			.-'    `"""    ,' |          _..====.._
			\__/         r"_  A        ,' _..---.._`,
			 `-.______,,-L// / \  ___,' ,'_..:::.. `,`,
					  j   / / / 7"    `-<""=:'  '':. \ \
					 /   <,' /  F  . i , \   `,    :T W I
					 |    \,'  /    >X<  |     \   :| | L
					 |     `._/    ' ! ` |      I  :| |  G
					  \           \     /       |  :H T  |
					 __>-.__   __,-\   |        |  S P   |
					/     /|   | \  \  \_       | 'A R   |
				   /   __/ |   |  L  L   \      K./ /    L
				  /   |    |   4  I  I    |    E./ /   ,'
				 J    \    I    L F  I    |    // / _,'
		_________|     |   F    |J   F    |   //_/-'
		\   __   |    /   J     |/  J     |  /="
		\\  \_\  \__,' \  F     |   F     |
		\\\_____________\/      F__/      F
		 \\| 计算机编程 |_____/  (______/
		  \/从入门到入土/
*/
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
#include <functional>
using namespace std;
#define MATH_PI 3.14159265358979323846
int main(){
	ios::sync_with_stdio(false);
	int H, W, iX, iY, i, j;
	string sInput;
	cin >> H >> W;
	for (i = 1; i <= H; ++i){
		for (j = 1; j <= W; ++j){
			cin >> sInput;
			if (sInput == "snuke"){
				iX = j;
				iY = i;
			}
		}
	}
	cout << char(iX + 'A' - 1) << iY << endl;
endapp:
	//system("pause > nul");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <array>
#include <cmath>

using namespace std;

using ll = long long int;

int main() {

    int A, B, T;

    cin >> A >> B >> T;

    int cnt = T / A;

    cout << B * cnt;

    return 0;
}



Measured memory_bytes: 256
import math

a, b, h, m = [int(x) for x in input().split()]

#a, b, h, m = 3, 4, 11, 0

h_dig = 360 * (float(h) / 12) + 30 * (float(m) / 60)
m_dig = 360 * (float(m) / 60)

#print(str(h_dig) + " " +  str(m_dig))

abs_dig = abs(h_dig - m_dig)
if(abs_dig > 180):
    abs_dig = 360 - abs_dig

#print(abs_dig)

c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(abs_dig / 360 * 2 * math.pi))

print('{:.09f}'.format(c))

Measured memory_bytes: 9396
#include <bits/stdc++.h>
        using namespace std;
         
        using ll = long long;
         
        #define INF (1LL << 31 - 1)
        #define MOD int(1e9+7)
        #define repi(i,j,n) for(int i = (j); i < (n); ++i)
        #define rep(i,n) repi(i,0,n)
        #define fi first
        #define se second
         
        inline void init() {
            cin.tie(0);
            ios::sync_with_stdio(false);
        }
         
        int a, b, c, d, e, f, ansx, ansy;
        bool water[3001], suger[3001];
         
        int main() {
            cin >> a >> b >> c >> d >> e >> f;
            a *= 100;
            b *= 100;
         
            water[0] = suger[0] = true;
         
            for (int i = 0; i <= f; ++i) {
                if (i >= a) water[i] = water[i] | water[i - a];
                if (i >= b) water[i] = water[i] | water[i - b];
                if (i >= c) suger[i] = suger[i] | suger[i - c];
                if (i >= d) suger[i] = suger[i] | suger[i - d];
            }
         
            ansx = a, ansy = 0;
         
            for (int x = 0; x <= f; x+=100) {
                if (water[x]) {
                    for (int y = 0; y <= f - x; ++y) {
                        if (suger[y]) {
                            if (x * e < y * 100) break;
         
                            if ((x + y) * ansy < y * (ansx + ansy)) {
                                ansx = x;
                                ansy = y;
                            }
                        }
                    }
                }
            }
         
            cout << ansx + ansy << " " << ansy << endl;
         
            return 0;
        }

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <utility>
#include <queue>
#include <bitset>

using namespace std;
 
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define endl '\n'
typedef long long ll;

int gcd(int a,int b){
    if(a < b){
        int tmp=a;
        a=b;
        b=tmp;
    }
    int r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    int Max=0;
    rep(i,n){
        cin>>a[i];
        Max=max(Max,a[i]);
    }
    if(Max < k){
        cout<<"IMPOSSIBLE"<<endl;
        return 0;
    }
    int g=a[0];
    for(int i=1;i<n;i++){
        g=gcd(g,a[i]);//最大公約数を求める
    }
    if(k%g==0){
        cout<<"POSSIBLE"<<endl;
    }else{
        cout<<"IMPOSSIBLE"<<endl;
    }
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int digitsum(int x)
{
	int dsum = 0;
  	while(x > 0){
    	dsum += x % 10;
      	x /= 10;
    }
  	return dsum;
}
int main()
{
	int n; cin >> n;
  	int minsum = 100000000;
  	for (int a = 1; a < n; a++){
    	int b = n - a;
      	int dsumsum = digitsum(a) + digitsum(b);
      	if (dsumsum < minsum){
        	minsum = dsumsum;
        }
    }
  	cout << minsum;
}

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

using namespace std;

#define PI 3.1415926535897932

int main(){
    int mod=1000000007;
    int n,m;
    char a[10],b[10],c[10];
    scanf("%s %s %s",a,b,c);
    printf("%s\n",a[strlen(a)-1]==b[0] && b[strlen(b)-1]==c[0]?"YES":"NO");
    return 0;
}


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

string rot(string S){
    int N;
    N = S.size();
    string after;
    after = S;
    after.at(0) = S.at(N - 1);
    for (int i = 1; i < N; i++){
        after.at(i) = S.at(i - 1);
    }
    return after;
}
int main(){
    string S,T;
    cin >> S >> T;
    bool same = false;
    for (int i = 0; i < S.size(); i++){
        if (S == T){
            same = true;
        }
        S = rot(S);
    }
    if (same){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	string s; cin >> s;
	
	cout << s.substr(0, 4) << " " << s.substr(4) << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean flg = false;
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } 
        if (flg == true) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
}


Measured memory_bytes: 36032
#include<bits/stdc++.h>
#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(int i=0;i<j;i++)
#define rep1(i,j) for(int i=1;i<=j;i++)
#define rep0d(i,j) for(int i=j-1;i>=0;i--)
#define MOD 1000000007

using namespace std;

template <typename T>
bool cmp(const T left, const T right) {
  	return left < right;
}
bool cmp(const pair<lli, lli> left, const pair<lli, lli> right) {
  	return left.second < right.second;
}

lli f[1000000], rf[1000000];
lli inv(lli x) {
    lli res = 1;
    lli k = MOD - 2;
    lli y = x;
    while (k) {
        if (k & 1) res = (res * y) % MOD;
        y = (y * y) % MOD;
        k /= 2;
    }
    return res;
}
void init() {
    f[0] = 1;
    rep1(i, 1000000) f[i] = (f[i - 1] * i) % MOD;
    rep0(i, 1000001) rf[i] = inv(f[i]);
}
lli C(lli n, lli k) {
    lli a = f[n]; // = n!
    lli b = rf[n-k]; // = (n-k)!
    lli c = rf[k]; // = k!

    lli bc = (b * c) % MOD;

    return (a * bc) % MOD;
}

void dfs(lli ed, lli num, vector<map<lli,lli>>& vec){
    lli n=1;
    for(auto e: vec[num]){
        if(n == ed)n++;
        if(e.second != -1)continue;
        vec[num][e.first] = n;
        vec[e.first][num] = n;   
        dfs(n, e.first, vec);
        n++;
    }
}

lli gcd(lli a, lli b){
    if(a < b)return gcd(b, a);
    lli temp;
    while((temp = a%b)){
        a=b;
        b=temp;
    }
    return b;
}

int main(){
    string a, b;
    cin >> a >> b;
    cout << b + a;
}

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

const int Max=51;
int n,m,now,num[Max],sum[Max];
long long ans;
long long f[3][Max][Max*Max];

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d",&num[i]),sum[i]=sum[i-1]+num[i];
	f[1][0][0]=f[0][0][0]=1;
	for(int i=1;i<=n;i++)
	{
	  for(int j=1;j<=i;j++)
	    for(int k=0;k<=sum[i];k++)
	    {
	      f[now][j][k]=f[now^1][j][k];
	      if(k>=num[i]) f[now][j][k]+=f[now^1][j-1][k-num[i]];
	    }
	  now^=1;
	}
	for(int i=1;i<=n;i++) ans+=f[now^1][i][i*m];
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 2304
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

void dout() { cerr << '\n'; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << " " << H;
    dout(T...);
}

#ifdef LOCAL
    #define dbg(...) cerr << #__VA_ARGS__, dout(__VA_ARGS__)
#else
    #define dbg(...) ;
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;

const int N = 200007, K = 19, alph = 26;
int n, up[K][N], fen[N], last[26][N];
string s;

void upd(int x, int y) {
    for (; x <= n; x |= (x + 1)) {
        fen[x] += y;
    }
}

int get(int x) {
    int res = 0;
    for (; x >= 0; x = (x & (x + 1)) - 1) {
        res += fen[x];
    }
    return res;
}

int path(int x) {
    if (x > n) {
        return 0;
    }
    int res = 0;
    for (int i = K - 1; i >= 0; i--) {
        if (up[i][x] <= n) {
            x = up[i][x] + 1;
            res += (1 << i);
        }
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(NULL);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif

    cin >> s;
    n = s.size();
    memset(& last, -1, sizeof(last));
    for (int i = 0; i < K; i++) {
        up[i][n + 1] = n + 1;
    }
    for (int i = n; i >= 1; i--) {
        for (int j = 0; j < alph; j++) {
            last[j][i] = last[j][i + 1];
        }
        int ch = (s[i - 1] - 'a');
        if (last[ch][i] == -1) {
            upd(i, 1);
        }   else {
            upd(last[ch][i], -1);
            upd(i, 1);
        }
        last[ch][i] = i;
        if (get(n) < alph) {
            up[0][i] = n + 1;
        }   else {
            int l = i, r = n + 1;
            while (l < r - 1) {
                int mid = l + r >> 1;
                if (get(n) - get(mid - 1) > 0) {
                    l = mid;
                }   else {
                    r = mid;
                }
            }
            up[0][i] = l;
        }
    }
    for (int i = 1; i < K; i++) {
        for (int j = 1; j <= n; j++) {
            up[i][j] = up[i - 1][min(n + 1, up[i - 1][j] + 1)];
        }
    }
    int len = path(1) + 1, cur = 1;
    string ans = "";
    for (int i = 1; i <= len; i++) {
        for (int j = 0; j < alph; j++) {
            if (last[j][cur] == -1) {
                if (len == i) {
                    ans += char('a' + j);
                    break;
                }
                assert(false);
            }
            if (len - i > path(last[j][cur] + 1)) {
                cur = last[j][cur] + 1;
                ans += char('a' + j);
                break;
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 36500
// finish date: 2018/04/21

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>


int main() {
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    if (X > Y) {
        swap(X, Y);
        swap(A, B);
    }
    if (A + B <= C * 2) {
        cout << A * X + B * Y << endl;
    } else {
        cout << min(C * 2 * Y, C * 2 * X + B * (Y - X));
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	priority_queue<int> que;
	string s;
	int a;
	cin >> s;
	while (s != "end") {
		
		if (s == "insert") {
			cin >> a;
			que.push(a);

		}
		else if(s == "extract"){
			cout << que.top() << endl;
			if (!que.empty()) {
				que.pop();
			}
		}
		cin >> s;
	}
	return 0;
}




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

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        int j = i;
        int keta = 0;
        while(j){
            keta++;
            j /= 10;
        }
        if(keta % 2) ans++;
    }

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

Measured memory_bytes: 256
#include<cstdio>
#include<map>
using namespace std;
#define N 215000
map<int,int> tp;
int n,s[N];
bool check(int k)
{
	if(k==1){for(int i=2;i<=n;i++)if(s[i]<=s[i-1])return 0;return 1;}
	tp.clear();
	int ls=0;
	for(int i=1;i<=n;i++)
	{
		if(s[i]>ls){ls=s[i];continue;}
		while(1)
		{
			if(!tp.size())break;
			map<int,int>::reverse_iterator it=tp.rbegin();
			if(it->first<=s[i])break;
			tp.erase(--(it.base()));
		}
		tp[s[i]]++;
		int t=s[i];
		while(tp[t]>=k){if(t==1)return 0;tp[t]-=k,tp[t-1]++,t--;}
		ls=s[i];
	}
	return 1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&s[i]);
	int lb=1,rb=n,as=n;
	while(lb<=rb)
	{
		int mid=(lb+rb)>>1;
		if(check(mid))as=mid,rb=mid-1;
		else lb=mid+1;
	}
	printf("%d\n",as);
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            c = 1
if c == 0:
    print("APPROVED")
else:
    print("DENIED")

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

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

    int h, w, d;
    cin >> h >> w >> d;

    pair<int, int> a[h * w + 1];
    int ix;
    for (int j = 1; j <= h; ++j) {
        for (int i = 1; i <= w; ++i) {
            cin >> ix;
            a[ix] = make_pair(i, j);
        }
    }

    int dist_cum[h * w + 1];
    memset(dist_cum, 0, sizeof(dist_cum));
    for (int i = 1; i <= h * w - d; ++i) {
        pair<int, int> start = a[i];
        pair<int, int> end = a[i + d];
        int dist = abs(start.first - end.first) + abs(start.second - end.second);
        dist_cum[i + d] = dist_cum[i] + dist;
    }

    int q;
    cin >> q;
    int l, r;
    for (int i = 0; i < q; ++i) {
        cin >> l >> r;
        cout << dist_cum[r] - dist_cum[l] << '\n';
    }

    return 0;
}


Measured memory_bytes: 2176
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define wl(n) while(n--)
#define fl(i,a,b) for(i=a; i<b; i++)
#define rev(i,a,b) for(i=a; i>=b; i--)

#define si(n) scanf("%d", &n)
#define sll(l) scanf("%lld",&l)

#define debug(x) cout<<"\n#("<<x<<")#\n"
#define nline printf("\n")

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

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define PB push_back
#define SZ size
#define MP make_pair

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

const ll INF = (1LL << 58);
const bool DEBUG = 0;

int main()
{
	ll i, j;

	ll a, b;

	sll(a);	sll(b);

	int ans = 0;

	fl(i,0,a + 1)
	{
		fl(j,0,a + 1)
		{
			ll x = b - i - j;
			if(x >= 0 && x <= a && x + i + j == b)
			{
				// cout << i << " " << j << " " << b - i - j << "\n";
				ans++;
			}
		}
	}

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

	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A;
  int B;
  cin >> A >> B;
  int count;
  count = 0;
  int misiyou=1;
  
  for(int i = 0;i<100;i++){
  if(misiyou >= B){break;}
  misiyou = misiyou-1+A;
  count +=1;    
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import sys,itertools,collections,bisect
from collections import deque,Counter,defaultdict
from heapq import heappush,heappop,heapify
read=sys.stdin.readline
sys.setrecursionlimit(10**6)

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
cA,cB=Counter(A),Counter(B)
for i in range(1,N+1):
    if cA.get(i,0)+cB.get(i,0)>N:
        print('No')
        exit()

C,D=[0]*(N+1),[0]*(N+1)
for i in range(1,N+1):
    C[i]=C[i-1]+cA.get(i,0)
    D[i]=D[i-1]+cB.get(i,0)


x,y=0,10**30
for i in range(1,N+1):
    x=max(x,C[i]-D[i-1])
    y=min(y,C[i-1]+N-D[i])

print('Yes')
print(*(B[N-x:]+B[:N-x]))

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    double a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a+n);

    for (int i = 0; i < n - 1; i++) {
        a[i+1] = (a[i] + a[i+1]) / 2;
    }

    cout << a[n-1] << endl;

    return 0;
}

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

typedef long long ll;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007


#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(int i=a;i<b;i++)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}


int main()
{
   su;
   int k;
   cin>>k;
   int x=7%k;
   lo(i,1,3*k+1)
   {
     if(x==0)
     {
       return cout<<i<<nl,0;
     }
     x=(x*10+7)%k;
   }
   cout<<-1<<nl;
   return 0;
}


Measured memory_bytes: 3600
import sys
#input = sys.stdin.readline
from sys import setrecursionlimit
setrecursionlimit(10**9)

def inpl(): return list(map(int, input().split()))
S = input()
T = S.replace("BC", "X")
U = T.replace("B", "_").replace("C", "_")

ans = 0
cnt = 0
for i in range(len(U)):
    if U[i] == "A":
        cnt += 1
    elif U[i] == "X":
        ans += cnt
    else:
        cnt = 0

print(ans)

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

int n, m;
map<int, vector<int>> graf;
bool ok = 0;
void dfs(int v, int deep) {
    if(deep >= 2) {
        if(v == n) {
            ok = 1;
        }
        return;
    }
    for (auto x : graf[v]) {
        dfs(x, deep + 1);
    }
}

void solve() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        graf[a].push_back(b);
    }
    dfs(1, 0);
    if(ok) {
        cout << "POSSIBLE";
    }
    else {
        cout << "IMPOSSIBLE";
    }
}


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


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

int main(void){
  int n,m,ans;
  vector<int> va, vd;
  
  cin >> n >> m;
  if (n>m) n=m; // 無駄な駒は無かったことにする
  for (int i=0; i<m; i++){
    int t; cin >> t;
    va.push_back(t);
  }
  sort(va.begin(), va.end());
  for (int i=0; i<m-1; i++){
    vd.push_back(va[i+1]-va[i]);
  }
  sort(vd.begin(), vd.end());
  ans = va[m-1]-va[0];
  for (int i=0; i<n-1; i++){
//    cout << ans << endl;
    ans -= vd[vd.size()-1-i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <iterator>
#include <bitset>
#include <random>
#include <assert.h>
#include <unordered_map>
#include <array>
#include <ctime>

#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define X first
#define Y second
#define MP make_pair
#define MT make_tuple

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> P;
typedef unsigned int uint;

struct UF{
	vector<int> par;
	int n;
	UF(int size){
		n = size;
		par = vector<int>(n);
		rep(i, n) par[i] = i;
	}

	int find(int x){
		if (x == par[x]) return x;
		return par[x] = find(par[x]);
	}

	void unite(int x, int y){
		par[find(x)] = find(y);
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int main(){
	auto sq = [](double x){return x*x; };

	cout.setf(ios::fixed);
	cout.precision(3);

	int n;
	while (cin >> n, n){
		vector<double> x(n), y(n), z(n), r(n);
		rep(i, n) cin >> x[i] >> y[i] >> z[i] >> r[i];

		vector<tuple<double, int, int>> edge;
		rep(i, n) rep(j, i){
			double len = sqrt(sq(x[i] - x[j]) + sq(y[i] - y[j]) + sq(z[i] - z[j]));
			len -= r[i] + r[j];
			len = max(len, 0.);
			edge.push_back(MT(len, i, j));
		}
		sort(ALL(edge));

		UF uf(n);

		double ans = 0;
		for (auto e : edge){
			double cost;
			int s, t;
			tie(cost, s, t) = e;
			if (uf.same(s, t)) continue;
			uf.unite(s, t);
			ans += cost;
		}
		cout << ans << endl;
	}

	return 0;
}

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n;
  cin >> n;
  VI a(n);
  REP(i, n) cin >> a[i];

  int con = 1, ret = 0;
  FOR(i, 1, n) {
    if(a[i] == a[i-1]) {
      con++;
    } else {
      if(con == 2) {
        ret++;
      } else if(con > 2) {
        ret += con / 2;
      }
      con = 1;
    }
  }

  if(con == 2) {
    ret++;
  } else if(con > 2) {
    ret += con / 2;
  }

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
using namespace std;

namespace zyt
{
	template<typename T>
	inline bool read(T &x)
	{
		char c;
		bool f = false;
		x = 0;
		do
			c = getchar();
		while (c != EOF && c != '-' && !isdigit(c));
		if (c == EOF)
			return false;
		if (c == '-')
			f = true, c = getchar();
		do
			x = x * 10 + c - '0', c = getchar();
		while (isdigit(c));
		if (f)
			x = -x;
		return true;
	}
	template<typename T>
	inline void write(T x)
	{
		static char buf[20];
		char *pos = buf;
		if (x < 0)
			putchar('-'), x = -x;
		do
			*pos++ = x % 10 + '0';
		while (x /= 10);
		while (pos > buf)
			putchar(*--pos);
	}
	typedef long long ll;
	const int N = 3e5 + 10;
	int ans, t[N], x[N], n, L;
	int l[N], r[N];
	int work()
	{
		read(n), read(L);
		for (int i = 1; i <= n; i++)
			read(x[i]);
		for (int i = 1; i <= n; i++)
		{
			read(t[i]);
			ans += t[i] / (L * 2) * 2, t[i] %= (L * 2);
			l[i] = (x[i] * 2 >= t[i] ? 1 : 3);
			r[i] = ((L - x[i]) * 2 >= t[i] ? 1 : 3);
		}
		ans += r[n];
		int lc = 0, rc = 0;
		for (int i = 1; i < n && x[i] <= (L / 2); i++)
			if (t[i])
			{
				if (l[i] != r[i])
				{
					if (lc)
						--lc, ++ans;
					else
						ans += 2;
				}
				else
				{
					if (l[i] == 1)
						++lc, ++ans;
					else
						ans += 2;
				}
			}
		for (int i = n - 1; i > 0 && x[i] > (L / 2); i--)
			if (t[i])
			{
				if (l[i] != r[i])
				{
					if (rc)
						--rc, ++ans;
					else
						ans += 2;
				}
				else
				{
					if (l[i] == 1)
						++rc, ++ans;
					else
						ans += 2;
				}
			}
		if ((lc + rc) & 1)
			++ans;
		write(L * ll(ans + 1));
		return 0;
	}
}
int main()
{
	return zyt::work();
}

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

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

  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    int x;
    cin >> x;

    sum += x;
  }

  cout << 15 - sum << '\n';

  return (0);
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,a[200010],c[200010];
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
         c[i] = (a[i]-i-1);
    }
    sort(c,c+n);
    int b = c[n/2];
    ll ans = 0;
    for(int i=0;i<n;i++) ans += abs(a[i]-b-i-1);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define F first
#define S second
#define endl "\n"
#define nl cout<<endl
#define pb push_back
#define f(i,a,b) for(ll i=a;i<b;i++)
#define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL);
#define txti freopen("input.txt", "r", stdin);
#define txto freopen("output.txt", "w", stdout);
//#define mod 100000007

#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;} 
bool sortmahstyle(const pair<ll,ll> &a,  const pair<ll,ll> &b) 
{ 
    if(a.second > b.second )
        return true;
    if( a.second==b.second && a.first > b.second )
       return true;
 
    return false;
 }
//me
ll const mod = 1e9+7;
ll const inf = 1e5+1;

vector<ll> nodes[inf];
ll vis[inf];



void solve()
{   
    ll a,b,c,k; cin >> a >> b >> c >> k;

    ll ans = 0;
    while(b<=a)
    {
        ans++;
        b*=2;
    }

    while(c<=b)
    {
        ans++;
        c*=2;
    }
    if(ans<=k)
    cout << "Yes" << endl;
    else
    cout << "No" << endl;
}
int main() {
Knucklehead 
/*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/


        
        ll t;
        /**/t=1;
        /*/cin>>t;/**/
        while(t-->0){
            solve();
 
        }
 
 
 
 
    return 0;
}

Measured memory_bytes: 5964
import sys
k, a, b = [int(i) for i in sys.stdin.readline().split()]
if b - a <= 2:
    print(k + 1)
else:
    cnt = 0
    cnt += min(k, a - 1)
    bisk = 1 + cnt + (b - a) * ((k - cnt) // 2)
    bisk += (k - cnt) % 2
    print(bisk)

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

int main() {
    int n,k,q;cin>>n>>k>>q;
    vector<int>x(n);

    rep(i,q){
        int a;cin>>a;
        x[a-1]++;
    }

    rep(i,n){
        if(k-(q-x[i])>0){
            cout<<"Yes"<<endl;
        }
        else {
            cout<<"No"<<endl;
        }
    }

}


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

typedef long long ll;

int main()	
{
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	int ans = 0;
	for(int i=0;i<k;i++) ans += a[i];
	cout<<ans;
}

Measured memory_bytes: 3572
N, K = map(int, input().split())
li = list(input())
a = 0
b = 0
for i in range(N-1):
  if li[i] == li[i+1]:
    b += 1
  else:
    a += 1
for j in range(K):
  if a >= 2:
    a -= 2
    b += 2
  elif a == 1:
    a -= 1
    b += 1
  else:
    break
print(b)
  


Measured memory_bytes: 4084
#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 if(c<b && b<a){
		cout<<c<<" "<<b<<" "<<a<<endl;
	}else if(a==b && b<c){
		cout<<a<<" "<<b<<" "<<c<<endl;
	}else if(a==b && b>c){
		cout<<c<<" "<<b<<" "<<a<<endl;
	}else if(c==b && b>a){
		cout<<a<<" "<<b<<" "<<c<<endl;
	}else if(c==b && b<a){
		cout<<c<<" "<<b<<" "<<a<<endl;
	}else if(a==c && b>c){
		cout<<c<<" "<<a<<" "<<b<<endl;
	}else if(a==c && b<c){
		cout<<b<<" "<<a<<" "<<c<<endl;
return 0;
}
}


Measured memory_bytes: 3096
#include<stdio.h>

int gcd(int, int);

int main()
{
  int x, y;

  scanf("%d%d", &x, &y);
  printf("%d\n",gcd(x, y));
  
  return 0;
}

int gcd(int x, int y)
{

  int r;
  
  if(x<y)
    {
      r = x;
      x = y; y = r;
    }

  while(y>0)
    {
      r = x%y;
      x = y;
      y = r;
    }
  return x;
}



Measured memory_bytes: 2084
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
//#include <chrono>
#include <iomanip>
#include <utility>
#include <assert.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(34);

int n;
ll d[50], ans;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("bst.in", "r", stdin);
	//freopen("bst.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> d[i];
	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			ans += d[i] * d[j];
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        if (Math.abs(a - c) <= d) {
            System.out.println("Yes");
        } else if ((Math.abs(a - b) <= d) && (Math.abs(b-c) <= d)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21716
def submit():
    n, m = map(int, input().split())
    price_stocks = [tuple(map(int, input().split())) for _ in range(n)]
    price_stocks.sort(key=lambda x: x[0])

    pay = 0
    for price, stock in price_stocks:
        if stock < m:
            m -= stock
            pay += price * stock
        else:
            pay += price * m
            break

    print(pay)
            

if __name__ == "__main__":
    submit()

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

int main()
{
	int N,M;
	cin >> N >> M;
	vector<int> a(N,0);
	for(int i=0; i<M; ++i){
		int k;
		cin >> k;
		for(int j=0; j<k; ++j){
			int s;
			cin >> s;
			s--;
			a[s] =  a[s] | (1 << i);
		}
	}

	int p = 0;
	for(int i=0; i<M; ++i){
		int x;
		cin >>x;
		p = p | (x << i);
	}

	int ans = 0;

	for(int s= 0; s < (1<<N); ++s){
		int t=0;

		for(int i=0; i<N; ++i){
			if( (s >>i) & 1){
				t = t ^ a[i];
			}
		}

		if( t== p){
			ans++;
		}

	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 384