akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

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

    vector<int> a(n);
    vector<int> j(n);
    REP(i,n){
        cin>>a.at(i);
        j.at(a.at(i)-1) = i+1;
    }

    REP(i,n){
        cout<<j.at(i)<<" ";
    }
    cout<<endl;


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

Measured memory_bytes: 1664
h,w=map(int, input().split( ))
s=[input() for _ in range(h)]
a = [-1,0,1]
b=[-1,0,1]
n=[(i,j) for i in a for j in b]
#print(n)
ans=[["#"]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        tmp=0
        if s[i][j]=="#":
            continue
        for x,y in n:
            if 0<=i+x<h and 0<=j+y<w:
                if (x or y) and s[i+x][j+y]=="#":
                    tmp+=1
        ans[i][j]=str(tmp)
for i in range(h):
    print(''.join(ans[i]))

Measured memory_bytes: 41648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define In_The_Name_Of_Allah_The_Merciful ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Alhamdulillah return 0;
#define loop(i,k,n) for (ll i = k ; i < n ; ++i)
#define all(v) v.begin(),v.end()
#define debug(n) cerr << "[" << #n << " = " << n << "]" << endl

void Suhaib_Sawalha (){

    //26 -> 26 , 26 -> 26

    ll n;
    cin >> n;
    ll gab = 26;
    int grade = 1;
    while (n > gab){
        n -= gab;
        gab *= 26;
        grade++;
    }

    string s = "";
    n--;
    while (grade--){
        s += char('a'+n%26);
        n /= 26;
    }

    reverse(s.begin(),s.end());
    cout << s;

}

int main(){
                                In_The_Name_Of_Allah_The_Merciful   /* بسم الله الرحمن الرحيم  */
#ifndef ONLINE_JUDGE
    freopen("SuhaibSawalha1.txt","r",stdin);
#endif
//int _;for(cin>>_;_;--_,cout<<endl)
        Suhaib_Sawalha();
                                         Alhamdulillah                    /* الحمد لله */
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
	int N; string S; cin>>N>>S;
	vector<vector<int>> v(3,vector<int>(0));
	for(int i=0;i<N;i++){
		if(S[i]=='R')v[0].push_back(i);
		else if(S[i]=='G')v[1].push_back(i);
		else if(S[i]=='B') v[2].push_back(i);
	}
	int ans=0;
	for(int i=0;i<N-2;i++){
		int now,tmp;
		if(S[i]=='R')now=0;
		else if(S[i]=='G')now=1;
		else if(S[i]=='B') now=2;

		//now+1が2文字目について
		int tmp1; int ch2=(now+1)%3;
		for(int j=0;j<v[ch2].size();j++){
			if(i>=v[ch2][j])continue;
			int ch3=(now+2)%3;
			auto ite=lower_bound(v[ch3].begin(),v[ch3].end(),v[ch2][j]+1);
			if(ite==v[ch3].end())continue;
			else {
				tmp1=v[ch3].end()-ite;
				int che;
				int ch=v[ch2][j];
				if(ch+ch-i<N){
					if(S[ch+(ch-i)]=='R')che=0;
					else if(S[ch+ch-i]=='G')che=1;
					else if(S[ch+ch-i]=='B') che=2;
					if((ch3)%3==che)tmp1--;
				}
				ans+=tmp1;
			//	cout<<i<<":"<<tmp1<<endl;
			}
		}

		int tmp2; ch2=(now+2)%3;
		for(int j=0;j<v[ch2].size();j++){
			if(i>=v[ch2][j])continue;
			int ch3=(now+1)%3;
			auto ite=lower_bound(v[ch3].begin(),v[ch3].end(),v[ch2][j]+1);
			if(ite==v[ch3].end())continue;
			else {
				tmp2=v[ch3].end()-ite;
				int che;
				int ch=v[ch2][j];
				if(ch+ch-i<N){
					if(S[ch+(ch-i)]=='R')che=0;
					else if(S[ch+ch-i]=='G')che=1;
					else if(S[ch+ch-i]=='B') che=2;
					if((ch3)%3==che)tmp2--;
				}
				ans+=tmp2;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int N;
int main(){
    cin >> N;
    for(int i = 0; i < 3; i++){
        if(N % 10 == 7 || N == 7){
            cout << "Yes" << endl;
            return 0;
        }
        N /= 10;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3632
# coding: utf-8
import queue

class Node:
    def __init__(self, myNum, left, right):
        self.myNum = myNum
        self.left = left
        self.right = right
        self.parent = -1
        self.bs = -1
        self.nodeType = ""
        self.degree = -1
        self.depth = -1
        self.height = -1

        
nodes = []
n = int(input().rstrip())
for i in range(n):
    line = [int(j) for j in input().rstrip().split()]
    nodes.append(Node(line[0],line[1],line[2]))

nodes = sorted(nodes, key = lambda x: x.myNum)

# 親ノード、degreeを設定する
for node in nodes:
    dg = 0
    if node.left != -1:
        nodes[node.left].parent = node.myNum
        dg += 1
    if node.right != -1:
        nodes[node.right].parent = node.myNum
        dg += 1
    node.degree = dg

# 兄弟ノードを設定する
for node in nodes:
    if node.left != -1 and node.right != -1:
        nodes[node.left].bs = nodes[node.right].myNum
        nodes[node.right].bs = nodes[node.left].myNum

# nodeTypeを設定する
for node in nodes:
    if node.parent == -1:
        node.nodeType = "root"
        node.depth = 0
        rootNum = node.myNum
    elif node.left == -1 and node.right == -1:
        node.nodeType = "leaf"
    else:
        node.nodeType = "internal node"

# depthを設定する
q = queue.Queue()
q.put(nodes[rootNum])
while not q.empty():
    nd = q.get()
    if nd.left != -1:
        nodes[nd.left].depth = nd.depth + 1
        q.put(nodes[nd.left])
    if nd.right != -1:
        nodes[nd.right].depth = nd.depth + 1
        q.put(nodes[nd.right])

# heightを設定する
for node in nodes:
    if node.parent == -1 or node.nodeType == "leaf":
        node.height = 0
        q.put(node)
while not q.empty():
    nd = q.get()
    if nd.parent != -1:
        nodes[nd.parent].height = max(nodes[nd.parent].height, nd.height + 1)
        q.put(nodes[nd.parent])

# 出力！
for node in nodes:
    print("node {0}: parent = {1}, sibling = {2}, degree = {3}, depth = {4}, height = {5}, {6}"
          .format(node.myNum, node.parent, node.bs, node.degree, node.depth, node.height, node.nodeType))


Measured memory_bytes: 6900
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>
#include <unordered_set>
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
#define ms(a, b) memset(a, b, sizeof(a))
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define eps 0.0000000001
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define random(a, b) rand()*rand()%(b-a+1)+a
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 200000 + 10;
const int mod = 1e9+7;
int num[maxn];
struct node{
    int a, num;
    node(int _a, int _num){
        a = _a;
        num = _num;
    }
    bool operator < (node const& b) const{
        return num > b.num;
    }
};
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    IOS
    ms(num, 0);
    int n, k, x;
    scanf("%d%d", &n, &k);
    for(int i = 1;i<=n;i++){
        scanf("%d", &x);
        num[x]++;
    }
    priority_queue<node>Q;
    for(int i = 1;i<=n;i++){
        if(num[i]>0)
            Q.push(node(i, num[i]));
    }
    int ans = 0;
    while(Q.size()>k){
        node now = Q.top();
//        cout << now.a << endl;
        ans += now.num;
        Q.pop();
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int N;
	cin >> N;
	vector<int> x(N), y(N);
	REP(i, N) { cin >> x[i] >> y[i]; }
	vector<int> p(N);
	REP(i, N) { p[i] = i; }
	double sum = 0;
	int cnt = 0;
	do {
		++cnt;
		REP(i, N - 1) {
			int x0 = x[p[i]], y0 = y[p[i]];
			int x1 = x[p[i + 1]], y1 = y[p[i + 1]];
			sum += sqrt((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1));
		}
	} while (next_permutation(p.begin(), p.end()));
	cout << fixed << setprecision(10) << sum / cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

int main(){

    int M;
    ll K;cin>>M>>K;
    if(M==0){
        if(K==0) cout<<"0 0"<<endl;
        else cout<<-1<<endl;
    }else if(M==1){
        if(K==0) cout<<"0 0 1 1"<<endl;
        else cout<<-1<<endl;
    }else{
        if(0<=K&&K<(1<<M)){
            cout<<K;
            vector<int> A((1<<M));
            for(int i=0;i<(1<<M);i++){
                A[i]=i;
            }
            for(int i=(1<<M)-1;i>=0;i--){
                if(i==K) continue;
                cout<<" "<<i;
            }
            cout<<" "<<K;
            for(int i=0;i<(1<<M);i++){
                if(i==K) continue;
                cout<<" "<<i;
            }
            cout<<endl;
        }else cout<<-1<<endl;
    }
}


Measured memory_bytes: 2304
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
const int N=1505;
int S[N],n,u[N][N],l[2][N],r[2][N],flag[N][N];
char A[N][N];
int main(){
	scanf("%d",&n);
	for (register int i=1;i<=n;++i)scanf("%s",A[i]+1);
	for (register int i=1;i<=n;++i)
		for (register int j=1;j<=n;++j)flag[i][j]=A[i][j]>='0'&&A[i][j]<='9';
	for (register int i=0;i<=n;++i)
		for (register int j=0;j<=n;++j)u[i][j]=flag[i][j]?min(i,min(u[i-1][j],u[i][j-1])):1<<30;
	long long ans=0;
	for (register int x=1;x<=n;++x){
		for (register int i=x;i;--i){
			int t=i&1;
			for (register int j=1;j<=n;++j)S[j]=S[j-1]+(u[x][j]<=i?A[x][j]-'0':0);
			for (register int j=n+1;j;--j){
				if (flag[i][j]){
					l[t][j]=min(l[t][j+1],i==x?j:l[t^1][j]);
					r[t][j]=max(r[t][j+1],i==x?j:r[t^1][j]);
					if (l[t][j]<=r[t][j])ans+=(A[i][j]-'0')*(S[r[t][j]]-S[l[t][j]-1]-(i==x?A[i][j]-'0':0));
				}
				else l[t][j]=1e9,r[t][j]=-1;
			}
		}
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 9344
def is_prime(x):
    if x == 2:
        return True
    elif x < 2 or x % 2 == 0:
        return False
    else:
        i = 3
        while i <= x ** 0.5:
            if x % i == 0:
                return False
            i += 2
    return True
 

n = int(input())
ret = 0
while n:
    x = int(input())
    if is_prime(x): ret += 1
    n -= 1

print(ret)

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

long long int N, dp[200];

int main(){
    for(int i = 0; i < 101; ++i){
        if(!(i & 3)){
            for(int j = 0; j < (150 - i) / 7; ++j){
                dp[i + j * 7] = 1;
            }
        }
    }
    scanf("%lld", &N);
    puts(dp[N] ? "Yes" : "No");
    return 0;
}

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

#define MAX 30
#define rep(i, a) for(int i = 0; i < (a); ++i)
#define rept(i, a, b) for(int i = (a); i <= (b); ++i)

int main(){
	int w, n;
	int num[MAX];
	int a, b;
	std::cin >> w >> n;
	rep(i, MAX)
		num[i] = i + 1;		
	rep(i, n){
		scanf("%d,%d", &a, &b);
		std::swap(num[a - 1], num[b - 1]);
	}
	rep(i, w)
		std::cout << num[i] << std::endl;
	return 0;
}

Measured memory_bytes: 1240
S = input()
left = ((len(S) - 1) // 2)
right = ((len(S) + 3) // 2) - 1
l_s = S[0:left]
r_s = S[right:len(S)]
if(S == S[::-1] and l_s == l_s[::-1] and r_s == r_s[::-1]):
  print("Yes")
else:
  print("No")

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

int main() {
	int n;
	cin >> n;
	int e[n];
	for (int i = 0; i < n; i++) {
		cin >> e[i];
	}
	sort(e, e + n);
	int sum = 0;
	for (int i = 0; i < n - 1; i++) {
		sum += e[i];
	}
	if (e[n - 1] < sum) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector <ll> a(n);
    for(int i = 0; i <n; i++) {
        cin >> a[i];
    }
    int cnt = 0;
    int ans=1;
    while (ans){
        for(int i = 0; i < n; i++) {
            if (a[i] % 2 == 1){
                cout << cnt;
                return 0;
            }
            a[i] = a[i] / 2;
        }
        cnt++;
        
    }

    return 0;
}

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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK" << endl

const double PI = M_PI;
const long long INF = int(10e9-1);
const long long MOD = int(10e9+7);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t start = clock();
        solve();
        clock_t end = clock();
        const double time = static_cast<double>(end-start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
   int A, B, C;
   cin >> A >> B >> C;
   cout << ((A<C&&B>C)||(A>C&&B<C)?"Yes":"No") << endl;
}



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

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

    int n = 0;
    int a = 0;
    int b = 0;

    cin >> n >> a >> b;
    int sum = 0;
    int t_sum = 0;
    int t_i = 0;

    for (int i = 1; i < n + 1; i++)
    {
        t_sum = 0;
        t_i = i;
        while (t_i > 0)
        {
            t_sum += t_i % 10;
            t_i /= floor(10);
        }
        if (a <= t_sum && t_sum <= b)
        {
            sum += i;
        }
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<ll, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 110;
const int MAXK = 510;

int n, res[MAXN];
vector<II> a[MAXN];

void dfs(int u, int p, ll len) {
    if (len % 2 == 0) res[u] = 1;
    FOR(i,0,SZ(a[u])-1) {
        int v = a[u][i].FI;
        if (v != p) dfs(v, u, len + a[u][i].SE);
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,1,n-1) {
        int u, v, c;
        cin >> u >> v >> c;
        a[u].emplace_back(II(v, c));
        a[v].emplace_back(II(u, c));
    }
    dfs(1, 0, 0);
    FOR(i,1,n) cout << res[i] << "\n";
    return 0;
}

Measured memory_bytes: 9984
// "header" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

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> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;

inline double sqrt( const double &x) 
{
	double         xHalf = 0.5 * x;
	int64_t  tmp   = 0x5FE6EB50C7B537AAl - ( *(int64_t*)&x >> 1);
	double         xRes  = * (double*)&tmp;

	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	return xRes * x;
}
// }}}


signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string o,e;
	cin >> o >> e;
	rep(i,o.size()){
		if(i == o.size()-1 && o.size() - e.size() == 1){
			cout << o[i];
			break;
		}
		cout << o[i] << e[i];
	}
	cout << '\n';
	return 0;	
}


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

using namespace std;

int main()
{
	int n;

	while (scanf("%d", &n), n) {
		int s[5001] = {};

		for (int i = 1; i <= n; ++i) {
			int a; scanf("%d", &a);
			s[i] = a + s[i - 1];
		}

		int ma = INT_MIN;

		for (int i = 1; i <= n; ++i) for (int j = 1; j <= i; ++j) {
			ma = max(ma, s[i] - s[j - 1]);
		}

		printf("%d\n", ma);
	}
}

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

int main() {
	
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i, n) cin >> h[i];
	int ans = 0;
	int max = 0;
	rep(i, n){
		if(max <= h[i]){
			ans++;
			max = h[i];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
S = input()
slist = S.split("LR")
res = [["0"] * len(s) for s in slist]
for i in range(len(slist)):
  if i < len(slist) - 1:
    slist[i] = slist[i] + "L"
    res[i].append("0")
    slist[i + 1] = "R" + slist[i + 1]
    res[i + 1].append("0")
  Rc = slist[i].count("R")
  Lc = slist[i].count("L")
  #print(slist[i], Rc, Lc)
  res[i][Rc - 1] = str(Lc // 2 + (Rc - Rc // 2))
  res[i][Rc] = str(Rc // 2 + (Lc - Lc // 2))
res2 = ""
#print(res)
for i in range(len(slist)):
  #print(res[i])
  res2 = res2 + " ".join(res[i])
  if i < len(slist) -1:
    res2 = res2 + " "
print(res2)


Measured memory_bytes: 18372
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long int ll;
const int INF = 100000000;

int main()
{
    string s, t;
    cin >> s >> t;

    int ans = 0;
    rep(i, 3) {
        if (s[i] == t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);

const int N = 2e6;
ll arr[N];

void sieve(){
    for(ll i = 1; i <= 1e6; i++){
        arr[i]++;
        for(ll j = 2*i; j <= 1e6; j+=i) arr[j]++;
    }
}

int main()
{
    int i = 0, j = 0, cs = 0, in;
    sieve();
    int n; cin>>n;
    ll cnt = 0;
    for(ll c = 1; c < n; c++){
        ll x = n-c;
        cnt += arr[x];
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 11432
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}

ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}

        
//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;

int main(){
 string S;cin>>S;
  
 
    if(S[0]=='R' &&S[1]=='R'&&S[2]=='R'){
      cout<<3<<endl;
    }
    else if(S[0]=='R' &&S[1]=='R'&&S[2]=='S'){
      cout<<2<<endl;
    }
    else if(S[0]=='S' &&S[1]=='R'&&S[2]=='R'){
      cout<<2<<endl;
    }
    else if(S[0]=='S' &&S[1]=='R'&&S[2]=='S'){
      cout<<1<<endl;
    }
    else if(S[0]=='R' &&S[1]=='S'&&S[2]=='S'){
      cout<<1<<endl;
    }
    else if(S[0]=='S' &&S[1]=='S'&&S[2]=='R'){
      cout<<1<<endl;
    }
    else if(S[0]=='R' &&S[1]=='S'&&S[2]=='R'){
      cout<<1<<endl;
    }
    else cout<<0<<endl;

}

Measured memory_bytes: 3748
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <queue>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
//typedef long long int;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  cin >> n;
  vi c(100005);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    c[x]++;
  }
  int res = 0;
  for (int i = 1; i + 1 < c.size(); ++i) res = max(res, c[i-1] + c[i] + c[i+1]);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 640
n, q = list(map(int, input().split()))
s = input().split()[0]
lr_list = [list(map(int, input().split())) for _ in range(q)]

count_ac_list = [0] * n
for i in range(n-1):
    # print('{}: {}'.format(i, s[i:i+2]))
    if s[i:i+2] == 'AC':
        count_ac_list[i+1] = count_ac_list[i] + 1
    else:
        count_ac_list[i+1] = count_ac_list[i]

count_list = [str(count_ac_list[r-1] - count_ac_list[l-1]) for l, r in lr_list]

print('\n'.join(count_list))


Measured memory_bytes: 37804
#include <iostream>
typedef long long ll;
using namespace std;

int main(void) {
    ll A,B,K;
    cin>>A>>B>>K;
    if (A>=K) cout << A - K << " " << B << endl;
    else if (K <= A + B) cout << 0 << " " << (A + B) - K << endl;
    else cout << 0 << " " << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

if __FILE__ == $0
  while line = STDIN.gets
    tokens = line.chomp!.split.map!(&:to_i)
    a, b = tokens[0], tokens[1]
    x = a * b
    y = (a + b) * 2
    puts "#{x} #{y}"
  end
end

Measured memory_bytes: 8584
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int bsr(int x) { return 31 - __builtin_clz(x); }
bool B(int x,int i){return (x>>i)&1;}
const int MN = 100000;
int N;
vector<int> G[MN];
int dfs(int v,int p=-1){
	int b[20]={};
	for(int u:G[v]) if(u!=p){
		int tmp=dfs(u,v);
		rep(i,20) if(B(tmp,i)) b[i]++;
	}
	int ret=1e9;
	for(int i=19;i>=0;i--){
		if(b[i]>=2) break;
		if(b[i]==0){
			int x=0;
			for(int j=19;j>i;j--) if(b[j]) x|=1<<j;
			x|=1<<i;
			ret=x;
		}
	}
	return ret;
}
int main(){
	cin>>N;
	rep(i,N-1){
		int a,b;
		cin>>a>>b;
		a--,b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	int tmp=dfs(0);
	cout<<bsr(tmp)<<endl;
}


Measured memory_bytes: 14848
import sys
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

for _ in range(INT()):
    N = INT()
    ans = 0
    adjli1 = [[] for i in range(N)]
    adjli2 = [[] for i in range(N+1)]
    for _ in range(N):
        k, l, r = MAP()
        k -= 1
        if l > r:
            adjli1[k].append(l - r)
        elif l < r:
            adjli2[k+1].append(r - l)
        ans += min(l, r)

    que = []
    for i in range(N):
        for a in adjli1[i]:
            heappush(que, a)
        while len(que) > i+1:
            heappop(que)
    ans += sum(que)
    que = []
    for i in range(N-1, -1, -1):
        for a in adjli2[i]:
            heappush(que, a)
        while len(que) > N-i:
            heappop(que)
    ans += sum(que)
    print(ans)


Measured memory_bytes: 105636
n = int(input())
A = list(map(int, input().split()))
total_xor = A[0]
for i in range(1, n):
    total_xor ^= A[i]
ans = []
_total_xor = int(total_xor)
for i in range(n):
    total_xor = _total_xor ^ A[i]
    ans.append(total_xor)

print(*ans)


Measured memory_bytes: 31756
#include<bits/stdc++.h>
using namespace std;
main(){
int i,j,k,l,n,m;
while(cin>>l>>m>>n){
int x[l+1]={0};j=0;k=0;
for(i=0;i<n;i++){
    cin>>j;
    x[j]++;
}
for(i=1;i<=l;i++){
        n-=x[i];
    if(m>n) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
n+=x[i];
}
} return 0;
}

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

using namespace  std;

int height[100000+5];
int dp[100000+5];

int main() {
    int N, K;
    memset(dp, 0x3f3f3f3f, sizeof(dp));
    scanf("%d%d",&N, &K);
    for(int i = 0 ;i < N; ++i) {
        scanf("%d",&height[i]);
    }
    dp[0] = 0;
    for(int i = 0 ;i < N; ++i){
        for(int k = 1; k <= K; ++k){
            if(i + k >= N) break;
            dp[i+k] = min(dp[i+k], dp[i] + abs(height[i] - height[i+k]));
        }
    }
    printf("%d\n", dp[N-1]);
    return 0;
}

Measured memory_bytes: 4604
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    int n;
    std::cin >> n;
    std::vector<int> vi(n);
    for (auto i = 0; i < n; ++i)
    {
        std::cin >> vi[i];
    }
    std::sort(vi.begin(), vi.end(), [](const int &a, const int &b) { return a > b; });
    int scores[2]{};
    for (auto i = 0; i < n; ++i)
    {
        scores[i % 2] += vi[i];
    }
    std::cout << (scores[0] - scores[1]) << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n,m;
  cin >> n >> m;
  ll d[n+1],c[n+1];
  d[0]=c[0]=1;
  rep(i,n) {
    c[i+1]=c[i]*2+3;
    d[i+1]=d[i]*2+1;
  }
  ll ans=0;
  rrep(i,n+1) {
    if(m>=c[i]) {
      ans+=d[i];
      m-=c[i];
      if(m) {
        ans++;
        m--;
      }
      i++;
    } else if(m) m--;
  }
  pr(ans);
}

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


Measured memory_bytes: 256
integer(8) N
integer(8),allocatable,dimension(:)::work,dead
integer(8) timeline
read*,N
allocate(work(N),dead(N))
do i=1,N
  read*,work(i),dead(i)
end do

call heapsort(n,dead,work)

timeline=0
do i=1,N
  timeline=timeline+work(i)
  if(timeline>dead(i))then
    print"(A)","No"
    Stop
  end if
end do

print"(A)","Yes"

contains

subroutine heapsort(n,array,b)
  implicit none
  integer(8),intent(in) :: n
  integer(8),intent(inout) :: array(1:n),b(1:n)
  integer(8)::i,k,j,l
  integer(8):: t,tb

  l=n/2+1
  k=n
  !$omp parallel
  do while(k /= 1)
     if(l > 1)then
        l=l-1
        t=array(L)
        tb=b(L)
     else
        t=array(k)
        tb=b(k)
        array(k)=array(1)
        b(k)=b(1)
        k=k-1
        if(k == 1) then
           array(1)=t
           b(1)=tb
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j<=k)
        if(j < k)then
           if(array(j) < array(j+1))j=j+1
        endif
        if (t < array(j))then
           array(i)=array(j)
           b(i)=b(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
     b(i)=tb
  enddo
  !$omp end parallel
  return
end subroutine heapsort
end

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main(){
    int s;
    cin >> s;
    set<int> st;
    st.insert(s);
    int a=s;
    for(int i=2;;i++){
        if(a%2==0){
            st.insert(a/2);
            a=a/2;
        }else{
            st.insert(3*a+1);
            a=3*a+1;
        }
        if(st.size()!=i){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
// Main
object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val len = sc.nextInt
    val s = sc.next
    if (len % 2 != 0) {
      println("No")
      System.exit(0)
    }
    val s1 = s.substring(0,len/2)
    val s2 = s.substring(len/2, len)
    if (s1 == s2) {
      println("Yes")
    } else {
      println("No")
    }
  }
}


Measured memory_bytes: 25804
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

const long long MAX_N = 1000000000;
const long long MIN_N = -1000000000;

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

    int n;
    cin >> n;
    if (n == 0) {
        cout << 0 << endl;
        return 0;
    }

    bool is_on[101] = {};
    std::vector<long long> max;
    std::vector<long long> min;

    // max,minを計算
    max.push_back(0);
    min.push_back(0);
    long long add = 1;
    int count     = 0;
    while (1) {
        count++;
        if (count % 2 == 1) {
            max.push_back(max[count - 1] + add);
            min.push_back(min[count - 1]);
        } else {
            max.push_back(max[count - 1]);
            min.push_back(min[count - 1] + add);
        }
        if (max[count] >= MAX_N && min[count] <= MIN_N)
            break;
        add *= -2;
    }

    int top_digit = 0;
    while (n != 0) {
        // cout << "n is " << n << endl;
        if (n > 0) {
            int digit = 1;
            while (max[digit] < n) {
                digit++;
            }
            is_on[digit] = true;
            if (top_digit == 0)
                top_digit = digit;
            n -= std::pow(-2, digit - 1);
            // cout << "digit " << digit << "is on" << endl;
        } else {
            int digit = 1;
            while (min[digit] > n) {
                digit++;
            }
            is_on[digit] = true;
            if (top_digit == 0)
                top_digit = digit;
            n -= std::pow(-2, digit - 1);
            // cout << "digit " << digit << "is on" << endl;
        }
    }

    // cout << "top_digit is " << top_digit << endl;

    for (int i = top_digit; i >= 1; i--) {
        if (is_on[i])
            cout << 1;
        else
            cout << 0;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N;

int main()
{
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    
    auto b = a;
    sort(b.begin(), b.end());
    if (b[N - 1] == b[N - 2])
    {
        for (int i = 0; i < N; i++)
        {
            cout << b[N - 1] << "\n";
        }
    }
    else
    {
        for (int i = 0; i < N; i++)
        {
            if (b[N - 1] == a[i])
                cout << b[N - 2] << "\n";
            else
                cout << b[N - 1] << "\n";
        }
    }
}

Measured memory_bytes: 3200
#include<iostream>
#include<unordered_map>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<unordered_set>
#include<map>
#include<queue>
#include<iomanip>
#include<tgmath.h>







/*
_
_._ _..._ . - ',     _.._(`))
'-. `     ' / -._. - '    ', /
)         \            '.
/ _    _ | \
| a    a    /              |
\   . - .;
'-('' ).-', '       ;
'-;           |      .'
\           \    /
| 7.__  _. - \   \
| |  |  ``/ / `  /
/, _|  |   /, _/   /
/, _ / '`-'
*/
using namespace std;




int main() 
{
    string str;
    cin >> str;
    if (str[2] == str[3] && str[4] == str[5]) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

    



}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int A_place;
  int Z_place;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == 'A') {
      A_place = i;
      break;
    }
  }
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s.at(i) == 'Z') {
      Z_place = i;
      break;
    }
  }

  cout << Z_place - A_place + 1 << endl;
  return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;

class Solution
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();
        var toWest = new int[n];
        var toEest = new int[n];

        int west = 0;
        for (int i = 0; i < n; i++)
        {
            if (s[i] == 'W')
            {
                west++;
            }
            toWest[i] = west;
        }
        int east = 0;
        for (int i = n - 1; i >= 0; i--)
        {
            if (s[i] == 'E')
            {
                east++;
            }
            toEest[i] = east;
        }
        var min = int.MaxValue;
        for (int i = 0; i < n; i++)
        {
            int x = 0;
            if (i > 0)
            {
                x += toWest[i - 1];
            }
            if (i < n - 1)
            {
                x += toEest[i + 1];
            }
            min = Math.Min(min, x);
        }

        Console.WriteLine(min);
    }
}

Measured memory_bytes: 14432
import java.io.*;

class Main{
    public static void main(String[] args) throws Exception{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String num1 = br.readLine();
        String[] num2 = num1.split(" ");

        int a = Integer.parseInt(num2[0]);
        int b = Integer.parseInt(num2[1]);
        int c = Integer.parseInt(num2[2]);

        if(a < b && b < c){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 24440
#include <iostream>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
set<ll> one,two;

void input(int pos,set<ll> &to){
	to.insert(pos);
	char c;cin >> c;
	if(c == '('){
		input(pos*2,to);
		cin >> c;
	}
	cin >> c;
	if(c == '('){
		input(pos*2+1,to);
		cin >> c;
	}
	if(c == ')')return;
}
string ret = "";
void gen(int pos,set<ll> &from){
	if(from.find(pos*2) != from.end()){
		ret += "(";
		gen(pos*2,from);
	}
	ret += ",";
	if(from.find(pos*2+1) != from.end()){
		ret += "(";
		gen(pos*2+1,from);
	}
	ret += ")";
}
int main(){
	char type; char dummy;
	while(cin >> type){
		one.clear(),two.clear();
		
		cin >> dummy;
		input(1,one);
		cin >> dummy;
		input(1,two);
		vector<ll> cd;
		
		set<ll> get;
		if(type == 'u'){
			get = one;
			for(set<ll>::iterator it = two.begin(); it != two.end(); ++it)
				get.insert(*it);
		}else{
			for(set<ll>::iterator it = two.begin(); it != two.end(); ++it)
				if(one.find(*it) != one.end())get.insert(*it);
			for(set<ll>::iterator it = one.begin(); it != one.end(); ++it)
				if(two.find(*it) != two.end())get.insert(*it);
		}
		ret = "";
		gen(1,get);
		cout << "(" << ret << endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
using namespace std;

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

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, a[110];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    bubbleSort(a, n);
    int even = 0, odd = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0)
            even += a[i];
        else
            odd += a[i];
    }
    cout << abs(even - odd) << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

struct B {
  ll num, two, five;
  B() = default;
  B(ll num, ll two, ll five) : num(num), two(two), five(five) {
  }

  bool operator<(const B& another) const {
    return two < another.two;
  };
};


signed main() {
  int N;
  cin >> N;
  vector<double> A(N);
  vector<B> Bs(N);

  int T = 18, F = 18;
  vector<vector<int>> table(T + 1, vector<int>(F + 1));

  rep(i, N) {
    cin >> A[i];
    Bs[i].num = A[i] * 1000000000 + 0.5;

    int b = Bs[i].num;
    while (b % 2 == 0) {
      b /= 2;
      Bs[i].two++;
      if (Bs[i].two == 18)
        break;
    }

    while (b % 5 == 0) {
      b /= 5;
      Bs[i].five++;
      if (Bs[i].five == 18)
        break;
    }

    table[Bs[i].two][Bs[i].five]++;
  }

  int ans = 0;
  rep(t, T + 1) {
    rep(f, F + 1) {
      repp(tt, max(0ll, 18 - t), T) {
        repp(ff, max(0ll, 18 - f), F) {
          if (t == tt && f == ff)
            ans += table[t][f] * (table[tt][ff] - 1);
          else
            ans += table[t][f] * table[tt][ff];
        }
      }
    }
  }

  ans /= 2;
  cout << ans << endl;
}

Measured memory_bytes: 11128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

template<int M>
class Cyclic {
	using ll = long long;
	int n;
	static ll inv(ll a, ll p) { return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p); }
public:
	Cyclic() : n(0) { ; }
	Cyclic(int m) : n(m) {
		if (n >= M) n %= M;
		else if (n < 0) n = (n % M + M) % M;
	}
	operator int() const { return n; }
	bool operator==(const Cyclic &a) const { return n == a.n; }
	Cyclic operator+=(const Cyclic &a) { n += a.n; if (n >= M) n -= M; return *this; }
	Cyclic operator-=(const Cyclic &a) { n -= a.n; if (n < 0) n += M; return *this; }
	Cyclic operator*=(const Cyclic &a) { n = (ll(n) * a.n) % M; return *this; }
	Cyclic operator+(const Cyclic &a) const { Cyclic res = *this; return res += a; }
	Cyclic operator-(const Cyclic &a) const { Cyclic res = *this; return res -= a; }
	Cyclic operator*(const Cyclic &a) const { Cyclic res = *this; return res *= a; }
	Cyclic operator/(const Cyclic &a) const { return *this * Cyclic<M>(inv(a, M)); }
	Cyclic operator^(int n) const {
		if (n == 0) return Cyclic(1);
		const Cyclic a = *this;
		Cyclic res = (a * a) ^ (n / 2);
		return n % 2 ? res * a : res;
	}
};

template<int M> Cyclic<M> fact(int n, bool sw = true) {
	static vector<Cyclic<M>> v1 = { 1 }, v2 = { 1 };
	if (n >= (int)v1.size()) {
		const int from = v1.size(), to = n + 1024;
		v1.reserve(to);
		v2.reserve(to);
		for (int i = from; i < to; ++i) {
			v1.push_back(v1.back() * Cyclic<M>(i));
			v2.push_back(v2.back() / Cyclic<M>(i));
		}
	}
	return sw ? v1[n] : v2[n];
}

template<int M> Cyclic<M> comb(int a, int b) {
	return fact<M>(a, true) * fact<M>(b, false) * fact<M>(a - b, false);
}

const int mod = 1000000007;
using Mod = Cyclic<mod>;


int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n, m, k;
	cin >> n >> m >> k;
	Mod ans = 0;
	REP(i, k + 1)
	{
		Mod tmp = comb<mod>(n + m + k * 2, n + i * 2);
		int j = k - i;
		Mod a = comb<mod>(n + 2 * i, i);
		if (i > 0)
		{
			a -= comb<mod>(n + 2 * i, i - 1);
		}
		Mod b = comb<mod>(m + 2 * j, j);
		if (j > 0)
		{
			b -= comb<mod>(m + 2 * j, j - 1);
		}
		ans += tmp * a * b;
	}
	cout << int(ans) << endl;
	return 0;
}

Measured memory_bytes: 4296