akhauriyash/Code-Regression huggingface dataset:
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m;
	cin>>n>>m;
	vi in(n);
	rep(i,n)cin>>in[i];
	vi dp(m+1);
	dp[0]=1;
	int out=0,MOD=998244353;
	rep(i,n){
		for(int j=m;j>=0;j--)if(j+in[i]<=m)
			(dp[j+in[i]]+=dp[j]*(j?1:i+1)%MOD)%=MOD;
		(out+=dp[m]*(n-i)%MOD)%=MOD;
		dp[m]=0;
	}
	cout<<out<<endl;
}






Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n;
	int k, money;
	money = 100000;
	cin >> n;

	for (int i = 0; i < n; i++) {
		money = money * 1.05;

		k = money % 1000;
		if (k > 0) {
			money = money - k + 1000;
		}
	}
	cout << money << endl;
}

Measured memory_bytes: 1160
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main () {
  int N;
  cin >> N;
  int C[1000];
  int S[1000];
  int F[1000];
  for (auto i = 0; i < N-1; ++i) {
    cin >> C[i] >> S[i] >> F[i];
  }
  for (auto k = 0; k < N; ++k) {
    int now = 0;
    for (auto i = k; i < N-1; ++i) {
      if (now < S[i]) now = S[i];
      if (now%F[i] != 0) {
        now += F[i] - (now%F[i]);        
      }
      now += C[i];
    }
    cout << now << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <utility>
#include <climits>
#include <algorithm>

using namespace std;

typedef pair<int, int> P;

int h, w;
char maze[50][51];
int reach[50][50];

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

int sharp;

int bfs() {
    queue<P> que;
    que.push(P(0, 0));
    reach[0][0] = 0;

    while (que.size()) {
        P p = que.front();
        que.pop();

        for (int i = 0; i < 4; ++i) {
            int ny = p.first + dy[i], nx = p.second + dx[i];
            if (0 <= ny && ny < h && 0 <= nx && nx < w && maze[ny][nx] != '#' && reach[ny][nx] == INT_MAX) {
                que.push(P(ny, nx));
                reach[ny][nx] = min(reach[ny][nx], reach[p.first][p.second] + 1);
            }
        }
    }

    return reach[h - 1][w - 1];
}

int main() {
    cin >> h >> w;
    sharp = 0;
    for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) {
        cin >> maze[i][j];
        reach[i][j] = INT_MAX;
        if (maze[i][j] == '#') ++sharp;
    }

    int ans = bfs();

    if (ans == INT_MAX) cout << -1 << endl;
    else                cout << h * w - ans - sharp - 1 << endl;

    return 0;
}

Measured memory_bytes: 256
/*    कर्मण्येवाधिकारस्ते मा फलेषु कदाचन । मा कर्मफलहेतुर्भुर्मा ते संगोऽस्त्वकर्मणि ॥    */
#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 ) cout << (#x) <<"="<< x << endl;
#define bug2( x , y ) cout << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;
#define bug3( x , y , z ) cout << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;
#define bug4( x , y , z , w) cout << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;
#define bug5( x , y , z , w ,p) cout << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;
#define bug6( x , y , z , w ,p , q) cout << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;
#define bugn( x , n ){ cout<<(#x)<<":";for(int i=0;i<n;i++)cout<<(#x)<<"["<<i<<"]:"<< x[i] << "    "; cout<<endl;}
#define bugnm( x , n , m ){ cout<<(#x)<<endl;for(int i=0;i<n;i++){ cout<<"Row #"<<i<<":"; for(int j=0;j<m;j++) cout<<x[i][j]<<"     "; cout << endl;}}
using namespace std;	




int32_t main()
{
	IOS
	int x;cin>>x;
	int ans = 0;
	int bal = 100;
	while( bal < x ){
		int k = bal/100;
		ans+=1;
		bal+=k;
	}
	cout<<ans<<endl;

	
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main(void) 
{
    int i;
    int hs[10];

    for (i = 0; i < 10; i++) {
        cin >> hs[i];
    }

    sort(hs, hs+10, greater<int>());

    for (i = 0; i < 3; i++) {
        cout << hs[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    long long n; cin>>n;
    long long a[n]; rep(i,n) cin>>a[i];
    sort(a,a+n);
    long long tmp=0,ans=0;
    rep(i,n){
        if((a[i]-tmp)%2){
            ans^=(n-i);
        }
        tmp=a[i];
    }
    if(ans==0){
        cout<<"second"<<endl;
    }else{
        cout<<"first"<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>

using std::cin;
using std::cout;
using std::endl;

using std::min;
using std::max;
using std::abs;

using std::vector;

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

    char c = '-';
    if(abs(a - x) <= abs(b - x)){
        c = 'A';
    }else{
        c = 'B';
    }
    cout << c << endl;

    return 0;
}


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

int main() {
    int n; cin >>n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    bool ok = false;
    int odd = 0, even4 = 0, even2 = 0;

    rep(i, n) {
        if (a[i] % 2 != 0) odd++;
        else if (a[i] %4 == 0) even4++;
        else even2++;
    }
    //printf("odd=%d, even4=%d, even2=%d\n", odd, even4, even2);
    even4-=(odd-1);
    if (even4<0){
        puts("No");
        return 0;
    }
    even2 %= 2;
    if (even2 != 0) {
        if (even4!= 0)
            puts("Yes");
        else
            puts("No");
    }
    else {
        puts("Yes");
    }
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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

__attribute__ ((constructor))
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(10);
}

int main(){
    int k;
    cin >> k;
    rep(i, k) { cout << "ACL"; }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;


int main()
{
    FASTIO
    /*
    //double start_time = clock();
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
//*/
    int T;
    //cin >> T;
    T = 1;
    for (int cs = 1; cs <= T; cs++) {
        int a, b, c;
        cin >> a >> b >> c;
        cout << max(0, (b + c) - a) << endl;
    }

    //double end_time = clock();
    //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	double a, b;
	cin >> a >> b;
	double tubo = 3.305785;
	printf("%.5f\n", a*b / tubo);
	return 0;
}

Measured memory_bytes: 3248
// AOJ CGL_7_A Intersection
// 2018.5.3 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

typedef struct { double x, y; } PP;
typedef struct { double x, y, r; } C;

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define INF 1e8
#define EPS 1e-8
#define EQ(a,b)		(fabs((a)-(b))<EPS)

PP vset(double x, double y) { PP r; r.x = x, r.y = y; return r; }
PP vsub(PP p1, PP p2) { PP r; r.x = p1.x - p2.x, r.y = p1.y - p2.y; return r; }
double vabs(PP a) { return hypot(a.x, a.y); }
double dist(PP p1, PP p2) {	return vabs(vsub(p1, p2)); }

/* return
   4: if they do not cross (there are 4 common tangent lines), 
   3: if they are circumscribed (there are 3 common tangent lines), 
   2: if they intersect (there are 2 common tangent lines), 
   1: if a circle is inscribed in another (there are 1 common tangent line), 
   0: if a circle includes another (there is no common tangent line). 
*/
int intersectCC(C c1, C c2, PP *p1, PP *p2)
{
	double x1 = c1.x, y1 = c1.y, r1 = c1.r;
	double x2 = c2.x, y2 = c2.y, r2 = c2.r;
	double d = hypot(x1-x2, y1-y2);
	double w, n, x, y, p, q;
	double u, v;

	u = r1+r2, v = fabs(r1-r2);

	if (EQ(d, u)) return 3;
	if (d >= u)   return 4;
	if (EQ(d, v)) return 1;
	if (d <= v)   return 0;

	w = ((r1*r1 - r2*r2)/d + d) / 2;
	n = sqrt(r1*r1 - w*w);
	x = x1 + (x2-x1)*w / d;
	y = y1 + (y2-y1)*w / d;
	p = (y2-y1)*n / d;
	q = (x2-x1)*n / d;

	p1->x = x+p, p2->x = x-p;
	p1->y = y-q; p2->y = y+q;

	return 2;
}

int main()
{
	C c1, c2;
	PP p1, p2;

	c1.x = in(), c1.y = in(), c1.r = in();
	c2.x = in(), c2.y = in(), c2.r = in();
	printf("%d\n", intersectCC(c1, c2, &p1, &p2));
	return 0;
}


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

using namespace std;

typedef pair<int, int> pii;

int main()
{
    int N, M;
    while (cin >> N >> M, N) {
        vector<vector<int>> a(N, vector<int>(M));
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                cin >> a[i][j];
            }
        }
        priority_queue<pii> Q;
        for (int i = 0; i < M; i++) {
            int cnt = 0;
            for (int j = 0; j < N; j++) {
                if (a[j][i] == 1) ++cnt;
            }
            Q.push(pii(cnt, -(i+1)));
        }
        bool f = 0;
        while (!Q.empty()) {
            if (f) cout << " ";
            f = 1;
            cout << -Q.top().second; Q.pop();
        }
        cout << endl;
    }
    return 0;
}

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

int main() {
  int  i,j;
  char c;
  cin>>c;
  string ret;
  if (c=='a'||c=='e'||c=='u'||c=='i'||c=='o'){ret="vowel";}
  else {ret="consonant";}

  cout<<ret<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定 setprecision()
#include <list> //前後に数値を入れれる配列
#include <map> //map
#include <vector> //vecror

#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = acos(-1); //円周率
ll mod = 1e9 + 7;


//提出コード

ll n, k,cnt,d[110];
ll a[110];
bool J[110];


int main() {
	cin >> n >> k;
	rep(i, k) {
		cin >> d[i];
		rep(j, d[i]) {
			cin >> a[j];
			J[a[j]] = true;
		}
	}
	REP(i, 1, n + 1) {
		if(!(J[i])) cnt++;
	}
	cout << cnt << endl;

	return 0;
}



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

int n,t;

int main(){
	cin>>n;
	for (int i=1;i<=n;++i){
		int x;
		scanf("%d",&x);
		t^=x;
	}
	if (t) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}


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

int main(void) {
	string str;
	cin >> str;
	int size, count = 0;

	vector<bool> vec(26, true);
	size = str.size();
	for (int i = 0; i < size; i++) {
		if (vec.at(str.at(i) - 'a')) { vec.at(str.at(i) - 'a') = false;  count++; }
		if (count >= 26) break;
	}
	if (count == 26) { cout << "None" << endl; return 0; }
	for (int i = 0; i < 26; i++) {
		if (vec.at(i)) { cout << "abcdefghijklmnopqrstuvwxyz"[i] << endl; return 0; }
	}
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define mxn 2010
using namespace std;
int n,m,sl,fh,ans,l[mxn][mxn],r[mxn][mxn],u[mxn][mxn],d[mxn][mxn];
char s[mxn][mxn];
int rd()
{
	sl=0;fh=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch) {if(ch=='-') fh=-1; ch=getchar();}
	while('0'<=ch&&ch<='9') sl=sl*10+ch-'0',ch=getchar();
	return sl*fh;
}
int main()
{
	n=rd();m=rd();
	for(int i=1;i<=n;++i) scanf("%s",s[i]+1);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			if(s[i][j]=='.') l[i][j]=l[i][j-1]+1;
			else l[i][j]=0;
	for(int i=1;i<=n;++i)
		for(int j=m;j;--j)
			if(s[i][j]=='.') r[i][j]=r[i][j+1]+1;
			else r[i][j]=0;
	for(int i=1;i<=m;++i)
		for(int j=1;j<=n;++j)
			if(s[j][i]=='.') u[j][i]=u[j-1][i]+1;
			else u[j][i]=0;
	for(int i=1;i<=m;++i)
		for(int j=n;j;--j)
			if(s[j][i]=='.') d[j][i]=d[j+1][i]+1;
			else d[j][i]=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			ans=max(ans,l[i][j]+r[i][j]+u[i][j]+d[i][j]-3);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 67200
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<iomanip>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;

using namespace std;
int main() {
	double w, h, x, y;
	cin >> w >> h >> x >> y;

	printf("%.10f\n", w*h / 2);
	if (x == w / 2 && y == h / 2) cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
def input():
	return sys.stdin.readline().strip()

N, K, Q = list(map(int, input().split()))

ans = [0]*N
for i in range(Q):
	a = int(input())
	a -= 1
	ans[a] += 1

for i in range(N):
	if K - (Q - ans[i]) > 0:
		print("Yes")
	else:
		print("No")

Measured memory_bytes: 47068
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  double ans = 0;
  int N; double t; 
  cin >> N >> t;
  for (int i = 0; i < N; i++) {
    double x, h; cin >> x >> h;
    ans = max((t/x)*h, ans);
  }
  cout << fixed << ans << endl;
}



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

int main(){
	bool F,S,T;
	int out,point;
	
	int i,j;
	
	int dataN,dataLoop;
	string E;
	
	cin>>dataN;
	for(dataLoop=0;dataLoop<dataN;dataLoop++){
	out=0;point=0;
	F=false;S=false;T=false;
	while(out!=3){
	 cin>>E;
	 if(E=="HIT"){
	  if(T){point++;}
	  T=S;S=F;F=true;
	 }else if(E=="HOMERUN"){
	  point++;
	  if(F){point++;F=false;}
	  if(S){point++;S=false;}
	  if(T){point++;T=false;}
	 }else{
	  out++;
	 }
	}
	cout<<point<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1204
import math


def main():
    s = int(input())
    quo = int(s/3)
    count = 0

    for i in range(1, quo+1):
        a = math.factorial((s-3*i)+(i-1))
        b = math.factorial(s-3*i)
        c = math.factorial(i-1)
        add = a//(b*c)
        count += add

    return count % (10**9+7)


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 79412
import math
RMAX = 10**5

def get_primes(n):
    ps = []
    upper = math.sqrt(n)
    data = [i+1 for i in range(1, n)]
    while True:
        p = data[0]
        if p >= upper:
            break
        ps.append(p)
        data = [e for e in data if e%p != 0]
    return ps + data

primes = get_primes(RMAX)
primes_set = set(primes)
sim_2017 = [0]*(RMAX+1)
for p in primes:
    if (p+1)//2 in primes_set:
        sim_2017[p] = 1

for i in range(1, len(sim_2017)):
    sim_2017[i] += sim_2017[i-1]

q = int(input())
for _ in range(q):
    l, r = list(map(int, input().split()))
    ans = sim_2017[r] - sim_2017[l-1]
    print(ans)


Measured memory_bytes: 8064
import java.util.*;
import java.io.*;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int K = sc.nextInt();
        String ans = "IMPOSSIBLE";
        int div = sc.nextInt();
        int max = div;
        if(div==K) ans = "POSSIBLE";
        for(int i=1;i<n;i++){
            int cur = sc.nextInt();
            if(cur==K){
                ans = "POSSIBLE";
                break;
            }
            div = gcd(div,cur);
            max = Math.max(max,cur);
        }
        if(max>K&&(max-K)%div==0) ans = "POSSIBLE";
        System.out.println(ans);
    }
    static int gcd(int a, int b){
        if(a<b){
            int med = b;
            b=a;
            a=med;
        }
        while(a%b!=0){
            int s = a;
            a = b;
            b = s%a;
        }
        return b;
    }
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

void solve(int n, string s, int t1, int t2) {
    vector<int> sh(n);
    sh[0] = t1;
    sh[1] = t2;
    forn(i, 2, n) {
        sh[i] = (sh[i - 1] + sh[i - 2] + (s[i - 1] == 'x')) % 2;
    }
    if ((sh[n - 1] + sh[0] + sh[1] + (s[0] == 'x')) % 2 == 0 && (sh[n - 2] + sh[n - 1] + sh[0] + (s[n - 1] == 'x')) % 2 == 0) {
        forn(i, 0, n) cout << (sh[i] ? 'W' : 'S');
        cout << '\n';
        exit(0);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    solve(n, s, 0, 0);
    solve(n, s, 0, 1);
    solve(n, s, 1, 0);
    solve(n, s, 1, 1);
    cout << "-1\n";
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int a=0;
  for (int i=0; i<n;i++){
    if(s.at(i)=='R'){
    a++;
    }
    else{}
  }
  if(a>n-a){
  cout<<"Yes";
  }
  else{
  cout<<"No";
  }
  cout<<endl;
 }


Measured memory_bytes: 256
//Practice
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 2e5 + 5;
const ll INF = 1e9 + 5;
const ll mxN = 1000000007;
const double E = 1e-9;

//------------------------------------------------------------------------------
string s;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	/*ifstream cin("input.txt");
	ofstream cout("output.txt");*/
	cin >> s;
	ll cnt = 0, ans = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[s.size() - 1 - i] == 'B')
		{
			ans += i - cnt;
			// cout<<i<<" "<<ans<<"\n";
			++cnt;
		}
	}
	cout << ans;
	return 0;
}
//29-08-2020 13:01:13
//------------------------------------------------------------------------------

Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
int32_t main() {
    fast_io();
    int n, k;
    cin >> n >> k;
    int ans = min(n % k, k - (n % k));
    cout << ans << "\n";
    return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K;
    string S, ans;
    cin >> K >> S;
    if(S.size() <= K) cout << S << endl;
    else {
        ans = S.substr(0,K);
        ans = ans + "...";
        cout << ans << endl;
    }
    return 0;
}


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

int main() {
	char c;
	cin >> c;

	if (c == 'a' || c == 'e' || c =='i' || c =='o' || c == 'u') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
while True:
    n,x = map(int,input().split())
    if n == 0 and x == 0:
        break

    count = 0
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1,n+1):
                if i+j+k ==x:
                    count +=1
    print(count)


Measured memory_bytes: 5596
#include <iostream>

using namespace std;

int main()
{
	int N;
	int x = 0;
	int max = 0;
	char s[100];
	cin >> N;
	cin >> s;
	
	for(int i=0;i<N;i++)
	{
		if(s[i]=='I')
		{
			x++;
		}else if(s[i]=='D'){
			x--;
		}

		if(x>max)
		{
			max = x;
		}
	}
	cout << max << endl;
	return 0;
}

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

#include <cstdint>
using namespace std;

const int MOD = 1e9 + 7;
using ll = long long;

template <uint_fast64_t Modulus> class mint {
    using u64 = uint_fast64_t;
    u64 a;
public:

    constexpr mint(const u64 a = 0) noexcept : a(a % Modulus) {}

    constexpr u64& value() noexcept {
        return a;
    }

    constexpr mint& operator +=(const mint& rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) a -= Modulus;
        return *this;
    }

    constexpr mint& operator -=(const mint& rhs) noexcept {
        a += Modulus - rhs.a;
        if (a >= Modulus) a -= Modulus;
        return *this;
    }

    constexpr mint& operator *=(const mint& rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }

    constexpr mint& operator /=(const mint& rhs) noexcept {
        u64 power = Modulus - 2;
        while (power) {
            if (power & 1u) {
                *this *= rhs;
            }

            rhs *= rhs;
            power >>= 1u;
        }

        return *this;
    }

    constexpr mint operator +(const mint rhs) const noexcept {
        return mint(*this) += rhs;
    }

    constexpr mint operator -(const mint rhs) const noexcept {
        return mint(*this) -= rhs;
    }

    constexpr mint operator *(const mint &rhs) const noexcept {
        return mint(*this) *= rhs;
    }

    constexpr mint operator /=(const mint &rhs) const noexcept {
        return mint(*this) /= rhs;
    }
};

mint<MOD> dp[62][2][2][2];

int main() {
    ll L, R;
    cin >> L >> R;

    // dp[i][more][less][bit]
    dp[61][0][0][0] = 1;

    for (int i = 60; i >= 0; i--) {
        int lb = (L >> i) & 1u;
        int rb = (R >> i) & 1u;

        for (int more = 0; more < 2; more++) for (int less = 0; less < 2; less++) for (int bit = 0; bit < 2; bit++) {
            mint<MOD> before = dp[i+1][more][less][bit];

            for (int x = 0; x < 2; x++) for (int y = 0; y < 2; y++) {
                if (!y && x) continue;
                int n_more = more, n_less = less, n_bit = bit;

                if (!bit && x != y) continue;
                if (x && y) n_bit = 1;

                if (!more && !x && lb) continue;
                if (x && !lb) n_more = 1;

                if (!less && y && !rb) continue;
                if (!y && rb) n_less = 1;

                dp[i][n_more][n_less][n_bit] += before;
            }
        }
    }

    mint<MOD> ans;
    for (int more = 0; more < 2; more++) for (int less = 0; less < 2; less++) for (int bit = 0; bit < 2; bit++) {
        ans += dp[0][more][less][bit];
    }

    cout << ans.value() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
	ll N;
	cin >> N;
	vector<tuple<ll,ll,ll>> v(N);
	FOR(i,0,N){
		ll A,B;
		cin >> A >> B;
		v.pb(make_tuple(A+B,A,B));
	}
	sort(ALL(v));
	reverse(ALL(v));
	ll takahashi = 0;
	ll aoki = 0;
	FOR(i,0,N){
		if(i%2 == 0)takahashi += get<1>(v[i]);
		else aoki += get<2>(v[i]);
	}
	cout << takahashi - aoki << endl;
}

Measured memory_bytes: 6400
#include<stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    int i;
    int a[100005];
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    int ans = 0;
    for (i = 0; i < n; i++)
        if (i == a[a[i] - 1] - 1)
            ans++;
    ans /= 2;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

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

    size_t N, T;
    cin >> N >> T;

    vector<size_t> t(N);
    cin >> t[0];

    int64_t res = 0;
    for (size_t i = 1; i < N; ++i) {
        cin >> t[i];
        res += min(t[i] - t[i - 1], T);
    }

    res += T;

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 1792
# 2020/07/26
# AtCoder Beginner Contest 066 - B
# B:後ろから順に消して全探索
# 2文字ずつ消す

# Input
s = list(input())
n = len(s)

# Calc
for i in range(n-1, 0, -1):
    s.pop()
    slen = len(s)
    # 偶数時のみ実施
    if slen % 2 == 0:
        hs = slen // 2
        tflg = True
        for j in range(0, hs, 1):
            if s[j] != s[j+hs]:
                tflg = False
                break
        if tflg == True:
            ans = slen
            break

# Output
print(ans)


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

#define ll long long
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int N = 1e5 + 2;
int n, k;
ll dp[N], arr[N];

ll solve(int i) {
    if (i >= n)return 1e9;
    if (i == n - 1)return 0;
    ll &ret = dp[i];
    if (~ret)return ret;
    ret = 1e9;
    for (int j = 1; j <= k; ++j) {
        ret = min(solve(j + i) + abs(arr[i + j] - arr[i]), ret);
    }
    return ret;
}

int main() {
    scanf("%d%d", &n, &k);
    memset(dp, -1, sizeof dp);
    for (int i = 0; i < n; ++i)scanf("%lld", arr + i);
    cout << solve(0);
    return 0;
}


Measured memory_bytes: 6528
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = sum([a[i]-b[i] if a[i]>b[i] else -((b[i]-a[i])//2) for i in range(N)])
print("Yes" if s < 1 else "No")

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

double max(double a, double b) {
	if (a > b) return a;
	return b;
}
double min(double a, double b) {
	if (a < b) return a;
	return b;
}

int main() {
	double xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2;
	while (cin>>xa1>>ya1>>xa2>>ya2>>xb1>>yb1>>xb2>>yb2) {
		if (max(xa1, xb1)<=min(xa2, xb2)&&max(ya1, yb1)<=min(ya2, yb2)) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
bool prime(int x){
    if(x<2) return false;
    else if(x==2) return true;
    else if(x%2==0) return false;
    double sqx=sqrt(x);
    for(int i=3;i<=sqx;i+=2){
        if(x%i==0)return false;
    }
    return true;
}
int main(){
    int x;
    cin >> x;
    while(prime(x)==false)x++;
    cout << x << endl;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
p=[int(i)-1for i in input().split()]
c=list(map(int,input().split()))
ans=-10**9
for i in range(n):
    start=i
    cycle=[0]
    for _ in range(n):
        i=p[i]
        cycle+=[cycle[-1]+c[i]]
        if i==start:break
    S,L=cycle[-1],len(cycle)-1
    if S<=0:ans=max(ans,max(cycle[1:k+1]))
    else:
        if k>L:ans=max(ans,(k//L-1)*S+max(max(cycle),max(cycle[:k%L+1])+S)) 
        else:ans=max(ans,max(cycle[:k+1]))
print(ans)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define repit2(x) for (__typeof((x).begin()) it2 = (x).begin(); it2 != (x).end(); it2++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define Sort(v) sort(All(v))
#define SortR(v) sort(All(v), std::greater<__typeof(v[0])>())
#define Sart(a) sort(a, a + sizeof(a) / sizeof(__typeof(a[0])));
#define SartR(a) sort(a, a + sizeof(a) / sizeof(__typeof(a[0])), std::greater<__typeof(a[0])>())

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    int n;
	string s, t;

	cin >> n;
	cin >> s;
	cin >> t;

	bool isSame;
	string str = s + t;

    int i, j;

	rep(i, n) {
		isSame = true;
		
		rep(j, n) {
			if (n <= i + j) break;
			
		    if (s[i + j] != t[j]) {
				isSame = false;

				break;
			}
		}

		if (isSame) {
			str = s.substr(0, i);
			str += t;

		    break;
		}
	}
    
	Out(str.size());
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {
  int N;
  int s[100] = {};
  int sum = 0;

  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", s + i);
    sum += s[i];
  }

  sort(s, s + N - 1);

  for (int i = 0; i < N; i++) {
    if (sum % 10 != 0) {
      break;
    }
    if (s[i] % 10 != 0) {
      sum -= s[i];
    }
  }

  if (sum % 10 == 0) sum = 0;
  printf("%d\n", sum);

  return 0;
}


Measured memory_bytes: 128
N = int(raw_input())
S = raw_input()

#print N, S

res = ['0' for i in range(len(S))]

#print res

for i in range(len(S)):
    res[i] = ord(S[i])+N
    if res[i] > ord('Z'):
        res[i] -= 26
    res[i] = chr(res[i])

#print res
result = ""
for i in range(len(S)):
    result += res[i]
print result


Measured memory_bytes: 2948
using System;

namespace CircleInRactangle
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int W, H, x, y, r;
            W = int.Parse(str[0]);
            H = int.Parse(str[1]);
            x = int.Parse(str[2]);
            y = int.Parse(str[3]);
            r = int.Parse(str[4]);

            if ((0 <= (x - r)) && ((x + r) <= W) && (0 <= (y - r)) && ((y + r) <= H))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");


        }
    }
}

Measured memory_bytes: 17560
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define INF 1000000000
#define mod 1000000007
int main(){
    long long n;
    cin>>n;
    vector<char> ans;
    if(n==0){
        cout<<0<<endl;
        return 0;
    }
    while(n!=1){
        if(n%2)
        ans.push_back('1');
        else
        ans.push_back('0');
        if(n<0){
            if(n%2){
                n/=-2;n++;
            }
            else{
                n/=-2;
            }
        }
        else{
            n/=-2;
        }
        if(n==0)    break;
    }
    ans.push_back('1');
    for(int i=ans.size()-1;i>=0;i--)   
    cout<<ans[i];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#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 ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 0;

int N;
int d[212345];
ll sum[212345];

int main() {
	cin >> N;
	REP(i, N) scanf("%d", d + i);
	
	REP(i, N) sum[i + 1] = sum[i] + d[i];
	
	int ans = 0;
	map<ll, int> m;
	REP(i, N + 1) {
		if (!m.count(sum[i])) m[sum[i]] = i;
		if (m.count(sum[i])) chmax(ans, i - m[sum[i]]);
	}
	
	cout << ans << endl;
	
	return 0;
}

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

#define ull unsigned long long
#define endl '\n'
#define ll long long
const int N = 2e3 + 5;
string s[N];
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        //freopen("VLJUM.INP", "r", stdin);
        //freopen("VLJUM.OUT", "w", stdout);
        ll n, l;
        cin >> n >> l;
        for (int i = 1; i <= n; i++){
                cin >> s[i];
        }
        sort(s + 1, s + n + 1);
        for (int i = 1; i <= n; i++) cout << s[i];
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
{
    int a,b,sum=0;
    cin>>a>>b;
    for(int i=a;i<=b;i++)
    {
        int c[5],f=i;
        for(int k=0;k<5;k++)
        {
            c[k]=f%10;
            f=f/10;
        }
        if(c[0]==c[4]&&c[1]==c[3])
            sum++;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 256
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define ull       unsigned long long
#define si(x)     scanf("%d", &x)
#define sll(x)    scanf("%lld", &x)
#define ssll(x,y)    scanf("%lld %lld", &x ,&y)
#define sd(x)     scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
#define MAX       100005
#define maxn 	  200002
#define pb 		  push_back
#define mk 		  make_pair
#define endl	  "\n"
#define INF 	  1000000000
#define MOD		  1000000007
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main ()
{
		ios::sync_with_stdio(0);
		cin.tie(0);
		//CODE TONOY
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		if(a==c-1 && d==1)
		cout << 1 << endl;
		else cout << 0 << endl;
		return 0;  
}  


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <limits>
#include <iomanip>

using namespace std;

int main() {
    string s, ans;
    cin >> s;
    int size = (int)(s.length());
    for(int i = 0; i < size; i++) {
        if(i % 2 == 0) ans += s[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0){
            break;
        }
        n=1000-n;
        int count=0;
        if(n>=500){
            count++;
            n -= 500;
        //    cout<<"500"<<endl;
        }
        if(n>=100){
            while(n>=100){
                count++;
                n -= 100;
          //      cout<<"100"<<endl;
            }
        }
        if(n>=50){
            count++;
            n -= 50;
         //   cout<<"50"<<endl;
        }
        if(n>10){
            while(n>=10){
                count++;
                n -= 10;
             //   cout<<"10"<<endl;
            }
        }
        if(n>=5){
            count++;
            n -= 5;
          //  cout<<"5"<<endl;
        }
        count += n;
        cout<<count<<endl;
    }
}


Measured memory_bytes: 2984
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int n;
    int count=0;
    string s,ans;
    string a;
    cin>>n;
    cin>>s;
    for (int i=0; i<n; i++){
        a=s[i];
        if(a=="R"){
            count+=1;
        }
    }ans="Yes";
    if (n/2>=count){
        ans="No";
    }cout<<ans;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c, int n=INT_MAX)
{ rep(i, min(n, (int)c.size())) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

int main()
{
    vi AB(2); cin >> AB;
    sort(all(AB));

    if (AB[0] == 2) {
        cout << "1" << endl;
    } else if (AB[1] == 2) {
        cout << "3" << endl;
    } else {
        cout << "2" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;
int p[100000];
vector<int> v,v2,hen[100000];bool used[100000];
void dfs(int a){
used[a]=true;
v2.push_back(p[a]);
for(auto&& i :hen[a])if(!used[i])dfs(i);
}

     signed main(){
         cout << std::fixed << std::setprecision(15);
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++)cin>>p[i];
int x,y;
for(int i=0;i<m;i++){
     cin>>x>>y;
     hen[x].push_back(y);
     hen[y].push_back(x);
}
fill(used,used+n,false);int t=0,ans=0;
for(int i=0;i<n;i++){
     if(used[i])continue;
     t++;
     dfs(i);
     sort(v2.begin(),v2.end());
     ans+=v2[0];

     for(int i=1;i<v2.size();i++)v.push_back(v2[i]);
     v2.clear();
}
if(t==1){
     cout<<0<<endl;
     return 0;
}
if(v.size()<t-2){
     cout<<"Impossible"<<endl;
     return 0;
}
  sort(v.begin(),v.end());
for(int i=0;i<t-2;i++)ans+=v[i];
cout<<ans<<endl;
     }

 


 






    





      

        


Measured memory_bytes: 9460
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

#include <set>

typedef vector<string> vs;

bool ok(string s){
    rep(i,s.size()/2) if(s[i]!=s[s.size()-1-i]) return false;
    return true;
}

int main(){
    string line;
    while(getline(cin,line)){
        string s;
        for(char c : line) if(isalpha(c)) s += toupper(c);
        vs cand;
        int n=s.size();
        for(int i=n;i>=3;i--){
            rep(j,n-i+1){
                if(ok(s.substr(j,i))) cand.eb(s.begin()+j, s.begin()+j+i);
            }
        }
        bool used[1111]={};
        rep(j,cand.size()){
            rep(i,j){
                int diff=abs((int)cand[j].size()-(int)cand[i].size());
                diff/=2;
                if(cand[i].size()<cand[j].size()){
                    if(cand[j].substr(diff,cand[i].size())==cand[i]) used[i]=true;
                }
                else{
                    if(cand[i].substr(diff,cand[j].size())==cand[j]) used[j]=true;
                }
            }
        }
        vs ans;
        rep(i,cand.size()) if(!used[i]) ans.eb(cand[i]);
        sort(all(cand));
        cand.erase(unique(all(cand)), cand.end());
        rep(i,ans.size()){
            cout << ans[i];
            if(i+1!=(int)ans.size()) cout << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        sc.close();
        int a = Integer.parseInt(s.substring(0, 2));
        int b = Integer.parseInt(s.substring(2, 4));
        if (a >= 1 && a <= 12) {
            if (b >= 1 && b <= 12) {
                System.out.println("AMBIGUOUS");
            } else {
                System.out.println("MMYY");
            }
        } else {
            if (b >= 1 && b <= 12) {
                System.out.println("YYMM");
            } else {
                System.out.println("NA");
            }
        }
    }
}


Measured memory_bytes: 22228
from math import log2,ceil

def main():
    N,K = map(int,input().split())
    ans = 0
    for i in range(1,N + 1):
        digit = ceil(log2(K) - log2(i)) if K > i else 0
        ans += (1/N)*(0.5**digit) 
    print(ans)
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include<bits/stdc++.h>
  using namespace std;
  int main()
  {
    int N;
    cin >> N;
    int x=1;
    int count=0;
    int max_k;
    int sum;
    int A=0;
    int test1,test2;
    int first=1;
    test1=N;
    test2=N;
    do{
      test1/=10;
      count++;
    }while(test1);
    max_k=count-1;
    for(int j=0; j<max_k; j++){
      first*=10;                                                                                                                                                                                          
      }
    for(int i=max_k; i>=0; i--){
      A+=(test2/first);
      test2=test2%first;
      first/=10;
    }
    if(N%A==0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
           
    
    
    
    
    
    

Measured memory_bytes: 256