akhauriyash/Code-Regression huggingface dataset:
N = int(input())

A = input()
B = input()
C = input()

ans = 0
for i in range(N):

    if A[i] == B[i] == C[i]:
        continue
    elif A[i] == B[i] or B[i] == C[i] or C[i] == A[i]:
        ans += 1
    else:
        ans += 2

print (ans)


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define NINTH_POWER_OF_TEN 1000000000
#define LL_INF (numeric_limits<long long>::max()/2)
#define int long long

typedef long long ll;
typedef pair<int, int> Pair;

// const int kMaxN;

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

signed main() {
  cin >> A >> B >> C;
  int a[3] = {A, B, C};
  sort(a, a+3);

  ans = a[2]*10 + a[1] + a[0];

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


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (R, G, B, N) = readLine()!!.split(' ').map { it.toInt() }
    var ans = 0
    for (r in 0..N) {
        for (g in 0..N - r) {
            val n = N - (r * R + g * G)
            if (n >= 0 && n % B == 0) {
                ans++
            }
        }
    }
    println(ans)
}


Measured memory_bytes: 38232
#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[5020];
long long f[5020];
int n;
bool cmp(const pair<int, int> &a, pair<int, int> &b) {
	return a.first + a.second < b.first + b.second;
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &a[i].first, &a[i].second);
	}
	sort(a, a + n, cmp);
	memset(f, 0x3f, sizeof f);
	f[0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j > 0; j--) {
			if (f[j - 1] <= a[i].first) {
				f[j] = min(f[j], f[j - 1] + a[i].second);
			}
		}
	}
	for (int i = n; i >= 0; i--) {
		if (f[i] < 1e18) {
			printf("%d\n", i);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<vector>
#include<cmath>
#include<complex>
using namespace std;
const double EPS = 1e-10;
typedef complex<double> P;

bool zero(double a) { return abs(a) <= EPS; }

int n, x[10], y[10], l[10];
P dir[10];
double r[10];

bool canClear(P p, int i1, int i2) {
  for (int i = 0; i < n; i++) if (i != i1 && i != i2 && EPS + r[i] < abs(p - dir[i])) return false;
  return true;
}

bool check(double h) {
  for (int i = 0; i < n; i++) {
    if (-EPS > ((double)l[i] - h)) return false;
    if (zero((double)l[i] - h)) r[i] = 0.0;
    r[i] = sqrt((double)l[i] * l[i] - h * h);
  }
  for (int i = 0; i < n; i++) if (canClear(dir[i], -1, -1)) return true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      double d = abs(dir[j] - dir[i]);
      if (d - r[i] - r[j] > EPS) return false;
      if (r[i] - r[j] - d > EPS) continue;
      if (r[j] - r[i] - d > EPS) continue;
      double A = atan2((dir[j] - dir[i]).imag(), (dir[j] - dir[i]).real());
      double S = acos((d*d + r[i]*r[i] - r[j]*r[j]) / (2 * d * r[i]));
      if (canClear(dir[i] + polar(r[i], A + S), i, j)) return true;
      if (canClear(dir[i] + polar(r[i], A - S), i, j)) return true;
    }
  }
  return false;
}

double getH() {
  double lb = 1.0, ub = 300.0;
  while (!zero(ub - lb)) {
    double ave = (lb + ub) / 2;
    if (check(ave)) lb = ave;
    else ub = ave;
  }
  return lb;
}

int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    for (int i = 0; i < n; i++) scanf("%d%d%d", &x[i], &y[i], &l[i]);
    for (int i = 0; i < n; i++) dir[i] = P(x[i], y[i]);
    if (n == 1) printf("%f\n", (double)l[0]);
    else printf("%f\n", getH());
  }
}



Measured memory_bytes: 3156
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;


int main(){
  string o, e;
  cin >> o >> e;
  rep(i, o.size()+e.size()){
    if (i%2) cout << e[i/2];
    else cout << o[i/2];
  } 
  cout << endl;
}


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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

