akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template<class T>
void print(vector<T>& V, bool spaced = true) {
    string space;
    spaced ? space = " " : space = "";
    for(int i = 0; i < V.size(); i++) {
        cout<< V[i] << space;
    }cout<< '\n';
}

template<class T>
void printendl(vector<T>& V) {
    for(int i = 0; i < V.size(); i++) {
        cout<< V[i] << '\n';
    }
}

template<class T>
T gcd(T a, T b) {
    T r;
    while (b != 0) {
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}

template <class T>
T lcm (T a, T b) {
    return a / gcd(a, b) * b;
}

template<class T>
T Max(T a, T b) {
    return (a < b) ? b : a;
}

template<class T>
T Min(T a, T b) {
    return (a < b) ? a : b;
}

//str

bool isPalindrome(string str){
    
    int length = str.length();
 
    for (int i = 0; i < (length / 2); i++)
        if (str[i] != str[length - 1 - i])
            return false;
 
    return true;    
}

void reverseStr(string& str) 
{ 
    int n = str.length(); 
    for (int i = 0; i < n / 2; i++) 
        swap(str[i], str[n - i - 1]); 
}
 

//Read through the messages at the end when you're done

const int INF = 10e9;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);


    int n, k; cin>> n>>k;
    vector<int> v(n);
    for(int i = 0; i < n; ++i) cin>> v[i];
    vector<int> dp(n, INF);
    dp[0] = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = i+1; j < i+k+1; ++j) {
            dp[j] = min(dp[j], dp[i] + abs(v[i]-v[j]));
        }
    }

    cout << dp[n-1] << '\n';
    

    return 0;
}

    //Use long long da5eel rabbak!
    //Dont use endl;
    //DONT SUBMIT IZA UR NOT SURE WALLAHI BTENDAM
    //Dear Amine, just because it worked for the test cases doesnt necessarily mean it is correct.
    //Dear Amine, try it on ur own test cases iza ur not SURE
    //In case u didnt use long long, CHECK FOR POTENTIAL OVERFLOWS
    //DONT FORGET TO MOD EVERYTHING IZA U NEED TO MOD



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int N; cin>>N;
  vector<int> f(N+1,0);
  for(int x = 1; x <= 100; x++) {
  for(int y = 1; y <= 100; y++) {
  for(int z = 1; z <= 100; z++) {
    int	ans = x*x + y*y	+ z*z +	x*y + y*z + z*x;
    if(ans <= N) f[ans]++;
  }
  }
  }
  for(int i = 1; i <= N; i++) {
    cout << f[i] << endl;
  }
  return 0;
}



Measured memory_bytes: 3180
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math

    #inf = 10**17
    #mod = 10**9 + 7

    def segfunc(a, b):
        if b == 0:
            return a
        else:
            return segfunc(b, a % b)

    def init(arr):
        # 0-index/上段の分ズラす
        for i in range(n):
            seg[i+num-1]=arr[i]
        # 上段の分を右から埋めていく
        for i in range(num-2,-1,-1) :
            seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
        
    def update(k,x):
        # 元の配列のindex→seg木上のindex
        k += num-1
        seg[k] = x
        while k:
            k = (k-1)//2
            seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
        
    def query(p,q):
        # 不当な区間
        if q<=p:
            return ide_ele
        p += num-1
        q += num-2
        res=ide_ele
        # 最下段から区間を見て更新していく
        # 見ている区間が覆う区間はその時点で見る必要はなく
        # 半分しか覆っていない区間は更新する
        # 上段に上がる際に区間外が混ざらないようにする
        while q-p>1:
            if p&1 == 0:
                res = segfunc(res,seg[p])
            if q&1 == 1:
                res = segfunc(res,seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = segfunc(res,seg[p])
        else:
            res = segfunc(segfunc(res,seg[p]),seg[q])
        return res

    n = int(input())
    A = tuple(map(int, input().split()))

    # 単位元
    ide_ele = 0

    # num:n以上の最小の2のべき乗
    # n:5~8のときnum=8なので3が入ってほしいから-1
    num =2**((n-1).bit_length())

    # セグ木初期化
    seg=[ide_ele]*2*num
    init(A)

    res = 0
    for i in range(n):
        res = max(res, segfunc(query(0, i), query(i+1, n)))
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 14640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf (int)(1e18)

signed main(){
	int N, M, L, Q, i, j, k;
	scanf("%lld%lld%lld", &N, &M, &L);
	vector<vector<int>> dis(N, vector<int>(N, inf));
	for(i = 0; i < M; i++){
		int A, B, C;
		scanf("%lld%lld%lld", &A, &B, &C);
		A--;
		B--;
		dis[A][B] = C;
		dis[B][A] = C;
	}
	for(k = 0; k < N; k++){
		for(i = 0; i < N; i++){
			for(j = 0; j < N; j++){
				dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
			}
		}
	}
	for(i = 0; i < N; i++){
		for(j = 0; j < N; j++){
			dis[i][j] = (dis[i][j] <= L ? 1 : inf);
		}
	}
	for(k = 0; k < N; k++){
		for(i = 0; i < N; i++){
			for(j = 0; j < N; j++){
				dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
			}
		}
	}
	scanf("%lld", &Q);
	for(i = 0; i < Q; i++){
		int s, t;
		scanf("%lld%lld", &s, &t);
		s--;
		t--;
		if(dis[s][t] >= inf){
			printf("-1\n");
		}
		else{
			printf("%lld\n", dis[s][t] - 1);
		}
	}
	return 0;
}

Measured memory_bytes: 1280
N = int(input())
S = list()

for _ in range(N):
    S.append(input())
S_set = set(S)
S_dict = dict()
for s in S_set:
    S_dict[s] = 0

for val in S:
    S_dict[val] += 1
max_num = max(S_dict.values())
ans = list()
for k, v in S_dict.items():
    if v == max_num:
        ans.append(k)
ans = sorted(ans)
for res in ans:
    print(res)
    

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

int main() {
    int A, B, num = 0;
    int keta[5];
    cin >> A >> B;

    for (int i = A; i <= B; i++) {
        int C = i;
        
        // ketaに各桁を格納
        for (int j = 0; j < 5; j++) {
            keta[j] = C % 10;
            C /= 10;
        }
        
        // 回分数か？
        if (keta[0] == keta[4] && keta[1] == keta[3]) {
            num++;
        }
    }
    cout << num << endl;
}


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

const LL INF = 1e18;

int x[100];

int main()
{
    Rep(i, 5) {
        cin >> x[i];
        if(x[i] == 0) {
            cout << i << endl;
            break;
        }
    }
	return 0;
}



Measured memory_bytes: 3516
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

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

string a,b,c;
int r;
cin >> a >> b;
if(a>b){
    c=b;
    r=STI(a);
}else{
    c=a;
    r=STI(b);
}
rep(i,r){
    cout << c;
}

//////////////////////////////////////////////////////
return 0;}


