akhauriyash/Code-Regression huggingface dataset:
#define TEST_MODE true
 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= b; --i)
#define range(i, a, b, c) for (int i = a;		\
                               c > 0 ? i < b : i > b;	\
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long
 
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x)
#define dump_l(x) dump(x) << endl
#else
const bool test = false;
#define dump(x)
#define dump_l(x)
#endif
 
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
 
//.....................
const int MAX = (int)2e5 + 5;
 
vector<string> split(const string &str, char sep)
{
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep))
    {
      v.push_back(buffer);
    }
  return v;
}

string reverse_str(string input) {
  string res = input;
  reverse(all(res));
  return res;
}
 
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
  return accumulate(begin, end, 0ll);
}

int H = 20, W = 30;

bool ng(int y, int x) {
  return y < 0 || H <= y || x < 0 || W <= x;
}

void solve();

class Solver {
public:
  int A, B, C, X, Y;

  void solve() {
    cin >> A >> B >> C >> X >> Y;
    int d = A * X + B * Y;
    int m = min(X, Y);
    int e = 2 * C * m + A * (X - m) + B * (Y - m);
    int M = max(X, Y);
    int g = 2 * C * M;
    cout << min({d, e, g}) << endl;
  }
};
 
signed main()
{
  cout << fixed << setprecision(20);
  auto ptr = new Solver();
  ptr->solve();
  delete ptr;
  // while (true) {
  //   auto ptr = new Solver();
  //   ptr->solve();
  //   delete ptr;
  // }
  return 0;
}
 
// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'
 


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long d = sc.nextLong();
		long max_a = Math.max(a*c, a*d);
		long max_b = Math.max(b*c,b*d);
		long max = Math.max(max_a, max_b);
		System.out.println(max);
	}
}

Measured memory_bytes: 35624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _20180305_AOJ
{
    class ALDS1_5A
    {
        static void Main(string[] args)
        {
            for (;;)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line))
                {
                    break;
                }

                int[] A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                Console.ReadLine();
                int[] m = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

                foreach (var v in m)
                {
                    bool solved = Solve(A, 0, v);
                    if (solved)
                    {
                        Console.WriteLine("yes");
                    }
                    else
                    {
                        Console.WriteLine("no");
                    }
                }
            }
        }

        static bool Solve(int[] A, int i, int m)
        {
            if (m == 0)
            {
                return true;
            }
            if (i >= A.Length)
            {
                return false;
            }

            return Solve(A, i + 1, m) || Solve(A, i + 1, m - A[i]);
        }
    }
}



Measured memory_bytes: 9492
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b;
  cin>>a>>b;
  if(a>9||b>9){
    cout<<-1<<endl;
    return 0;
  }
  cout<<a*b<<endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include <vector>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>
#include <climits>
#include <map>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;


//しゃくとり法(条件を満たす区間をすべて求める方法)
//しゃくとり法では半区間[0,i)　で考えることが多い(ex:[0,2) なら0,1のみ )
int main()
{
  long n;
  cin >> n;
  vector<long> a(n);
  vector<long> b(n);
  vector<long> c(n);

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

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

  for (int i = 0; i < n; ++i) {
    cerr <<  a[i] << " ";
  } cerr << endl;
  for (int i = 0; i < n; ++i) {
    cerr <<  b[i] << " ";
  } cerr << endl;
  for (int i = 0; i < n; ++i) {
    cerr <<  c[i] << " ";
  } cerr << endl;

  //bjを固定すると上下調べればよい
  //cj固定でもよくね？ →　だめ
  // bjこていのみ！
  long ans = 0;

  for (int i = 0; i < n; ++i) {
    long bs = b[i];
    // cerr << bs <<endl;


    long lb = -1;  //  2 , 4
    long ub = n;   //  3 , 6  // (-1 +2) /2 = 0
    while (ub - lb > 1) { ////0,1,2,3,4　要素数5のとき  最後 lb=0 ub=1のとき 0 - 1
      long mid = lb + (ub - lb) / 2;
      // cerr << c[mid] <<endl;
      if (bs < c[mid]) {//昇順ソートしてるから、条件を満たすならlbを増やす //中央がbsより大きいなら ubを寄せる
        ub = mid;
      } else {
        lb = mid;
      }
    }
    lb++;
    long cs = c[lb];
    long cnum = n - lb ;

    // cerr <<"c[" << lb <<"]:" << cs <<endl;


    lb = -1;
    ub = n;
    while (ub - lb > 1) { ////0,1,2,3,4　要素数5のとき  最後 lb=0 ub=1のとき 0 - 1
      long mid = lb + (ub - lb) / 2;
      if (bs > a[mid]) {//昇順ソートしてるから、条件を満たすならlbを増やす
        lb = mid;
      } else {
        ub = mid;
      }
    }
    // lb++;
    long as = a[lb];
    long anum = lb + 1 ;

    // cerr <<"a[" << lb <<"]:" << as <<endl;

    ans += cnum * anum;

    cerr << " cs:" << cs << " bs:" << bs << " as:" << as << endl;
    cerr  << " cnum:" << cnum << " anum:" << anum << endl;

  }

// 2*5 10
// 3*5 15
// 5*4 20
// 5*3 15
// 5*3 15
// 6*2 12




  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2560
# abc167 C
n, m, x = gets.split.map(&:to_i)
ca = n.times.map {
  c, *a = gets.split.map(&:to_i)
  [c, a]
}
# pp ca
#
min = 10 ** 10
# (2 ** 12) * 12 ~=> 40000
[true, false].repeated_permutation(n) { |bools|
  b = []
  mon = 0
  bools.each_with_index do |bool, i|
    next if !bool

    b << ca[i][1]
    mon += ca[i][0]
  end

  next if b.empty?

  bsum = b.transpose.map(&:sum)

  if bsum.all?{|pri|pri >= x}
    min = mon if mon < min
  end
}
p min == 10**10 ? -1 : min


Measured memory_bytes: 14672
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    string s;
    int k;
    cin >> s;
    cin >> k;
    REP(i,s.size()){
        if(s[i] != 'a' && k >= 26 - (s[i] - 'a')){
            k -= 26 - (s[i] - 'a');
            s[i] = 'a';
        }        
    }
    k %= 26;
    while(k > 0){
        if(s[s.size() - 1] == 'z'){
            s[s.size() - 1] = 'a';
        }else{
            s[s.size() - 1]++;
        }
        k--;
    }
    cout << s << endl;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

template<typename T>
struct edge {
    int src, to;
    T cost;

    // to, costで初期化
    edge (int to, T cost) : src(-1), to(to), cost(cost) {}

    // src, to, costで初期化
    edge (int src, int to, T cost) : src(src), to(to), cost(cost) {}

    // toにxを代入？
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }
    
    // edge()でtoを返す？
    operator int() const {return to;}
};

