akhauriyash/Code-Regression huggingface dataset:
#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 rrep(i, n) for(int i=((int)(n)-1); i>=0; i--)
#define ALL(a) (a).begin(), (a).end()
#define pb push_back
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x, ll y){ if(x>y) swap(x, y);while(x!=0){ y%=x; swap(x, y); }return y; }
ll mpow(ll x, ll r){if(r==0) return 1;if(r%2==1){ return x*mpow(x, r-1)%mod; }else{ ll aa = mpow(x, r/2); return aa*aa%mod; }}

int main(){
	int s, w; cin >> s >> w;
	if(w >= s) cout << "unsafe" << endl;
	else cout << "safe" << endl;
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector <int> vec_d(n);
  
  for(int i= 0; i < n; i++){
    cin >> vec_d.at(i);
  }
  sort(vec_d.begin(),vec_d.end());
  vec_d.erase(unique(vec_d.begin(), vec_d.end()),vec_d.end());
  
  cout << vec_d.size() <<endl;  
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9+7, A = 1e5+5;
struct point {
	int x, y;
};
int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	point p1, p2, p3, p4, cur;
	cin >> p1.x >> p1.y >> p2.x >> p2.y;

	cur.x = p2.x - p1.x;
	cur.y = p2.y - p1.y;

	cur.y *= -1;
	swap(cur.x, cur.y);
	p3.x = p2.x + cur.x;
	p3.y = p2.y + cur.y;

	cur.y *= -1;
	swap(cur.x, cur.y);
	p4.x = p3.x + cur.x;
	p4.y = p3.y + cur.y;

	cout << p3.x << ' ' << p3.y << ' ' << p4.x << ' ' << p4.y;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
N = int(input())
A = list(map(int, input().split(' ')))

min, max = A[0], A[0]
for i in range(N-1):
    if A[i+1] < min:
        min = A[i+1]
    elif A[i+1] > max:
        max = A[i+1]

print(max-min)

Measured memory_bytes: 3060
N, M, C = [int(num) for num in input().split()]
B = [int(num) for num in input().split()]
A = []
for n in range(N):
  a = [int(num) for num in input().split()]
  A.append(a)
t = 0
for i in range(N):
  S = 0
  for j in range(M):
    S += A[i][j]*B[j]
  S += C
  if S > 0:
    t += 1
print(t)

Measured memory_bytes: 3064
#include <cstdio>
#define int long long
using namespace std;

signed main(){
	int n,q,s,t,a[200001],d[200000],temp = 0;
	scanf("%lld %lld %lld %lld",&n,&q,&s,&t);
	for(int i = 0;i < n + 1;i++){
		scanf("%lld",&a[i]);
		if(i) d[i - 1] = a[i] - a[i - 1];
	}
	for(int i = 0;i < n;i++) {
		if(d[i] > 0) temp -= s * d[i];
		else temp -= t * d[i];
	}
	for(int i = 0;i < q;i++){
		int l,r,x;
		scanf("%lld %lld %lld",&l,&r,&x);
		if(d[l - 1] > 0) temp += s * d[l - 1];
		else temp += t * d[l - 1];
		if(r < n){
			if(d[r] > 0) temp += s * d[r];
			else temp += t * d[r];
		}
		d[l - 1] += x;
		d[r] -= x;
		if(d[l - 1] > 0) temp -= s * d[l - 1];
		else temp -= t * d[l - 1];
		if(r < n){
			if(d[r] > 0) temp -= s * d[r];
			else temp -= t * d[r];
		}
		printf("%lld\n",temp);
	}
	return 0;
}

Measured memory_bytes: 5880
#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<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 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 long long LLINF = 1LL<<60;
//g++ -std=c++1z main.cpp
//.\a.exe

int main(void){ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////////////////
int n;
cin >> n;
cout << n*n*n << endl;
////////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int r, D, x;;
	cin >> r >> D >> x;
	REP(i, 10) {
		cout << (x = r*x - D) << "\n";
 	}
	cout << flush;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;
// const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// struct edge {int to, cost;};
// vector<edge> graph[MAX];
// bool visited[MAX];
// int dist[MAX];

int main() {
    // input
    double l;
    cin >> l;
    // solve
    double ans = (l/3)*(l/3)*(l/3);
    // output
    cout << fixed << setprecision(10) << ans << endl;
}

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

int digits_sum(int x){
  int sum = 0;
  while(x > 10){
     sum += x % 10;
     x /= 10;
  }
  return sum += x;
}

int main(void){
  int N;
  cin >> N;
 
  if(N % 10 == 0) cout << "10" << "\n";
  else cout << digits_sum(N) << "\n";
}


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

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 RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }

ll modpow(ll a, ll x)
{
    ll res = 1;
    while(x > 0)
    {
        if(x & 1) res = res * a % MOD;
        a = a * a % MOD;
        x >>= 1;
    }
    return res;
}

ll modinv(ll a)
{
    return modpow(a, MOD-2);
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N; cin >> N;
    cout << N * (N+1) / 2 << endl;
}

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

const int NMAX = 1e5 + 5;
const int MOD = 1e9 + 7;
const int DIV = 13;
string s;
int dp[NMAX][DIV];

int main()
{
    cin >> s;
    int n = s.size();
    s = "#" + s;
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++) {
        if(s[i] == '?') {
            for(int j = 0; j <= 9; j++) {
                for(int k = 0; k < DIV; k++) {
                    int rem = (10 * k + j) % DIV;
                    dp[i][rem] = (dp[i][rem] + dp[i - 1][k]) % MOD;
                }
            }
        } else {
            int x = s[i] - '0';
            for(int k = 0; k < DIV; k++) {
                    int rem = (10 * k + x) % DIV;
                    dp[i][rem] = (dp[i][rem] + dp[i - 1][k]) % MOD;
                }
        }
    }
    cout << dp[n][5];
    return 0;
}