Measured memory_bytes: 256
import math

x1, y1, x2, y2 = map(float, input().split())

if x2 > x1:
    x = x2 - x1
    
else:
    x = x1 - x2
    
if y2 > y1:
    y = y2 - y1

else:
    y = y1 - y2
    
ans = math.sqrt(x ** 2 + y ** 2)

print(f"{ans:.4f}")


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i = k; i < n; i++)
//#define sum(start, end) accumulate(start, end, 0)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

using namespace std;
template <class T = ll> T in() { T _in; cin >> _in; return (_in); }


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

    ll N=in(), A=in();

    N = N%500;
    if(A >= N)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int n,k,a[200000];
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i];
    vector<pair<int,int>>vp;
    for(int i=0;i<n;i++)
        if(a[i]==0)
            vp.emplace_back(0,0);
        else
            vp.emplace_back(abs(a[i]),a[i]/abs(a[i]));
    sort(vp.begin(),vp.end(),greater<>());
    int sig=1;
    for(int i=0;i<k;i++)
        sig*=vp[i].second;
    if(sig>=0){
        int ans=1;
        for(int i=0;i<k;i++)
            (ans*=vp[i].first)%=mod;
        cout<<ans<<endl;
        return 0;
    }
    int b=-1,c=-1,d=-1,e=-1;
    for(int i=0;i<k;i++)
        if(vp[i].second==1)
            d=i;
        else
            b=i;
    for(int i=n-1;i>=k;i--)
        if(vp[i].second==1)
            c=i;
        else
            e=i;
    int dele,app;
    if(b!=-1&&c!=-1){
        if(d!=-1&&e!=-1){
            if(vp[c].first*vp[d].first>=vp[b].first*vp[e].first){
                dele=b;
                app=c;
            }else{
                dele=d;
                app=e;
            }
        }else{
            dele=b;
            app=c;
        }
    }else{
        if(d!=-1&&e!=-1){
            dele=d;
            app=e;
        }else{
            int ans=1;
            for(int i=n-1;i>=n-k;i--)
                (ans*=vp[i].first)%=mod;
            cout<<(mod-ans)%mod<<endl;
            return 0;
        }
    }
    int ans=1;
    for(int i=0;i<k;i++)
        if(i!=dele)
            (ans*=vp[i].first)%=mod;
    cout<<ans*vp[app].first%mod<<endl;
}


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

using namespace std;

