akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

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

    int N, A, B, C, D;
    string S;
    cin >> N >> A >> B >> C >> D >> S;
    --A; --B; --C; --D;

    S += ".";

    rep(i, A, max(C, D)) {
        if (S[i-1] == '#' and S[i] == '#') {
            cout << "No" << endl;
            return 0;
        }
    }

    if (C > D) {
        bool okB = false;
        rep(bi, B, D+1) {
            if (S[bi-1] == '.' and S[bi] == '.' and S[bi+1] == '.')
                okB = true;
        }

        if (!okB) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    int r;
    cin >> r;
    cout << 3*pow(r,2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#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>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, cnt = 0, maxi = 0;
  cin >> n;
  REP(i,n) {
    char c;
    cin >> c;
    if(c == 'I') cnt++;
    if(c == 'D') cnt--;
    maxi = max(maxi,cnt);
  }
  cout << maxi << endl;
  return 0;
}
//templete by private_yusuke

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

int main() {
    int N, T;
    int c[1010];
    int t[1010];
    int ans = 99999;
    
    cin >> N >> T;
    
    for (int i = 0; i < N; i++) {
        cin >> c[i] >> t[i];
    }
    
    for (int i = 0; i < N; i++) {
        if (t[i] <= T) {
            ans = min(ans, c[i]);
        }
    }
    
    if (ans == 99999) {
        cout << "TLE" << endl;
    }
    else {
        cout << ans << endl;
    }
    
    return 0;
}

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

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

  ll N; cin >> N;
  ll P; cin >> P;
  ll ans = 1, PMAX = sqrt(P);
  for (ll i = 2; i <= PMAX; i++) {
    ll cnt = 0;
    while (P % i == 0) {
      cnt++;
      P /= i;
    }
    ans *= pow(i, (cnt / N));
  }
  if (P != 1 && N == 1) ans *= P;
  cout << ans << '\n';
  return 0;
}

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