string solve(int N, const vector<string>& xs)
{
    vector<int> cs;
    vector<ii> ds, es;

    int open = 0, close = 0;

    for (int i = 0; i < N; ++i)
    {
        int a = 0, b = 0;

        for (auto c : xs[i])
        {
            open += (c == '(' ? 1 : 0);
            close += (c == ')' ? 1 : 0);

            b += (c == '(' ? 1 : -1);

            if (b < 0)
            {
                a--;
                b = 0;
            }
        }

        if (a == 0)
            cs.push_back(i);
        else if (b + a > 0)
            ds.push_back(ii(-a, i));
        else
            es.push_back(ii(b, i));
    }

    if (open != close)
        return "No";

    sort(ds.begin(), ds.end());
    sort(es.begin(), es.end(), greater<ii>());

    int s = 0;

    for (auto i : cs)
    {
        for (auto c : xs[i])
        {
            s += (c == '(' ? 1 : -1);

            if (s < 0)
                return "No";
        }
    }

    for (auto p : ds)
    {
        auto i = p.second;

        for (auto c : xs[i])
        {
            s += (c == '(' ? 1 : -1);

            if (s < 0)
                return "No";
        }
    }

    for (auto p : es)
    {
        auto i = p.second;

        for (auto c : xs[i])
        {
            s += (c == '(' ? 1 : -1);

            if (s < 0)
                return "No";
        }
    }


    return "Yes";
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<string> xs(N);

    for (int i = 0; i < N; ++i)
        cin >> xs[i];

    auto ans = solve(N, xs);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 46224
from math import ceil
n,h=map(int,input().split())
A,B=[],[]
for _ in range(n):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
a=max(A)
B=sorted(list(filter(lambda x:x>a,B)),reverse=True)
ans=0
i=0
l=len(B)
while h>0 and i<l:
    h-=B[i]
    ans+=1
    i+=1
if h>0:
    ans+=ceil(h/a)
print(ans)

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

const ll M = 1000000007;

ll FAC[202];
void math_init(){
	FAC[0] = 1;
	rep1(i,200){
		FAC[i] = FAC[i-1]*i;
		FAC[i] %= M;
	}
}
ll modpow(ll x,ll k){
	if(k == 0)return 1;
	ll ret = modpow(x,k/2);
	ret *= ret; ret %= M;
	if(k%2 == 1){
		ret *= x;
		ret %= M;
	}
	return ret;
}

int main(){
	ll n,x;
	ll s[202];
	cin >> n >> x;
	rep1(i,n)cin >> s[i];
	sort(s+1,s+1+n);
	
	static ll ret = 0;
	static ll dp1[2][100010];
	static ll dp2[2][100010];
	static ll t = 0, t_ = 1;
	rep(i,100010){
		dp1[t][i] = i;
		dp2[t][i] = i;
	}
	rep1(i,n){
		rep(j,100010){
			dp1[t_][j] = dp2[t][j%s[i]];
		}
		rep(j,100010){
			dp2[t_][j] = dp2[t][j]*(i-1)+dp1[t_][j];
			dp2[t_][j] %= M;
		}
		swap(t,t_);
	}
	cout << dp2[t][x] << endl;
}

Measured memory_bytes: 3328
DBG = !true
n,m = gets.split.map{|z| z.to_i}
a = []
for i in 0...n
  a << gets.split.map{|z| z.to_i}
end
print a if DBG
like = Array.new(m+1, 0)
for i in 0...n
  for j in 1..a[i][0]
    like[a[i][j]] += 1
  end
end
print like if DBG
likeall = like.select{|z| z==n}
print likeall if DBG
puts "#{likeall.size}"


Measured memory_bytes: 1788
while True:
    n = int(input())
    if n == 0:
        break
    y = int(input())
    money = []
    for _ in range(n):
        a,b,c = map(int,input().split())
        if c == 1:
            money.append([1+b/100*y,a])
        else:
            money.append([(1+b/100)**y,a])
    money.sort(reverse = True)
    print(money[0][1])


Measured memory_bytes: 5692
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
#include<vector>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i32 n;
cin >> n;
vector<P> d(n);
rep(i,n)cin >> d[i].first >> d[i].second;
i32 cnt = 0;
i32 ans = 0;
bool flag = false;
rep(i,n){
    if(d[i].first  == d[i].second)flag = true;
    else flag = false;
    if(flag)cnt++;
    else cnt = 0;
    if(cnt >= 3)ans++;
}
cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3652
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a < b && b < c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 26264
#include <iostream>
using namespace std;
int main(){
  int h[2],m[2],k;
  cin>>h[0]>>m[0]>>h[1]>>m[1]>>k;
  h[0]=h[0]*60;h[1]=h[1]*60;
  h[0]+=m[0];h[1]+=m[1];
  cout << h[1]-h[0]-k<<endl;
}

Measured memory_bytes: 3632
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

main(){
	int n,m;cin>>n>>m;int a[n]={},b[n]={};
	b[0]=1;
	rep(i,n)a[i]=1;
	rep(i,m){
		int x,y;cin>>x>>y;x--;y--;
		a[y]++,a[x]--;
		if(b[x])b[y]=1;
		if(a[x]==0)b[x]=0;
	}
	
	int ans=0;rep(i,n)ans+=b[i];dans;
}




Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
using namespace std;
int n,ans,big,ansnum;
int a[100030];

int main()
{
  int i,j,t;
  scanf("%d",&n),ans=-1,big=-1;
  for(i=1;i<=n;i++) 
   {
    scanf("%d",&a[i]);
    if(a[i]>big) big=a[i],j=i;
   }
  for(i=1;i<=n;i++) 
   {
   	if(a[i]==big) continue;
    t=min(a[i],big-a[i]);
    if(t>ans) ans=t,ansnum=a[i];
   }
   printf("%d %d\n",big,ansnum);
}

Measured memory_bytes: 512
#include <vector>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <functional>

const int INF = 1001001000;
const int MOD = (int)1e9 + 7;

using ll = long long;

using namespace std;

typedef pair<int,int> P;

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

int main(){

  string s;

  cin >> s;
  s[3] = '8';
  cout <<  s <<  endl;


}


Measured memory_bytes: 256
N,M = list(map(int,input().split()))

O=[]
for i in range(N):
    O.append(list(map(int,input().split())))

O_sort = sorted(O,key=lambda x:x[0])

HON = 0
MON = 0

for i in range(N):
    if(O_sort[i][1] + HON < M):
        HON += O_sort[i][1]
        MON += O_sort[i][0] * O_sort[i][1]
    else:
        MON += (M-HON) * O_sort[i][0]
        break

print(MON)

Measured memory_bytes: 29792
// ABC_172_B

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

  int counter = 0;
  for(int i = 0; i < s.size(); ++i) {
    if(s[i] != t[i]) ++counter;
       else continue;
  }

  cout << counter << "\n";

  return 0;
}