int main() {
  int k, s;
  cin >> k >> s;
  int ans = 0;
  for (int x = 0; x <= k; x++) {
    for (int y = 0; y <= k; y++) {
      int z = s - x - y;
      if (0 <= z && z <= k) ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#define L long long int
m[31][50];main(n,p,d,x){L a[50],b;for(;scanf("%d",&n),n;){memset(m,0,6200);for(p=0;p<n;a[p]=(L)1<<p,p++)for(scanf("%d",&x);x;x--)scanf("%d",&d),m[d][p]=1;for(d=1;d<31;d++){for(b=p=0;p<n;p++)if(m[d][p])b|=a[p];for(p=0;p<n;p++)if(m[d][p])if((a[p]=b)==((L)1<<n)-1){printf("%d\n",d);goto s;}}puts("-1");s:;}return 0;}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        int c; cin >> c;
        a[c-1] = i+1;
    }
    for (int i = 0; i < n; i++) {
        if (i) cout << " ";
        cout << a[i];
    }
    cout << endl;
    return 0;
}

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


int main(){
	//https://atcoder.jp/contests/dp/tasks/dp_a
	int n;
	cin >> n;
	int dp[n+1];
	int arr[n+1];
	arr[0] = 0;
	memset(dp, 0, sizeof(dp));
	for(int i=1;i<=n;i++)
		cin >> arr[i];

	if(n<2){
		cout << arr[1] << endl;
		return 0;
	}
	dp[1] = arr[1];
	dp[2] = abs(arr[2] - arr[1]);
	if(n==2){
		cout << dp[2] <<endl;
		return 0;
	}

	dp[3] = min(abs(arr[3]-dp[1]), dp[2] + abs(arr[3]- arr[2]));

	for(int i=4;i<=n;i++){
		dp[i] = min(dp[i-1]+ abs(arr[i-1]-arr[i]), dp[i-2]+ abs(arr[i-2] - arr[i]));
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 4368
#include<stdio.h>
int main(void)
{
  int a,b,c,i,count=0;
  scanf("%d %d %d",&a,&b,&c);
  for(i=a;i<=b;i++)
  {
    if(c%i==0)
      count++;
  }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

void solve(){
    int n,m,v;
    cin>>n>>m;
    vector<string> s(n);
    for(auto&c:s) cin>>c;
    mf_graph<int> g(n*m+2);
    int S=n*m,T=n*m+1;
    fr(i,n) fr(j,m){
        if(s[i][j]=='#') continue;
        v=i*m+j;
        if((i+j)%2) g.add_edge(S,v,1);
        else g.add_edge(v,T,1);
        if(i && s[i-1][j]=='.'){
            if((i+j)%2) g.add_edge(v,v-m,1);
            else g.add_edge(v-m,v,1);
        }
        if(j && s[i][j-1]=='.'){
            if((i+j)%2) g.add_edge(v,v-1,1);
            else g.add_edge(v-1,v,1);
        }
    }
    cout<<g.flow(S,T)<<'\n';
    auto e=g.edges();
    for(auto[fr,to,_,fl]:e){
        if(fr==S||to==T||fl==0) continue;
        if(fr>to) swap(fr,to);
        if(fr/m==to/m){
            s[fr/m][fr%m]='>';
            s[to/m][to%m]='<';
        }
        else{
            s[fr/m][fr%m]='v';
            s[to/m][to%m]='^';
        }
    }
    for(auto&c:s) cout<<c<<'\n';
}

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

Measured memory_bytes: 5544
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<math.h>
#include<set>
#include<iomanip>
#include<stdio.h>
#include<deque>
#include<stack>
#include<map>
#include<queue>
#include<cstring>
#include<unordered_map>
#define M 1000000007
#define pb push_back
#define mp make_pair
#define int long long
using namespace std;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s,t;
	cin>>s>>t;
	int i,o=0;
	for(i=0;i<3;i++)
	{
		if(s[i]==t[i])
			o++;
	}
	cout<<o<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int p[25];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>p[i];
	}
	int cnt=0;
	for(int i=1;i<n-1;i++)
	{
		vector<int> v;
		v.push_back(p[i-1]);
		v.push_back(p[i]);
		v.push_back(p[i+1]);
		sort(v.begin(),v.end());
		if(v[1]==p[i])cnt++; 
	}
	cout<<cnt<<endl;
	return 0;
}

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

struct ver {
    int l, r, d;
};
vector <ver> v;
vector <pair <int, int> > tr[100010];

int viz[100010], t[100010], n, m, l, r, d, ver;

void dfs(int nod) {
    if (ver == 1) {
        return;
    }
    //cout << "NODUL: " << nod <<'\n';
    for (int i = 0; i < tr[nod].size(); i++) {
        int r = tr[nod][i].first;
        //cout << "ACESTA ESTE R : --> " << r << '\n';
        if (viz[r] == 0) {
            viz[r] = viz[nod] + tr[nod][i].second;

        dfs(r);
        } else if (viz[r] != viz[nod] + tr[nod][i].second) {
            ver = 1;
            return;
        }
    }
}

int main()
{
    cin >> n >> m;
    tr[0].push_back({0, 0});
    for (int i = 1; i <= m; i++) {
        struct ver man;
        cin >> man.l >> man.r  >> man.d;
        t[man.r] = man.l;
        tr[man.l].push_back({man.r, man.d});
    }
    ver = 0;
    for (int i = 1; i <= n; i++){
        if (viz[i] == 0) {
            int x = i;
            int nr = 0;
            while (t[x] !=0) {
                x = t[x];
                nr++;
                if (nr > n) {
                    cout << "No\n";
                    return 0;
                }
            }
            viz[x] = 1;
            //cout << "AHA\n";
            dfs(x);
            if (ver == 1) {
                cout << "No\n";
                return 0;
            }
        }
    }
    /*
    for (int i = 0; i < v.size(); i++) {
        if (viz[v[i].r] != viz[v[i].l] + v[i].d && (viz[v[i].r] != 0 && viz[v[i].l] != 0)) {
            cout << "No";
            return 0;
        }
    }
    */
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 11136
import copy
x, y, a, b, c = map(int, input().split())
#s= list(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
por = p[a-x:a]
qor = q[b-y:b]
qp = por.copy()
qp.extend(qor.copy())
qp.sort()
i=0
while(i < x+y and i < c and r[c-i-1] > qp[i]):
    qp[i] = r[c-i-1]
    i = i + 1
ans = sum(qp)
print(ans)

Measured memory_bytes: 23840
i =  gets.chomp.split(" ").map(&:to_i)
one, nine, seven, four = false
i.each do |hoge|
    one = true if hoge == 1 
    nine = true if hoge == 9
    seven = true if hoge == 7
    four = true if hoge == 4
end
if one and nine and seven and four then
    puts "YES"
else
    puts "NO"
end


Measured memory_bytes: 1788
#include <stdio.h>
#include <string.h>

int main(){
    char s[1001],t[1001];
    scanf("%s\n%s",s,t);
    int n,m;
    n=strlen(s);m=strlen(t);

    int i,j,min,diff;
    min=m;
    for(i=0;i<n-m+1;i++){
        diff=0;
        for(j=0;j<m;j++){
            if(s[i+j]!=t[j]){
                diff++;
            }
        }
        if(min>diff){
            min=diff;
        }
    }
    printf("%d\n",min);
}

Measured memory_bytes: 1700
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
using namespace std;

struct Card { char suit; int value; };

void Bubblesort(struct Card A[], int N) {
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = N - 1; j > i; j--) {
			if (A[j].value < A[j - 1].value) {
				swap(A[j], A[j - 1]);
				flag = 1;
			}
		}
	}
}

void Selectionsort(struct Card A[], int N) {
	for (int i = 0; i < N; i++) {
		int minj = i;
		for (int j = i+1; N>j; j++) {
			if (A[minj].value > A[j].value) {
				minj = j;
			}
		}
		if (i != minj) {
			swap(A[i], A[minj]);
		}
	}
}

// ????????????????????????????????\???????????????
//???????????????????????????????????§????????¨??????????????????????????????

bool isStable(struct Card C1[], struct Card C2[],int N) {
	for (int i = 0; i < N; i++) {
		if (C1[i].suit != C2[i].suit) {
			return 0;
		}
	}
	return 1;
}

//????????????????????????

void print(struct Card A[], int N) {
	for (int i = 0; i < N; i++) {
		if (i) {
			cout << " ";
		}
		cout << A[i].suit << A[i].value;
	}
	cout << endl;
}

//????????????main???????????????

int main() {
	int N;
	Card C1[100], C2[100];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> C1[i].suit >> C1[i].value;
	}
	for (int i = 0; i < N; i++) {
		C2[i] = C1[i];
	}

	Bubblesort(C1, N);
	Selectionsort(C2, N);

	print(C1, N);
	cout << "Stable" << endl;

	print(C2, N);
	if (isStable(C1,C2,N)) {
		cout << "Stable" << endl;
	}
	else {
		cout << "Not stable" << endl;
	}
}

