akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double db;
const int oo=2139063143;
const int N=190;
const int P=1000000007;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }
int n,m,f[N][N][N][15],a[N][N],s[N][N];
int get (int lx,int rx,int ly,int ry) { --lx,--ly; return s[rx][ry]-s[lx][ry]-s[rx][ly]+s[lx][ly]; }
char t[N];

int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	sc(n),sc(m);
	for (int i=1; i<=n; i++)
	{
		scanf ("%s",t+1);
		for (int j=1; j<=m; j++)
			a[i][j]=t[j]=='#',s[i][j]=a[i][j]+s[i-1][j]+s[i][j-1]-s[i-1][j-1];
	}
	for (int i=1; i<=n; i++)
		for (int l=1; l<=m; l++)
			for (int r=l; r<=m; r++)
			{
				int L=i-1,R=n+1;
				while (L+1< R)
				{
					int mid=(L+R)>>1,g=get (i,mid,l,r);
					if (!g||g==(mid-i+1)*(r-l+1)) L=mid;
					else R=mid;
				}
				if (L>=i) f[i][l][r][0]=L;
			}
	for (int k=1; ; k++)
	{
		if (f[1][1][m][k-1]==n) return pr(k-1),0;
		for (int i=1; i<=n; i++)
			for (int l=1; l<=m; l++)
				for (int r=l; r<=m; r++)
				{
					int g=f[i][l][r][k-1],h=f[g+1][l][r][k-1];
					if (g&&h) f[i][l][r][k]=h;
					else f[i][l][r][k]=g;
					if (g==n) continue;
					int L=l-1,R=r+1;
					while (L+1< R)
					{
						int mid=(L+R)>>1,lp=f[i][l][mid][k-1],rp=f[i][mid+1][r][k-1];
						chkmax (f[i][l][r][k],min (lp,rp));
						if (lp< rp) R=mid;
						else L=mid;
					}
				}
	}


    return 0;
}

Measured memory_bytes: 393728
z=list(map(int,input().split()))
n=int(input())
a=list(map(int,input().split()))
b,c,d,e=[],[],0,0
while True:
    c.append(d+1)
    e+=1
    if e==a[d]:
        e=0
        d+=1
    if len(c)==z[1]:
        b.append(c)
        c=[]
    if d==n:
        break
for i in range(z[0]):
    if i%2==0:
        for j in range(z[1]):
            print(b[i][j],end=' ')
    else:
        for j in range(z[1]):
            print(b[i][-j-1],end=' ')
    print('')

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

int a, b;

int main()
{
    cin >> a >> b;
    string s1 = string(a, '0' + b);
    string s2 = string(b, '0' + a);
    if (s1 <= s2) cout << s1 << endl;
    else cout << s2 << endl;
    return 0;
}


Measured memory_bytes: 384
def main():
    """
    1 <= x <= 10**15

    どのパターンで得点が一番多いか
    (5) -> 6 -> 5 > 6 -> 5 ...
    """
    x = int(input())

    d1, r1 = divmod(x, 11)
    ans = d1 * 2 + (r1 // 6) + (r1 % 6 > 0)

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;

int n,m;
double x[40],y[40],dp[42][42][42];

double calArea(int a,int b,int c){
	int t[3];
	int i,p1,p2;
	double res = 0;

	t[0] = a;
	t[1] = b;
	t[2] = c;

	for(i=0;i<3;i++){
		p1 = t[i];
		p2 = t[(i+1)%3];
		res += x[p1] * y[p2] - x[p2] * y[p1];
	}

	return fabs(res / 2);
}

int main(void){
	int i,j,k,l;
	double theta,p,ans;

	while(scanf("%d%d",&n,&m) && (n||m)){
		for(i=0;i<n;i++){
			scanf("%lf",&p);
			theta = (p * 360) / 180 * M_PI;
			x[i] = cos(theta);
			y[i] = sin(theta);
		}

		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				for(k=0;k<=n;k++){
					dp[i][j][k] = 0;
				}
			}
		}

		for(i=0;i<n;i++){
			dp[i][i][1] = 0;
			for(j=i;j<n;j++){
				for(k=2;k<m;k++){
					for(l=j+1;l<n;l++){
						dp[i][l][k+1] = max(dp[i][l][k+1], dp[i][j][k] + calArea(i,j,l));
					}
				}
			}
		}

		ans = 0;
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				ans = max(dp[i][j][m],ans);
			}
		}
		printf("%.6lf\n",ans);
	}

	return 0;
}

Measured memory_bytes: 1368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
#define pi (acos(-1))
///#define for(i,a,b) for(i=(a);i<(b);++i)
///freopen("input.txt","r",stdin);
///   freopen("output.txt","w",stdout);
string s;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>s;
    reverse(s.begin(),s.end());
    string s1=s;
    reverse(s.begin(),s.end());
    if(s1!=s)
    {
        cout<<"No\n";
        return 0;
    }
    int n=s.length(),i;
    string s2;
    for(i=0; i<(n-1)/2; ++i)
        s2.pb(s[i]);
    reverse(s2.begin(),s2.end());
    string s3=s2;
    reverse(s2.begin(),s2.end());
    if(s3!=s2)
    {
        cout<<"No\n";
        return 0;
    }
    string s4;
    for(i=(n+3)/2-1; i<n; ++i)
        s4.pb(s[i]);
    reverse(s4.begin(),s4.end());
    string s5=s4;
    reverse(s4.begin(),s4.end());
    if(s5!=s4)
    {
        cout<<"No\n";
        return 0;
    }
    cout<<"Yes\n";
    return 0;
}

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