Measured memory_bytes: 3884
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<functional>
#include<iostream>
using namespace std;
int main(void)
{
	int i,j,k;
	char sho[20],a[6],b[8],c[6];
	cin>>sho;
	for(i=0;i<5;i++) a[i]=sho[i];
	for(i=6;i<13;i++) b[i-6]=sho[i];
	for(i=14;i<19;i++) c[i-14]=sho[i];
	cout<<a<<" "<<b<<" "<<c<<endl;
	return 0;
}

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

int main(){
  int N,M,X;
  std::cin >> N >> M >> X;

  int go0 = 0;
  int goN = 0;
  for (int i=0;i<M;i++) {
    int A;
    std::cin >> A;
    if (A<X) {
      go0 += 1;
    }
    else {
      goN += 1;
    }
  }
  std::cout << std::min(go0,goN) << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  string S;
  cin >> S;
  set<string> s;
  int n = S.length();
  if (n == 1) {
    cout << "1\n";
    return 0;
  }
  if (n == 2) {
    if (S[0] == S[1]) {
      cout << "1\n";
    } else {
      cout << "2\n";
    }
    return 0;
  }

  int dp[n]{};
  // 1文字目
  dp[0] = 1;
  // 2文字目
  if (S[0] == S[1]) {
    dp[1] = 1; // aa -> a, a
  } else {
    dp[1] = 2; // ab -> a, b
  }
  // 3文字目
  if (S[0] != S[1] && S[1] != S[2]) {
      dp[2] = 3; // aba -> a, b, a
  } else {
      dp[2] = 2; // aab -> aa, b
  }
  for (int i = 3; i < n; i++) {
      if (S[i - 1] == S[i]) {
          dp[i] = dp[i - 3] + 2;
      } else {
          dp[i] = dp[i - 1] + 1;
      }
  }
  cout << dp[n - 1] << "\n";
  return 0;
}

Measured memory_bytes: 1284
import scala.io.{StdIn => in}
import scala.annotation.tailrec

object Main extends App {
  val Array(n, q) = in.readLine.split(" ").map(_.toInt)
  val s = in.readLine.toCharArray

  val op = Iterator.continually(in.readLine)
    .take(q)
    .map(_.split(" ").map(_.head.toInt))
    .toArray
  
  op.foreach(e => e(1) = if(e(1) == 'L') -1 else 1)

  def f(pos:Int):Int = {
    @tailrec
    def rec(cnt:Int, pos:Int):Int = {
      if(pos < 0 || n <= pos || cnt == q) pos match {
        case p if p < 0 => 0
        case p if 0 <= p && p < n => 1
        case p if n <= p => 2
      }
      else if(s(pos) == op(cnt)(0)) rec(cnt+1, pos + op(cnt)(1))
      else rec(cnt+1, pos)
    }
    rec(0,pos)
  }

  val left = binarySearch(n,0)
  val right = binarySearch(n,1)

  // println(left + " " + right)
  val ans = right - left
  println(ans)

  def binarySearch(num:Int, find:Int):Int = {
    var left = 0
    var right = num

    @tailrec
    def loop(left:Int, right:Int):Int = {
      if(right - left < 2) left
      else {
        val mid = (left + right) / 2
        if(f(mid) <= find) loop(mid,right)
        else loop(left, mid)
      }
    }
    loop(left, right)
  }
}