template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<Edges<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

int main () {
  cin.tie(0);
  cout << setprecision(10);

  int n; cin >> n;
  UnWeightedGraph graph(n+1);
  vi depth(n+1);
  depth[0] = -1;
  vector<string> reply(n+1);
  FOR(i, 1, n+1) {
    int k; cin >> k;
    string s; cin >> s;
    depth[i] = depth[k]+1;
    reply[i] = s;
    graph[k].pb(edge<int> (k, i, -1));
  }

  stack<int> st;
  st.push(1);
  vector<bool> sel(n+1);
  while(!st.empty()) {
    int now = st.top(); st.pop();
    if(sel[now]) continue;
    sel[now] = true;
    REP(i, depth[now]) {
      cout << ".";
    }
    cout << reply[now] << endl;
    RREP(i, graph[now].size()-1) {
      st.push(graph[now][i].to);
    }
    
  }
}



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

int main() {

	int n; cin >> n;
	if (n == 1) { cout << 0 << endl; return 0; }
	vector<int> h(n);
	for (int i = 0; i < n; i++) { cin >> h[i]; }

	int max_c = 0;
	int c = 0;
	for (int i = 0; i < (n - 1); i++) {
		if (h[i] < h[i + 1]) {
			c = 0;
		}
		else {
			c++;
			max_c = max(max_c, c);
		}
	}

	cout << max_c << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
map<char, int> array_l;
map<int, int> array_v[256];
bool bag;
int expression(string s){
  //printf("expression(%s)\n", s.c_str());
  if(isdigit(s[0])){
    int res = atoi(s.c_str());
    //printf("expression(%s) return %d\n", s.c_str(), res);
    return res;
  }else{
    char name = s[0];
    string exp1 = s.substr(s.find("[") + 1, s.rfind("]") - s.find("[") - 1);
    int e1 = expression(string(exp1));
    int res;
    if(!array_v[name].count(e1)){
      bag = true;
      res = -INF;
    }else{
      res = array_v[name][e1];
    }
    //printf("expression(%s) return %d\n", s.c_str(), res);
    return res;
  }
}
bool eval(string& s){
  //printf("eval(%s)\n", s.c_str());
  int equal_idx = s.find("=");
  if(equal_idx == -1){
    char name;
    int len;
    sscanf(s.c_str(), "%c[%d]", &name, &len);
    assert(array_l.count(name) == 0);
    array_l[name] = len;
    //printf("  define %c[%d]\n", name, len);
    return true;
  }else{
    bag = false;
    char name = s[0];
    string exp1;
    string exp2 = s.substr(s.find("=") + 1);
    s = s.substr(0, s.find("="));
    exp1 = s.substr(s.find("[") + 1, s.rfind("]") - s.find("[") - 1);
    int e1 = expression(exp1);
    int e2 = expression(exp2);
    if(array_l.count(name) == 0 || e1 >= array_l[name]) bag = true;
    //assert(e1 == -INF || array_v[name].count(e1) == 0);
    array_v[name][e1] = e2;
    return !bag;
  }
}

int main(){
  string s;
  while(true){
    array_l.clear();
    REP(i, 256)array_v[i].clear();
    int cnt = 1;
    int ans = INF;
    while(cin>>s){
      if(s == ".") break;
      if(!eval(s)) ans = min(ans, cnt);
      cnt++;
    }
    if(cnt == 1) break;
    if(ans == INF) ans = 0;
    cout<<ans<<endl;
    //cout<<"------"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1316
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl A(N);
  set<ll> P;
  REP(i, N) {
    cin >> A[i];
    P.insert(A[i]);
  }
  if (P.size() == N)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}


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

int search(int A[], int n, int key){
    int i = 0;
    A[n] = key;
    while (A[i] != key){
        i++;
    }
    return i != n;
}

int main() {
    int i, n , A[10000+1], q, key, sum = 0;

    scanf("%d", &n);
    for ( i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }

    scanf("%d", &q);
    for ( i = 0; i < q; i++){
        scanf("%d", &key);
        if( search(A, n, key))
            sum++;
    }
    printf("%d\n", sum);
}



Measured memory_bytes: 3232
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  bool flag = true;
  rep(i, 10) {
    rep(j, 10) {
      int sum = i*j;
      if(sum == n) {
        flag = false;
        coYes;
        break;
      }
    }
    if (flag == false) {
      break;
    }
  }
  if (flag) {
    coNo;
  }
}


Measured memory_bytes: 3632
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iterator>
#include <set>
#include <functional>

using namespace std;

#define DT long long
#define forn(i,n)for(i=0;i<n;i++)
#define forc(i,c,n)for(i=c;i<=n;i++)

int main() {
	ifstream fin("Text.txt");
	int i, j, q;
	DT a, b, c, d, p, n, m, k, s = 0, t = 0, tt = 0, ss = 0, r;
	//scanf("%I64d", &n);
	//scanf_s("%d", &n);
	cin >> n;
	vector<DT>vc(n),vd(n);
	forn(i, n) {
		cin >> vd[i];
	}
	t = n;
	while (t>0) {
		t = 0;
		forn(i, n) {
			a = vd[i];
			vd[i] = a%n;
			vc[i] = a / n;
			t += vc[i];
		}
		forn(i, n) {
			vd[i] += (t - vc[i]);;
		}
		tt += t;
	}
	cout << tt << endl;
	return 0;
}

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

int PN[100010];

int acc[100010];

int main()
{	
	int l, r;

	int Q;

	cin >> Q;

	fill(begin(PN), end(PN), 1);

	PN[0] = PN[1] = 0;

	for (int i = 2; i*i <= 100010; i++)
	{
		if (PN[i] == 1)
		{
			for (int k = 2; i*k <= 100010; k++)
			{
				PN[i*k] = 0;
			}
		}

	}



	for (int i = 1; i <= 100010; i++)
	{
		acc[i] = acc[i - 1];

		if (i % 2 == 1 && PN[i] == 1 && PN[(i + 1) / 2] == 1)
		{
			acc[i]++;
		}
	}

	while (Q--)
	{
		cin >> l >> r;
		

		cout << acc[r] - acc[l - 1] << endl;

	}

	return 0;
}

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

int main(){
    int a,b,c,abc;
    cin>>a>>b>>c;
    for(int i;i<2;i++) {
        if (a>b){
            abc=a;
            a=b;
            b=abc;
        }
        if (b>c){
            abc=b;
            b=c;
            c=abc;
        }
    }
   cout<<a<<" "<<b<<" "<<c<<endl;
   
   return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

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

  vector<int> cnt(n+1, 0);
  REP(i, 1, n) REP(j, 1, i) if(i%j == 0) cnt[i]++;

  int ans = 0;
  REP(i, 1, n) if(cnt[i] == 8 && i%2 == 1) ans++;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int S[100];
int top;

void initialize(){
  top = 0;
  }

void push(int x){
  top++;
  S[top] = x;
}


int pop(){
  top--;
 return S[top+1];
}

int main(){
  int x,a,b;
  char s[100];

  initialize();
  
  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      a=pop();
      b=pop();
      push(a+b);
    } else if ( s[0] == '-' ){
      a=pop();
      b=pop();
      push(b-a);
    } else if ( s[0] == '*' ){
      a=pop();
      b=pop();
      push(a*b);
    } else {
      x = atoi(s);
      push(x);
    }
  }
  a=pop();
  printf("%d\n",a);
  
  return 0;
}

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