Measured memory_bytes: 3104
n = input ()
m = list(n)
cnt = 0
for i in range(len(m)-1):
  if m[i] != m[i+1] :
    pass
  elif m[i] == m[i+1] and m[i] == '0':
    m[i+1] = '1'
    cnt += 1
  elif m[i] == m[i+1] and m[i] == '1':
    m[i+1] = '0'
    cnt += 1
print(cnt)

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
   FAST/**/
   
   string s;
   cin>>s;
   
   map<char,ll> ma;
   rep(s.length())
        ma[s[i]] = 1;
   if(ma.size() == 1)
        cout<<"No";
   else cout<<"Yes\n";        
   
   
   return 0;        
}  
   

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int r,g,b;
    int n;
    cin>>r>>g>>b;
    n=g*10+b;
    if(n%4==0){
        cout<<"YES"<<endl; 
    }
   else{
       cout<<"NO"<<endl;
   }
    
    
}


Measured memory_bytes: 3528
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			long a = in.nextLong();
			long b = in.nextLong();
			long x = in.nextLong();
			out.println(a == 0 ? (b) / x + 1 : b / x - (a - 1) / x);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}


Measured memory_bytes: 22484
#include <iostream>

using namespace std;

int main() {
	
	int X;
	
	cin >> X; //Leggere una variabile da console (cin = console input).
	
	if(X < 30) {
		
		cout << "No";
	}
	
	else {
		cout << "Yes";
	}
	
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cmath>
#define eps 1e-9

using namespace std;

int m, n, d, N;
int mat[650][650];

void swapRow(int x, int y)
{
	int t;
	for(int i = 0; i < N+1; i++){
		t = mat[x][i];
		mat[x][i] = mat[y][i];
		mat[y][i] = t;
	}
}

int main(void)
{
	while(1){
		cin >> m >> n >> d;
		if(m == 0 && n == 0 & d == 0) break;
		
		N = m*n;
		for(int i = 0; i < N; i++){
			for(int j = 0; j < N; j++){
				mat[i][j] = 0;
			}
		}
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				for(int ii = 0; ii < n; ii++){
					for(int jj = 0; jj < m; jj++){
						if( abs(i - ii) + abs(j - jj) == d){
							mat[i*m+j][ii*m+jj] = 1;
						}
						if(i == ii && j == jj) mat[i*m+j][ii*m+jj] = 1;
					}
				}
			}
		}
		int s;
		for(int i = 0; i < N; i++){
			cin >> s;
			mat[i][N] = s;
		}
		
		for(int i = 0; i < N; i++){
			int piv, val = 0;
			for(int j = i; j < N; j++){
				if(val < mat[j][i]){
					val = mat[j][i];
					piv = j;
				}
			}
			if(val == 0) continue;
			swapRow(i, piv);
			
			for(int j = 0; j < N; j++){
				if(i == j) continue;
				if(mat[j][i] == 0) continue;
				for(int k = 0; k < N+1; k++){
					mat[j][k] += mat[i][k];
					mat[j][k] %= 2;
				}
			}
			
		}
		
		bool ans = true;
		for(int i = 0; i < N; i++){
			if(mat[i][i] == 0 && mat[i][N] == 1){
				ans = false;
				break;
			}
		}
		if(ans) cout << 1 << endl;
		else cout << 0 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 4584
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>

using namespace std;
#define int long  long int
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N, K, R, S, P;
	string T;
	cin >> N >> K >> R >> S >> P >> T;
	int sum = 0;
	for (int i = 0; i < T.size(); i++)
	{
		if (T[i] == 'r')
		{
			sum += P;
			T[i] = 'p';
		}
		else if (T[i] == 's')
		{
			sum += R;
			T[i] = 'r';
		}
		else
		{
			sum += S;
			T[i] = 's';
		}
	}
	for (int i = 0; i < N - K; i++)
	{
		if (T[i] == T[i + K])
		{
			if (i + 2 * K < N && T[i + K] == T[i + 2 * K])
			{
				char ch;
				if (T[i] == 'r')ch = 's';
				else if (T[i] == 's')ch = 'p';
				else ch = 'r';
				T[i + K] = ch;
			}

			if (T[i] == 'r')sum -= R;
			else if (T[i] == 's')sum -= S;
			else sum -= P;
		}
	}
	cout << sum;
}

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