Measured memory_bytes: 59784
import java.util.*;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner sc = new Scanner (System.in);
		
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int [] d = new int [n];
		int i, j;
		int temp;
		int max = 0;
		int sum, calorie;
		
		for (i = 0; i < n; i++) {
			d[i] = sc.nextInt();
		}
		
		for (i = 0; i < n - 1; i++) {
			for (j = i + 1; j < n; j++) {
				if (d[i] < d[j]) {
					temp = d[i];
					d[i] = d[j];
					d[j] = temp;
				}
			}
		}
		
		for (i = 0; i < n; i++) {
			sum = 0;
			for (j = 0; j < i; j++) {
				sum += d[j];
				calorie = (c + sum) / (a + i * b);
				
				if (max < calorie) {
					max = calorie;
				}
			}
		}
		
		System.out.println(max);
		
	}

}

Measured memory_bytes: 18188
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  //A
  int h, w;
  int hh, ww;
  cin >> h >> w;
  cin >> hh >> ww;
  cout << (h - hh) * (w - ww) << endl;
  return 0;	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {

	int N, D, X;
	vector<int> A;
	cin >> N >> D >> X;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		A.push_back(tmp);
	}
	int sum = X;
	for (int i = 0; i < N; i++) {
		int tmp = 0, day;
		while (true) {
			day = A[i] * tmp + 1;
			if (day > D) break;
			tmp++;
		}
		sum += tmp;
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
//ALDS1_3_A_19140837_Ojima_Yukiya.cpp
//
//提出日 2020/07/08 wednesday
//
//プログラミング基礎演習2 CS 第9回課題 ALDS1_3_A
//
//学修番号 19140837　小島優希也

#include <iostream>
#include <vector>
#include <sstream>

using namespace std;

class my_stack {
private:
    int s[256];
    int top;
public:
    my_stack();
    void push(int value);
    int get_top();
    bool stack_empty();
    int pop();
};

my_stack::my_stack() {
    top = -1;
}

void my_stack::push(int value) {
    top++;
    s[top] = value;
}

int my_stack::get_top() {
    return top;
}

bool my_stack::stack_empty() {
    if (top == -1) {
        return true;
    }
    else {
        return false;
    }
}

int my_stack::pop() {
    if (stack_empty()) {
        return -1;

    }
    else {
        top--;
        return s[top + 1];
    }
}

int main(void) {
    vector<string> vec;
    string str;
    getline(cin, str);
    str += " END";

    stringstream ss;
    ss << str;

    string s;

    while (true) {
        ss >> s;
        if (s == "END") {
            break;
        }
        else {
            vec.push_back(s);
        }
    }

    my_stack ms;
    int a, b;

    for (string s : vec) {
        if (s == "+") {
            a = ms.pop();
            b = ms.pop();
            ms.push(b + a);
        }
        else if (s == "-") {
            a = ms.pop();
            b = ms.pop();
            ms.push(b - a);
        }
        else if (s == "*") {
            a = ms.pop();
            b = ms.pop();
            ms.push(b*a);
        }
        else {
            a = stoi(s);
            ms.push(a);
        }
    }

    cout << ms.pop() << endl;

    return 0;
}


Measured memory_bytes: 3228
#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt
#include <sstream>	//stringstream,getline
#include <cmath>	//ceil

using namespace std;

int main() {

	string S;
	cin >> S;

	if (isupper(S[0])) {
		cout << "A" << endl;
	}
	else {
		cout << "a" << endl;
	}

	return 0;

}

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

bool isAinB(vector<int>& a, vector<int>& b){
    if(b.empty()) return false;
    unsigned int look=0;
    for(unsigned int i=0; i<a.size(); i++){
        while(a[i]!=b[look]){
            look++;
            if(look>=b.size()){
                return false;
            }
        }
    }
    return true;
}
        

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        vector<vector<int> > info(n+1);
        for(int i=0; i<n+1; i++){
            int m;
            cin >> m;
            info[i].resize(m);
            for(int j=0; j<m; j++){
                cin >> info[i][j];
            }
            sort(info[i].begin(), info[i].end());
        }

        int susp=0;
        for(int i=0; i<n; i++){
            if(isAinB(info[n],info[i])){
                if(susp==0){
                    susp=i+1;
                }else{
                    susp=-1;
                    break;
                }
            }
        }
        
        if(susp==0) susp=-1;
        cout << susp << endl;
    }
    return 0;
}

Measured memory_bytes: 3152
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=100000000000000LL;

int main() {
	int n,a=1;
	cin>>n;
	while(1){
		if(a*2>n)break;
		a*=2;
	}
	cout<<a<<endl;
	return 0;
}


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

#include <algorithm>
#include <array>
#include <chrono>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