#define ll long long

using namespace std;

int main() {
	ll mod = 1000000007;
	int N;
	cin >> N;
	string s1, s2;
	cin >> s1 >> s2;
	int prev = -1;
	ll ans = 1;
	for (int i = 0; i < N; i++) {
		if (s1[i] != s2[i]) {
			if (prev == -1) {
				ans =ans*6;
			}
			else if (prev == 1) { //this type
				ans =ans*3;
			}
			else {
				ans =ans*2;
			}

			prev = 1;
			i++;
		}
		else {
			if (prev == -1) {
				ans =ans*3;
			}
			else if (prev == 1) {
				ans =ans*1;
			}
			else {
				ans =ans*2;
			}
			prev = 2;
		}
		ans = ans%mod;
	}
	cout << ans << endl;
	// cin >> N;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <limits>

using namespace std;
int main()
{
    cin.ignore(numeric_limits<streamsize>::max(), '\n');
    string S;
    cin >> S;
    int c = 0;
    for (int i = 1; i < S.size(); i++)
    {
        S[i - 1] != S[i] && (c++, i++);
    }
    cout << c << endl;
}


Measured memory_bytes: 3324
n = int(input())

A = [0]*12000

for i in range(1,101):
    for j in range(1, 101):
        for k in range(1, 101):
            val = i**2 + j**2 + k**2 + i*j + i*k + j*k
            if val < 12000:
                A[i**2 + j**2 + k**2 + i*j + i*k + j*k] += 1

for i in A[1:n+1]:
    print(i)

Measured memory_bytes: 74748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, k;
    cin >> n >> k;
    ll h[n];
    rep(i, 0, n) cin >> h[i];
    sort(h, h + n);
    int x = max(0, n - k);
    ll ans = 0;
    rep(i, 0, x) ans += h[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
 
int N;
string S[100];
 
int rec(int& idx, int depth)
{
  if(isdigit(S[idx][depth])) {
    return(S[idx++][depth] - '0');
  } else if(S[idx++][depth] == '+') {
    int ret = 0;
    while(S[idx].size() > depth + 1) ret += rec(idx, depth + 1);
    return(ret);
  } else {
    int ret = 1;
    while(S[idx].size() > depth + 1) ret *= rec(idx, depth + 1);
    return(ret);
  }
}
 
int main()
{
  while(cin >> N, N) {
    for(int i = 0; i < N; i++) cin >> S[i];
    S[N] = "";
    int idx = 0;
    cout << rec(idx, 0) << endl;
  }
}

Measured memory_bytes: 1204
#include <stdio.h>

int main()
{
    int i, N, I, count=0;
    
    scanf("%d", &N);
    for(i=0;i<N;i++){
        scanf("%d", &I);
        while((I%2) != 1){
            I /= 2;
            count++;
        }
    }
    
    printf("%d\n", count);
    
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>

using namespace std;

void Main(){
  int a,b;
  cin>>a>>b;
  a<=b ? cout<<a<<endl : cout<<a-1<<endl;
}

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  Main();
}

Measured memory_bytes: 256
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;



int main(void)
{
	//変数の宣言
	int a,b;

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	char dummy;



	//データの読み込み


	scanf("%d %d",&a,&b);
//	scanf_s("%d %d",&a,&b);


	//	scanf("%s",&s);
	//	scanf_s("%s",&s,200010);

//	scanf("%c",&dummy);
//	scanf_s("%c",&dummy);


/*	for(i=0;i<n;i++){
//		scanf("%d",&s[i]);
		scanf_s("%d",&s[i]);
	}*/

/*	for(i=0;i<n;i++){
//		scanf("%c",&t[i]);
		scanf_s("%c",&t[i]);
	}*/

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理



	
	//	printf("計算部分終了\n");

	//出力

	printf("%d",a-b+1);

//C	printf("\nL=%d,R=%d,D=%d,U=%d\n",L,R,D,U);

	//	printf("結果の出力終了\n");

	return 0;
}



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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll N; 
ll A[100005];

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

    cin >> N;

    ll tmp[100005];
    for (int i = 0;i < N;i++){
        cin >> tmp[i];
    }

    map<ll,vector<ll> > memo;
    for (int i = 0;i < N;i++){
        memo[tmp[i]].push_back(i);
    }

    ll h = 1;
    for(auto&& itr:memo){
        for (int i = 0;i < itr.second.size();i++){
            A[itr.second[i]] = h;
            if(tmp[itr.second[i]] == 0) A[itr.second[i]] = 0;
        }
        h++;
    }

    ll dif1[100005];
    memset(dif1,0,sizeof(dif1));

    dif1[0]++;
    dif1[A[0]]--;

    for (int i = 0;i < N-1;i++){
        if(A[i] < A[i+1]){
            dif1[A[i]]++;
            dif1[A[i+1]]--;
        }else{
            dif1[A[i]]--;
            dif1[A[i+1]]++;
        }
    }

    dif1[A[N-1]]--;
    dif1[0]++;

    ll dif2[100005];
    memset(dif2,0,sizeof(dif2));

    ll ans = 0;
    ll t = 0;

    for (int i = 0;i < N+5;i++){
        t += dif1[i];
        dif2[i] = t;
        ans = max(ans,t);
    }

    cout << ans/2 << endl;

    /*for (int i = 0;i < N;i++){
        cout << A[i] << " ";
    }

    cout << endl;*/

    return 0;

}


Measured memory_bytes: 17180
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main()
{
   
    char a;
    cin >> a;
    a++;
    cout << a << endl;

    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <bitset>
#include <map>
#include <cstring>
#include <cstdlib>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

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

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int flag[10] = {};
int N, M;
vector<int> G[9];

int dfs(int x, int be, int cnt){
	if(cnt == N) return 1;
	
	ll res = 0;
	REP(i, G[x].size()){
		if(flag[G[x][i]]) continue;
		flag[G[x][i]] = true;
		res += dfs(G[x][i], x, cnt+1);
		flag[G[x][i]] = false;
	}
	return res;
}
int dp[41][401][401];

int main(void){
	int N, Ma, Mb;
	int a[41], b[41], c[41];
	REP(i, 41) REP(j, 401) REP(k, 401) dp[i][j][k] = INF;

	cin >> N >> Ma >> Mb;
	REP(i, N){
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[0][0][0] = 0;
	REP(i, N){
		REP(j, N*10+1){
			REP(k, N*10+1){
				if(j >= a[i] && k >= b[i])
					dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j-a[i]][k-b[i]]+c[i]);
				dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k]);
			}
		}
	}
	int res = INF;
	REP(k, N+1){
	REP(i, N*10+1){
		REP(j, N*10+1){
			if(dp[k][i][j] != INF && dp[k][i][j] != 0 && i*Mb - j*Ma == 0){
				res = min(res, dp[k][i][j]);
			}
		}
	}
	}
	if(res == INF)
		cout << -1 << endl;
	else
		cout << res << endl;
}


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