class BNode{
public:
	int value;
	BNode *right;
	BNode *left;
};

class BTree{
	BNode *root;
public:
	BTree(){
		root = NULL;
	}
	void Insert(int v){
		BNode *cur = root;
		BNode *prt = NULL;
		BNode *node = new BNode();
		node->value = v;
		
		while(cur){
			prt = cur;
			if(cur->value < v){
				cur = cur->right;
			}else{
				cur = cur->left;
			}
		}
		if(prt){
			if(prt->value > v){
				prt->left = node;
			}else{
				prt->right = node;
			}
		}
		if(!root){
			root = node;
		}
	}
	
	void Inorder(BNode *cur){
		if(cur){
			Inorder(cur->left);
			cout << " " << cur->value;
			Inorder(cur->right);
		}
	}
	void PrintInorder(){
		Inorder(root);
	}
	void Preorder(BNode *cur){
		if(cur){
			cout << " " << cur->value;
			Preorder(cur->left);
			Preorder(cur->right);
		}
	}
	void PrintPreorder(){
		Preorder(root);
	}
};

int main() {
	BTree bt;
	int m, v;
	string com;
	
	cin>>m;
	for(int i=0;i<m;++i){
		cin>>com;
		if(com=="insert"){
			cin>>v;
			bt.Insert(v);
		}else if(com=="print"){
			bt.PrintInorder();
			cout<<endl;
			bt.PrintPreorder();
			cout<<endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 16836
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Solve(int N, List<Tuple<int, int>>[] paths)
        {
            int[][] costs = new int[N][];
            for (int i = 0; i < N; ++i)
            {
                var q = new Queue<int>();
                costs[i] = Enumerable.Repeat(int.MaxValue, N).ToArray();
                costs[i][i] = 0;
                q.Enqueue(i);
                while (q.Count > 0)
                {
                    int a = q.Dequeue();
                    foreach (var path in paths[a])
                    {
                        int b = path.Item1;
                        int c = path.Item2;
                        if (costs[i][b] > costs[i][a] + c)
                        {
                            costs[i][b] = costs[i][a] + c;
                            q.Enqueue(b);
                        }
                    }
                }
            }
            int count = 0;
            for (int a = 0; a < N; ++a)
            {
                foreach (var path in paths[a])
                {
                    int b = path.Item1;
                    int c = path.Item2;
                    if (c > costs[a][b]) { ++count; }
                }
            }
            return count / 2;
        }
        static void Main(string[] args)
        {
            int[] V1 = ReadInts();
            int N = V1[0];
            int M = V1[1];
            var paths = new List<Tuple<int, int>>[N];
            for (int i = 0; i < N; ++i) { paths[i] = new List<Tuple<int, int>>(); }
            for (int i = 0; i < M; ++i)
            {
                int[] V2 = ReadInts();
                int a = V2[0] - 1;
                int b = V2[1] - 1;
                int c = V2[2];
                paths[a].Add(new Tuple<int, int>(b, c));
                paths[b].Add(new Tuple<int, int>(a, c));
            }
            Console.WriteLine(Solve(N, paths));
        }
    }
}


Measured memory_bytes: 13524
import java.util.*;
import java.io.*;
import java.lang.*;

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

        String a = sc.next();
        String b = sc.next();

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

        String e = sc.next();

        if (e.equals(a))
            System.out.println((c - 1) + " " + d);
        else
            System.out.println(c + " " + (d - 1));
    }
}


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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); ++i)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100005
#define SAFE_FREE(ptr) if( ptr != NULL ){ free(ptr); ptr = NULL; }
typedef unsigned int UINT;
typedef long long  ll;
typedef pair<int, int> P;

int pow(ll x, ll n, ll mod)
{
	ll res = 1;
	while (n>0)
	{
		if (n & 1)res = res*x%mod;
		x = x*x%mod;
		n >>= 1;
	}
	return res;
}

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