int main(){
    int k;
    string s;
    cin >> k >> s;
    int ss = s.size();
    for(int i= 0; i< min(k, ss); i++) cout << s.at(i);
    if(ss > k) cout << "...";
    cout << "\n";
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

struct A {
  i64 s, t, x;
};

struct B {
  i64 si, ti, x;
};

i64 n, q;
vector<A> a;
vector<i64> d;

int main() {
  cin >> n >> q;
  init_n(a, n);

  for (i64 i = 0; i < n; ++i) {
    cin >> a[i].s >> a[i].t >> a[i].x;
  }
  sort(begin(a), end(a), [](A p, A q) {
    return p.x < q.x; 
  });
  read_n(d, q);

  vector<B> e;
  for (i64 i = 0; i < n; ++i) {
    i64 s = a[i].s, t = a[i].t, x = a[i].x;

    auto sit = lower_bound(begin(d), end(d), s - x);
    auto tit = lower_bound(begin(d), end(d), t - x);

    i64 si = sit - begin(d), ti = tit - begin(d);

//    cerr << si << '\t' << ti << '\t' << x << endl;

    e.push_back({si, ti, x });
  }

  vector<B> es = e, et = e;
  sort(begin(es), end(es), [](B p, B q) {
    return p.si < q.si;
  });
  sort(begin(et), end(et), [](B p, B q) {
    return p.ti < q.ti;
  });


  auto comp = [](const B& x, const B& y) {
    if (x.x == y.x) {
      if (x.si == y.si) return x.ti < y.ti;
      return x.si < y.si;
    }
    return x.x < y.x;
  };
  set<B, decltype(comp)> st(comp);
  vector<i64> f(q + 1, -1);
  for (i64 i = 0, sj = 0, tj = 0; i < q; ++i) {
    while (sj < n && es[sj].si == i) {
      st.insert(es[sj]);
      ++sj;
    }
    while (tj < n && et[tj].ti == i) {
      st.erase(et[tj]);
      ++tj;
    }
    /*
    cerr << i << '\t';
    for (auto&& b : st) cerr << b.x << ' ';
    cenrr << endl;
    */
    if (!st.empty()) f[i] = (*st.begin()).x;
  }

  for (i64 i = 0; i < q; ++i) cout << f[i] << '\n';
  return 0;
}


Measured memory_bytes: 36204
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
#include<random>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

const int MAXN = 30;
int x[MAXN], y[MAXN], r[MAXN], c[MAXN];
bool ok[MAXN];
char dp[1<<24];

int square(int x) {return x*x;}

// i, j ???????????£?????????????????????
// ????????£????????? true
bool check(int i, int j) {
    int d2 = square(x[i]-x[j]) + square(y[i]-y[j]);
    return d2 < square(r[i]+r[j]);
}

char dfs(int state, int n) {
    char& ret = dp[state];
    if (ret >= 0) return ret;
    ret = 0;
    // ???????????¨??????????????§??????????????????????????????
    vector<int> already;
    memset(ok, true, sizeof(ok));
    for (int i = 0; i < n; i++) {
        if ((state>>i)&1) continue;
        if (ok[i]) {
            already.push_back(i);
        }
        for (int j = i+1; j < n; j++) {
            if (check(i, j)) ok[j] = false;
        }
    }
    int sz = already.size();
    for (int i = 0; i < sz; i++) {
        for (int j = i+1; j < sz; j++) {
            int ai = already[i], aj = already[j];
            if (c[ai] == c[aj]) {
                int nstate = state;
                nstate |= 1<<ai;
                nstate |= 1<<aj;
                ret = max<char>(2+dfs(nstate, n), ret);
            }
        }
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while (cin >> n) {
        if (n==0) break;
        for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> r[i] >> c[i];
        memset(dp, -1, sizeof(dp));
        cout << (int)dfs(0, n) << endl;
    }
    return 0;
}

Measured memory_bytes: 19484
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define endl "\n"
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0)
#define go_t int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define trace2(x, y)         cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)      cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)   cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const ll inf = 1000000000000000000;
const int N = 300000 , mod = 1000000007;
double eps = 1e-9;
vector<ll>primes;
void primefactors(ll n)
{
    for(int i=2;i<=sqrt(n);i+=1)
    {
        if((n%i)==0)
        {
            while((n%i)==0)
            {
                primes.push_back(i);
                n/=i;
            }
        }
    }
    if(n>1)
    primes.push_back(n);
}
int solve(int n)
{
    int cur = 1;
    int ans = 0;
    while(100)
    {
        n = n - cur;
        if(n>=0)
            ans++;
        else break;
        cur+=1;
    }
    return ans;
}
int main()
{
    fastio;
    ll n;
    cin>>n;
    primefactors(n);
    sort(all(primes));
    map<ll,int>mp;
    for(auto it : primes)mp[it]++;
    int ans = 0;
    for(auto it : mp)
    {
        ans+=solve(it.se);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3660
n, k = gets.split.map(&:to_i)
r, s, p = gets.split.map(&:to_i)
t = gets.chomp.chars
for i in k..n-1
  if t[i - k] == t[i]
    t[i] = 'n'
  end
end
point = 0
point += r * t.count('s')
point += s * t.count('p')
point += p * t.count('r')
puts point


Measured memory_bytes: 8700
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	string s; cin >> s;
    int n = (int)s.size();
    stack<char> st;
    rep(i, n) {
        if(st.size() && st.top() == 'S' && s[i] == 'T') {
            st.pop();
        } else {
            st.push(s[i]);
        }
    }
    cout << (int)st.size() << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 720
N, M = map(int, input().split())
A,B = [],[]
for i in range(M):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
for i in range(1,N+1):
    ans = 0
    ans += A.count(i) + B.count(i)
    print(ans)


Measured memory_bytes: 2940
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for __ in range(M)]
BC.sort(key=lambda x: x[1],reverse=True)

l=[]
for b,c in BC:
    if len(l)+b>N:
        l.extend(list([c]*b))
        break
    else:
        l.extend(list([c]*b))
A.extend(l)
A.sort(reverse=True)
print(sum(A[:N]))


Measured memory_bytes: 89624
#include <iostream>
#include <vector>
#include <cstring>

#define HMAX 102
#define WMAX 102
#define MAX_V HMAX*WMAX
#define INF (int)1e9

using namespace std;


struct edge{int to,cap,rev;};
vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from,int to,int cap){
	G[from].push_back((edge){to,cap,(int)G[to].size()});
	G[to].push_back((edge){from,0,(int)G[from].size()-1});
}

int dfs(int v, int t,int f){
	if(v == t) return f;
	used[v] = true;
	for (int i = 0; i < G[v].size(); ++i)
	{
		edge &e = G[v][i];
		if(!used[e.to] && e.cap > 0){
			int d = dfs(e.to,t,min(f,e.cap));
			if(d > 0){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				// cout << v << " ";
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s, int t){
	int flow = 0;
	for(;;){
		memset(used,0,sizeof(used));
		int f = dfs(s,t,INF);
		if(f == 0) return flow;
		flow += f;
		// cout << endl;
	}
}
int main(){
	int H,W,B[HMAX][WMAX] = {},s_i,s_j,t_i,t_j;
	char A[HMAX][WMAX];
	cin >> H >> W;
	int num = 2;
	for (int i = 0; i < H; ++i)
	{
		for (int j = 0; j < W; ++j)
		{
			cin >> A[i][j];
			if(A[i][j] == 'o'){
				B[i][j] = num;
				num++;
			}else if(A[i][j] == 'S'){
				s_i = i;
				s_j = j;
			}else if(A[i][j] == 'T'){
				t_i = i;
				t_j = j;
			}
		}
	}
	B[s_i][s_j] = 1;
	B[t_i][t_j] = num;
	if(s_i == t_i || s_j == t_j){
		cout << -1 << endl;
		return 0;
	}
	for (int i = 0; i < H; ++i)
	{
		for (int j = 0; j < W; ++j)
		{
			if(A[i][j] == '.') continue;
			if(A[i][j] == 'o'){
				add_edge(i+1,H+j+1,1);
				add_edge(H+j+1,i+1,1);
			}else if(A[i][j] == 'S'){
				add_edge(0,i+1,INF);
				add_edge(0,H+j+1,INF);
			}else if(A[i][j] == 'T'){
				add_edge(i+1,H+W+1,INF);
				add_edge(H+j+1,H+W+1,INF);
			}
		}
	}
	int ans = max_flow(0,H+W+1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1152
import sys

def display(inp):
    s = len(inp)
    for i in range(s):
        if i!=len(inp)-1:
            print("%d" % inp[i], end=" ")
        else:
            print("%d" % inp[i], end="")
    print("")

line = sys.stdin.readline()
size = int(line)
line = sys.stdin.readline()
inp = []
for i in line.split(" "):
    inp.append(int(i))

display(inp)

for i in range(1,size):
    if inp[i]!=size:
        check = inp.pop(i)
        for j in range(i):
            if check<inp[j]:
                inp.insert(j,check)
                break
            if j==i-1:
                inp.insert(j+1,check)
                break
    display(inp)

Measured memory_bytes: 8164
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int a1, a2, z1, z2;
    int ans;
    a1=s.length();
    z1=0;
    for(int i=0; i<s.length(); ++i){
        if(s[i]=='A'){
            a1 = min(a1, i); 
        }else if(s[i]=='Z'){
            z1 = max(i, z1);
        }
    }
    cout << (z1-a1+1) << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define de(c) cout << #c << " = " << c << endl
#define dd(c) cout << #c << " = " << c << " "
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int maxn = 1e5 + 100;

int n;
ll h[maxn];

int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	rep(i,0,n)
	{
		cin >> h[i];
	}
	int f = 0;
	h[n-1]++;
	per(i,0,n-1)
	{
		if(h[i] == h[i+1])
		{
			continue;
		}
		else if(h[i] < h[i+1])
		{
			h[i]++;
		}
		else
		{
			f = 1;
			break;
		}
	}
	if(f)
	{
		cout << "No"<<endl;
	}
	else
	{
		cout <<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int n = fs.nextInt();
        final int t = fs.nextInt();
        final int a = fs.nextInt();
        double closestDist = 1e9;
        int res = -1;
        for (int i = 0; i < n; i++) {
            final double curr = t - (fs.nextInt() * 0.006);
            if (Math.abs(curr - a) < closestDist) {
                closestDist = Math.abs(curr - a);
                res = i + 1;
            }
        }
        System.out.println(res);
    }

    static final class Utils {
        public static void shuffleSort(int[] arr) {
            shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffleSort(long[] arr) {
            shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffle(int[] arr) {
            final Random r = new Random();

            for (int i = 0; i <= arr.length - 2; i++) {
                final int j = i + r.nextInt(arr.length - i);
                swap(arr, i, j);
            }
        }

        public static void shuffle(long[] arr) {
            final Random r = new Random();

            for (int i = 0; i <= arr.length - 2; i++) {
                final int j = i + r.nextInt(arr.length - i);
                swap(arr, i, j);
            }
        }

        public static void swap(int[] arr, int i, int j) {
            final int t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        public static void swap(long[] arr, int i, int j) {
            final long t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        private Utils() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int[] nextIntArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}


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


int main(void){
    int n,m,s[10],c[10];
    cin>>n>>m;
    for(int i=0;i<m;i++) cin>>s[i]>>c[i];
    bool ans=true;
    for(int i=0;i<m;i++){
        if(s[i]==1&&c[i]==0) ans=false;
    }
    for(int i=0;i<m-1;i++){
        for(int j=i+1;j<m;j++){
            if((s[i]==s[j])&&(c[i]!=c[j])) ans=false;
        }
    }
    bool all0=true;
    for(int i=0;i<m;i++){
        if(c[i]!=0) all0=false;
    }
    if(n==1&&all0){
        cout<<0;
        return 0;
    }
    if(ans==false){
        cout<<-1;
        return 0;
    }
    int z[4]={};
    z[1]=1;
    for(int i=0;i<m;i++){
        z[s[i]]=c[i];
    }
    if(n==1) cout<<z[1];
    else if(n==2) cout<<z[1]*10+z[2];
    else if(n==3) cout<<z[1]*100+z[2]*10+z[3];
}

Measured memory_bytes: 256
// {{{
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define ALL(x) begin(x),end(x)
#define SZ(x) ((int)x.size())
#define FOR(i,n) for(int i=0;i<n;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
using LL=long long;
using PII=pair<int,int>;
using VI=vector<int>;

#ifdef FEI
template<typename T>
void _dump(const char* s, T&& head) { cerr<<s<<"="<<head<<endl; }
template<typename T, typename... Args>
void _dump(const char* s, T&& head, Args&&... tail) {
    int c=0;
    while (*s!=',' || c!=0) {
        if (*s=='(' || *s=='[' || *s=='{') c++;
        if (*s==')' || *s==']' || *s=='}') c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1, tail...);
}

#define dump(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, ##__VA_ARGS__); \
} while(0);

template<typename Iter>
ostream& _out(ostream &s, Iter b, Iter e) {
    s<<'[';
    for (auto it=b; it!=e; it++) s<<(it==b?"":",")<<*it;
    s<<']';
    return s;
}

template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A,B> &p) { return s<<"("<<p.first<<","<<p.second<<")";}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &x) { return _out(s,ALL(x)); }
template<typename T, size_t N>
ostream& operator <<(ostream &s, const array<T,N> &x) { return _out(s,ALL(x)); }
template<typename T>
ostream& operator <<(ostream &s, const set<T> &x) { return _out(s,ALL(x)); }
template<typename A, typename B>
ostream& operator <<(ostream &s, const map<A,B> &x) { return _out(s,ALL(x)); }
#else
#define dump(...)
#endif

template<typename T>
void _R(T &x) { cin>>x; }
void _R(int &x) { scanf("%d",&x); }
void _R(LL &x) { scanf("%" PRId64,&x); }
void _R(double &x) { scanf("%lf",&x); }
void _R(char &x) { scanf(" %c",&x); }
void _R(char *x) { scanf("%s",x); }

void R(){}
template<typename T, typename... X>
void R(T& head, X&... tail) { _R(head); R(tail...); }
// }}}

int main() {
    LL n, m;
    R(n, m);
    if (n<m) swap(n, m);
    if (n-m>=2) puts("Alice");
    else puts("Brown");


    return 0;
}


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

vector<pair<ll, ll> > prime_factorize(ll N) {
    vector<pair<ll, ll> > res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0; // 指数
        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        // その結果を push
        res.push_back({a, ex});
    }
    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}
/* vector<pair<ll,ll>>で受け取る！
例えば360=2^3*3^2*5は
{{2,3},{3,2},{5,1}}*/

int main() {
    ll n;
    cin >> n;
    
    vector<pair<ll,ll>> a;
    a=prime_factorize(n);
    ll ans=0;
    for(int i = 0; i < a.size(); i++) {
        int x=a.at(i).second;
        for(int j = 1; j < 41; j++) {
            if(x-j>=0) {
                x -= j;
                ans++;
            }
        }
    }

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

Measured memory_bytes: 3584
import com.sun.org.apache.bcel.internal.generic.ARRAYLENGTH;

import java.util.*;


public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> a = new ArrayList<Integer>(n);
        ArrayList<Integer> b = new ArrayList<Integer>(n);

        for(int i = 0; i < n; i++){
            a.add(sc.nextInt());
        }
        for(int i = 0; i < n; i++){
            b.add(sc.nextInt());
        }

        int max = 0;
        for(int i = 0; i < n; i++){
            int count = 0;
            for(int j = 0; j <= i; j++){
                count += a.get(j);
            }
            for(int j = i; j < n; j++){
                count += b.get(j);
            }
            if(count > max){
                max = count;
            }
        }

        System.out.println(max);
    }
}


Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>

using ll = long long;
using namespace std;
constexpr ll inf = 1e15;

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

    int N, Y;
    cin>>N>>Y;

    for (int x = 0; x <= N; x++) {
        for (int y = 0; y <= N - x; y++) {
            if (10000*x + 5000*y + 1000*(N-x-y) == Y) {
                cout<<x<<" "<<y<<" "<<N-x-y<<endl;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1"<<endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np

N, *AB = map(int, open(0).read().split())
min_med = np.median([a for a in AB[::2]])
max_med = np.median([b for b in AB[1::2]])
if N % 2:
    print(int(max_med - min_med) + 1)
else:
    print(int(max_med * 2 - min_med * 2) + 1)


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

int main() {
    int n, a[100000];
    bool visited[100000] = {true, }, okay = false;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] -= 1;
    }
    int c = 0;
    int now = a[0];
    while (!visited[now]) {
        visited[now] = true;
        ++c;
        if (now == 1) {
            okay = true;
            break;
        }
        now = a[now];
    }
    if (okay) cout << c << '\n';
    else cout << -1 << '\n';
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <string.h>


using namespace std;


int main()
{
  char a[10], b[10], c[10];

  cin >> a >> b >> c;

  if (a[strlen(a)-1] == b[0] && b[strlen(b)-1] == c[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

int main(){
  float d,t,s;
  cin>>d>>t>>s;
  if(d/s<=t)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, Q;
	cin >> N >> Q;
	string S;
	cin >> S;
	vector<char> T(Q);
	vector<int> D(Q);
	char c;
	for (int i = 0; i < Q; i++) {
		cin >> T[i] >> c;
		if (c == 'L') {
			D[i] = 0;
		}
		else {
			D[i] = 1;
		}
	}
	
	int l = 0;
	int r = N + 1;

	for (int i = Q - 1; i >= 0; i--) {
		if (D[i] == 0) {
			if (S[l + 1 - 1] == T[i]) {
				l++;
			}

			if (r <= N) {
				if (S[r - 1] == T[i]) {
					r++;
				}
			}
		}
		else {
			if (S[r - 1 - 1] == T[i]) {
				r--;
			}
			if (l >= 1) {
				if (S[l - 1] == T[i]) {
					l--;
				}
			}
		}
		if (l >= r)break;

	}
	//cerr << l << " " << r << endl;
	int res = N - l - (N + 1 - r);
	res = max((int)0, res);

	cout << res << endl;
}

Measured memory_bytes: 2384
N, K = [int(i) for i in input().split(" ")]
sum = 0.0

def fank(n, k, i):
  kaku = 1 / n
  while k > i:
    i = i * 2
    kaku = kaku * 0.5
  return(kaku)

for i in range(N):
  sum += fank(N, K, i + 1)

print(sum)

Measured memory_bytes: 2940
x=int(input())
List=[]
counter=0
for i in range(x):
  List.append(list(map(int,input().split())))
for i in range(len(List)):
  if List[i][0]==List[i][1]:
    counter+=1
  else:
    counter=0
  if counter ==3:
    print("Yes")
    break
if counter<3:
  print("No")

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
ll dx[4]={1,-1,0,0};
ll dy[4] = {0, 0, 1, -1};
void solve() {
    ll h, w;
    cin >> h >> w;
    char grid[h][w];
    for (ll i = 0; i < h; i++){
        for (ll j = 0; j < w; j++){
        cin >> grid[i][j];
        }
    }
    for (ll i = 0; i < h;i++){
        for (ll j = 0;j<w;j++){
            if(grid[i][j]=='#'){
                bool flag = false;
                for (ll t = 0; t < 4; t++){
                    ll nx=j+dx[t];
                    ll ny=i+dy[t];
                    if (nx >= w or nx < 0 or ny >= h or ny < 0) continue;
                    if (grid[ny][nx] == '#') flag = true;
                }
                if(!flag){
                    cout << "No" << endl;
                    return;
                }
            }
        }
    }
    cout << "Yes" << endl;
}
int main()
{
    solve();
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<double> a(N);
  for(int i=0;i<N;i++)cin>>a.at(i);
  sort(a.begin(),a.end());
  double ans=a.at(0);
  for(int i=0;i<N-1;i++){
    ans+=a.at(i+1);
    ans/=2;
  }
  cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )
#define SORT(x) sort(x.begin(), x.end())

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define pb push_back
#define pu push
#define mp make_pair
#define fi first
#define sc second

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

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


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

    int N; cin >> N;
    vi v(N);
    int sum = 0;
    rep(i, N) {
        cin >> v[i];
        sum += v[i];
    }
    int ans = 0;
    if(sum % 10) {
        COUT(sum);
        return 0;
    }
    SORT(v);
    rep(i, N) {
        if(v[i] % 10) {
            ans = sum - v[i];
            break;
        }
    }
    COUT(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,x,sum;
bitset<2000005>f;
int main()
{
    scanf("%d",&n);
    f[0]=1;
    for(int i=1;i<=n;i++)
	{
        scanf("%d",&x);
        f|=f<<x;
        sum+=x;
    }
    for(int i=(sum+1)/2;i<=sum;i++)
        if(f[i]){cout<<i;return 0;}
}

Measured memory_bytes: 1024
n=int(input())
a,b,c = map(int,input().split())
d={'a':a,'b':b,'c':c}#初期化
for i in range(n-1):
    a,b,c = map(int,input().split())
    da,db,dc=d['a'],d['b'],d['c']
    d['a'] = a +max(db,dc)
    d['b'] = b +max(da,dc)
    d['c'] = c +max(da,db)
print(max(d.values()))

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

int main(){
    long long N; cin >> N;
    vector<int> T(N), A(N);
    for (int i=0; i<N; i++){
        cin >> T.at(i) >> A.at(i);
    }
    long long base, t, a;
    for (int i=0; i<N; i++){
        if (i==0){
            base=1;
        } else {
            base=max((T.at(i-1)*base+T.at(i)-1)/T.at(i), (A.at(i-1)*base+A.at(i)-1)/A.at(i));//整数A/Bの切り上げは以下のように行う。”(A+B-1)/B”
        }
        t=T.at(i)*base;
        a=A.at(i)*base;
    }
    cout << t+a << endl;
    return 0;
}

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

using namespace std;

#define N 100000
#define MAX 10

char aux[MAX + 2];
unordered_map<string, long long> freq;

int main(){
	long long ans;
	string str;
	int n, i;

	scanf("%d", &n);

	for (i = 1; i <= n; i++){
		scanf(" %s", aux);
		str = string(aux);
		sort(str.begin(), str.end());
		freq[str]++;
	}

	ans = 0;

	for (auto it : freq){
		ans += (it.second * (it.second - 1)) / 2;
	}

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

	return 0;
}

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

inline void azhe(){
    cout<<"No\n";
    exit(0);
}

inline bool get_diff(const int &x,set<pair<int,int>> &t,pair<int,int> &p){
    if(t.empty())return false;
    if(t.rbegin()->second==x){
        if(t.size()<2)return false;
        t.erase(p=*----t.end());
        return true;
    }
    t.erase(p=*--t.end());
    return true;
}

inline void solve(const vector<int> &a,vector<int> &b){
    const int n=a.size();
    map<int,int> occa,occb;
    for(int i=0;i<n;i++){
        occa[a[i]]++;
        occb[b[i]]++;
    }
    set<pair<int,int>> num;
    for(pair<const int,int> &p:occb){
        num.insert(make_pair(occa[p.first]+p.second,p.first));
        if(occa[p.first]+p.second>n)azhe();
    }
    for(int i=0;i<n;i++){cerr<<i<<endl;
        pair<int,int> p;
        if(!get_diff(a[i],num,p))azhe();
        b[i]=p.second;
        occa[a[i]]--;
        occb[p.second]--;
        p.first--;
        if(occb[p.second]==0){
            occb.erase(p.second);
        }else{
            num.insert(p);
        }
        if(occb.find(a[i])!=occb.end()){
            num.erase(make_pair(occa[a[i]]+1+occb[a[i]],a[i]));
            num.insert(make_pair(occa[a[i]]+occb[a[i]],a[i]));
        }
    }
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    vector<int> a(n),b(n);
    for(int &x:a)cin>>x;
    for(int &x:b)cin>>x;
    solve(a,b);
    cout<<"Yes\n";
    for(int &x:b)cout<<x<<' ';
    cout<<'\n';

    return 0;
}

Measured memory_bytes: 32856
#import sys
#input = sys.stdin.readline
import random
import bisect
#from statistics import mean, median, variance, stdev

#template input

def IT(): #整数1個
    return int(input())
def IL(): #整数複数
    return [int(_) for _ in input().split()]
def IS(): #文字列複数
    return [_ for _ in input().split()]
def ILS(n): #整数1つ　縦にズラーってなってるやつ
    return [int(input()) for _ in range(n)]
def SLS(n): #文字列　縦にズラーってなってるやつ
    return [input() for _ in range(n)]
def ILSS(n): #整数複数　縦にズラーってなってるやつ
    return [[int(_) for _ in input().split()] for j in range(n)]

#template technique
def bit_full_search(ss):
    n = len(ss)
    for i in range(1 << n):
        s = ""
        for j in range(n + 1):
            if ((1 & i >> j) == 1):
                s += ss[j]
        print(s)
def bit_full_search2(A):
    #https://blog.rossywhite.com/2018/08/06/bit-search/
    value = []
    for i in range(1 << len(A)):
        output = []

        for j in range(len(A)):
            if ((i >> j) & 1) == 1:
                #output.append(A[j])
                output.append(A[j])
        value.append([format(i, 'b').zfill(16), sum(output)])

    value.sort(key=lambda x:x[1])
    bin = [value[k][0] for k in range(len(value))]
    val = [value[k][1] for k in range(len(value))]
    return bin, val
def matching_bisect(list1_val, list2_val, n):
    #2分探索
    j = 0
    for i in range(len(list1_val)):
        j = bisect.bisect_left(list2_val, n - list1_val[i])
        if j < len(list2_val):
            if list1_val[i] + list2_val[j] == n:
                #ans = list2_bin[j] + list1_bin[i]
                break
    return j

"""ここからメインコード"""

def main():

    a,b,c = IL()

    print(min(int(b/a), c))







main()


Measured memory_bytes: 5224
#include <bits/stdc++.h>
using namespace std;
int main(){
  int M1, D1, M2, D2;
  cin >> M1 >> D1 >> M2 >> D2;
  if(M1 != M2){
    cout << 1 << endl;
  }
  else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
int count_c = 0;
bool check = false;
string str; cin >> str;
if (str[0] == 'A'){

    for(int i = 2; i < str.length() - 1;i++){
        if (str[i] == 'C') count_c++;
    }

    for(int i = 0; i < str.length(); i++){
        if(str[i] != 'A' and str[i] != 'C' and isupper(str[i])) check = true;


    }




    if (count_c == 1 and !check) cout << "AC";
    else cout << "WA";






}


else cout << "WA";



}

Measured memory_bytes: 256
n,m = map(int,input().split())
hei = list(map(int,input().split()))
bestT = [True for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    if(hei[a-1] == hei[b-1]):
        bestT[a-1] = False
        bestT[b-1] = False
        continue
    if(hei[a-1] > hei[b-1]):
        bestT[b-1] = False
    else:
        bestT[a-1] = False

ans = sum(bestT)
print(ans)

Measured memory_bytes: 20116
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 1e6 + 10 ;
const ll INF = 1e18 + 10 ;
int main(){
    fastio
    ll n ; 
    cin >> n ; 
    vector<ll> v(n) ; 
    vector<ll> sum(n + 1) ; 
    for(int i = 0; i < n; i++){
        cin >> v[i] ; 
        sum[i + 1] = sum[i] + v[i] ; 
    }
    ll L = 1, R = n ; 
    ll ans = -1 ;
    while(L <= R){
        ll mid = L + (R - L) / 2; 
        if ( sum[mid] == sum[n] - sum[mid] ){
            return cout << 0 << endl, 0;
        }
        if ( sum[mid] > sum[n] - sum[mid] ){
            ans = mid ; 
            R = mid - 1;
        }
        else L = mid + 1 ;
    }
    ll first = sum[ans] ; 
    ll second = sum[n] - sum[ans] ; 
    ll x = sum[ans - 1] ; 
    ll y = sum[n] - sum[ans - 1] ; 
    cout << min(first - second, y - x) << endl;
    return 0 ; 
}

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

int main(void) {
  int N;
  cin >> N;
  vector<vector<int>> A(2, vector<int>(N));
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < N; j++) {
      cin >> A[i][j];
    }
  }

  vector<vector<int>> sum(2, vector<int>(N, INT_MAX));
  sum[0][0] = A[0][0];
  sum[1][0] = A[0][0] + A[1][0];
  for (int i = 1; i < N; i++) {
    sum[0][i] = A[0][i] + sum[0][i - 1];
  }
  for (int j = 1; j < N; j++) {
    sum[1][j] = max(sum[0][j], sum[1][j - 1]) + A[1][j];
  }
  cout << sum[1][N - 1] << endl;

  return 0;
}

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

using namespace std;

int main(){
	
	int sum, d;
	
	while(true){
		
		cin >> sum;
		
		if(sum == 0){
			break;
		}
		for(int i = 0; i < 9; i++){
			cin >> d;
			sum -= d;
		}
		printf("%d\n", sum);
	}
	
	return 0;
}

Measured memory_bytes: 1144
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//
        int N;
        cin >> N;

        vector<int> mp(N);
        for (int i = 0; i < N; i++)
        {
                cin >> mp[i];
        }
        sort(mp.begin(), mp.end());
        int ans = 0;
        for (int i = 0; i < N; i++)
        {
                if (i == N - 1)
                {
                        ans += mp[i] / 2;
                }
                else
                {

                        ans += mp[i];
                }
        }
        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,n) for(int i=1; i<=(n); i++)

int main() {
    long long w,h,x,y;
    cin>>w>>h>>x>>y;
    if(w*h<100000000000){
        double w1=w,h1=h;
        long double ans=w1*h1/2;
        cout<<setprecision(15)<<ans<<endl;
        if(x*2==w&&y*2==h)cout<<'1';
        else cout<<'0';

    }
    else{
        long long ans=w*h/2;
        cout<<ans<<endl;
        if(x*2==w&&y*2==h)cout<<'1';
        else cout<<'0';
    }
    return 0;
}



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

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

    int cnt = 0;
    for (int i = 1; i <= N; i += 2) {
        int divisors = 0;
        for (int k = 1; k <= i; k++) {
            if (i % k == 0) divisors++;
        }
        if (divisors == 8) cnt++;
    }
    cout << cnt << endl;
}

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

using namespace std;
int a[15], f;
void dfs(int x, int y, int step)
{
    if( step == 11)
{
     f = 1;
     return;
}    if(x < a[step]) dfs(a[step], y, step+1);
    else if(y < a[step]) dfs(x, a[step], step+1);
  else
    return ;
}
int main ()
{
    int t;
    scanf("%d", &t);
    while(t--)
    {
        int i;
        f = 0;
        for(i = 1;i <= 10;i++)
            scanf("%d", &a[i]);
            dfs(0, 0, 1);
        if(f)
            printf("YES\n");
        else
            printf("NO\n");
    }
}

Measured memory_bytes: 1168
import sys
input=sys.stdin.readline

A,B=map(int,input().split())

ans=0
for i in range(1,10):
	for k in range(10):
		for j in range(10):
			bun=i*10000+k*1000+j*100+k*10+i
			if A<=bun<=B:
				ans+=1

print(ans)

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

int main()
{
	int n, k,count =0;
	cin >> n >> k;
	vector<int> d(n);
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}

	for (int i = 0; i < n; i++) {
		if (k <= d[i])
			count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 640
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  long N;
  cin >> N;

  vector<long> nums(N+1, 0);
  for (size_t n = 1; n <= N; ++n) cin >> nums[n];
  vector<uint8_t> check(N, 0);
  vector<long> res;
  res.reserve(N);
  for (size_t n = N; n > 0; --n) {
    long sum = 0;
    for (size_t i = 2 * n; i <= N; i += n) {
      if (check[i]) ++sum;
    }
    if ((sum & 1) ^ nums[n] == 1) {
      check[n] = 1;
      res.push_back(n);
    }
  }
  if (res.size() == 0) cout << 0 << endl;
  else {
    cout << res.size() << endl;
    auto it = res.crbegin();
    cout << *it++;
    for (auto end = res.crend(); it != end; ++it) {
      cout << " " << *it;
    }
    cout << endl;
  }
  return 0;
}


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

typedef long long ll;
int MAX_NODE = 300;

int main()
{
    // 整数の入力
    int N;
    cin >> N;
    int A[MAX_NODE][MAX_NODE];
    for (int i=0;i<N;i++){
        for (int j=0;j<N;j++){
            cin>>A[i][j];
        }
    }

    ll total = 0;
    bool isValid = true;
    for (int i =0;i<N; i++){
        for (int j = i + 1;j<N;j++){
            bool needed = true;
            for (int k = 0; k<N;k++){
                if (k != i && k!=j){
                    if (A[i][j] > A[i][k] + A[k][j]){
                        isValid = false;
                    }
                    else if (A[i][j] == A[i][k] + A[k][j]){
                        needed = false;
                    }
                }
            }
            if (needed){
                total += A[i][j];
            }

        }

    }

    if (isValid){
        cout<<total<<endl;
    } else {
        cout<<-1<<endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
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;
}
void print() { cout << "\n"; }
template <class T> void print(const T &x) { cout << x << "\n"; }
template <class T, class... Args> void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
template <class T> void printVector(const vector<T> &v) {
    for(const T &x : v) {
        cout << x << " ";
    }
    cout << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X, Y;
    cin >> X >> Y;
    bool f1 = Y - 2 * X >= 0 && (Y - 2 * X) % 2 == 0;
    bool f2 = 4 * X - Y >= 0 && (4 * X - Y) % 2 == 0;
    print(f1 && f2 ? "Yes" : "No");
}

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

using namespace std;

map<int, int> score;

int main(){
  int n, ans = 0;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
    if(score.count(a[i]) == 0){
      score[a[i]] = 0;
    }
    score[a[i]]++;
  }
  for(int i = 0; i< n; i++){
    ans = max(ans, score[a[i] - 1] + score[a[i]] + score[a[i] + 1]);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 5120
from collections import deque

n, qt = map(int, input().strip().split())
q = deque()
for i in range(n):
    name, time = input().strip().split()
    q.append((name, int(time)))

t = 0
while q:
    name, time = q.popleft()
    if time <= qt:
        t += time
        print(name, t)
    else:
        t += qt
        time -= qt
        q.append((name, time))

Measured memory_bytes: 14888