using namespace std;

int main(void){

    string str;
    cin >> str;
    bool ok = true;

    for(int i = 0;str[i] != '\0';i++){
        if(str[i] != str[str.length()-1-i]) ok = false;
    }

    for(int i = 0;i < (str.length()-1)/2;i++){
        if(str[i] != str[(str.length()-1)/2 - 1 - i]) ok = false;
    }

    for(int i = (str.length()+3)/2;str[i] != '\0';i++){
        if(str[i] != str[str.length()-1-i]) ok = false;
    }

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
// Problem : B - Product Max
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


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


#define sc(ar,n) for(int pen=0;pen<n;pen++){ cin>>ar[pen];}
#define pr(ar,n) for(int pen=0;pen<n;pen++){ cout<<ar[pen]<<" ";} cout<<endl;
#define mem(ar,x) memset(ar,x,sizeof(ar))
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define rt return 0;
#define ct continue;
#define pb push_back
#define ll long long int
#define ff first
#define ss second
#define mod 1000000007
#define maxn 1000003
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int main(){
	
	fastio;
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    
    ll ans = max(max(b*(1LL)*d,a*(1LL)*c),max(b*(1LL)*c,a*(1LL)*d));
    cout<<ans<<"\n";
	
	}


	
	
	
	



Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main(){
	int x,a,b,c,d;
	cin>>x>>a>>b;
	if(x<a)c=a-x;
	else c=x-a;
	if(x<b)d=b-x;
	else d=x-b;
	if(c<d)cout<<"A"<<endl;
	else cout<<"B"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {

  int A, B;
  std::cin >> A >> B;

  //  int result = std::max({A+B, A-B, A*B});                                                                                                                                                                      
  int result = std::max(std::max(A+B, A-B),std::max(A+B, A*B));
  std::cout << result << std::endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int max(int a, int b){return a<b?b:a;}
long long int min(long long int a, long long int b){return a>b?b:a;}
long long int dif(long long int a, long long int b){return a<b?b-a:a-b;}

#define MIN -100000000000

int A, B, Q, i;
long long int s[100001], t[100001], x;
int a, b, c, d;
long long int now, Min;

int searchA(long long int k){
	int l=0;
	int r=A;
	int m;
	while(r>l+1){
		m = (l+r)>>1;
		if(s[m]>=k){
			r=m;
		}else{
			l=m;
		}
	}
	return r;
}

int searchB(long long int k){
	int l=0;
	int r=B;
	int m;
	while(r>l+1){
		m = (l+r)>>1;
		if(t[m]>=k){
			r=m;
		}else{
			l=m;
		}
	}
	return r;
}

int main(){
	scanf("%d%d%d", &A, &B, &Q);
	s[0] = MIN;
	for(i=1; i<=A; i++){
		scanf("%lld", s+i);
	}
	t[0] = MIN;
	for(i=1; i<=B; i++){
		scanf("%lld", t+i);
	}
	for(i=0; i<Q; i++){
		scanf("%lld", &x);
		a=searchA(x);
		b=searchB(x);
		c=max(0, a-1);
		d=max(0, b-1);
		Min = dif(x, s[a]) + dif(s[a], t[searchB(s[a])]);
		now = dif(x, s[a]) + dif(s[a], t[searchB(s[a])-1]);	Min=min(Min, now);
		now = dif(x, s[c]) + dif(s[c], t[searchB(s[c])]);	Min=min(Min, now);
		now = dif(x, s[c]) + dif(s[c], t[searchB(s[c])-1]);	Min=min(Min, now);
		now = dif(x, t[b]) + dif(t[b], s[searchA(t[b])]);	Min=min(Min, now);
		now = dif(x, t[b]) + dif(t[b], s[searchA(t[b])-1]);	Min=min(Min, now);
		now = dif(x, t[d]) + dif(t[d], s[searchA(t[d])]);	Min=min(Min, now);
		now = dif(x, t[d]) + dif(t[d], s[searchA(t[d])-1]);	Min=min(Min, now);
		printf("%lld\n", Min);
	}
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++) 
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int N, M;
vector<vector<int>> v( 8 + 1 , vector<int>( 8 + 1, 0 ) );
vector<int> visited( 8 + 1, 0 );
bool flag = true;
int res{};
void dfs( int i )
{
    //始点 -> 1 をset
    visited[ i ] = 1;
    REP2( j, 1, N + 1 )
    {
        if( v[ i ][ j ] == 1 && visited[ j ] == 0 )
        {
            flag = true;
            dfs( j );
            visited[ j ] = 0;
        }
        if( !visited[ j ] )
        {
            flag = false;
        }
    }
    if( flag )
    {
        res++;
    }
}
int main()
{
    cin >> N >> M;
    
    int A, B;
    REP2( i, 1, M + 1 )
    {
        cin >> A >> B;
        REP2( j, 1, M + 1 )
        {
            v[ A ][ B ] = 1;
            v[ B ][ A ] = 1;
        }
    }
    dfs( 1 );
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }
        static void Solve()
        {
            var N = Sarray()[0];
            var x = 800 * N;
            var y = (N / 15) * 200;
            WriteLine(x - y);
        }


        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28188
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int i, j,n,q;
		int cnt=0;
		n = sc.nextInt();
		int [] S = new int [n];
		for(i=0;i<n;i++){
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		int [] T = new int[q];
		for(i=0;i<q;i++){
			T[i] = sc.nextInt();
		}
		
	    for(i=0;i<q;i++){
	    	for(j=0;j<n;j++){
	    		if(T[i]==S[j]){
	    			cnt++;
	    			break;
	    		}
	    	}
	    }
		
	    System.out.println(cnt);
	}

}


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

int main() {
	int n, s;
	double ave, sdev, sum1, sum2;
	while (1) {
		sum1 = sum2 = 0;
		cin >> n;
		if (n == 0) break;
		for (int i = 0; i < n; i++) {
			cin >> s;
			sum1 += s;
			sum2 += s*s;
		}
		ave = sum1 / n;
		sdev = sqrt(sum2 / n - ave*ave);
		cout << fixed;
		cout << setprecision(6) << sdev << endl;
	}
	return 0;
}


Measured memory_bytes: 3184
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx") 
#include<bits/stdc++.h>
using namespace std;

inline int read()
{
	int ret=0; char c=getchar();
	while(c<48||c>57)c=getchar();
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}
long long s,c;
int main()
{
	scanf("%lld",&s);
//	s*=2;
	c=sqrt(s+0.1);
	if(c*c < s) ++c;
	s=c*c-s;
	printf("0 0 %lld %lld %lld %lld",c,s,1,c);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int N, M, K, H, W, L, R, T, X;
vi a, p;
string S;
int f(int N, int X){
  if(N == 0 && X==1) return 1;
  if(X == 1) return 0;
  else if(1 < X && X <= 1+a[N-1]) return f(N-1,X-1);
  else if(X == 2+a[N-1]) return p[N-1]+1;
  else if(2+a[N-1] < X && X < a[N]) return p[N-1]+1+f(N-1,X-2-a[N-1]);
  else if(X == a[N]) return p[N];
}
signed main(){
  cin >> N >> X;

  a.push_back(1);
  p.push_back(1);
  rep2(i,1,N+1){
    a.push_back(a[i-1]*2+3);
    p.push_back(p[i-1]*2+1);
  }

  cout << f(N,X) << endl;
  return 0;
}


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

int main() {
  string str;
  cin >> str;
  if ( str == "a" ) {
    cout << "b";
  }
  else if ( str == "b" ) {
    cout << "c";
  }
  else if ( str == "c" ) {
    cout << "d";
  }
  else if ( str == "d" ) {
    cout << "e";
  }
  else if ( str == "e" ) {
    cout << "f";
  }
  else if ( str == "f" ) {
    cout << "g";
  }
  else if ( str == "g" ) {
    cout << "h";
  }
  else if ( str == "h" ) {
    cout << "i";
  }
  else if ( str == "i" ) {
    cout << "j";
  }
  else if ( str == "j" ) {
    cout << "k";
  }
  else if ( str == "k" ) {
    cout << "l";
  }
  else if ( str == "l" ) {
    cout << "m";
  }
  else if ( str == "m" ) {
    cout << "n";
  }
  else if ( str == "n" ) {
    cout << "o";
  }
  else if ( str == "o" ) {
    cout << "p";
  }
  else if ( str == "p" ) {
    cout << "q";
  }
  else if ( str == "q" ) {
    cout << "r";
  }
  else if ( str == "r" ) {
    cout << "s";
  }
  else if ( str == "s" ) {
    cout << "t";
  }
  else if ( str == "t" ) {
    cout << "u";
  }
  else if ( str == "u" ) {
    cout << "v";
  }
  else if ( str == "v" ) {
    cout << "w";
  }
  else if ( str == "w" ) {
    cout << "x";
  }
  else if ( str == "x" ) {
    cout << "y";
  }
  else {
    cout << "z";
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <numeric>
#include <set>
// #include <bits/stdc++.h>


using namespace std;
typedef long long li;

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

    li m, d;
    cin >> m >> d;

    li ans = 0;
    for (int i = 0; i < m; ++i) {
        const li mm = i + 1;
        for (int j = 0; j < d; ++j) {
            const li dd = j + 1;
            const li d1 = dd % 10;
            const li d10 = dd / 10;
            if (d1 * d10 == mm && d1 >= 2 && d10 >= 2) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
#define nn 300008
vector<int> va[nn],vb[nn],ve[nn];
int pa[nn],pb[nn];int ra,rb;int col[nn];
void add(int x,int y){
//	cout<<x<<" "<<y<<"\n";
	ve[x].push_back(y),ve[y].push_back(x);
}
vector<int> con[nn];
void merge(vector<int>&a,vector<int>&b){
//	if(a.size()<b.size()) swap(a,b);
	for(int i=0;i<b.size();i++) a.push_back(b[i]);
}
void dfs(int x,vector<int> v[nn]){
	for(int i=0;i<v[x].size();i++) {
		dfs(v[x][i],v);
		merge(con[x],con[v[x][i]]);
	}
	
	while(con[x].size()>=2) {
		int a=con[x][con[x].size()-1];con[x].pop_back();
		int b=con[x][con[x].size()-1];con[x].pop_back();
		add(a,b);
	}
	if(v[x].size()%2==0) con[x].push_back(x);
}

void paint(int x,int c){
	if(col[x]==c) return ;//cout<<x<<":"<<c<<"\n";
	if(col[x]!=-1 and col[x]!=c) assert(0);
	col[x]=c;
	for(int i=0;i<ve[x].size();i++) paint(ve[x][i],c^1);
}
signed main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&pa[i]);
	for(int i=1;i<=n;i++) scanf("%d",&pb[i]);
	for(int i=1;i<=n;i++) if(pa[i]!=-1) va[pa[i]].push_back(i);else ra=i;
	for(int i=1;i<=n;i++) if(pb[i]!=-1) vb[pb[i]].push_back(i);else rb=i;
	
	for(int i=1;i<=n;i++) if(va[i].size()%2!=vb[i].size()%2) 
		return puts("IMPOSSIBLE")*0; 
	
	dfs(ra,va);/*while(con[ra].size()>=2) {
		int a=con[ra][con[ra].size()-1];con[ra].pop_back();
		int b=con[ra][con[ra].size()-1];con[ra].pop_back();
		add(a,b);
	}*/
	for(int i=1;i<=n;i++) con[i].clear();
	dfs(rb,vb);/*while(con[rb].size()>=2) {
		int a=con[rb][con[rb].size()-1];con[rb].pop_back();
		int b=con[rb][con[rb].size()-1];con[rb].pop_back();
		add(a,b);
	}*1*/
	
	memset(col,-1,sizeof col);
	for(int i=1;i<=n;i++) if(col[i]==-1 and va[i].size()%2==0) paint(i,0);
	
	puts("POSSIBLE");
	for(int i=1;i<=n;i++) if(va[i].size()%2) printf("0 ");else printf("%d ",col[i]*2-1);
	return 0;
}

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

template<class T, class Upd>
struct SegmentTree {
    int n;
    Upd upd;
    vector<T> data;
    const T Lim;
    explicit SegmentTree(int n_, const T& Lim_)
        : upd(Upd()), Lim(Lim_) { init(n_);}
    void init(int n_) {
        for(n = 1; n < n_; n <<= 1);
        data.assign(2 * n - 1, Lim);
    }
    void update(int k, T a) {//0-indexed
        k += n - 1;
        data[k] = a;
        while(k > 0) {
            k = (k - 1) >> 1;
            data[k] = upd(data[k * 2 + 1], data[k * 2 + 2]); 
        }
    }
    T __query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return Lim;
        if(a <= l && r <= b) return data[k];
        else {
            T val_l = __query(a, b, k * 2 + 1, l, (l + r) >> 1);
            T val_r = __query(a, b, k * 2 + 2, (l + r) >> 1, r);
            return upd(val_l, val_r);
        }
    }
    T query(int a, int b) { //[a, b)
        return __query(a, b, 0, 0, n);
    }
};

template<class T>
struct updmin {
    T operator () (const T& l, const T& r) { return min(l, r);}
};

using i64 = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    SegmentTree<int, updmin<int>> seg(n, 2147483647);
    while(q--) {
        int k, u, v;
        cin >> k >> u >> v;
        if(k)
            cout << seg.query(u, v + 1) << endl;
        else
            seg.update(u, v);
    }
    return 0;
}

Measured memory_bytes: 3860
#include <cstdio>
#include <algorithm>
#include <cstdlib>

using namespace std;

int main() {
    int N, Z, W, a0=0, a1;
    scanf("%d %d %d", &N, &Z, &W);
    for (int i=0; i<N; i++) {
        if (i == N-2) scanf("%d", &a0);
        else scanf("%d", &a1);
    }
    printf("%d\n", max( abs(W-a1), a0>0 ? abs(a0-a1) : 0));
    return 0;
}

Measured memory_bytes: 128
input_val = [int(input()) for i in range(5)]
min_val = 10
min_index = 0
sum_time = 0
for i in range(0,5):
    str_num = str(input_val[i])
    if(int(str_num[len(str_num)-1]) < min_val) and (int(str_num[len(str_num)-1]) != 0):
        min_val = int(str_num[len(str_num)-1])
        min_index = i

for i in range(0,5):
    str_num = str(input_val[i])
    if(i==min_index):
        continue
    elif(int(str_num[len(str_num)-1])>0):
        sum_time += 10 - int(str_num[len(str_num)-1])

print(sum_time + sum(input_val))

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            var dic = S
                .GroupBy(elem => elem)
                .ToDictionary(elem => elem.Key, elem => elem.Count(c => c == elem.Key));
            var answer = (long)dic.GetValueOrDefault('R') * dic.GetValueOrDefault('G') * dic.GetValueOrDefault('B');

            answer -= Enumerable.Range(0, N)
                .SelectMany(i => Enumerable.Range(i + 1, N - i - 1), (i, j) => new { i = i, j = j, k = j + j - i })
                .Where(elem => elem.k < N && S[elem.i] != S[elem.j] && S[elem.i] != S[elem.k] && S[elem.j] != S[elem.k])
                .Count();

            Console.WriteLine(answer);
        }
    }
}


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