using namespace std;

long long int lcm(long long int a, long long int b ){
	return	( a * b ) / __gcd( a, b );
}

int main(){
    long long int A,B;
    long long int C,D;
    cin>>A>>B>>C>>D;
    A--;
    long long int dd = lcm(C,D);
    // cout<<dd<<endl;
    // B--;
    long long int adc,add,adcd,bdc,bdd,bdcd;
    adc=A/C;
    add=A/D;
    adcd=A/dd;
    bdc=B/C;
    bdd=B/D;
    bdcd=B/dd;
    long long int aaa,bbb,ans;
    aaa = A-adc-add+adcd;
    bbb = B-bdc-bdd+bdcd;
    ans = bbb-aaa;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
N=int(input())
W=[int(s) for s in input().split(" ")]

List_Ans=[]

for i in range(1,N):
    Ans=0
    SUM_left=0
    SUM_right=0
    List_left=W[0:i]
    List_right=W[i:N]
    SUM_left=sum(List_left)
    SUM_right=sum(List_right)
    Ans=abs(SUM_left-SUM_right)
    List_Ans.append(Ans)

print(min(List_Ans))

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;
const int N = 105;
int a[N];
int main()
{
	int n;
	cin >> n;

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

	int res = 0;
	for (int i = 1; i <= n; ++i)
	{
		if ((i & 1) && (a[i] & 1)) ++res;
	}

	printf("%lld\n", res);

	return 0;
}


Measured memory_bytes: 3748
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    D = I()

    d = {}
    d[22] = 'Christmas Eve Eve Eve'
    d[23] = 'Christmas Eve Eve'
    d[24] = 'Christmas Eve'
    d[25] = 'Christmas'

    print(d[D])

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9996
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int maxN = 2e5 + 10;
int ansx[maxN], ansy[maxN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    memset(ansx, -1, sizeof ansx);
    memset(ansy, -1, sizeof ansy);
    int n, q;
    cin >> n >> q;
    int limx = n;
    int limy = n;
    ll cur = (1LL * (n - 2)) * (n - 2);
    for (int i = 0; i < q; i++) {
        int tp, x;
        cin >> tp >> x;
        if (tp == 1) {
            if (x <= limx) {
                cur -= limy - 2;
                for (int j = x + 1; j <= limx; j++) {
                    ansx[j] = limy - 2;
                }
                limx = x;
            }
            else {
                cur -= ansx[x];
            }
        }
        else {
            if (x <= limy) {
                cur -= limx - 2;
                for (int j = x + 1; j <= limy; j++) {
                    ansy[j] = limx - 2;
                }
                limy = x;
            }
            else {
                cur -= ansy[x];
            }
        }
    }
    cout << cur;
    return 0;
}

Measured memory_bytes: 5196
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;

//rank and path compression used
const int maxn = 1e5 + 5;
vector<int>par(maxn,-1),best(maxn),a(maxn);
int root(int v){return par[v] < 0 ? v : (par[v] = root(par[v]));}
void merge(int x,int y){	//	x and y are some tools (vertices)
        if((x = root(x)) == (y = root(y)) )    return ;
	if(par[y] < par[x])	// balancing the height of the tree
		swap(x, y);
	if( a[best[y]] < a[best[x]] ){
		best[x] = best[y];
	}
	par[x] += par[y];
	par[y] = x;
}

int32_t main(){
	IOS
	int n,m;cin>>n>>m;
	for(int i=0;i<n;i++){
		cin >> a[i];
		best[i] = i;
	}
	for(int i=0;i<m;i++){
		int u,v;cin>>u>>v;
		merge(u,v);
	}
	vector<int>used(n);
	int ans=0,cnt=0;
	for(int i=0;i<n;i++){
		if( root(i) == i ){
			used[ best[i] ] = 1;
			ans += a[best[i]];
			cnt++;
		}
	}
	if( cnt == 1){
		cout << 0 << endl; return 0;
	}
	if( 2 * ( cnt - 1) > n ){
		cout << "Impossible" << endl; return 0;
	}
	vector<int>lft;
	for(int i=0;i<n;i++){
		if( !used[i] ){
			lft.push_back(a[i]);
		}
	}
	sort(lft.begin(),lft.end());
	for(int i=0;i+cnt < 2*(cnt-1);i++){
		ans+=lft[i];
	}
	cout<<ans<<endl;
	
	
	
}
/*
 * long long or int?
 * index out of bound?
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


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

#define inRange(x,a,b) (a <= x && x < b)

int di[2][6] = {{ 0,-1, 0, 1, 1,-1}, { 1,-1,-1, 0, 1, 0}};
int dj[2][6] = {{-1, 0, 1,-1, 0,-1}, { 1, 0, 1,-1, 0, 1}};

int main(){
    int w, h;
    cin >> w >> h;

    int mat[102][102] = {};
    bool outer[103][103] = {};

    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            cin >> mat[i][j];
        }
    }

    // 考察の関係でiとjがめちゃくちゃになっています.
    queue<pair<int,int>> q;
    q.push({0,0});
    while(!q.empty()){
        pair<int,int> now = q.front();  q.pop();
        int i = now.first, j = now.second;
        if(outer[i][j]) continue;
        outer[i][j] = true;
        for(int k = 0; k < 6; k++){
            int ni = i + di[i%2][k], nj = j + dj[i%2][k];
            if(!inRange(ni, 0, h+3) || !inRange(nj, 0, w+3) || mat[ni][nj] == 1) continue;
            q.push({ni,nj});
        }
    }

    int ans = 0;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(mat[i][j] == 0)  continue;
            int wall = 0;
            for(int k = 0; k < 6; k++){
                int ni = i+di[i%2][k], nj = j+dj[i%2][k];
                if(outer[ni][nj])   wall++;
            }
            ans += wall;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3176
#include "bits/stdc++.h"
using namespace std;

int main(){
	string s;
	cin>>s;
	
	for(int i=0;i<s.size()-1;i++){
		if(s[i]=='A'&&s[i+1]=='C'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	
	cout<<"No"<<endl;
	
	
	return 0;
}

Measured memory_bytes: 768
#include<cstdio>
using namespace std;
const int N=1e5+5;
int n,x,y,z,tot,t,g,root1,root2,last[N],nex[N+N],to[N+N],v[N+N],s[N],f[N];
long long ans,dep[N];
void read(int &n)
{
   	int x=0;
    	char ch=getchar();
    	while (ch<'0' || ch>'9') ch=getchar();
    	while (ch<='9' && ch>='0') x=(x<<1)+(x<<3)+ch-48,ch=getchar();
    	n=x;
}
void add(int x,int y,int z)
{
	to[++tot]=y;
	v[tot]=z;
	nex[tot]=last[x];
	last[x]=tot;
}
int max(int a,int b){return a>b?a:b;}
void dg(int x,int y)
{
	s[x]=1;
	for (int i=last[x];i;i=nex[i])
	if (to[i]!=y)
	{
		dg(to[i],x);
		s[x]+=s[to[i]];
		f[x]=max(f[x],s[to[i]]);
	}
	f[x]=max(f[x],n-s[x]);
	if (f[x]<=t)
	{
		if (f[x]<t) t=f[x],root1=x,g=1;
		else g=2,root2=x;
	}
}
void dg1(int x,int y)
{
	ans+=dep[x];
	for (int i=last[x];i;i=nex[i])
	if (to[i]!=y) 
	{
		dep[to[i]]=dep[x]+v[i];
		dg1(to[i],x);
	}
}
int main()
{
	read(n);
	for (int i=1;i<n;i++)
	{
		read(x),read(y),read(z);
		add(x,y,z),add(y,x,z);
	}
	t=1e7;
	dg(1,0);
	dg1(root1,0);
	ans*=2;
	if (g==2) ans-=dep[root2];
	else
	{
		t=1e8+5;
		for (int i=last[root1];i;i=nex[i]) if (v[i]<t) t=v[i];
		ans-=t;
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

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

  int ans = x / 500 * 1000;
  x %= 500;
  ans += x / 5 * 5;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int Fairfield(int y,int m,int d){
  if(m <= 2) y--,m += 12;
  return 365*y+y/4-y/100+y/400+153*(m+1)/5+d-428;
}

int main(){
  int y1,m1,d1,y2,m2,d2;

  while(true){
    cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;

    if(y1 == -1 && m1 == -1 && d1 == -1 && 
       y2 == -1 && m2 == -1 && d2 == -1) break;

    cout << Fairfield(y2,m2,d2) - Fairfield(y1,m1,d1) << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
n,k=map(int,input().split())
a=list(map(int,input().split()))
k=bin(k)[2:]
p=[0]*40
for i,x in enumerate(a):
  for j in range(40):
    p[-1-j]+=(x>>j)&1
d=2**39
flag=1
b=0
for i in p[:-len(k)]:
  b+=i*d
  d//=2
ans=0
for i,x in enumerate(k):
  if x=='0':continue
  dy=d
  c=0
  for j,(y,z) in enumerate(zip(p[-len(k):],k)):
    if j<i:c+=[y,n-y][z=='1']*dy
    if j==i:c+=y*dy
    if j>i:c+=max(y,n-y)*dy
    dy//=2
  ans=max(ans,b+c)
c=0
for y,z in zip(p[-len(k):],k):
  c+=[y,n-y][z=='1']*d
  d//=2
print(max(ans,b+c))

Measured memory_bytes: 86932
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,x,m;
	cin>>n>>x>>m;
	bool visited[100005]={false};
	deque<long long>deq;
	long long ret = 0;
	while(!visited[x]){
		visited[x] = true;
		deq.push_back(x);
		long long curr = x;
		curr*=curr;
		curr%=m;
		x=curr;
	}
	while(deq.front()!=x && n){
		ret+=deq.front();
		deq.pop_front();
		n--;
	}
	long long len = deq.size(); 
	long long val = 0;
	for(int i=0; i<len; i++){
		val+=deq.front();
		deq.push_back(deq.front());
		deq.pop_front();
	}
	ret+=(n/len)*val;
	n%=len;
	for(int i=0; i<n; i++){
		ret+=deq.front();
		deq.pop_front();
	}
	cout<<ret;
}

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

using namespace std;
int n,m;
long long int a[101];
string s;
int w;
int main(){
  cin >> s;
  cin >> w;
  for(int i=0;i<s.length();i+=w)cout << s[i];
  cout << endl;
 
  return 0;
}


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

int main()
{
  int n;
  bool first = true;
  while (cin >> n) {
    vector<string> ans(8, "");
    for (int keta = 0; keta < 5; ++keta) {
      int d = n % 10;
      
      if (d >= 5) {
	ans[0] = " " + ans[0];
	ans[1] = "*" + ans[1];
      } else {
	ans[0] = "*" + ans[0];
	ans[1] = " " + ans[1];
      }
      ans[2] += "=";

      for (int i = 0; i < 5; ++i) {
	if (i == d%5)
	  ans[i+3] = " " + ans[i+3];
	else
	  ans[i+3] = "*" + ans[i+3];
      }

      n /= 10;
    }
    if (!first)
      cout << endl;
    for (unsigned int i = 0; i < ans.size(); ++i)
      cout << ans[i] << endl;
    first = false;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n, K; cin >> n >> K;

    int cnt = 0;
    int cur = 1;
    while(cur <= n){
    	cnt++;
    	cur += 2;
    }

    cout << (cnt >= K ? "YES":"NO") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lowbit(x) (x & -x)
#define jh(x, y) x ^= y ^= x ^= y
#define loc(x, y) (x - 1) * m + y
#define rg register
#define inl inline
#define PI 3.141592654
typedef long long ll;
const int N = 6e5 + 5, INF = 0x3f3f3f3f, mod = 998244353;
using namespace std;
namespace fast_IO {
	inl ll read() {
		rg char c;
		rg ll x = 0;
		rg bool flag = false;
		while ((c = getchar()) == ' ' || c == '\n' || c == '\r');
		if (c == EOF)return c; if (c == '-')flag = true; else x = c ^ 48;
		while ((c = getchar()) != ' ' && c != '\n' && c != '\r' && ~c)
			x = (x << 1) + (x << 3) + (c ^ 48);
		if (flag)return -x; return x;
	}
	inl ll max(rg ll a, rg ll b) { if (a > b)return a; return b; }
	inl ll min(rg ll a, rg ll b) { if (a < b)return a; return b; }
	void write(rg ll x) { if (x < 0)putchar('-'), x = -x; if (x >= 10)write(x / 10); putchar(x % 10 ^ 48); }
}
inl double ksm(rg double a, rg int b, rg int c) {
	rg int tmp = c, tt = b; b = 0;
	while (tmp < tt)tmp <<= 1, ++b;
	rg double ans = 1;
	for (; b; b >>= 1) {
		if (b & 1)ans *= a;
		a *= a;
	}
	return ans;
}

int main(void) {
	rg int n = fast_IO::read(), k = fast_IO::read();
	rg double ans = 0;
	for (rg int i = 1; i <= n; ++i)
		if (i >= k)ans += 1.0 / n;
		else ans += ksm(0.5, k, i) * (1.0 / n);
	printf("%.12f", ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    
    int n=sc.nextInt();
    int give=n/15;
    int x=n*800;
    int y=give*200;
    System.out.println(x-y);
    
  }
}

Measured memory_bytes: 24020
#include <iostream>

using namespace std;

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

	int t = n / 1.08;

	if (n == (int)(t * 1.08)) {
		cout << t << endl;
	}
	else if (n == (int)((t + 1) * 1.08)) {
		cout << t + 1 << endl;
	}
	else {
		cout << ":(" << endl;
	}

	return 0;
}

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

using namespace std;
const int N=2e7+5;
int a[N];
int dp[15][15];
long long rem,ans;
int solve(int idx,int lst)
{
    if(idx==11) return lst!=-1;
    int &ret=dp[idx][lst+1];
    if(~ret) return ret;
    ret=0;
    if(lst==-1)
    {
        ret+=solve(idx+1,lst);
        for(int i=1;i<=9;i++)
            ret+=solve(idx+1,i);
    }
    else
    {
       for(int i=-1;i<=1;i++)
            if(lst+i>=0&&lst+i<=9)
                ret+=solve(idx+1,lst+i);
    }
    return ret;
}
void build(int idx,int lst)
{
    if(idx==11) return;
    if(lst==-1)
    {
        if(solve(idx+1,lst)>=rem)
        {
            build(idx+1,lst);
            return;
        }
        rem-=solve(idx+1,lst);
        for(int i=1;i<=9;i++)
        {
            if(solve(idx+1,i)>=rem)
            {
                ans=i;
                build(idx+1,i);
                return;
            }
            rem-=solve(idx+1,i);
        }
    }
    else
    {
        for(int i=-1;i<=1;i++)
            if(lst+i>=0&&lst+i<=9)
            {
                if(solve(idx+1,lst+i)>=rem)
                {
                    ans=ans*10+(lst+i);
                    build(idx+1,lst+i);
                    return;
                }
                rem-=solve(idx+1,lst+i);
            }
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;cin>>n;
    rem=n;
    memset(dp,-1,sizeof dp);
    build(0,-1);
    cout<<ans<<endl;
    return 0;
}


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

int main(){
    int n,q;
    cin >> n;
    vector<int> A(n);
    rep(i,n) cin >> A[i];
    cin >> q;
    vector<int> m(q);
    rep(i,q) cin >> m[i];
    map<int,bool> sumnum;
    for(int b=0;b<pow(2,n);b++){
        int sum = 0;
        for(int bit=0;bit<n;bit++){
            if(b&(1<<bit)){
                sum+=A[bit]; 
            }
        }
        sumnum[sum]=true;
    }
    for(int i=0;i<q;i++){
        if(sumnum[m[i]]){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3268
function main()
	N=parse(Int,readline())
	A=map(x->parse(Int,x),split(readline()))
	cnt=zeros(Int,N)
	sum=zeros(Int,N)
	for a=A
		cnt[a]+=1
		sum[cnt[a]]+=1
	end
	it=N
	acc=N
	for i=1:N
		while acc<it*i
			acc-=sum[it]
			it-=1
		end
		println(it)
	end
end
main()


Measured memory_bytes: 172944
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

        queue<ll> q;
        FOR(i, 1, 10) q.push(i);

        ll ans = -1;
        REP(i, k) {
                ans = q.front();
                q.pop();

                if (ans % 10 != 0) {
                        q.push(10 * ans + (ans % 10 - 1));
                }

                q.push(10 * ans + ans % 10);

                if (ans % 10 != 9) {
                        q.push(10 * ans + (ans % 10 + 1));
                }
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 1792
import java.io.*;
import java.math.*;
import java.util.*;


public class Main {

	public static void main(String[] args) throws Exception {
		new Main().solve();
	}
	@SuppressWarnings("unchecked")
	void solve() throws Exception {
		FastScanner in = new FastScanner(System.in);

		long x = in.nextLong();
		long y = in.nextLong();
		long d = x - y;
		if (-1 <= d && d <= 1) {
			System.out.println("Brown");
		}else{
			System.out.println("Alice");
		}
	}
	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	class FastScanner {

		private InputStream _stream;
		private byte[] _buf = new byte[1024];
		private int _curChar;
		private int _numChars;
		private StringBuilder _sb = new StringBuilder();

		FastScanner(InputStream stream) {
			this._stream = stream;
		}

		public int read() {
			if (_numChars == -1) throw new InputMismatchException();
			if (_curChar >= _numChars) {
				_curChar = 0;
				try {
					_numChars = _stream.read(_buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (_numChars <= 0) return -1;
			}
			return _buf[_curChar++];
		}

		public String next() {
			int c = read();
			while (isWhitespace(c)) {
				c = read();
			}
			_sb.setLength(0);
			do {
				_sb.appendCodePoint(c);
				c = read();
			} while (!isWhitespace(c));
			return _sb.toString();
		}

		public int nextInt() {
			return (int) nextLong();
		}
		public long nextLong() {
			int c = read();
			while (isWhitespace(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9') throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isWhitespace(c));
			return res * sgn;
		}

		public boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
constexpr int dir[] = {-1, 0, 1, 0, -1};  // N->E->S->W
constexpr char mv[] = {'^', '>', 'v', '<'};
int H, W, Gx, Gy, y, x, d, pos, ans, cnt;
bool f[50][50];
string S;
int read(const char c)
{
    for (int i = 0; i < 4; i++) {
        if (c == mv[i]) { return i; }
    }
    return -1;
}
bool check()
{
    char c = S[pos];
    bool ok = false;
    if (c == '~') { ok = true, pos++; }
    c = S[pos];
    if (c == 'N') {
        if (d == 0) { ok = not ok; }
    } else if (c == 'E') {
        if (d == 1) { ok = not ok; }
    } else if (c == 'S') {
        if (d == 2) { ok = not ok; }
    } else if (c == 'W') {
        if (d == 3) { ok = not ok; }
    } else if (c == 'C') {
        if (not f[y + dir[d]][x + dir[d + 1]]) { ok = not ok; }
    } else if (c == 'T') {
        ok = not ok;
    }
    return pos++, ok;
}
void move()
{
    const int m = read(S[pos]);
    ans++;
    if (m == 0) {
        if (f[y + dir[d]][x + dir[d + 1]]) { y += dir[d], x += dir[d + 1]; }
    } else if (m == 1) {
        d = (d + 1) % 4;
    } else if (m == 2) {
        if (f[y - dir[d]][x - dir[d + 1]]) { y -= dir[d], x -= dir[d + 1]; }
    } else {
        d = (d + 3) % 4;
    }
    if (y == Gy and x == Gx) { cout << ans << endl, exit(0); }
}

void prog(const bool);
bool sent(const bool exec)
{
    cnt++;
    if (cnt > 10000000) { cout << -1 << endl, exit(0); }
    const char c = S[pos];
    if (c == '[') {
        pos++, prog(check() and exec), pos++;
    } else if (c == '{') {
        pos++;
        const int prev = pos;
        while (true) {
            const bool c = check();
            if (c and exec) {
                prog(true), pos = prev;
            } else {
                prog(false);
                break;
            }
        }
        pos++;
    } else if (read(c) != -1) {
        if (exec) { move(); }
        pos++;
    } else {
        return false;
    }
    return true;
}

void prog(const bool exec)
{
    while (sent(exec)) {}
}

int main()
{
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            char c;
            cin >> c;
            if (c == 's') { y = i, x = j; }
            if (c == 'g') { Gy = i, Gx = j; }
            f[i][j] = (c != '#');
        }
    }
    cin >> S;
    prog(true);
    cout << -1 << endl;
    return 0;
}



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

using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    vector <int> arr;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        arr.push_back(a);
    }
    sort(arr.begin(),arr.end());
    int ans=0;
    for(int i=k-1;0<=i;i--){
        ans+=arr[i];
        
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3624
// template version 1.14
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;
const int MOD=1e9+7;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int n,m;
vector<int> x;

signed main() {
  cin>>n>>m;

  x.resize(m);
  vi d;
  rep(i, m) { cin>>x[i]; }
  x.pb(n+1);
  rep(i, 1, m+1){
    d.pb(x[i]-x[i-1]);
  }
  sort(all(d));
  dump(d);

  vi dp(n+1);
  dp[1] = n-m;
  rep(y, 2, n+1){
    int x = posl(d, y);
    int v = (sz(d)) - x;
    dump(y, x);
    dp[y] = dp[y-1]-v;
  }
  dump(dp);

  vi ans(100001, -1);
  rrep(i, 1, n+1){
    ans[dp[i]] = i;
  }
  rep(i, 1, 100001){
    if (ans[i]==-1) ans[i]=ans[i-1];
  }

  int Q;cin>>Q;
  rep(i, Q) {
    int s;cin>>s;
    cout << ans[s] << endl;
  }
  return 0;
}



Measured memory_bytes: 5928
#include<stdio.h>
int main(){
  int a;
  char s[5];
  // 整数の入力
  scanf("%s", s);
  if((s[0]==s[1]) && (s[2]==s[3]) && (s[1]!=s[2])){
    printf("Yes");
  }else if((s[0]==s[2]) && (s[1]==s[3]) && (s[0]!=s[1])){
    printf("Yes");
  }else if((s[0]==s[3]) && (s[1]==s[2]) && (s[0]!=s[1])){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef pair<int, int>P;

int high[100000];
int main() {
	queue<P>que;
	int n, l; scanf("%d%d", &n, &l);
	rep(i, n)scanf("%d", &high[i]);
	rep(i, n) {
		if ((!i || high[i - 1] < high[i]) && (i == n - 1 || high[i + 1] < high[i]))
			que.push(P(i, l - high[i]));
	}
	int Max = 0;
	while (!que.empty()) {
		queue<P>k;
		while (!que.empty()) {
			P p = que.front(); que.pop();
			int i = p.first;
			Max = max(Max, p.second);
			high[i] = 0;
			if (i > 0)k.push(P(i - 1, p.second));
			if (i < n - 1)k.push(P(i + 1, p.second));
		}
		while (!k.empty()) {
			P p = k.front(); k.pop();
			int i = p.first;
			if ((!i || high[i - 1] < high[i]) && (i == n - 1 || high[i + 1] < high[i]))
				que.push(P(i, p.second + l - high[i]));
		}
	}
	printf("%d\n", Max);
}

Measured memory_bytes: 4156
N = int(input())
A = list(map(int,input().split()))
s = [0]*N
for i in range(N):
    s[i] = s[i-2]+A[i]

dp = [0]*N
dp[1] = max(A[0],A[1])
if N>=3:
    dp[2] = max(A[0],A[1],A[2])
for n in range(3,N):
    if n%2==1:
        dp[n] = max(A[n]+dp[n-2],s[n-1])
    else:
        dp[n] = max(A[n]+dp[n-2],A[n-1]+dp[n-3],s[n-2])

print(dp[-1])

Measured memory_bytes: 94088
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int mod = 1e9 +7;
typedef long long int lli;

lli mpower(lli a, lli b){
    lli ret=1;
    for(int i=63; i>=0; i--){
	ret = ret*ret %mod;
	if(b>>i & 1) ret = ret*a %mod;
    }
    return ret;
}

lli mmul(lli a, lli b){
    return (a*b) %mod;
}
lli mdiv(lli a, lli b){
    return (a*mpower(b, mod-2)) %mod;
}

int main(){
    lli h,w,k;
    cin >> h >> w >> k;
    vector<lli> fact(h+w+1);
    fact[0] = fact[1] = 1;
    for(int i=2; i<=h+w; i++){
	fact[i] = fact[i-1]*i %mod;
    }
    lli a = mmul(k, k+3);
    a = mdiv(a, 2);
    a = mmul(a, fact[h+w]);
    a = mdiv(a, fact[h+w-k]);
    lli b = mmul(h, w);
    b = mmul(mmul(b, k), mmul(k-1, k+1));
    b = mdiv(b, 3);
    b = mmul(b, fact[h+w-2]);
    b = mdiv(b, fact[h+w-k]);
    cout << (a+b) %mod << endl;
    return 0;
}


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

#define MOD 1000000007
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i <= (n); i++)

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

    int n, m, k;
    cin >> n;
    vector<int> l(n);

    REP(i, n)
    {
        cin >> k;
        l[i]=k;
    }
    int max = *std::max_element(l.begin(), l.end());
    int sum = std::accumulate(l.begin(), l.end(),0);
    if(sum-max > max){
       cout << "Yes" <<endl;
    }else{
        cout << "No"<<endl;
    }

}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

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


i64 n, m;
i64 h[55], p[55];

void init(){
	i64 cnt = 1;
	h[0] = 1;
	for(int i = 1; i <= n; i++){
		cnt = cnt*2 + 3;
		h[i] = cnt;
	}
	cnt = 1;
	p[0] = 1;
	for(int i = 1; i <= n; i++){
		cnt = cnt*2 + 1;
		p[i] = cnt;
	}
}

i64 solve(int a, i64 b){
	if(a == 0) return 1;
	if(b == 1) return 0;
	if(b < 2 + h[a-1]) return solve(a-1, b-1);
	if(b == 2 + h[a-1]) return p[a-1] + 1;
	if(b < h[a]) return p[a-1]+1 + solve(a-1, b-2-h[a-1]);
	if(b == h[a]) return p[a];
}

int main(){
	cin >> n >> m;
	init();
	
	cout << solve(n, m) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

	int N, a[10000];
	int result = 0;

	cin >> N;

	for (int i = 0; i < N; i++){
		cin >> a[i];
		result += a[i] - 1;
	}

	cout << result << endl;

	return 0;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

bool check(ll N, ll K, vector<ll> &A, vector<ll> &F, ll mid) {
    ll num = 0;
    rep(i, N) {
        if (A[i] * F[i] > mid) {
            num += A[i] - (mid / F[i]);
        }
    }
    if (num <= K) {
        return true;
    } else {
        return false;
    }
}

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

    ll N, K;
    cin >> N >> K;
    vector<ll> A(N), F(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> F[i];

    sort(all(A));
    sort(rall(F));

    ll ng = -1, ok = INF;

    while (ok - ng > 1) {
        ll mid = (ng + ok) / 2;
        if (check(N, K, A, F, mid)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <(n); (i)++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}
long comb(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
using namespace std;

int main(){
  string a,b,e;
  std::cin >> a>>b;
  int c,d;
  std::cin >> c>>d>>e;
  if(a==e)std::cout << c-1<<" "<<d << std::endl;
  else std::cout << c<<" "<<d-1 << std::endl;
  
  
}


Measured memory_bytes: 256
#!/usr/bin/env python3
A, B, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
min_A = min(A)
min_B = min(B)

C = []
d = []

for i in range(M):
    x, y, c = map(int, input().split())
    C.append(A[x-1]+B[y-1]-c)

print(min(min(C), min_A+min_B))


Measured memory_bytes: 18612
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<int>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  int n;
  cin >> n;
  int ans=0;
  rep(i,n){
    int a;
    cin >> a;
    if(i%2==0&&a%2==1)ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3632
S=input()

if S[0]!='A' or S[1].isupper():
  print('WA')
  exit()
  
Ccount=0
for i in range(2,len(S)):
  if S[i]=='C' and i!=(len(S)-1):
    if Ccount==0:
      Ccount+=1
    else:
      print('WA')
      exit()
  elif S[i].isupper():
    print('WA')
    exit()
if Ccount==1:
  print('AC')
else:
  print('WA')

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

int main(void) {
    vector<int> in;
    int k;
    in.resize(3);
    cin >> in[0] >> in[1] >> in[2] >> k;
    sort(in.begin(), in.end(), greater<int>());
    for (int i = 0; i < k; i++)
        in[0] *= 2;
    cout << in[0] + in[1] + in[2] << endl;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
k = list(list(map(int, input().split())) for _ in range(m))
p = list(map(int, input().split()))
check = 0

def rec(A, c):
  if len(A) == n:
    count_m = 0
    for l in range(m):
      list_k = k[l]
      count = 0
      for j in range(1, list_k[0] + 1):
        if A[list_k[j] - 1] == 1:
          count += 1
      if p[l] == (count%2):
        count_m += 1
    if(count_m == m):
      c += 1
    return c
  
  for i in range(2):
    A.append(i)
    c = rec(A, c)
    A.pop()

  return c

print(rec([], check))


Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
int a,b,c;
int cnt1,cnt2;
signed main(){
	cin>>a>>b>>c;
	cnt1=min(a,b)+1;
	while(true){
		cnt1--;
		if(a%cnt1==0&&b%cnt1==0)cnt2++;
		if(cnt2==c){
			cout<<cnt1<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <iostream>
#include <string>

#include <algorithm>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define PB push_back
#define MP make_pair

#define FOR(i, b, e) for(int i=(b);i<(e);i++)
#define REP(i, n) FOR(i,0,n)

#define ALL(v) (v).begin(),(v).end()

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VPII;

const int MOD = 1000000007;
const int INF = 1e9;

const double EPS = 1e-9;
const double PI = acos(-1.0);

const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

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

int N;

vector<char> vc;

void rec(char c, int n, char m) {
    if (n == N) {
        REP (i, N) {
            cout << vc[i];
        }
        cout << endl;
        return;
    }
    for (char i = 'a'; i <= m + 1; i++) {
        vc.PB(i);
        rec(i, n + 1, (i > m ? i : m));
        vc.pop_back();
    }
}

int main() {
    cin >> N;
    vc.PB('a');
    rec('a', 1, 'a');
    return 0;
}

Measured memory_bytes: 1536
;; B - Greedy Takahashi

(let ((A (read))  ; 高橋君のクッキー数
      (B (read))  ; 青木君のクッキー数
      (K (read))) ; 食べる回数
  (let ((eat (min A K)))
    (decf A eat)
    (decf K eat))
  (let ((eat (min B K)))
    (decf B eat)
    (decf K eat))
  (format t "~a ~a~%" A B))


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

int main(){
  string W;
  cin >> W;

  for(int i=0;i<W.size();i++){
    W[i] = toupper(W[i]);
  }
  string T = "";
  string T2 = "";

  int counter = 0;
  while (T2 != "END_OF_TEXT") {
    cin >> T;
    T2 = T;
    for(int i=0;i<T.size();i++){
        T[i] = toupper(T[i]);
    }

    if(T == W){
      counter++;
    }
  }
  cout << counter << endl;
}



Measured memory_bytes: 3200
H, W = map(int, input().split())
ans = (H % 3 > 0) * W
ans = min(ans, (W % 3 > 0) * H)
for h in range(1, H):
    a = h * W
    b = (H - h) * (W // 2 + (W % 2 == 1))
    c = (H - h) * (W // 2)
    ans = min(ans, max(a, b, c) - min(a, b, c))

for w in range(1, W):
    a = H * w
    b = (W - w) * (H // 2 + (H % 2 == 1))
    c = (W - w) * (H // 2)
    ans = min(ans, max(a, b, c) - min(a, b, c))
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
int main() {
 string s;
  int i;
  cin >> s;
  for(i=2; i<s.length(); i+=2) {
    if(s.substr(0,(s.length()-i)/2)==s.substr((s.length()-i)/2,(s.length()-i)/2)) {
      break;
    }
  }
  cout << s.length()-i << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int n; cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll ans = 0;
    ll mx = a[0];
    for (int i = 0; i < n; i++) {
        ans += max(0LL, mx - a[i]);
        mx = max(a[i], mx);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 4776
use std::io::*;
use std::str::*;
use std::collections::*;

pub fn read_from<T: FromStr, R: Read>(s: &mut R) -> T {
    let s = s.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    if !s.is_empty() {
        if let Ok(s) = s.parse::<T>() {
            s
        } else {
            panic!("faild to parse {}", s);
        }
    } else {
        if cfg!(local) {
            // eprintln!("reached to EOF");
        }
        std::process::exit(0)
    }
}

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let mut stdin = stdin.lock();
    read_from(&mut stdin)
}

fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x
    } else {
        gcd(y, x % y)
    }
}

fn main() {
    loop {
        let n = read();
        let x: i64 = read();
        let xs: Vec<i64> = (0..n).map(|_| (read::<i64>() - x).abs()).collect();
        let gcd = xs.iter().fold(0, |x, &y| gcd(x, y));
        println!("{}", gcd);
    }
}


Measured memory_bytes: 4352
N = int(input())
rem = []

for i in range(1, N):
    if i * i > N:
        break
    elif i * i == N:
        rem.append(i)
    elif N % i == 0:
        rem.extend([i, N // i])

ans = 0
for r in rem:
    if (r - 1) > N // r:
        ans += r - 1
print(ans)

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

const int INF = 100000000;
const int MAX_N = 51;
const int MAX_M = 51;
typedef pair<int, int> P;

char maze[MAX_N][MAX_M + 1];
int N, M;
int d[MAX_N][MAX_M];
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int cnt_b = 0;

int bfs() {
  queue<P> que;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      d[i][j] = INF;
    }
  }
  que.push(P(0, 0));
  d[0][0] = 0;
  while (que.size()) {
    P p = que.front();
    que.pop();
    if (p.first == N - 1 && p.second == M - 1) break;
    for (int i = 0; i < 4; ++i) {
      int nx = p.first + dx[i];
      int ny = p.second + dy[i];
      if (0 <= nx && nx < N && 0 <= ny && ny < M && maze[nx][ny] != '#' && d[nx][ny] == INF) {
        que.push(P(nx, ny));
        d[nx][ny] = d[p.first][p.second] + 1;
      }
    }
  }
  return d[N - 1][M - 1];
}

int main() {
  cin >> N >> M;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      cin >> maze[i][j];
      if (maze[i][j] == '#') cnt_b++;
    }
  }
  int ans = bfs();
  if (ans != INF) cout << N * M - ans - 1 -  cnt_b << endl;
  else cout << "-1" << endl;
}


Measured memory_bytes: 256
n,h=map(int, input().split())
x=[list(map(int, input().split())) for i in range(n)]
a=0
b=[]

for i in range(n):
    if a<x[i][0]:
        a=x[i][0]

for i in range(n):
    if a<x[i][1]:
        b.append(x[i][1])
        
b.sort()
b.reverse()

for i in range(len(b)):
    h-=b[i]
    if h<=0:
        print(i+1)
        exit()
        
w=-(-h//a)
print(w+len(b))
    

Measured memory_bytes: 28588
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int n;
    string s;
    cin >> n >> s;
    string s1, s2;
    s1 = s.substr(0, s.size()/2);
    s2 = s.substr(s.size()/2, s.size()/2);
    if (s1 != s2 || n % 2 == 1) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define pf push_front
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define rep(i,n) for(ll i=0;i<n;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int M = 1000000007;
int ll_max=1e6;



int main() {
	// your code goes here
	IOS;
	ll n,m,i,j,d;
	
	
      ll x,y,t,b,c,k;
      cin>>n;
      ll a[n];
      rep(i,n){
            cin>>a[i];
      }
      sort(a,a+n);
      ll max=a[n-1];
      
      ll dummy[max+1]={0};
      ll count=0;
      rep(i,n){
            if(dummy[a[i]]==0){
                  for(j=a[i];j<=max;j+=a[i])
                  dummy[j]=1;
                  
                  if(a[i]!=a[i+1])
                  count++;
                  
            }
      }
      
      cout<<count;
      return 0;
}

Measured memory_bytes: 12968