Measured memory_bytes: 1164
#include<stdio.h>
#define _USE_MATH_DEFINES
#include<math.h>

 int main(void)
{
	double r,s,l;
	scanf("%lf",&r);
	s=M_PI*r*r;
	l=2*M_PI*r;
	
	printf("%lf %lf",s,l);
	
	return 0;
}

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

using i64 = long long;

vector<i64> v, s;

int main() {
#ifdef HOME
	freopen("agc11b.in", "r", stdin);
	freopen("agc11b.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	i64 sum(0);
	int ant(0), n, p, t;

	cin >> n;
	v.resize(n);
	for (auto &i: v)
		cin >> i;

	sort(begin(v), end(v));
	s.reserve(n);
	for (auto i: v)
		s.push_back(sum+= i);

	for (int i = 0; i < n; ++i) {
		sum = s[i];
		p = i;
		do {
			t = p;
			for (int msk = 1 << 20; msk > 0; msk/= 2)
				if (p + msk < n && sum * 2 >= v[p + msk])
					p+= msk;
			sum+= s[p] - s[t];
			if (p == t)
				break; }
		while (p != n);

		ant+= int(s.back() == sum); }

	cout << ant << endl;

	return 0; }


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

using namespace std;

long long prime = 998244353;

vector<int> divisors(int n) {
    vector<int> ds;
    for (int i = 1; i*i <= n; ++i) {
        if (n % i == 0) {
            ds.push_back(i);
            if (i != n/i) {
                ds.push_back(n/i);
            }
        }
    }
    sort(ds.begin(), ds.end());
    return ds;
}

template <typename F>
map<long long, long long> mult_fun(long long n, F& fun, long long P) {
    if (n == 1LL) {
        map<long long, long long> res;
        res[1] = 1;
        return res;
    }
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) {
            long long pk = p;
            int k = 1;
            while ((n / pk) % p == 0) {
                pk *= p;
                ++k;
            }
            map<long long, long long> rec = mult_fun(n / pk, fun, P);
            vector<long long> p_rec = fun(pk, p);
            pk = 1;
            map<long long, long long> res;
            for (int i = 0; i <= k; ++i, pk *= p) {
                for (auto g : rec) {
                    res[g.first * pk] = (g.second * p_rec[i]) % P;
                }
            }
            return res;
        }
    }
    vector<long long> p_rec = fun(n, n);
    map<long long, long long> res;
    res[1] = p_rec[0];
    res[n] = p_rec[1];
    return res;
}

vector<long long> generator(long long pk, long long p) {
    vector<long long> fs;
    fs.push_back(1LL);
    while (pk > 1) {
        fs.push_back(((1LL - p) % prime + prime) % prime);
        pk /= p;
    }
    return fs;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    vector<int> xs(n);
    for (int i = 0; i < n; ++i) {
        xs[i] = s[i] == '1';
    }
    int m = n&(-n);
    map<int, long long> f;
    auto fits_equal = [&](int k) {
        for (int i = k; i < n; ++i) {
            // xs[i] vs xs[i%k] if i/k is even and 1-xs[i%k] if i/k is odd.
            int y = (i/k) % 2 == 0 ? xs[i%k] : 1-xs[i%k];
            if (xs[i] > y) {
                return true;
            }
            if (xs[i] < y) {
                return false;
            }
        }
        return true;
    };
    auto ds = divisors(n / m);
    for (int d : ds) {
        long long num_less = 0;
        int k = d * m;
        for (int i = 0; i < k; ++i) {
            num_less = (2*num_less + xs[i]) % prime;
        }
        num_less = (num_less + fits_equal(k) + prime) % prime;
        f[d] = num_less;
    }
    // result is 1 * (id g) = 1 * (id (mu * f)) = (1 * (id mu)) * (id f)
    // let h = 1 * (id mu)
    // h(1) = 1
    // h(p) = p * mu(p) + 1 * mu(1) = 1 - p
    // h(p^k) = 1 - p, k >= 1
    map<long long, long long> h = mult_fun(n/m, generator, prime);
    long long result = 0;
    for (int d : ds) {
        result = (result + ( h[n/m/d] * d ) % prime * f[d]) % prime;
    }
    cout << (2*m*result)%prime << endl;
    return 0;
}


Measured memory_bytes: 1428
list=[]
for i in range(int(input())):
    list.append(input())
AC,WA,TLE,RE=0,0,0,0
for a in list:
    if a=="AC":
        AC+=1
    elif a=="WA":
        WA+=1
    elif a=="TLE":
        TLE+=1
    elif a=="RE":
        RE+=1
print("AC","x",AC)
print("WA","x",WA)
print("TLE","x",TLE)
print("RE","x",RE)


Measured memory_bytes: 16312
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
const ll MOD = 998244353;
const int INF = 1e9+9;
const int MAXN = 3003;


