akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

int main() {
  int res[4] = {};
  while (true) {
    string tmp;
    if (not getline(cin, tmp, ','))
      break;
    getline(cin, tmp);

    if (tmp == "A")
      ++res[0];
    else if (tmp == "B")
      ++res[1];
    else if (tmp == "AB")
      ++res[2];
    else
      ++res[3];
  }

  for (auto &v : res)
    cout << v << endl;
}


Measured memory_bytes: 3092
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

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

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

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

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

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

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

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

    size_t N; cin >> N;

    vector<pair<intmax_t, intmax_t>> vec(N);
    for (size_t i = 0; i < N; ++i) {
        intmax_t x, y; cin >> x >> y;
        vec[i] = {x, y};
    }

    sort(vec.begin(), vec.end());

    double res = 0, cnt = 0;
    do {
        for (size_t i = 0; i < N - 1; ++i) {
            double x1, y1, x2, y2;
            tie(x1, y1) = vec[i];
            tie(x2, y2) = vec[i + 1];
            res += hypot(x1 - x2, y1 - y2);
        }
        cnt++;
    } while (next_permutation(vec.begin(), vec.end()));

    cout << fixed << setprecision(12);
    cout << res / cnt << "\n";

    return 0;
}


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

int main()
{
    int N;
    std::cin>>N;
    std::vector<int> A(N);
    std::vector<int> ans(N); 
    for(int i=0;i<N;i++)std::cin>>A[i];

    for(int i=0;i<N;i++){
        ans[A[i]-1] = i;
    }
    for(int i=0;i<N;i++){
    std::cout<<ans[i]+1<<" ";
    }
    std::cout<<std::endl;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  int s[n+1],t[m+1];
  for(int i = 1;i <= n;i++) cin >> s[i];
  for(int i = 1;i <= m;i++) cin >> t[i];
  long dp[n+1][m+1],sum[n+1][m+1];
  long inf = 1000000007;
  for(int i = 0;i <= n;i++) for(int j = 0;j <= m;j++) dp[i][j] = sum[i][j] = 0;
  for(int i = 0;i <= n;i++) sum[i][0] = 0;
  for(int i = 0;i <= m;i++) sum[0][i] = 0;
  for(int i = 1;i <= n;i++){
    for(int j = 1;j <= m;j++){
      if(s[i] == t[j]) dp[i][j] = (sum[i-1][j-1] + 1)%inf;
      else dp[i][j] = 0;
      sum[i][j] = (sum[i][j-1] + sum[i-1][j] + dp[i][j] - sum[i-1][j-1])%inf+inf;
      sum[i][j] %= inf;
    }
  }
  cout << sum[n][m]+1 << endl;
}

Measured memory_bytes: 62848
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	int n,cnt=0;
	vector<int> v[5];
	vector<int> vv;
	cin>>n;
	for(int i=2;i<=10000;i++)
	{
		cnt=0;
		for(int j=1;j<=i;j++)
		{
			if(i%j==0) cnt++;
		}
		if(cnt==2) vv.push_back(i);
	}
	for(int i=0;i<vv.size();i++)
	{
		for(int j=0;j<5;j++)
		{
			if(vv[i]%5==j) v[j].push_back(vv[i]);
		}
	}
	for(int i=0;i<5;i++)
	{
		if(v[i].size()>=n)
		{
			for(int j=0;j<n;j++)
			{
				cout<<v[i][j]<<" ";
			}
			return 0;
		}
		else continue;
	}
	//system("pause");
	return 0;
}

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

int ans=0;
int N,M,Q; 
vector<int> a,b,c,d;

void solve(int now,vector<int> vec){
	if(now==0){
		int tmp=0;
		for(int i=0;i<Q;i++){
			if(vec[b[i]-1]-vec[a[i]-1]==c[i])tmp+=d[i];
		}
		ans=max(tmp,ans);
	}
	else{
		int top=vec[vec.size()-1];
		for(int i=top;i<=M;i++){
			vec.push_back(i);
			solve(now-1,vec);
			vec.erase(vec.end()-1);
		}
	}
}

signed main(){
	cin>>N>>M>>Q;
	a.assign(Q,0);
	b.assign(Q,0);
	c.assign(Q,0);
	d.assign(Q,0);
	for(int i=0;i<Q;i++)cin>>a[i]>>b[i]>>c[i]>>d[i];
	vector<int> vec;
	for(int i=1;i<=M;i++){
		vec.push_back(i);
		solve(N-1,vec);
		vec.erase(vec.end()-1);
	}
	cout<<ans<<endl;
	
}

Measured memory_bytes: 3636
while(True) :
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=='+' :
        print("{}".format(a+b))
    elif op=='-' :
        print("{}".format(a-b))
    elif op=='*' :
        print("{}".format(a*b))
    elif op=='/' :
        print("{}".format(int(a/b)))
    else :
        break


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX/2;