Measured memory_bytes: 8796
N, M = map(int, input().split())
mod = 10 ** 9 + 7
dp = [0] * (N+1)
dp[0] = 1
idx = 0
for m in range(M):
    a = int(input())
    for i in range(idx+1, a):
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
    idx = a

for i in range(idx+1, N+1):
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[-1])

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

int main()
{
    int x,y,z;
    cin >> x >> y >> z;
    int ans = 0;
    x -= z;
    while(x > 0){
        if(x >= y+z){
            ans++;
            x -= y+z;
        }else{
            break;
        }
    }
    cout << ans << endl;
}

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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

double kaijyo(int n){
    int k(1);
    for(int i=n;i>0;i--){
        k *= i;
    }

    return k;
}

double distance(int x[],int y[],int i,int j){
    int dx = (x[i] - x[j]) * (x[i] - x[j]);
    int dy = (y[i] - y[j]) * (y[i] - y[j]);
    return sqrt(dx+dy);
}

int main(){
    ll n,k;
    cin >> n >> k;

    if(n%k==0)    
        cout << n/k << endl;
    else
        cout << n/k+1 << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    ll n;
    cin>>n;
    vector<ll> d(n);
    rep(i,0,n-1) cin>>d[i];
    sort(d.begin(),d.end());
    ll ans = 0;
    ans = d[n/2] - d[n/2-1];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
vector<vec> x;
int main(){
    int n=in();
    ll k=lin();
    int m=60;
    x.resize(n,vec(m));
    vec a(n);
    rep(i,n){
        a[i]=in()-1;
        x[i][0]=a[i];
    }
    for(int j=1;j<m;j++)rep(i,n)x[i][j]=x[x[i][j-1]][j-1];
    int ans=0;
    int cnt=0;
    while(k>0){
        while(k%2==0){
            cnt++;
            k/=2;
        }
        ans=x[ans][cnt];
        k/=2;
        cnt++;
    }
    cout<<ans+1<<endl;
}

Measured memory_bytes: 58708
N = int(input())
arr = list(map(int, input().split()))
target = [0]*(10**5+1)
for i in arr:
    target[i] += 1
ans = sum(arr)
Q = int(input())
for i in range(Q):
    B, C = map(int, input().split())
    target[C] += target[B]
    ans += target[B]*C
    ans -= target[B]*B
    target[B] = 0
    print(ans)

Measured memory_bytes: 20996
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    c = 0
    for i in range(1, n + 1):
        for j in range(1, i):
            for k in range(1, j):
                if i + j + k == x:
                    c += 1
    print(c)
    


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

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

Measured memory_bytes: 256
import sys
import math
def main():
    for line in sys.stdin:
        n = int(line)
        if n == 0:
            break
        else:
            A = list(map(float, input().split()))
            t1 = 0
            for a in A:
                t1 += a
            ave = t1 / len(A)
            
            t2 = 0
            for a in A:
                t2 += (a - ave) ** 2
            s = math.sqrt(t2 / n)
            print(s)


if __name__ == "__main__":
    main()

Measured memory_bytes: 7920
A, B, C = map(int, input().split())


def count_odd(*nums):
    counter = 0
    for num in nums:
        if num % 2 == 0:
            counter += 1
    return counter


def min_2(*nums):
    mins = sorted(nums)
    return mins[:2]


if count_odd(A, B, C) >= 1:
    print(0)
else:
    m1, m2 = min_2(A, B, C)
    print(m1 * m2)


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね

//ここから編集する

int main() {

    int N, K;
    cin >> N >> K;
    vector<ll> a(N), b(N);
    vector<ll> acc_a(N + 1, 0), acc_b(N + 1, 0);
    REP(i, 0, N) {
        cin >> a[i];
        b[i] = max(0LL, a[i]);
    }

//K個の連続する0以上や0以下を調べる
    REP(i, 0, N) {
        acc_a[i + 1] = acc_a[i] + a[i];
        acc_b[i + 1] = acc_b[i] + b[i];
    }
    //a[x] ~ a[y] の累積和 is acc_a[y+1] - acc_a[x]


    ll ans = 0;
    REP(i,K,N+1){
        //acc_a[i - K] ~ acc_a[i-1]は塗りつぶすやつ
        //acc_b[0] ~ acc_b[i-K-1] と acc_b[i] ~ acc_b[N-1]までのWA
        ll sub1 = max(acc_a[i] - acc_a[i-K],0LL);
        ll sub2 = (acc_b[i-K] - acc_b[0]) + (acc_b[N] - acc_b[i]);
        ans = max(ans,sub1 + sub2);

    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3328
#include<stdio.h>

int str_str(char* s, char* t)
{
	for (int i = 0;;i++)
	{
		
		 if (*(s + i) == '\0')
		{
			break;
		}
		 else if (*(s + i) != *(t + i))
		{
			return 0;
		}

	}
	return 1;

}


int main()
{
	char s[11], t[12];
	scanf("%s", &s);
	scanf("%s", &t);
	
	if(str_str(s, t)==1)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 1620
#include<bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int inf = 0x3f3f3f3f;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
#define gc getchar
#define pc putchar
#define fi first
#define se second
#define debug(x) cout << #x" = " << x << endl;
#define pp(x,y) cout << "pp: " << x << " " << y << endl;
inline ll read(){
	register ll x=0,f=1;register char c=gc();
	for(;!isdigit(c);c=gc())if(c=='-')f=-1;
	for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
#define rd read
void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
void writeln(ll x){write(x);puts("");}
const int N=2e5+5;
int val[N<<2],add[N<<2],n,m;
void push(int k) {
	if(!add[k]) return;
	add[k<<1]+=add[k];add[k<<1|1]+=add[k];
	val[k<<1]+=add[k];val[k<<1|1]+=add[k];
	add[k]=0;
}
void pull(int k) {
	val[k]=max(val[k<<1],val[k<<1|1]);
}
void build(int k,int lef,int rig) {
	add[k]=0;
	if(lef==rig) {
		val[k]=lef-m-1;
		return;
	}
	int mid=(lef+rig)>>1;
	build(k<<1,lef,mid),build(k<<1|1,mid+1,rig);
	pull(k);
}
void update(int k,int lef,int rig,int l,int r) {
	if(l<=lef&&rig<=r) {
		add[k]++;val[k]++;
		return;
	}
	int mid=(lef+rig)>>1;push(k);
	if(l<=mid) update(k<<1,lef,mid,l,r);
	if(r>mid) update(k<<1|1,mid+1,rig,l,r);
	pull(k);
}
int query(int k,int lef,int rig,int l,int r) {
	if(l<=lef&&rig<=r) return val[k];
	int mid=(lef+rig)>>1,ans=0;push(k);
	if(l<=mid) ans=max(ans,query(k<<1,lef,mid,l,r));
	if(r>mid) ans=max(ans,query(k<<1|1,mid+1,rig,l,r));
	return ans;
}
std::vector<int> g[N];
signed main() {
	n = rd(),m = rd();
	build(1,1,m+1);
	int ans=max(0,n-m);
	int l,r;
	while(n--){
		l=rd(),r=rd();
		g[l].push_back(r);
	}
	for(int i=0;i<=m;i++) {
		for(int v:g[i]) update(1,1,m+1,1,v);
		ans=max(ans,query(1,1,m+1,i+1,m+1)-i);
	}
	writeln(ans);
	return 0;
}//copy from vjudge


Measured memory_bytes: 14080
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
typedef long long int ll;
using namespace std;

int main(){
  int n, a[100];
  cin >> n;
  for(int i=0;i<n;i++) cin >> a[i];
  double ans = 0;
  for(int i=0;i<n;i++) ans += 1.0 / a[i];
  printf("%.8f\n", 1.0 / ans);
  return 0;
}
  

Measured memory_bytes: 256
import itertools

n=int(input())
f=[[]]*n
for i in range(n):
    fij=list(map(int,input().split()))
#    f[i].append(fij)
    f[i]=fij
p=[[]]*n
for i in range(n):
    pij=list(map(int,input().split()))
    p[i]=pij
    
pmax=-10**11
for a in itertools.product([0,1], repeat=10):
    if sum(a)==0:
        continue
    psum=0
    for ni in range(n):
        k=0
        for i in range(10):
            if f[ni][i]==1 and a[i]==1:
                k+=1
        psum=psum+p[ni][k] 
    pmax=max(pmax,psum)   

print(pmax)


Measured memory_bytes: 3064
MOD = 10**9+7
N, K = map(int, input().split())
count = 0
ans = pow(K, N, MOD)
dictionary = [0 for _ in range(K+1)]
for i in range(K-1):
    j = K-i
    tmp = K // j
    tmp2 = pow(tmp, N, MOD)
    tmp2 -= sum(dictionary[::j])
    dictionary[j] = tmp2
    ans = (ans + (j-1) * tmp2)%MOD
    #print(tmp2, j)
#print(dictionary)
print(ans)


Measured memory_bytes: 11612
def f(n):
    if n % 2 == 0:
        return n // 2
    else:
        return 3 * n + 1


s = int(input())
a = [s]
while True:
    x = f(a[-1])
    if x in a:
        print(len(a) + 1)
        exit()
    a.append(x)

Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.Linq;
class Program
    {
        static void Main(string[] args)
        {
            //0<=x,y,z<=K
            //X+Y+Z=S
            var Array = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int K = Array[0];
            int S = Array[1];
            int Count = 0;
            int z = 0;
            for (int x = 0; x <= K; x++)
            {
                for (int y = 0; y <= K; y++)
                {
                    z = S - (x + y);
                    if (0 <= z && z <= K)
                        Count++;
                }
            }

            Console.WriteLine(Count);
        }

    }

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

int main() {
    // 制約見て！！！デカかったらlong longにすること！
    int a, b, c, d, e;
    vector<int> dishes(5);
    rep(i, 5) cin >> dishes[i];
    int m = dishes[0] % 10;
    int idx = 0;
    for(int i = 1; i < 5; i++) {
        if(dishes[i] % 10 < m && dishes[i] % 10 > 0) {
            m = dishes[i] % 10;
            idx = i;
        }
    }
    int ans = 0;
    rep(i, 5) {
        if(idx == i)
            ans += dishes[i];
        else if(dishes[i] % 10 == 0)
            ans += dishes[i];
        else
            ans += dishes[i] - dishes[i] % 10 + 10;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
    long int a,b,c=1,m,n,i,j;
    scanf("%li%li",&m,&n);



        for(i=0 ; i<1000000000; i++)

        {
            a=abs(m-i);
            b=abs(n-i);

            if(a==b)
            {
                printf("%li",i);
                c=0;
                break;
            }

        }


    if(c==1)
    {
       printf("IMPOSSIBLE");

    }



}


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
//using ll=long long;
#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
 
int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}
 
int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}
 
int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
 
int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
//最小化問題(DP)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
//最大化問題(DP)
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//dp注意点
//問題の種類	 初期化する値	 備考
//最小化問題 	INF	
//最大化問題	    -INF	 テーブル全体で 00 以上の値しかとらないことがわかっていれば −1−1 でもいいですし、00 でもいい場合もあります
//数え上げ問題	00	
//確率問題	      00	
//Yes/No 判定問題	False
/*-------------ここまで---------------------------------------------*/
 
signed main(){
  int h,a;
  cin>>h>>a;
  cout<<(h-1)/a+1<<endl;
  return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;
  cin >> a;
  cin >> b;
  if((a*b)%2 == 0){
    cout << "Even" << endl;
  }else{
    cout << "Odd" << endl;
  }
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
using namespace  std;
typedef long long int ll;
int main(){
  ll a,b,n;
  cin >> n>> a>> b;
  if(a>b) cout <<0<<endl;
  else{
    if(n==1){
      if(a==b) cout <<1<<endl;
      else cout <<0<<endl;
    }
    else{
      cout <<(n-1)*(b-a)+(a-b)+1<<endl;
    }
  }
}


Measured memory_bytes: 256
import sys

N, P = map(int, sys.stdin.readline().split())

primes = {}
for i in range(2, int(P**0.5) + 1):
    count = 0
    while P % i == 0:
        P //= i
        count += 1
    if 0 < count:
        primes[i] = count

if P != 1:
    primes[P] = 1

if not primes:
    primes[P] = 1

# print(primes)
ans = 1
for value, count in primes.items():
    p = count // N
    if 0 < p:
        ans *= value ** p

print(ans)

Measured memory_bytes: 63484
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 50010
 
class Union_Find{
public:
    int par[MAX],rank[MAX],size[MAX],gnum;
    Union_Find(int N){
	gnum = N;
	for(int i = 0 ; i < MAX ; i++){
	    par[i] = i;
	    rank[i] = 0;
	    size[i] = 0;
	}
    }
    int find(int x){
	if(par[x] == x){
	    return x;
	}
	return par[x] = find(par[x]);
    }
    void unite(int x,int y){
	x = find(x);
	y = find(y);
	if(x == y) return;
	if(rank[x] < rank[y]){
	    par[x] = y;
	    size[y] += size[x];
	}else{
	    par[y] = x;
	    size[x] += size[y];
	    if(rank[x] == rank[y]){
		rank[x]++;
	    }
	}
	gnum--;
    }
    bool same(int x,int y){
	return find(x) == find(y);
    }
    int getSize(int x){
	return size[find(x)];
    }
    int groups(){
	return gnum;
    }
};
 
int N,W,H;
int X[2*MAX],Y[2*MAX],x[MAX],y[MAX];
 
bool isWall(int x,int y){
    if(x == 1 || y == 1 || x == W || y == H){
	return true;
    }
    return false;
}
 
int main(){
    cin >> N >> W >> H;
    Union_Find uf(N);
    for(int i = 0 ; i < 2*MAX ; i++){
	X[i] = Y[i] = -1;
    }
    bool wall = false;
    for(int i = 0 ; i < N ; i++){
	cin >> x[i] >> y[i];
	uf.size[i] = 1;
	if(X[x[i]] == -1){
	    X[x[i]] = i;
	}else{
	    uf.unite(X[x[i]],i);
	}
	if(Y[y[i]] == -1){
	    Y[y[i]] = i;
	}else{
	    uf.unite(Y[y[i]],i);
	}
	wall |= isWall(x[i],y[i]);
    }
    if(uf.groups() == 1){
	cout << uf.getSize(0)-1 << endl;
    }else{
	int sum = 0;
	set<int> visited;
	for(int i = 0 ; i < N ; i++){
	    int f = uf.find(i);
	    if(!visited.count(f)){
		visited.insert(f);
		sum += uf.getSize(i)-1;
	    }
	}
	cout << sum+(uf.groups()-1)*2+1-wall << endl;
    }
    return 0;
}

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

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    int ans=-1;
    for(int i=1;i<=50000;i++){
        if(i*108/100==N) ans=i;
    }
    if(ans==-1) cout<<":("<<endl;
    else cout<<ans<<endl;
}


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

int main(void){
  int N,M,X,Y;cin>>N>>M>>X>>Y;
  vector<int> x,y;
  x.resize(N);
  y.resize(M);
  for(int i = 0;i < N;i++)cin>>x[i];
  for(int t = 0;t < M;t++)cin>>y[t];

  bool bl = false;
  int jud1 = 0,jud2 = 0;
  for(int k = X + 1;k <= Y ;k++){
    jud1 = 0;
    jud2 = 0;

    for(int s = 0;s < N;s++){
      if(x[s] < k ){
        jud1++;
      }
    }
    if(jud1 != N)continue;

    for(int q = 0;q < M;q++){
      if(y[q] >= k){
        jud2++;
      }
    }
    if(jud2 != M)continue;
    if(jud1 == N && jud2 == M){
      bl = true;
    }
  }
  if(!bl)cout<<"War";
  else cout<<"No War";


}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
string s;
int main(){
    cin>>s;
    LL sum=0,ans=0;
    for(int i=0;i<s.length()-1;i++){
        if(s[i]=='A')
            sum++;
        else if(s[i]=='B'){
            if(s[i+1]=='C'){
                ans+=sum;
                i++;
            }else{
                sum=0;
            }
        }else{
            sum=0;
        }
    }

    cout<<ans;
    return 0;
}

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

int main()
{
    int N, M;
    cin >> N >> M;
    vector<string> Nmap(N);
    vector<string> Mmap(M);
    for(int i = 0; i < N ;i++)
    {
        string Nstr;
        cin >> Nstr;
        Nmap.at(i) = Nstr;
    }
    for(int i = 0; i < M ;i++)
    {
        string Mstr;
        cin >> Mstr;
        Mmap.at(i) = Mstr;
    }
    string answer = "No";
    bool matched = false;
    for(int i = 0; i <= N - M; i++){
        for(int j = 0; j <= N - M; j++){
            matched = true;
            for(int k = 0; k < M ; k++){
                for(int l = 0; l < M; l++){
                    if(Nmap.at(i + k)[j + l] != Mmap.at(k)[l]){
                        matched = false;
                        break;
                    }
                }
                if(!matched){
                    break;
                }
            }
            if(matched){
                answer ="Yes";
                break;
            }
        }
        if(matched){
            break;
        }
    }

    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	double a,b;
	scanf("%lf %lf",&a,&b);
	if(a>b)
	printf("GREATER");
	else if(a<b)
	printf("LESS");
	else if(a==b)
	printf("EQUAL");
	
	return 0;	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int x,int y){
    return y==0?x:gcd(y,x%y);
}
map<int,char> mt;
ll n,m;
string s,t;
int main(){
    ios::sync_with_stdio(false);
    cin>>n>>m>>s>>t;
    if(s[0]!=t[0]){
        cout<<-1<<endl;
    } else{
        if(gcd(n,m)==1){
            cout<<n*m<<endl;
        } else{
            ll ttt = gcd(n,m);
            bool flag = false;
            ll tmp = n*m/ttt;
            //for(;!flag&&tmp<=n*m;tmp+=max(n,m)) {
                for (ll i = 0; i < n; i++) {
                    mt[i*tmp / n + 1] = s[i];
                }
                bool flag2 = true;
                for (ll i = 0; i < m; i++) {
                    if (mt[i * tmp / m + 1] == 0)
                        continue;
                    else if (mt[i * tmp / m + 1] != t[i]) {
                        flag2 = false;
                        break;
                    }
                }
                if(flag2) {
                    flag = true;
                    //break;
                }
            //}
            if(flag){
                cout<<tmp<<endl;
            } else{
                cout<<-1<<endl;
            }
        }
    }
}



Measured memory_bytes: 7936
for a in iter(input,'0 0'):
 H,W=map(int,a.split())
 m=[input()for _ in[0]*H]
 y=x=0
 for _ in range(H*W):
  c=m[y][x]
  if'>'==c:x+=1;
  if'v'==c:y+=1;
  if'<'==c:x-=1;
  if'^'==c:y-=1;
  if'.'==c:print(x,y);break
 else:print('LOOP')


Measured memory_bytes: 5620
#include <bits/stdc++.h>
#define REP(i,n)   for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(long long i=(a);((a)<(b)?i<=(b):i>=(b));((a)<(b)?++i:--i))
#define ALL(v)     (v).begin(),(v).end()
#define debug(x)   cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

int main(){//Refering other editorials.
	int n,k;
	cin>>n>>k;
	
	vector<llong> num(k,0LL);//num[x]:=(1~n間でkで割ってx余る数の個数).
	FOR(i,1,n) num[i%k]++;
	
	llong ans=0LL;
	REP(a,k){
		int b=(k-a)%k;
		int c=(k-a)%k;
		
		if((b+c)%k==0) ans+=num[a]*num[b]*num[c];
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 4784
function main(input) {
	const args = input.split(' ').map((n) => parseInt(n, 10));
  	const N = args[0],
          A = args[1],
          B = args[2]

    let total = 0;
  	
  	for (let i = 1; i <= N; i++) {
    	sum = findSumOfDigits(i);
      	if (A <= sum && sum <= B) {
        	total += i
        }
    }
  
  	console.log(total);
}

function findSumOfDigits(n) {
  	sum = 0;
	while(n > 0) {
      sum += (n % 10);
      n = Math.floor(n / 10);
    }
  	return sum;
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 31768
q_num = int(input())
q_list = []

# 素数list
# エラトステネスの篩
max = 101000
p_list = [1] * max
for i in range(max):
    if i == 0 or i == 1: p_list[i] = 0
    if p_list[i] == 0: continue
    for j in range(i*2, max, i):
        p_list[j] = 0


# 2017-like数list
like_list = [0] * max
for i in range(max):
    if i % 2 == 0: continue
    if p_list[i] == 1 and p_list[int((i+1)/2)] == 1:
        like_list[i] = 1

# 累積和
# 区間のlike数の合計を更新
sum = [0] * (max+1)
for i in range(max):
    sum[i+1] = sum[i] + like_list[i]

for i in range(q_num):
    q_list.append(list(map(int, input().split())))

for item in q_list:
    l, r = item
    r += 1
    print(sum[r] - sum[l])


Measured memory_bytes: 34640
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main(){
	
	long long int H, W;
	
	cin >> H >> W;
	
	if(H % 3 == 0 || W % 3 == 0){
		cout << "0" << endl;
		return 0;
	}
	
	long long int ans = min(H, W);
	
	for(long long int i = 0; i < H; i++){
		long long int p1 = i * W;
		long long int p2 = (H - i) * (W / 2);
		long long int p3 = H * W - p1 - p2;
		long long int max_p = max(p1, max(p2, p3));
		long long int min_p = min(p1, min(p2, p3));
		ans = min(ans, max_p - min_p);
	}
	
	swap(H, W);
	
	for(long long int i = 0; i < H; i++){
		long long int p1 = i * W;
		long long int p2 = (H - i) * (W / 2);
		long long int p3 = H * W - p1 - p2;
		long long int max_p = max(p1, max(p2, p3));
		long long int min_p = min(p1, min(p2, p3));
		ans = min(ans, max_p - min_p);
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
 int N,K,A;
 int a =1;
 cin >> N >> K;
  for(int i; i<N ; i++){
    if(K+a<2*a){
      a += K;
    }else{
      a =2*a;
    }
  }
  cout << a << endl;
}

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

int main(){
    string s,t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.size(); i++){
        if (s[i] != t[i]){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3860
use strict;
use warnings;

chomp(my $n = <>);

my @s;
for (my $i = 0; $i < $n; $i++){
  chomp($s[$i] = <>);
}

my %ss;
for my $s (@s){
  $ss{$s}++;
}

my $max=0;

for my $key (keys %ss) {
  if ($ss{$key} > $max) {
    $max = $ss{$key};
  }
}

my @ss;

for my $key (keys %ss) {
  if ($ss{$key} == $max) {
    push @ss, $key;
  }
}

@ss = sort @ss;
for (@ss) {print "$_\n";}


Measured memory_bytes: 76772
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define ff first
#define ss second
#define sfi(a) scanf("%d",&a)
#define sfi2(a,b) scanf("%d %d",&a,&b)
#define sfi3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfll(a) scanf("%lld",&a)
#define inf 1e9
#define m_p make_pair
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define mem(x,val) memset(x,val,sizeof(x))
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)
#define FAST  ios_base::sync_with_stdio(0);cout.tie(0)
#define sqr(x) ((x)*(x))

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
const ll M = 1e9+7;
const int sz = 1000001;
int main()
{
    string str;
    cin >> str;
    if(str[2]==str[3] && str[4]==str[5]) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
//#pragma GCC target ("tune=native")
//#pragma GCC target ("avx")
//#include <bits/stdc++.h>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PPI;
typedef pair<ll,P> PIP;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
#define PQ(T) priority_queue<T,vector<T>,greater<T>>
#define PQ2(T) priority_queue<T>
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) ((x)=min((x),(y)))
#define chmax(x,y) ((x)=max((x),(y)))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
#define DEBUG(x) cerr<<"line ("<<__LINE__<<")  "<<#x<<": "<<x<<endl;
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);

bool go(vector<vector<int> > &g, int u, vector<int> &mt, vector<bool> &vs){
	int n = g.size();
	if(u<0) return true;
	for(int v = 0; v < n; v++){
		if(!g[u][v] || vs[v] || mt[v]!=-1) continue;
		vs[v] = true;
		mt[v] = u;
		return true;
	}
	for(int v = 0; v < n; v++){
		if(!g[u][v] || vs[v]) continue;
		vs[v] = true;
		if(go(g, mt[v], mt, vs)){
			mt[v] = u;
			return true;
		}
	}
	return false;
}

// g (subset of K_{n,n}) is adjacency matrix (g[left vertex][right vertex])
int bm(vector<vector<int> > &g){
	int n = g.size();
	vector<int> mt(n, -1);
	int res = 0;
	for(int i = 0; i < n; i++){
		vector<bool> vs(n);
		if(go(g, i, mt, vs)) res++;
	}
	return res;
}

int main(){
	ll n;
	cin>>n;
	vector<P> x(n), y(n);
	rep(i, n) cin>>x[i].fst>>x[i].snd;
	rep(i, n) cin>>y[i].fst>>y[i].snd;
	vector<vector<int>> g(n, vector<int>(n, 0));
	rep(i, n) rep(j, n){
		if(x[i].fst<y[j].fst&&x[i].snd<y[j].snd) g[i][j] = 1;
	}
	cout<<bm(g)<<endl;
	return 0;
}


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

int cal_happy(char* s){
    int cal = 0, l = strlen(s);
    for (int i = 0; i < l;i++){
        if (s[i + 1] == s[i])
            cal++;    
    }
    return cal;
}
int min(int a, int b){
    if(a<b)
        return a;
    return b;
}
int main(){
    int n, k;
    cin >> n >> k;
    char s[100002] = {0};
    int cal = cal_happy(s);
    for (int i = 0; i < n; i++){
        cin >> s[i];
    }
    cout << min(strlen(s)-1, cal_happy(s) + 2 * k);
    // if (s == "RLR" || "LRL" || "RL" || "LR" || "R" || "L"){
    //     cout << 0;
    //     return 0;
    // }
    // int once = 0;
    // if (s[strlen(s) - 3] != s[strlen(s) - 2] && s[strlen(s) - 2] != s[strlen(s) - 1])
        // int repeathead;
        // int repeattime = 0;
        // for (int i = 1; i < n && k > 0;){
        //     if (s[i] == s[i - 1]){
        //         repeathead = i - 1;
        //         while (++i < n && s[i - 1] == s[i]);
        //         if (repeathead == 0)
        //             repeattime++;
        //         else
        //             cal += 2, k--;
        //     }
        //     else {
        //         while (++i < n && s[i - 1] == s[i]);
        //     }
        // }
        // for (int i = 1; i < n && k > 0; i++){
        //     bool flag = false;
        //     if (s[i - 1] == s[i])
        //         continue;
        //     else if(!flag){

        //     } else {

        //     }
        // }
        return 0;
}

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

int d[333];
int cnt;

void push(int n){
  d[cnt] = n;
  cnt++;
}

int pop(){
  int key = d[cnt-1];
  cnt--;
  return key;
}

int main(){

  char str[333];
  while(scanf("%s",str) != EOF){
    int a, b;
    if(str[0] == '*'){
      a = pop();
      b = pop();
      push(a*b);
    }else if(str[0] == '-'){
      a = pop();
      b = pop();
      // cout << a-b << endl;
      push(b-a);
    }else if(str[0] == '+'){
      a = pop();
      b = pop();
      push(a+b);
    }else if(str[0] == '/'){
      a = pop();
      b = pop();
      push(b/a);
    }else push(atoi(str));
  }

  cout << pop() << endl;

}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pii;
typedef pair<pii,pii> piiii;
typedef vector<pii> vii;
typedef vector<ll> vi;
typedef queue<ll> qi;
typedef queue<char> qc;
typedef queue<string> qs;
typedef vector<char> vc;
typedef vector<string> vs;
typedef map<char,ll> mpci;
typedef map<ll,ll> mpii;
typedef map<string,ll> mpsi;
typedef set<ll> sei;
typedef set<char> sec;
typedef set<string> ses;
typedef stack<ll> si;
typedef stack<char> sc;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pll> vpll;
typedef vector<pdd> vdd;
typedef unsigned int uint;
typedef long double ld;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vii> vvii;
/*=====================================================================*/
#define pb push_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define sz(a) (int)(a.size())
#define len(a) (int)(a.length())
#define all(s) (s).begin(),(s).end()
#define fi first
#define se second
#define be begin
#define en end
#define m_p make_pair
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define forn(i,p,n) for(int i=p;i<=n;i++)
#define ford(i,p,n) for(int i=n-1;i>=p;i--)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();++i)
#define zero(a) memset(a,0,sizeof(a))
#define number(a,num) memeset(a,num,sizeof(a))

/*=====================================================================*/

inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
inline void write(long long x) {
  static long long sta[35];
  long long top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[--top] + 48);
  puts("");
}
/*======================================================================*/
bool prime(int n)
{
	if(n==0||n==1)
	  return false;
	for(int i=2;i*i<=n;i++)
	  if(n%i==0)
	    return false;
	return true;
}
/*======================================================================*/
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
/*======================================================================*/
int main()
{
  /*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
  */
  /*====================================================================*/
  int n;
  cin>>n;
  string s;
  cin>>s;
  rep(i,s.size())
  {
  	s[i]=(char)(((s[i]+n)>'Z')?s[i]+n-26:s[i]+n);
  }
  cout<<s;
  return 0;
}


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

using namespace std;

void __print(int x) { cerr << x; }

void __print(long x) { cerr << x; }

void __print(long long x) { cerr << x; }

void __print(unsigned x) { cerr << x; }

void __print(unsigned long x) { cerr << x; }

void __print(unsigned long long x) { cerr << x; }

void __print(float x) { cerr << x; }

void __print(double x) { cerr << x; }

void __print(long double x) { cerr << x; }

void __print(char x) { cerr << '\'' << x << '\''; }

void __print(const char *x) { cerr << '\"' << x << '\"'; }

void __print(const string &x) { cerr << '\"' << x << '\"'; }

void __print(bool x) { cerr << (x ? "true" : "false"); }

template<typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}

template<typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i: x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}

void _print() { cerr << "]\n"; }

template<typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define int long long
#define INF 1e18
#define MOD 1e9+7
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

inline void solve() {
    int k;
    cin >> k;
    string str;
    cin >> str;
    int f = 0;
    while (str.length() > k) {
        f = 1;
        str.pop_back();
    }
    if (f != 1) {
        cout << str;
    } else {
        cout << str + "...";
    }
}

signed main() {
    IOS
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
N, Q = map(int, input().split())
data = input()
result = [0] * N
for i in range(N-1):
  if data[i] == "A" and data[i+1] == "C":
    result[i+1] = result[i] + 1
  else:
    result[i+1] = result[i]

for i in range(Q):
  l, r = map(int, input().split())
  print(result[r-1]-result[l-1])



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long

const unsigned int BIT_FLAG_0 = (1 << 0);  // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1);  // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2);  // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3);  // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4);  // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5);  // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6);  // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7);  // 0000 0000 1000 0000

const double PI = 3.14159265358979323846;

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

#define H_MAX 500
#define W_MAX 500
#define INF 1e9 + 7

int main() {
    int N, cnt = 0;
    cin >> N;
    string S;
    cin >> S;
    rep(i, S.size() - 2) {
        if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') {
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3616
N = int(input())
result = [0] * 4
for _ in range(N):
    S = input()
    if S == 'AC':
        result[0] += 1
    elif S == 'WA':
        result[1] += 1
    elif S == 'TLE':
        result[2] += 1
    elif S == 'RE':
        result[3] += 1
        
print('AC x {}'.format(result[0]))
print('WA x {}'.format(result[1]))
print('TLE x {}'.format(result[2]))
print('RE x {}'.format(result[3]))
        

Measured memory_bytes: 9200