int a, b, c, d;
ll dp[MAXN][MAXN];

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> a >> b >> c >> d;
    dp[a-1][b-1] = 1;
    for (int j = b; j < d; ++j) {
        dp[a-1][j] = dp[a-1][j-1]*a%MOD;
    }
    for (int i = a; i < c; ++i) {
        dp[i][b-1] = dp[i-1][b-1]*b%MOD;
        ll sumyes = 0;
        for (int j = b; j < d; ++j) {
            dp[i][j] = (j+1)*dp[i-1][j];
            sumyes = (sumyes*i%MOD + dp[i][j-1]%MOD)%MOD;
            dp[i][j] = (dp[i][j] + sumyes)%MOD;
        }
    }
    // for (int i = 0; i < c; ++i) {
    //     for (int j = 0; j < d; ++j) {
    //         cerr << "(" << dp[i][j] << ") ";
    //     }
    //     cerr << endl;
    // }
    // cerr << endl;
    cout << dp[c-1][d-1] << endl;
}


Measured memory_bytes: 73960
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, k;
    cin >> n >> k;
    if (k == 1) cout << 0 << endl;
    else cout << n - k << endl;
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)

# 最初の値を正にする
div1 = 1
sum1 = 0
counter1 = 0
(0..n-1).each do |i|
  sum1 += a[i]
  if sum1 * div1 <= 0
    counter1 += sum1.abs + 1
    sum1 = div1
  end
  div1 *= -1
end

# 最初の値を負にする
div2 = -1
sum2 = 0
counter2 = 0
(0..n-1).each do |i|
  sum2 += a[i]
  if sum2 * div2 <= 0
    counter2 += sum2.abs + 1
    sum2 = div2
  end
  div2 *= -1
end

p [counter1,counter2].min

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