template<class T> struct QueueAggregation {
    using F = function<T(T, T)>;
private :
    struct node {
        T val, sum;
        node (const T &v, const T &s) : val(v), sum(s) { }
    };
    F op;
    stack<node> front_stack, back_stack;
public :
    QueueAggregation (const F &op) : op(op), front_stack(), back_stack() { }

    bool empty() const { return front_stack.empty() && back_stack.empty(); }

    size_t size() const { return front_stack.size() + back_stack.size(); }

    T fold_all() const {
        assert(!empty());
        if (front_stack.empty()) {
            return back_stack.top().sum;
        } else if (back_stack.empty()) {
            return front_stack.top().sum;
        } else {
            return op(front_stack.top().sum, back_stack.top().sum);
        }
    }

    void push(const T &x) {
        if (back_stack.empty()) {
            back_stack.emplace(x, x);
        } else {
            T s{op(back_stack.top().sum, x)};
            back_stack.emplace(x, s);
        }
    }

    void pop() {
        assert(!empty());
        if (front_stack.empty()) {
            front_stack.emplace(back_stack.top().val, back_stack.top().val);
            back_stack.pop();
            while (!back_stack.empty()) {
                T s{op(back_stack.top().val, front_stack.top().sum)};
                front_stack.emplace(back_stack.top().val, s);
                back_stack.pop();
            }
        }
        front_stack.pop();
    }

};

int main() {
    int n, m;
    string s;
    cin >> n >> m >> s;
    
    struct node { int step, idx; };
    auto f = [](const node& l, const node& r) { return l.step < r.step ? l : r; };
    QueueAggregation<node> swag(f);
    swag.push({0, n});
    vector<int> next(n+1);
    int ans, p = 0;
    
    for (int i = n-1; i >= 0; i--) {
        if (swag.size() > m) swag.pop();
        const node t = swag.fold_all();
        next[i] = t.idx;
        if (i == 0) ans = t.step + 1;
        if (s[i] == '0') swag.push({t.step + 1, i});
        else swag.push({INF, i});
    }
    
    if (ans >= INF) { cout << -1 << "\n"; return 0; }
    while (p != n) {
        cout << next[p] - p << " ";
        p = next[p];
    }
    return 0;
}

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