#define ll long long
#define ld long double
#define P pair<ll, ll>
#define FOR(i, n, m) for (ll i = n; i < (ll)m; i++)
#define FORr(i, m, n) for (ll i = n; i >= (ll)m; i--)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define sortAl(v) sort(v.begin(), v.end())
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())
#define cout(n) cout << fixed << setprecision(n)

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

  string S, T;
  cin >> S >> T;

  FOR(i, 0, T.size()) {
    if (S == T) {
      cout << "Yes" << endl;
      return 0;
    }
    S = S[S.size() - 1] + S;
    S.pop_back();
  }
  cout << "No" << endl;
  return 0;
}


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

namespace CSharpSample01
{
    

    class Program
    {


        static long Solve(int N, int[,] a)
        {
            long[,] dp = new long[N + 2, 3];

            for (int j = 0; j < 3; j++) dp[1, j] = 0;

            for(int i = 2; i <= N + 1; i++)
            {
                for(int j = 0; j < 3; j++)
                {
                    for(int k = 0; k < 3; k++)
                    {
                        if (j == k) continue;
                        dp[i, j] = Math.Max(dp[i, j], dp[i - 1, k] + a[i - 1, j]);
                    }
                }
            }

            long max = 0;

            for (int j = 0; j < 3; j++) max = Math.Max(max, dp[N + 1, j]);

            return max;
        }


        
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int[,] a = new int[N + 1, 3];
            
            for(int i = 1; i <= N; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                for(int j = 0; j < 3; j++)
                {
                    a[i, j] = int.Parse(input[j]);
                }
            }

            Console.WriteLine(Solve(N, a));
            
        }
    }
}