#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); i++)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); i--)
#define maxi(a, b) if(a < b)a = b;

int main()
    {
    int n;
    scanf("%d", &n);
    LL a = 1;
    LL b = 1;
    FOR(i, 1, n)
        {
        int x, y;
        scanf("%d%d", &x, &y);
        if(a % x != 0)a += x - a%x;
        if(b % y != 0)b += y - b%y;
        maxi(b, a/x*y);
        maxi(a, b/y*x);
        }
    cout << a + b << endl;
    }

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <vector>
#include <iostream>
#include <map>
#include <queue>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
#define mst(a,b) memset((a),(b),sizeof(a))
#define rush() int T;scanf("%d",&T);while(T--)

typedef long long ll;
const int maxn = 305;
const ll mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double eps = 1e-9;


int n;

int mp[maxn][maxn];
int vis[maxn][maxn];


int floyd1()
{
    for(int k=1;k<=n;k++)
    for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
    {
        if(i==j||j==k||i==k) continue;
        if(mp[i][k]+mp[k][j]<mp[i][j])
        {
            return -1;
        }
    }
}

void floyd2()
{
    for(int k=1;k<=n;k++)
    for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
    {
        if(i==j||j==k||i==k) continue;
        if(mp[i][k]+mp[k][j]==mp[i][j])
        {
            vis[i][j]=vis[j][i]=1;
        }
    }
}

int main()
{
    scanf("%d",&n);
    ll ans=0;
    mst(vis,0);
    for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
    {

        scanf("%d",&mp[i][j]);
    }
    int flag=floyd1();
    if(flag==-1)
    {
        puts("-1");
        return 0;
    }
    floyd2();
    for(int i=1;i<=n;i++)
    for(int j=i+1;j<=n;j++)
    {
        if(vis[i][j]==0)
            ans+=(ll)mp[i][j];
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 1024