int main()
{
    int n,i;
    cin >> n;
    vector<int>t(n+1,0);
    vector<int>x(n+1,0);
    vector<int>y(n+1,0);
    for(i = 1;i <= n;++i){
        cin >> t.at(i) >> x.at(i) >> y.at(i);
    }
    int temp;
    for(i = 1;i <= n;++i){
        temp = abs(x.at(i)-x.at(i-1))+abs(y.at(i)-y.at(i-1));
        if(temp > t.at(i)-t.at(i-1)){
            cout << "No" << endl;
            return 0;
        }else{
            if((temp - t.at(i)-t.at(i-1))%2 != 0){
                cout << "No" << endl;
                return 0; 
            }  
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define nl cout<<'\n';
int main()
{
    string s;
    cin>>s;
    int li=s.size(),r=0,l=0,R=0,L=0;
    for(int i=0; i<li; i++)
    {
        if(s[i]=='R')
            r++;
        else if(s[i]=='L')
            l++;
    }
    for(int i=0; i<li; i++)
    {
        if(i%2==0&&s[i]=='R')
            R++;
        else if(i%2!=0&&s[i]=='L')
            L++;
    }
    if(R==r&&L==l)
        cout<<"Yes";
    else
        cout<<"No";
    nl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio 	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
using namespace std;
int mod = 1e9 + 7;


int modpow(int a, int n) {
	int res = 1;
	while (n) {
		if (n & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		n >>= 1;
	}
	return res;
}

int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;

	int n;
	cin >> n;
	cout << ((modpow(10, n) + modpow(8, n) - 2 * modpow(9, n)) % mod + mod) % mod;
	return 0;
}

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

// アルファベットを数値に変換 → 'c' - 'a' = 2
// 数値をアルファベットに変換 → (char)(2 + 'a') = 'c'

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

  bool alphabets[26];
  fill(alphabets, alphabets + 26, false);
  for (int i = 0; S[i] != '\0'; i++) alphabets[S[i] - 'a'] = true;

  for (int i = 0; i < 26; i++) {
    if (alphabets[i] == false) {
      cout << (char)(i + 'a') << endl;
      return 0;
    }
  }

  cout << "None" << endl;
  return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}

const string YES = "Yes";
const string NO = "No";
#define judge(f) cout<<(f?YES:NO)<<"\n";

void solve(std::string S){
    bool f=true;
    if(S != string(rbegin(S), rend(S))){
        f=false;
        judge(f);
        return;
    }
    string s1=string(begin(S), begin(S)+(S.size()-1)/2);
    // debg(s1);
    if(s1 != string(rbegin(s1), rend(s1))){
        f=false;
        judge(f);
        return;
    }
    string s2=string(begin(S)+(S.size()+3)/2-1, end(S));
    // debg(s2);
    if(s2 != string(rbegin(s2), rend(s2))){
        f=false;
        judge(f);
        return;
    }
    judge(f);
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
  ll d;cin >> d;
  vl c(26);rep(i,26)cin >> c[i];
  vvl s(d,vl(26));rep(i,d)rep(j,26)cin >> s[i][j];
  vector<set<ll>> ch(26);rep(i,26)ch[i].ins(-1),ch[i].ins(d);
  vl days(d);
  ll pre=0;
  vl last(26,-1);
  rep(i,d){
    ll t=0;
    ll maxi=-INF;
    rep(j,26){
        ll p=s[i][j];
        rep(k,26){
            if(k==j)continue;
            p-=c[k]*(i-last[k]);
        }
        if(chmax(maxi,p))t=j;
      }
      days[i]=t;
      last[t]=i;
  }
  rep(i,d){
    ll t=days[i];
    pre+=s[i][t];
    ch[t].ins(i);
    days[i]=t;
  }
  ll score=pre; 
  rep(i,26){
      ll mini=0;
      ll pp=-1;
      for(auto a:ch[i]){
        mini+=(a-pp)*(a-pp-1)/2;
        pp=a;
      }
      score-=c[i]*mini;
  }
  //rep(i,d)cout << days[i] <<endl;

  ll q=600000;
  while(q--){
    ll y=-1,sz=inf;
    rep(i,26){
      if(chmin(sz,(ll)ch[i].size()))y=i;
    }
    ll x=rand()%d;
    //cout << x <<" " << y <<endl;
    ll old=days[x];
    pre-=s[x][days[x]];
    ch[days[x]].erase(x);
    days[x]=y;
    pre+=s[x][y];
    ch[y].ins(x);
    ll p=0;
    rep(i,26){
      ll mini=0;
      ll pp=-1;
      for(auto a:ch[i]){
        mini+=(a-pp)*(a-pp-1)/2;
        pp=a;
      }
      p+=c[i]*mini;
    }
    //if(q>299990)cout << score <<endl;
    if(pre-p>=score){
      score=pre-p;
    }
    else{
      ch[y].erase(x);
      pre-=s[x][y];
      days[x]=old;
      ch[days[x]].ins(x);
      pre+=s[x][old];
    }
  }
  rep(i,d)cout << days[i]+1 <<endl;
}   

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

typedef long long ll;

void factorize(vector<ll> &p,vector<ll> &cnt,ll x) {
    p.clear(); cnt.clear();
    if(x <= 1) {
        p.push_back(1);
        cnt.push_back(1);
        return;
    }

    ll lim = (ll)sqrt(x);
    ll pp = 2;
    while(true) {
        if(x <= 1) break;
        if(pp > lim) {
            p.push_back(x);
            cnt.push_back(1);
            break;
        }
        if(x % pp == 0) {
            p.push_back(pp);
            cnt.push_back(0);
            while(x%pp == 0) {
                cnt[cnt.size()-1]++;
                x /= pp;
            }
        }
        pp++;
    }
    return;
}

int main() {
    int base;
    string a;
    while(cin>>base>>a, base) {
        unsigned long long m = 0;
        for(int i=0; i<a.length(); ++i) {
            m *= base;
            if(a[i] <= '9') m += a[i] - '0';
            else m += a[i] - 'A' + 10;
        }

        vector<ll> p,cnt;
        factorize(p,cnt,base);

        vector<ll> pp(p.size(), 0);
        for(int i=0; i<p.size(); ++i) {
            ll n = p[i];
            while(n <= m) {
                pp[i] += m/n;
                n *= p[i];
            }
        }

        ll ans = 1ll<<62;
        for(int i=0; i<p.size(); ++i) ans = min(ans, pp[i]/cnt[i]);
        cout<<ans<<endl;
    }
}

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


/* Raiyan Noory Rady,CSE'17,RUET
Email:raiyannooryrady@gmail.com
Smile->Desire->Unity->Effort->Struggle->Success->Again smile :)
*/

#define ll long long int
#define pf push_front
#define mod  1000000007
#define inf  1000000000000000000
#define pi  acos(-1.0)
#define maxn  1000009
#define sorted(s)  sort(s.begin(),s.end())
#define sortarr(a) sort(a,a+n)
#define slc(n) scanf("%I64d", &n)
#define sl(n)  scanf("%lld", &n)
#define sf(n)  scanf("%lf", &n)
#define si(n)  scanf("%d", &n)
#define sch(n)  scanf(" %c", &n)
#define ss(n)  scanf("%s", n)
#define prf printf
#define pb  push_back
#define fr first
#define sc second
#define all(a)  a.begin(),a.end()
#define forl(n) for(i=0;i<n;i++)
/*STL library functions

sort(first_iterator, last_iterator) – To sort the given vector.

reverse(first_iterator, last_iterator) – To reverse a vector.

*max_element (first_iterator, last_iterator) – To find the maximum element of a vector.

*min_element (first_iterator, last_iterator) – To find the minimum element of a vector.

accumulate(first_iterator, last_iterator, initial value of sum) – Does the summation of vector elements

count(first_iterator, last_iterator,x) – To count the occurrences of x in vector.

find(first_iterator, last_iterator, x) – Points to last address of vector ((name_of_vector).end())
 if element is not present in vector.

binary_search(first_iterator, last_iterator, x) – Tests whether x exists in sorted vector or not.

lower_bound(first_iterator, last_iterator, x) – returns an iterator pointing to the first element in the range [first,last)
which has a value not less than ‘x’.

upper_bound(first_iterator, last_iterator, x) – returns an iterator pointing to the first element in the range [first,last)
 which has a value greater than ‘x’.

arr.erase(position to be deleted) – This erases selected element in vector and shifts and resizes the vector elements accordingly.

arr.erase(unique(arr.begin(),arr.end()),arr.end()) – This erases the duplicate occurrences in sorted vector in a single line.

distance(first_iterator,desired_position) – It returns the distance of desired position from the first iterator.
This function is very useful while finding the index.

next_permutation(first_iterator, last_iterator) – This modified the vector to its next permutation.

prev_permutation(first_iterator, last_iterator) – This modified the vector to its previous permutation.
*/

using namespace std;

int main()
{

    string s;
    cin>>s;
    if(s=="Sunny")
        cout<<"Cloudy"<<endl;
    else if(s=="Cloudy")
        cout<<"Rainy"<<endl;
    else if(s=="Rainy")
        cout<<"Sunny"<<endl;



    return 0;
}






Measured memory_bytes: 256