Measured memory_bytes: 18496
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int dp[3001][3001]={{}};
int main(){
	string X,Y;
	scan(X);scan(Y);
	rep1(x,X.size()){
		rep1(y,Y.size()){
			int v=dp[x-1][y-1]+(X[x-1]==Y[y-1]);
			if(dp[x-1][y]>v) v=dp[x-1][y];
			if(dp[x][y-1]>v) v=dp[x][y-1];
			dp[x][y]=v;
		}
	}
	int xnow=X.size(),ynow=Y.size();
	string ans="";
	while(dp[xnow][ynow]){
		if(dp[xnow][ynow]==dp[xnow][ynow-1]) ynow--;
		else if(dp[xnow][ynow]==dp[xnow-1][ynow]) xnow--;
		else{
			xnow--;
			ynow--;
			ans=X[xnow]+ans;
		}
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 35456
#include <iostream>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
// long long -> lint
using lint = long long;
// fast cin and cout from hitonanode-san's code
// w/o 71 ms -> w/ 18 ms (tested on ABC148-D with C++14(GCC 5.4.1))
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;


int main(){
    // input
    int H, W;
    cin >> H >> W;
    char maze[H*W];
    for( int hw=0; hw<H*W; hw++ ){
        cin >> maze[hw];
    }


    // calc
    int h, w;
    int ans = 0;
    for( int hw=0; hw<H*W; hw++ ){
        int sth = hw / W;
        int stw = hw % W;
        int max_dist = 0;
        
        // if not wall
        if( maze[hw]=='.' ){
            // exe BFS
            vector<int> dist(H*W, -1);
            queue<int> que;

            ////////////////////////////////////////////
            // init params
            dist[hw] = 0;
            que.push( hw );
            ////////////////////////////////////////////
            // start BFS
            while( !que.empty() ){
                // decode current index
                int v = que.front();
                que.pop();
                h = v / W;
                w = v % W;

                // for all index
                for ( int dhw = 0; dhw<4; dhw++ ){
                    int dh, dw;
                    if( dhw==0 ) { dh=-1; dw= 0; }
                    if( dhw==1 ) { dh= 1; dw= 0; }
                    if( dhw==2 ) { dh= 0; dw=-1; }
                    if( dhw==3 ) { dh= 0; dw= 1; }

                    // next index
                    int nh = h + dh;
                    int nw = w + dw;

                    // can we move to maze[nh][nw]?
                    int nv = nh*W + nw;
                    if( nh<0 ) continue;
                    if( nw<0 ) continue;
                    if( nh>=H ) continue;
                    if( nw>=W ) continue;
                    if( maze[nv] == '#' ) continue;
                    if (dist[nv] != -1) continue;

                    // if we have not reached maze[nh][nw]
                    dist[nv] = dist[v] + 1;
                    que.push(nv);
                }
            }
            ////////////////////////////////////////////
            for (int i = 0; i < H*W; i++){
                if( max_dist < dist[i] ) max_dist = dist[i];
            }
            ans = max( ans, max_dist );
        }
    }

    // out
    cout << ans << endl;
} 

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

namespace My_Math{
	#define N 100000

	int fac[N+100],invfac[N+100];

	int add(int x,int y) {return x+y>=maxd?x+y-maxd:x+y;}
	int dec(int x,int y) {return x<y?x-y+maxd:x-y;}
	int mul(int x,int y) {return 1ll*x*y%maxd;}
	ll qpow(ll x,int y)
	{
		ll ans=1;
		while (y)
		{
			if (y&1) ans=mul(ans,x);
			x=mul(x,x);y>>=1;
		}
		return ans;
	}
	int inv(int x) {return qpow(x,maxd-2);}

	int C(int n,int m)
	{
		if ((n<m) || (n<0) || (m<0)) return 0;
		return mul(mul(fac[n],invfac[m]),invfac[n-m]);
	}

	int math_init()
	{
		fac[0]=invfac[0]=1;
		rep(i,1,N) fac[i]=mul(fac[i-1],i);
		invfac[N]=inv(fac[N]);
		per(i,N-1,1) invfac[i]=mul(invfac[i+1],i+1);
	}
	#undef N
}
using namespace My_Math;
int k,q,n,m,x,d[5050];

int main()
{
	k=read();q=read();
	rep(i,0,k-1) d[i]=read();
	while (q--)
	{
		n=read();x=read();m=read();x%=m;
		ll sum=0;int cnt0=0;
		rep(i,0,k-1)
		{
			sum+=(d[i]%m);cnt0+=(d[i]%m==0);
		}
		int cnt=(n-1)/k;
		ll add=sum*cnt;cnt0*=cnt;
		rep(i,1,n-1-cnt*k) 
		{
			add+=(d[i-1]%m);cnt0+=(d[i-1]%m==0);
		}
		ll ans=n-1-cnt0;
		ans-=(add+x)/m-x/m;
		printf("%lld\n",ans);
	}
	return 0;
}



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

int main() {
  int n;
  cin >> n;
  if(n < 10){
    cout << n << endl;
  }
  else if(10 <= n && n < 100){
    cout << 9 << endl;
  }
  else if(n >= 100 && n < 1000){
    cout << n-90 << endl;
  }
  else if(n >=1000 && n<10000){
    cout << 909 << endl;
  }
  else if(n >= 10000 && n < 100000){
    cout <<  n - 9090 << endl;
  }
  else {
    cout << 90909 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair
#define eb emplace_back

const int MAX_N = 1e6+10;

int N;
ll dp[MAX_N][2][2];

void solve()
{
	dp[0][0][0]=1;
	for(int i=1;i<=N;++i){
		for(int j=0;j<=9;++j){
			if(j==0){
			    (dp[i][1][1]+=dp[i-1][0][1])%=MOD;
			    (dp[i][1][1]+=dp[i-1][1][1])%=MOD;
			    (dp[i][1][0]+=dp[i-1][0][0])%=MOD;
			    (dp[i][1][0]+=dp[i-1][1][0])%=MOD;
			}
			else if(j==9) {
			    (dp[i][0][1]+=dp[i-1][0][0])%=MOD;
			    (dp[i][0][1]+=dp[i-1][0][1])%=MOD;
			    (dp[i][1][1]+=dp[i-1][1][0])%=MOD;
			    (dp[i][1][1]+=dp[i-1][1][1])%=MOD;
			}
			else{
			    (dp[i][0][0]+=dp[i-1][0][0])%=MOD;
			    (dp[i][0][1]+=dp[i-1][0][1])%=MOD;
			    (dp[i][1][0]+=dp[i-1][1][0])%=MOD;
			    (dp[i][1][1]+=dp[i-1][1][1])%=MOD;
			}
		}
	}
	cout<<dp[N][1][1]<<'\n';
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> N;
	solve();
	return 0;
}

Measured memory_bytes: 34768
//Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define file_input
//#define multitest
//#define measure_time
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<v32>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print_container(const ContainerType<ValueType, Args...> &c)
{
	cout << "{ ";
	for (const auto &v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

const int N = 1e6 + 7;
int temp[N];
s32 prime;

void init()
{
	for (int i = 1; i < N; i++)
		temp[i] = i;
	for (int i = 2; i * i < N; i++)
	{
		if (temp[i] == i)
		{
			for (int j = 2; i * j < N; j++)
				if (temp[i * j] == i * j)
					temp[i * j] = 0;
		}
	}
	for (int i = 2; i < N; i++)
	{
		if (temp[i])
			prime.insert(i);
	}
	return;
}

void solve()
{
	int n;
	cin >> n;
	init();
	auto itr = *prime.lower_bound(n);
	cout << itr << ln;
	return;
}

int main()
{
	FASTIO;
#ifdef file_input
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	clock_t start, stop;
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
#ifdef measure_time
	start = clock();
#endif
	for (int tc = 1; tc < t + 1; tc++)
		solve();
#ifdef measure_time
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


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

int main() {
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}

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

	double ans = 0;
	double sm = a[0];
	int i = 1;

	while(i < n) {
      sm = (a[i] + sm) / 2;
      i++;
	}
	printf("%.2f\n", sm);
}

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

class Program
{
    static Scanner sc = new Scanner();

    static void Main(string[] args)
    {
        var L = sc.ReadInt();
        var R = sc.ReadInt();

        var l = L / 2019;
        var r = R / 2019;

        var ans = int.MaxValue;
        if (l == r)
        {
            for (int x = L; x <= R; x++)
            {
                for (int y = x + 1; y <= R; y++)
                {
                    ans = Math.Min(ans, (x % 2019) * (y % 2019) % 2019);
                }
            }
        }
        else
        {
            ans = 0;
        }

        Console.WriteLine(ans);
    }

    static long Gcd(long a, long b)
    {
        var v = new[] { a, b };
        while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
        return v[0];
    }

    static long Lcm(long a, long b)
    {
        return a / Gcd(a, b) * b;
    }
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }

    public string ReadStr()
    {
        return this.Next();
    }

    public char ReadChar()
    {
        return this.Next()[0];
    }

    public int ReadInt()
    {
        return int.Parse(this.Next());
    }

    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }

    public long ReadLong()
    {
        return long.Parse(this.Next());
    }

    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }

    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }

    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }

    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}

class HashMap<K, V> : Dictionary<K, V> where V : new()
{
    private V DefaltValue = new V();
    public HashMap() { }
    public HashMap(V defaultValue)
    {
        this.DefaltValue = new V();
    }
    new public V this[K i]
    {
        get
        {
            V v;
            return TryGetValue(i, out v) ? v : base[i] = this.DefaltValue;
        }
        set { base[i] = value; }
    }
}

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

using namespace std;

ifstream f("input.in");
ofstream g("output.out");

int main(int argc, char **argv)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //cout<<fixed<<setprecision(10)<<;
    //cout.unsetf(ios::fixed);

    int a, b, c;
    string str;

    //f>>n>>ws;
    cin>>a>>b>>c;
    
    int t = b / a;
    t = min(t, c);
    cout<<t;
    
    /*
    for(int i = 0; i < n; ++i)
    {
        //getline(f, str);

    }*/

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int n,n2;
	int s=0;
	cin>>n;
	n2=n;
	while(n2)
	{
		s+=n2%10;
		n2/=10;
	}
	if(n%s==0)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}
  

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