int main() {
    int N; cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; ++i) cin >> H[i];
    
    int res = 0;
    int current_max = 0;
    for (int i = 0; i < N; ++i) {
        // i 番目が、i-1 番目以前の最大値以上だったらカウント
        if (H[i] >= current_max) ++res;

        // これまでの最大値を新たに更新する
        if (current_max < H[i]) current_max = H[i];
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

using pii = pair<int, int>;

int number(string s, int &i) {
    int res = 0;
    while (isdigit(s[i])) {
        res = 10 * res + (s[i] - '0');
        ++i;
    }
    return res;
}

void dfs(string s, int &i, int lev, int idx, map<pii, int> &num) {
    if (s[i] == ')') return;
    ++i;
    dfs(s, i, lev + 1, 2 * idx, num);
    ++i;
    ++i;
    num[pii(lev, idx)] = number(s, i);
    ++i;
    ++i;
    dfs(s, i, lev + 1, 2 * idx + 1, num);
    ++i;
}

string dfs2(int lev, int idx, map<pii, int> &num) {
    if (!num.count(pii(lev, idx))) return "";
    return "(" + dfs2(lev + 1, 2 * idx, num) + ")[" + to_string(num[pii(lev, idx)]) + "](" + dfs2(lev + 1, 2 * idx + 1, num) + ")";
}

void _main() {
    string A, B;
    cin >> A >> B;
    map<pii, int> numA, numB, numC;
    int i = 0;
    dfs(A, i, 0, 0, numA);
    i = 0;
    dfs(B, i, 0, 0, numB);
    for (auto p : numA) if (numB.count(p.first)) {
        numC[p.first] = numA[p.first] + numB[p.first];
    }
    cout << dfs2(0, 0, numC) << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}


Measured memory_bytes: 3508
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import product, combinations,permutations
from copy import deepcopy
import sys
sys.setrecursionlimit(4100000)



if __name__ == '__main__':
    N = int(input())
    S = input()

    mid = N // 2

    if S[:mid] == S[mid:]:
        print("Yes")
    else:
        print("No")

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

using namespace std;

long long int n,s;

long long int base(long long int x,long long int b)
{
    long long int res=0;
    while(x>0)
    {
        res+=x%b;
        x/=b;
    }
    return res;
}



long long int res=1e18;

int main()
{
   cin>>n>>s;
   for(int i=2;i<=1e6;i++)
   {
       long long int cnt=base(n,i);
       if(cnt==s)
       {
           cout<<i<<endl; return 0;
       }
   }
   if(n==s)
   {
       res=min(res,s+1);
   }
   for(long long i=1;i<=1e6;i++)
   {
       long long int bck=s-i;
       if(bck<0) break;
       long long int t=n;
       t-=bck;
       t/=i;
       if(t<=1e6) continue;
       if(t>bck && t*i+bck==n)
       {
           res=min(res,t);
       }
   }
   if(res==1e18) cout<<-1;
   else cout<<res;
    return 0;
}


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

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> X(M);
    vector<int> margin(M);

    for(int i=0; i<M; i++){
        cin >> X[i];
    }
    sort(X.begin(), X.end());

    for(int i=0; i<M; i++){
        margin[i] = 0;
    }
    for(int i=0; i<M-1; i++){
        margin[i] = X[i+1] - X[i];
    }
    sort(margin.rbegin(), margin.rend());

    int length = X[M-1] - X[0];

    int m = min(M, N-1);
    for(int i=0; i<m; i++){
        length -= margin[i];
    }
    cout << length << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;

int main(){//予選決勝法、左と右の予選に分けてそれらの最大で決勝をする
	int n;cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	
	int l[n],r[n];
	l[0]=0;r[n-1]=0;

	for(int i=1;i<n;i++) l[i]=max(l[i-1],a[i-1]);//iより左にあるものの中のmax
	for(int i=n-2;i>=0;i--) r[i]=max(r[i+1],a[i+1]);//iより右にあるものの中のmax
	
	for(int i=0;i<n;i++) cout<<max(l[i],r[i])<<endl;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,sugar[3005],water[35],sugarx,waterx,ans1,ans2;
double mx=-1,ee;
int main()
{
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
	ee=((double)e*(double)100/(double)(100+e));
	//printf("%lf\n",ee);
	for(int i=0;i<=30/a;i++)
	{
		for(int j=0;j<=30/b;j++)
		{
			if(a*i+b*j<=30)
			{
				water[a*i+b*j]=1;
			}
		}
	}
	for(int i=0;i<=3000/c;i++)
	{
		for(int j=0;j<=3000/d;j++)
		{
			if(c*i+d*j<=3000)
			{
				sugar[c*i+d*j]=1;
			}
		}
	}
	for(int i=0;i<=30;i++)
	{
		for(int j=0;j<=3000;j++)
		{
			if(water[i]==1&&sugar[j]==1)
			{
				sugarx=j;
				waterx=100*i;
				if(sugarx+waterx<=f&&sugarx+waterx!=0)
				{            
					if((double)sugarx*(double)100/(double)(sugarx+waterx)>mx&&(double)sugarx*(double)100/(double)(sugarx+waterx)<=(double)ee)
					{              
						mx=(double)sugarx*(double)100/(double)(sugarx+waterx);
						ans1=sugarx+waterx;
						ans2=sugarx;
					}
				}
			}
		}
	}
	printf("%d %d\n",ans1,ans2);
}

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

int main()
{
    int N, K, l[55];
    cin >> N >> K;
    REP(i, N) cin >> l[i];
    sort(&l[0], &l[N], greater<int>());
    int ans = 0;
    REP(i, K) ans += l[i];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	for {
		var n, x int
		fmt.Scan(&n, &x)
		if n == 0 && x == 0 {
			break
		}

		ans := 0
		for a := 1; a < x-2; a++ {
			for b := 2; b < x-a; b++ {
				c := x - a - b
				if c >= 3 && max(a, b, c) <= n && a+b+c == x && a != b && b != c && c != a && a < b && b < c {
					ans++
				}
			}
		}
		fmt.Println(ans)

	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b, c int) int {
	if a >= b && a >= c {
		return a
	} else if b >= a && b >= c {
		return b
	}
	return c
}



Measured memory_bytes: 1124
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

#define MAXN 100
#define MAXK 100000

const ll p = 1000000007;

int main(){
  ll n,k; cin >> n >> k;
  ll dp[n+1][k+1];
  ll a[n];
  REP(i,n) cin >> a[i];
  REP(j,k+1){
    if(j==0) dp[0][j]=1;
    else dp[0][j]=0;
  }
  REP(i,n){
    ll sum = 0;
    REP(j,k+1){
      if(j<a[i]+1) sum += dp[i][j];
      else sum += dp[i][j]-dp[i][j-a[i]-1]+p;
      sum %= p;
      dp[i+1][j] = sum;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}


Measured memory_bytes: 79104
using System;
using System.IO;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(Solve());
        Console.Out.Flush();
    }

    static object Solve() {
        var input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int N = input[0], Y = input[1];
        for (int i = 0; i <= N; i++) {
            if (10000 * i > Y) break;
            if (10000 * i + 5000 * (N - i) < Y) continue;
            for (int j = 0; j <= N - i; j++) {
                if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y) return $"{i} {j} {N - i - j}";
            }
        }
        return "-1 -1 -1";
    }
}

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

int main(){
    int n;
    string s;
    cin>>n>>s;
    int ans=0;
    for(int i=1;i<n;i++){
        int sum=0;
        string s1,s2;
        s1=s.substr(0,i);
        s2=s.substr(i,n-i);
        vector<int>a1(26);
        vector<int>a2(26);
        for(int j=0;j<s1.length();j++){
            a1[s1[j]-'a']++;
        }
        for(int j=0;j<s2.length();j++){
            a2[s2[j]-'a']++;
        }
        for(int j=0;j<26;j++){
            if(a1[j]>0&&a2[j]>0)sum++;
        }
        ans=max(ans,sum);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int N,M,cur;
vpi adj[MX];
bitset<MX> visit, need[MX];
bool bad[MX];

void dfs(int x, int mx) {
    if (bad[cur]) return;
    if (visit[x]) { bad[cur] = 1; return; }
    visit[x] = 1;
    for (auto a: adj[x]) if (a.s < mx) dfs(a.f,a.s);
}

void test(int x) {
    cur = x;
    visit.reset(); 
    dfs(x,MOD);
    need[x] = visit;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> M;
    F0R(i,M) {
        int a,b; cin >> a >> b;
        adj[a].pb({b,i}), adj[b].pb({a,i});
    }
    FOR(i,1,N+1) test(i);
    int ans = 0;
    FOR(i,1,N+1) FOR(j,i+1,N+1) if (!bad[i] && !bad[j] && (need[i]&need[j]).count() == 0) ans ++;
    cout << ans;
    // for every y adjacent to x: y must be eaten
    // for every z adjacent to any y not equal to x: z must be eaten
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 11776
# -*- coding: utf-8 -*-

N,A,B,C,D = map(int, input().split())
S = list(input())

A -= 1
B -= 1
C -= 1
D -= 1
S[A] = 'a'
S[B] = 'b'

ans_D = False
ans_C = False

b = B
a = A

if C <= D:
    while True:
        if b == D:
            ans_D = True
            break
        else:
            if S[b+1] == '.':
                S[b] = '.'
                S[b+1] = 'b'
                b += 1
            else:
                if S[b+2] == '.':
                    S[b] = '.'
                    S[b+2] = 'b'
                    b += 2
                else:
                    break
    if ans_D:
        while True:
            if a == C:
                ans_C = True
                break
            else:
                if S[a+1] == '.':
                    S[a] = '.'
                    S[a+1] = 'a'
                    a += 1
                else:
                    if S[a+2] == '.':
                        S[a] = '.'
                        S[a+2] = 'a'
                        a += 2
                    else:
                        break
    if ans_C and ans_D:
        print('Yes')
    else:
        print('No')
else:
    swap_flag = False
    while b + 1 < N:
        if (S[b-1] == '.' and S[b+1] == '.') or (S[b-1] == 'a' and S[b+1] == '.'):
            swap_flag = True
            break
        else:
            if S[b+1] == '.':
                S[b] = '.'
                S[b+1] = 'b'
                b += 1
            else:
                if S[b+2] == '.':
                    S[b] = '.'
                    S[b+2] = 'b'
                    b += 2
                else:
                    break
    if swap_flag:
        while True:
            if a == C:
                ans_C = True
                break
            else:
                if S[a+1] == '.':
                    S[a] = '.'
                    S[a+1] = 'a'
                    a += 1
                else:
                    if S[a+2] == '.':
                        S[a] = '.'
                        S[a+2] = 'a'
                        a += 2
                    else:
                        break
        if ans_C:
            while True:
                if b == D:
                    ans_D = True
                    break
                else:
                    if S[b+1] == '.':
                        S[b] = '.'
                        S[b+1] = 'b'
                        b += 1
                    else:
                        if S[b+2] == '.':
                            S[b] = '.'
                            S[b+2] = 'b'
                            b += 2
                        else:
                            break
            if ans_C and ans_D:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')


Measured memory_bytes: 5052
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T, class U> inline void chmax(T &a, const U &b) { if ((a) < (b)) (a) = (b); }
template <class T, class U> inline void chmin(T &a, const U &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll a,b,c,d;cin>>a>>b>>c>>d;

    ll ans = -(1e18+5);

    chmax(ans, a*c);
    chmax(ans, a*d);
    chmax(ans, b*c);
    chmax(ans, b*d);
    cout << ans << endl;

    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 3628
#include <stdio.h>
#include <inttypes.h>

int N;
char map[114514];

uint64_t J[114514], I[114514];
uint64_t JO[114514], OI[114514];

uint64_t memo[114514][4];

uint64_t search(int idx, int status) {
	uint64_t answer = 0;
	if (idx > N) return status == 3;
	if (memo[idx][status]) return ~memo[idx][status];

	answer = search(idx + 1, status);
	if ((status == 0 && map[idx] == 'J') || (status == 1 && map[idx] == 'O') ||
	(status == 2 && map[idx] == 'I')) {
		answer += search(idx + 1, status + 1);
	}

	return ~(memo[idx][status] = ~answer);
}

int main(void) {
	uint64_t koremade;
	uint64_t max = 0;
	int i;
	if (scanf("%d", &N) != 1) return 1;
	if (scanf("%114512s", map + 1) != 1) return 1;
	koremade = search(1, 0);
	for (i = 1; i <= N; i++) {
		J[i] = J[i - 1] + (map[i] == 'J');
	}
	for (i = N; i >= 1; i--) {
		I[i] = I[i + 1] + (map[i] == 'I');
	}
	for (i = 1; i <= N; i++) {
		JO[i] = JO[i - 1];
		if (map[i] == 'O') JO[i] += J[i];
	}
	for (i = N; i >= 1; i--) {
		OI[i] = OI[i + 1];
		if (map[i] == 'O') OI[i] += I[i];
	}
	/* mise N no tugi ni dasu -> J ya O wo osetemo imi ga nai */
	max = JO[N];
	/* mise i no tugi ni dasu */
	for (i = 0; i < N; i++) {
		uint64_t candidate;
		/* J */
		candidate = OI[i + 1];
		if (candidate > max) max = candidate;
		/* O */
		candidate = J[i] * I[i + 1];
		if (candidate > max) max = candidate;
		/* I */
		candidate = JO[i];
		if (candidate > max) max = candidate;
	}
	printf("%" PRIu64 "\n", max + koremade);
	return 0;
}



Measured memory_bytes: 12900
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

ll dp[12][10]={};

signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll k;cin>>k;
  queue<ll> q;
  rep(i,1,10)q.push(i);

  ll now=0;
  rep(i,0,k){
    now=q.front();q.pop();
    if(now%10>0)q.push(10*now+(now%10)-1);
    q.push(10*now+(now%10));
    if(now%10<9)q.push(10*now+(now%10)+1);
  }
  cout<<now<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 1792
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	valueList := make([]int, n)
	for i := range valueList {
		fmt.Scan(&valueList[i])
	}
	costList := make([]int, n)
	for i := range costList {
		fmt.Scan(&costList[i])
	}

	total := 0
	for i := range valueList {
		if valueList[i] > costList[i] {
			total += valueList[i] - costList[i]
		}
	}

	fmt.Println(total)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int n,t,a;
  cin >> n >> t >> a;
  vi h(n,0);
  rep(i,n) cin >> h.at(i);

  int ans=0;
  double mn=100100100.0;
  rep(i,n) {
    double b = abs(a-t+h.at(i)*0.006);
    if(b<mn) {
      mn = b;
      ans=i+1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    ll N;
    cin >> N;
    vec<ll> A(N);
    for(int i=0;i<N;i++) cin >> A[i];
    ll sum = accumulate(A.begin(),A.end(),0LL);
    ll num = N*(N+1)/2;
    if(sum%num!=0){
        cout << "NO\n";
        return 0;
    }
    vec<ll> D(N);
    for(int i=0;i<N;i++){
        D[i] = A[(i+1)%N]-A[i];
    }
    if(accumulate(D.begin(),D.end(),0LL)!=0){
        cout << "NO\n";
        return 0;
    }
    ll n = sum/num;
    ll s = 0;
    for(int i=0;i<N;i++){
        if(n-D[i]<0){
            cout << "NO\n";
            return 0;
        }
        if((n-D[i])%N!=0){
            cout << "NO\n";
            return 0;
        }
        s += (n-D[i])/N;
    }
    cout << (s==n? "YES\n":"NO\n");
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[100005];
int ans[100005],n;
int check(){
	int flag=1,i;
	for(i=1;i<=n;i++){
		int l=i-1,r=i+1;
		if(l==0)l=n;
		if(r==n+1)r=1;
		if(ans[i]==1){
			if(s[i]=='o'&&ans[l]!=ans[r])return 0;
			if(s[i]=='x'&&ans[l]==ans[r])return 0;
		}
		else{
			if(s[i]=='o'&&ans[l]==ans[r])return 0;
			if(s[i]=='x'&&ans[l]!=ans[r])return 0;
		}
	}
	return 1;
}
void work(){
	for(int i=2;i<n;i++){
		if(ans[i]==1){
			if(s[i]=='o')ans[i+1]=ans[i-1];
			else ans[i+1]=(ans[i-1]==1?2:1);
		}
		else{
			if(s[i]=='o')ans[i+1]=(ans[i-1]==1?2:1);
			else ans[i+1]=ans[i-1];
		}
	}
}
int main(){
	int flag=0,i;
	scanf("%d",&n);
	scanf("%s",s+1);
	ans[1]=ans[2]=1;
	work();
	if(check()){
		for(i=1;i<=n;i++)printf("%c",ans[i]==1?'S':'W');
		printf("\n");
		return 0;
	}
	ans[1]=ans[2]=2;
	work();
	if(check()){
		for(i=1;i<=n;i++)printf("%c",ans[i]==1?'S':'W');
		printf("\n");
		return 0;
	}
	ans[1]=1;
	ans[2]=2;
	work();
	if(check()){
		for(i=1;i<=n;i++)printf("%c",ans[i]==1?'S':'W');
		printf("\n");
		return 0;
	}
	ans[2]=1;
	ans[1]=2;
	work();
	if(check()){
		for(i=1;i<=n;i++)printf("%c",ans[i]==1?'S':'W');
		printf("\n");
		return 0;
	}
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 768
import math

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

if not(A % 2) or not(B % 2) or not(C % 2):
	print(0)
	exit()

tl = [A, B, C]
tm = max(tl)
tl.remove(tm)
t2, t3 = tl

print(t2 * t3)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U> bool chmax(T &a, U b) { if (a <= b) {a = b; return 1;} return 0; }
template <class T, class U>  bool chmin(T &a, U b) { if (a > b) { a = b; return 1; } return 0; }
template <typename T>  ostream &operator<<(ostream &os, vector<T> &v) { os << "{"; rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); } os << "}"; return os; }

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)
    
int main() {
    ll x=0,y=0,z=0,k,n,m,h,w,ans=0,sum=0,Max=-1,Min=1e9+1;
    bool ok = true;
    string t;
    cin >> n;
    VL a(n),b(n),c(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n) cin >> c[i];
    sort(ALL(a)); sort(ALL(b)); sort(ALL(c));
    rep(i,n){
        x = lower_bound(ALL(a),b[i]) - a.begin(); 
        y = n - (upper_bound(ALL(c),b[i]) - c.begin());
        ans += x * y; 
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

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

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

bool was_output = false;
template<class t>
void output(t a){
  if(was_output)cout << " ";
  cout << a;
  was_output = true;
}
void outendl(){
  was_output = false;
  cout << endl;
}
ll in(){
  ll res;
  scanf("%lld", &res);
  return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
  for(auto &i:x)is >> i;
  return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
  is >> x.first >> x.second;
  return is;
}

template<class t>
void in(t&x){
  cin >> x;
}

template<class t>
void out(t x){
  cout << x;
}

template<class t>
vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
  sort(line.begin(),line.end(),comp);
  return line;
}

template<class t>
vector<t> reversed(vector<t> line){
  reverse(line.begin(),line.end());
  return line;
}

vector<int> ans;

void func2(vector<int> &line,int place,int &k){
  int n = line.size();
  if(n==place){
    --k;
    if(k==0){
      ans = line;
    }
    return;
  }
  rep(i,max(0,line[place-1]-1),min(10,line[place-1]+2)){
    line[place] = i;
    func2(line,place+1,k);
    if(ans.size())return;
  }
}

void func(int d,int &k){
  vector<int> line(d);
  rep(i,1,10){
    line[0] = i;
    func2(line,1,k);
    if(ans.size())return;
  }
}


int main(){
  int k = in();
  vector<int> line;
  rep(i,1,100000){
    func(i,k);
    if(ans.size())break;
  }
  foreach(i,ans)cout<<i;
  cout<<endl;

  return 0;
}


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

using namespace std;

bool s1, s2, s3, s4;

int main(){
    int n, ans = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        char tmp;
        cin >> tmp;
        if(tmp == 'P' and !s1){
            s1 = true;
            ans++;
            
        }
        if(tmp == 'W' and !s2){
            s2 = true;
            ans++;
        }
        if(tmp == 'G' and !s3){
            s3 = true;
            ans++;
        }
        if(tmp == 'Y' and !s4){
            s4 = true;
            ans++;
        }
    }
    if(ans == 3){
        cout << "Three";
    }
    else{
        cout << "Four";
    }
    return 0;
}

Measured memory_bytes: 3552
#include<cstdio>;
//入出力を行う関数が使える//(scanf,printf)
#include<cctype>;
//文字の種類の判定や文字の変換を行う関数を使うことができる//

int main(){
    char ch;
    
    while(true){
        scanf("%c",&ch);
        //文字（1文字）として入力する//
        if (isalpha(ch)){
            //chがアルファベットならtrueを返す//
            if(islower(ch)) printf("%c",toupper(ch));
            //chが小文字ならtrueを返す// //chの大文字を返す//
            else printf("%c", tolower(ch));
            //chの小文字を返す//
        } else printf("%c",ch);
        //アルファベット以外はそのまま出力//
        
        if (ch == '\n') break;
        //終端文字が現れたら終了//
    }
    return 0;
}


Measured memory_bytes: 2680
# Rectangular Searching

from collections import deque

while True:
    h, w = map(int, raw_input().split())
    if (h, w) == (0, 0):
        break

    g = []
    for i in range(h):
        g.append([1 if c == '.' else 0 for c in raw_input()] + [0])

    for i in range(1, h):
        for j in range(w):
            if g[i][j] != 0:
                g[i][j] = g[i - 1][j] + 1

    stack = deque()
    area = 0
    for i in range(h):
        for j in range(w + 1):
            curr = g[i][j]
            if len(stack) == 0:
                stack.append((j, curr))
            else:
                if stack[-1][1] < curr:
                    stack.append((j, curr))
                elif stack[-1][1] > curr:
                    idx = j
                    while len(stack) != 0 and stack[-1][1] >= curr:
                        prev = stack.pop()
                        idx = prev[0]
                        area = max(area, prev[1] * (j - idx))
                    stack.append((idx, curr))

    print area

Measured memory_bytes: 6388
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N;
    cin >> N;
    int s = sqrt(N);
    cout << s * s << endl;
    return 0;
}


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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c;

    if (a == 5 || a == 7) {
      if (b == 5 || b == 7) {
        if (c == 5 || c == 7) {
          int d = a * b * c;
          if (d == 175) {
            cout << "YES" << endl;
          }
          else cout << "NO" << endl;
        }
        else cout << "NO" << endl;
      }
      else cout << "NO" << endl;
    }
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
N = int(input())
H = [int(h) for h in input().split()]
H.reverse()

if N == 1:
    print("Yes")
else:
    is_clear = True
    for n in range(N-1):
        if H[n] >= H[n+1]:
            pass
        elif H[n+1] - H[n] == 1:
            H[n+1] -= 1
        else:
            is_clear = False
            break

    if is_clear:
        print("Yes")
    else:
        print("No")

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

string S;
int main() {

cin >> S;

    int A, B, C, D;
    int ans = 0;

    cin >> A >> B >> C >> D;
    cin >> S;

    A -= 1;
    B -= 1;
    C -= 1;
    D -= 1;
    
    if(C>D){
        auto two_rock = S.find("##", B);
        if(two_rock < D ){
            cout << "No" << endl;
            return 0;
        }else{
            string S_ = S;
            auto three_space = S.find("...", B-1);
            auto two_rock = S.find("##", A);
            if(three_space >= D){
                cout << "No" << endl;
                return 0;
            }else if(two_rock < C) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    else{
        auto two_rock = S.find("##",B);
        if(two_rock < D) {
            cout << "No" << endl;
            return 0;
        } else{
            auto two_rock = S.find("##", A);
            if(two_rock < C) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
using namespace std;
 
#define int                 long long int
#define ull                 unsigned int
#define ld                  long double
#define pb                  push_back
#define ff                  first
#define ss                  second
#define S(arr)              sort(arr.begin(),arr.end());
#define RS(arr)              sort(arr.rbegin(),arr.rend());
#define R(arr)              reverse(arr.begin(),arr.end());
#define si                  set <int>
#define vi                  vector <int>
#define vvi                 vector <vector <int>>
#define vs                  vector <string>
#define pii                 pair <int, int>
#define vpi                 vector <pii>
#define vpp                 vector <pair<int, pii>>
#define mii                 map <int, int>
#define mci                 map<char, int>
#define mpi                 map <pii, int>
#define spi                 set <pii>
#define speed               ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl                "\n"
#define all(p)              p.begin(), p.end()
#define T                   int tcf;cin>>tcf;while(tcf--)
#define que_max(t)             priority_queue <t>
#define que_min(t)             priority_queue <t, vector<t>, greater<t>>
#define debuga(a, l, r)     for(auto x:a)cout<<x<<" ";cout<<endl;
#define debug1(x)           cout << #x " = " << x << endl;
#define debug2(x,y)         cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x,y,z)       cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x,y,z,w)     cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;
#define debug5(x,y,z,w,v)   cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << " " << #v " = " << v << endl;
#define debug6(x,y,z,w,v,a) debug3(a, y, x)debug3(w, v, a)
#define p2d(v)          for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)              for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppi(v)  for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
 
 
void read(int n=10){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
    // #ifndef ONLINE_JUDGE
    //      freopen("input.txt",  "r",  stdin);
    //      freopen("output.txt", "w", stdout);
    // #endif
}
 
int M = 1e9 + 7;
int M1 = 998244353;
#define qqq 4000005
 
 
int32_t main(){
    read();
    char c;
    cin>>c;
    cout<<(char)(c+1);
}  

Measured memory_bytes: 256
#include<stdio.h>
#define NUM 10000
int main(){
   int n,m,i,s=0;
   scanf("%d %d",&n,&m);
   int A[NUM];
   for(i=0;i<m;i++){
      scanf("%d",&A[i]);
      s+=A[i];
   }
      if(s>n){
         printf("-1");
      }else{
         printf("%d",n-s);
      }
   
   return 0;
}

Measured memory_bytes: 1740
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long
#define INF 100000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

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

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


int N, M;
vector<ll> a;
vector<P> v;

int main () {
  cin >> N >> M;
  a.assign(N, 0);

  Rep(i, N) {
    cin >> a[i];
  }

  sort(All(a));

  Rep(i, M) {
    ll b, c;
    cin >> b >> c;

    v.emplace_back(c, b);
  }

  sort(All(v), [](P& x, P& y){ return x.first > y.first; });

  ll int n = v.size();
  int pos = 0;

  Rep(i, n) {
    ll num = v[i].first;
    ll times = v[i].second;

    bool flg = true;
    Rep(k, times) {
      if (a[pos] < num) {
        a[pos] = num;
        ++pos;
      } else {
        flg = false;
        break;
      }
    } 

    if (!flg) break;
  }

  //cout << "\n";

  ll int ans = 0;

  Rep(i, N) {
    ans += a[i];
  }

  cout << ans << "\n";
}

Measured memory_bytes: 3444
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int m,n;
  cin >> n >> m;
  int a[105][105] = {};
  int b[105] = {};
  int c[105] = {};
  for(int i = 0;i < n;i++){
    for(int j = 0;j < m;j++){
      cin >> a[i][j];
    }
  }
  for(int i = 0;i < m; i++){
    cin >> b[i];
  }

  /*
  for(int i = 0;i < n;i++){
    for(int j = 0;j < m;j++){
      cout << a[i][j];
    }
    cout << endl;
  }
  for(int i = 0;i < m; i++){
    cout << b[i] << endl;
  }
  */

  for(int i = 0;i < n;i++){
    for(int j = 0;j < m;j++){
      c[i] += a[i][j] * b[j];
    }
  }
  for(int i = 0;i < n;i++){
    cout << c[i] << endl;
  }

  return 0;
}



Measured memory_bytes: 3144
#include <stdio.h>

int main(void)
{
  int N, M, X, Y, xMax = -100, yMin = 100;
  scanf("%d%d%d%d", &N, &M, &X, &Y);
  for(int i = 0; i < N; i++){
    int x;
    scanf("%d", &x);
    if(xMax < x) xMax = x;
  }
  for(int i = 0; i < M; i++){
    int y;
    scanf("%d", &y);
    if(y < yMin) yMin = y;
  }
  printf("%s\n", xMax < yMin && X < yMin && xMax < Y ? "No War" : "War");
}


Measured memory_bytes: 128
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let a: usize = itr.next().unwrap().parse().unwrap();
    let b: usize = itr.next().unwrap().parse().unwrap();
    let _: usize = itr.next().unwrap().parse().unwrap();

    println!("{}", a * b / 2)
}


Measured memory_bytes: 2116
def ans():
  N = int(input())
  V = list(map(int,input().split()))
  even = [0]*100001
  odd = [0]*100001
  for v in V[1::2]:
    even[v] += 1
  for v in V[::2]:
    odd[v] += 1
  me = max(even)
  mo = max(odd)
  if(even.index(me) != odd.index(mo)):
    print(N - me - mo)
  else:
    even.sort()
    odd.sort()
    print(min(N-even[-1]-odd[-2], N-even[-2]-odd[-1]))
ans()

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

int main()
{
    int h,n,a;
    cin>>h>>n;
    while(n--)
    {
        cin>>a;
        h-=a;
    }
    if(h>0) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
int main(void)
{
	int n, q, a, com, b, e;
	cin >> n;
	vector<int> A;
	rep(i, n)
	{
		cin >> a;
		A.push_back(a);
	}
	cin >> q;
	rep(i, q)
	{
		cin >> com >> b >> e;
		if (com == 0)
		{
			cout << *min_element(A.begin() + b, A.begin() + e) << endl;
		}
		else
		{
			cout << *max_element(A.begin() + b, A.begin() + e) << endl;
		}
	}
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000009;
const double pi = acos(-1);

int main() {
    ll D,T,S; cin >> D >>T >> S;
    if(S*T >= D) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3632