#############
# Libraries #
#############

import math
from functools import lru_cache

#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#############
# Main Code #
#############

N,P = map(int,input().split())
S = list(input())


mods = [0 for _ in range(P)]
count = 0

loop = 0
mod = 0

if P != 2 and P != 5: 
  for digit in S[::-1]:
    loop += 1
    digit = int(digit)
    mod = (mod + digit*pow(10,loop-1,P))%P
    count += mods[mod]
    mods[mod] += 1
    if mod == 0:
      count += 1
else:
  for digit in S:
    loop += 1
    if int(digit)%P == 0:
      count += loop


  

print(count)


Measured memory_bytes: 63216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
template<typename T> inline T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << fixed << setprecision(11) << w * h / 2.0 << " ";
    if (2 * x == w && 2 * y == h) cout << 1 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
const int N=25;
int a[N],mx,n,res;
int main(){
	cin>>n;
	fp(i,1,n)cin>>a[i];
	fp(i,1,n){
		res=max(res,a[i]);
		if(res==a[i])++mx;
	}
	cout<<mx<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 20000005
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int N,H,W;
void Solve() {
	read(N);read(H);read(W);
	out(1LL * (N - H + 1) * (N - W + 1));enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
}


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

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

  int n,x;
  cin >> n >> x;

  int *m;
  m = new int[n];

  int minm = 1000000000;
  int sum = 0;;

  for(int i = 0; i < n; i++){
    cin >> m[i];
    if(m[i] < minm) minm = m[i];
    sum += m[i];
  }

  x -= sum;

  cout << x / minm + n << endl;



}


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

ll gcd(ll a, ll b) {
	return (b == 0) ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	ll h = gcd(a,b);
	return h ? (a * (b / h)) : 0;
}

int main()
{
	ll a, b;
	cin >> a >> b;

	cout << lcm(a, b) << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())

l = list(map(int, input().split()))

j = 0
flag = True
while flag:
  for i in range(0,n):
    if l[i]%2 == 1:
      flag=False
      break
    l[i]=l[i]/2
  if flag:
    j = j + 1
print(j)


Measured memory_bytes: 2940
// author:-*mdragneell*

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

#define ll long long
#define ld long double
#define pb push_back
#define pi  pair<int,int>
#define pl  pair<ll,ll>

int const N=3001;
ll min(ll x,ll y) { if(x<y) return x; else return y; }
ll max(ll x,ll y) { if(x>y) return x; else return y; }

long double cache[N][N];
ll n,m;
long double p[N];
ll mod=1e9+7;

long double coin(ll x,ll k)
{
	if(x>=n) return 1;
	if(cache[x][k]) return cache[x][k];
	if(k>0) return cache[x][k]=p[x]*coin(x+1,k)+(1-p[x])*coin(x+1,k-1);
	return cache[x][k]=(p[x])*coin(x+1,k);
}



int main()
{
	ll i,j;
	cin>>n;
	memset(cache,0,sizeof(cache));
	for(i=0;i<n;i++)
		cin>>p[i];
	cout<<fixed<<setprecision(10)<<coin(0,n/2);
}


Measured memory_bytes: 141184
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    string s,t;
    cin>>s>>t;
    int c=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]!=t[i])
        c++;
    }
    cout<<c<<"\n";
    return 0;
}


Measured memory_bytes: 3876
X = gets.chomp.to_i
# A, B, C = gets.chomp.split.map(&:to_i)
# S = gets.chomp.chars

# 0-5 
# X / 100 

diff = X / 100
remain = X % 100

if remain <= (diff * 5)
  p 1
else
  p 0
end

Measured memory_bytes: 1788
import java.util.Scanner;

class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  private Scanner sc = new Scanner(System.in);

  private void run() {
    String S = sc.next();
    if (S.contains("A") && S.contains("B")) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 21972
N = int(input())

ans = 0

if N < 10:
    ans = N

elif N < 100:
    ans = 9

elif N < 1000:
    ans += 9
    ans += N - 99

elif N < 10000:
    ans += 9
    ans += 900

elif N < 100000:

    ans += 9
    ans += 900

    ans += N - 9999

else:

    ans += 9
    ans += 900
    ans += 90000

print (ans)


Measured memory_bytes: 38384
/* Author : Prasuk Jain */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int              long long int
#define ull              unsigned long long
#define ld               long double
#define fo(i, n)         for(int i=0; i<n; i++)
#define FOR(i, a, b)     for(int i=a; i<b; i++)
#define rfor(i, n)       for(int i=n-1; i>=0; i--)
#define RFOR(i, a, b)    for(int i=b-1; i>=a; i--)
#define tr(it, v)        for(auto it=a.begin(); it!=a.end(); it++)
#define vi               vector<int>
#define pii              pair<int,int>
#define mii              map<int,int>
#define pqb              priority_queue<int>
#define pqs              priority_queue<int,vi,greater<int>>
#define mp               make_pair
#define pb(x)            push_back(x)
#define hcf(x, y)        __gcd(x, y)
#define lcm(x, y)        boost::math::lcm(x,y)
#define setpre(x, y)     fixed << setprecision(y) << x
#define setbits(x)       __builtin_popcountll(x)
#define zerolead(x)      __builtin_clzll(x)
#define zerotrail(x)     __builtin_ctzll(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define PI               3.1415926535897932384626
const int mod = 1e9+7;
const int inf = 1e18;
int mpow(int base, int exp);
bool isprime(int num);
void prifact(int num);

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

void coderprasukj(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main() {
    //coderprasukj();
    int t, n, k, x, y;
    string s;
    cin >> s;
    if(s[1]=='B') s[1]='R';
    else s[1]='B';
    cout << s << '\n';
    return 0;
}

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

int mpow(int base, int exp) {
    base %= mod;
    int result = 1;
    while (exp > 0) {
        if (exp & 1) result = ((int)result * base) % mod;
        base = ((int)base * base) % mod;
        exp >>= 1;
    }
  return result;
}

bool isprime(int num) {
    if(num <= 1) return false;
    for(int i=2; i*i <= num; i++)
        if(num%i == 0) return false;
    return true;
}

void prifact(int num){
    for(int i=2; i<=num; i++)
    if(num%i == 0){
        int cnt = 0;
        while(num%i == 0)
        cnt++ , num /= i;
        cout << i << "^" << cnt << " ";
    }
    if(num > 1)
    cout << num << "^" << "1" << " ";
}



Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <stack>
#include <unordered_set>
#include <numeric>
#include <iterator>
#include <unordered_map>
#include <array>
#include <map>
#include <cstring>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
#include <ctgmath>
#include <set>
#include <queue>
#include <fstream>
#include <ostream>
#include <list>
#include <string>
using namespace std;
#define int long long
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;

	vector<int> h;

	for (int i = 0; i < n; i++)
	{
		int hi;
		cin >> hi;

		h.push_back(hi);
	}

	vector<int> dp(n, 9999999999999LL);
	dp[0] = 0;
	for (int i = 0; i < n - 2; i++)
	{
		dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
	}

	dp[n-1] = min(dp[n-1], dp[n-2] + abs(h[n-2] - h[n -1]));

	cout << dp[n-1] << "\n";
	
}


Measured memory_bytes: 1908