akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main() {
	int d, n;
	cin >> d >> n;
	if (n != 100) {
		if (d == 0)cout << n << endl;
		else if (d == 1)cout << n * 100 << endl;
		else cout << n * 10000 << endl;
	}
	else {
		if (d == 0)cout << n + 1 << endl;
		else if (d == 1)cout << (n + 1) * 100 << endl;
		else cout << (n + 1) * 10000 << endl;
	}
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int n;
  scanf("%d", &n);
  map<int, int> dp;
  while(n--) {
    int t;
    scanf("%d", &t);
    dp[t]++;
  }
  int ret = 0;
  for(auto x: dp) {
    if(x.second >= x.first) {
      ret += x.second - x.first;
    }
    else {
      ret += x.second;
    }
  }
  printf("%d\n", ret);
}


Measured memory_bytes: 4736
def main():
    mod = 10**9+7
    fact = [1]
    fact_inv = [1]
    for i in range(2000005):
        new_fact = fact[-1]*(i+1)%mod
        fact.append(new_fact)


    def mod_comb_k(n,k,mod):
        return fact[n] * pow(fact[k],mod-2,mod) % mod * pow(fact[n-k],mod-2,mod) %mod

    x,p,y,q = map(int,input().split())

    res = mod_comb_k(p+x,x,mod) - mod_comb_k(p+y+1,y+1,mod) - mod_comb_k(q+x+1,x,mod) + mod_comb_k(q+y+2,y+1,mod)
    print(res%mod)

if __name__ == '__main__':
    main()

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

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

Measured memory_bytes: 3904
#include <bits/stdc++.h>
using namespace std;
 
int main(){
string S;
  cin >> S;
  int count = 0;
  for(int i=0; i<3; i++){
    if(S.at(i) == 'o'){
      count++;
    }
  }
  int price = 700+count*100;
  cout << price << endl;
	
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
 
int main(){
    int K,N;
    cin>>K>>N;
    vector<int>A(N);
    for(int i=0;i<N;i++)cin>>A[i];
    sort(A.begin(), A.end());
    priority_queue<int>x;
    x.push(A[0]+K-A[N-1]);
    for(int i=0;i<N-1;i++)
    {
        x.push(A[i+1]-A[i]);
    }
cout<<K-x.top();
 
return 0;
}

Measured memory_bytes: 2800
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }
  sort(all(a));
  reverse(all(a));
  ll ans=a[0];
  if(n%2==0){
    for(int i=1;i<=n/2-1;i++){
      ans+=a[i]*2;
    }
  }
  else{
    for(int i=1;i<=(n-3)/2;i++){
      ans+=a[i]*2;
    }
    ans+=a[(n-1)/2];
  }
  cout << ans << endl;
}

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

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template<typename Head> void dump(Head&& head) { cerr << head; dump(); }
template<typename Head, typename... Tail> void dump(Head&& head, Tail&&... tail) { cerr << head << ", "; dump(forward<Tail>(tail)...); }
#define debug(...) do {cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; dump(__VA_ARGS__); } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

struct UnionFind {
  vector<int> data;
  UnionFind(int n) {
    init(n);
  }
  void init(int n=1) {
    data.assign(n, -1);
  }
  int root(int x) {
    if (data[x] < 0) return x;
    return (data[x] = root(data[x]));
  }
  bool issame(int x, int y) {
    return (root(x) == root(y));
  }
  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return true;
  }
  int size(int x) {
    return (-data[root(x)]);
  }
};

int main()
{
  ll n,m; cin>>n>>m;
  vector<ll> x(m);
  vector<ll> y(m);
  vector<ll> z(m);
  rep(i, m) {
    cin>>x[i]>>y[i]>>z[i];
    x[i]--; y[i]--;
    z[i] %= 2;
  }
  UnionFind uf(n);
  rep(i, m) {
    uf.merge(x[i], y[i]);
  }
  set<ll> st;
  rep(i, n) {
    st.insert(uf.root(i));
  }
  cout << st.size() << endl;

  return 0;
}


Measured memory_bytes: 10572
from collections import deque

s = list(input())
s = deque(s)
q = int(input())
flag = ''
count = 0
for i in range(q):
    que = list(map(str,input().split()))
    if que[0] == "1":
        count += 1
        if flag == 'one':
          flag = ''
        else:
          flag = 'one'
    else:
        if que[1] == '1':
            if flag == 'one':
                s.append(que[2])
            else:
                s.appendleft(que[2])
        elif que[1] == '2':
            if flag == 'one':
                s.appendleft(que[2])
            else:
                s.append(que[2])
if count % 2 == 0:
  for i in s:
    print(i,end="")
else:
  for i in reversed(s):
    print(i,end="")
        


Measured memory_bytes: 7908
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[3], ans = 0;
    scanf("%d %d %d", &a[0], &a[1], &a[2]);
    sort(a, a + 3);
    if ((a[1] - a[0]) & 1){
        ans += (a[1] - a[0] + 1) / 2;
        ++a[2];
        a[0] += ans * 2;
        ++ans;
    }else{
        ans += (a[1] - a[0] + 1) / 2;
        a[0] += ans * 2;
    }
    ans += a[2] - a[0];
    printf("%d\n", ans);
    return 0;
}


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

typedef long double ld;

const ld EPS = 1e-9;
const ld INF = 1e10;
const ld PI = M_PI;

struct Point{
  ld x, y;
  Point(ld x, ld y):x(x), y(y){}
  Point(){}
};

Point operator+(const Point &a, const Point &b){
  return Point(a.x + b.x, a.y + b.y);
}
Point operator-(const Point &a, const Point &b){
  return Point(a.x - b.x, a.y - b.y);
}
Point operator*(const Point &a, const ld b){
  return Point(a.x * b, a.y * b);
}
Point operator*(const Point &a, const Point &b){
  return Point(a.x*b.x-a.y*b.y, a.x*b.y+a.y*b.x);
}
Point operator/(const Point &a, const ld b){
  return Point(a.x / b, a.y / b);
}

bool operator<(const Point &a, const Point &b){
  return make_pair(a.x, a.y) < make_pair(b.x, b.y);
}
bool operator==(const Point &a, const Point &b){
  return a.x == b.x && a.y == b.y;
}

ld cross(const Point &a, const Point &b){
  return a.x*b.y - a.y*b.x;
}

ld dot(const Point &a, const Point &b){
  return a.x*b.x + a.y*b.y;
}

ld norm(const Point &a){
  return dot(a, a);
}

struct Line:vector<Point>{
  Line(Point a = Point(0, 0), Point b = Point(0, 0)){
    this->push_back(a);
    this->push_back(b);
  }
};

typedef vector<Point> Polygon;

int ccw(Point a, Point b, Point c){
  b = b - a;
  c = c - a;
  if(cross(b, c) > EPS) return +1; // 反時計周り
  if(cross(b, c) < -EPS) return -1; // 時計周り
  if(dot(b, c) < 0) return +2; // c -- a -- b がこの順番に一直線上
  if(norm(b) < norm(c)) return -2; // a -- b -- c がこの順番に一直線上
  return 0; // a -- c -- b が一直線上
}

Point next(const Polygon &a, int x){
  return a[(x+1)%a.size()];
}

Point prev(const Polygon &a, int x){
  return a[(x-1+a.size()) % a.size()];
}

bool eq(ld a,ld b){ return abs(a-b) < EPS; }

bool compare(const Point &a, const Point &b){
  if(eq(a.y, b.y)) return a.x < b.x;
  return a.y < b.y;
}

Polygon convex_hull(Polygon ps){
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end(), compare);
  Polygon ch(2*n);
  for(int i = 0 ; i < n ; i++){
    while(k > 1 && ccw(ch[k-2], ch[k-1], ps[i]) == -1) --k;    
    ch[k++] = ps[i];
  }
  int t = k;
  for(int i = n-2 ; i >= 0 ; i--){
    while(k > t && ccw(ch[k-2], ch[k-1], ps[i]) == -1) --k;
    ch[k++] = ps[i];
  }
  ch.resize(k-1);
  return ch;
}


int main(){
  int q;
  cin >> q;
  Polygon poly;
  while(q--){
    Point p;
    double x, y;
    scanf("%lf %lf", &x, &y);
    poly.push_back(Point(x, y));
  }
  
  Polygon ans = convex_hull(poly);
  cout << ans.size() << endl;
  for(int i = 0 ; i < (int)ans.size() ; i++){
    printf("%.0Lf %.0Lf\n", ans[i].x, ans[i].y);
  }
  
  return 0;
}

Measured memory_bytes: 14264
#include <iostream>
#include <string>

int main() {
	std::string str;
	std::cin>>str;
	int len=str.length();
	bool f=1;
	for(int i=0; i<len; i++) {
		int j=i+1;
		if(j%2) {
			if(str[i]=='L') {
				f=0;
				goto print_res;
			}
		}
		else {
			if(str[i]=='R') {
				f=0;
				goto print_res;
			}
		}
	}
print_res:
	std::cout<<(f?"Yes":"No")<<'\n';
	return 0;
}

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=1e9+7;
const int mod=1e9+7;
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define rep(i,n) for (int i=1;i<=(n);i++)
#define rep2(i,a,b) for (int i=(a);i<=(b);i++)

int main()
{
 	ios::sync_with_stdio(0); cin.tie(0);
 	int n,x,sum=0,min=inf;
 	cin>>n;
 	while (n--)
 	{
 		cin>>x;
 		sum+=x;
 		if ((x%10)&&x<min) min=x;
	}
	if (sum%10) cout<<sum <<endl;
	else if (min!=inf) cout<<sum-min<<endl;
	else cout<<0<<endl;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int list[][] = new int[3][3]; // 3*3の二次元配列
        // 二次元配列に値を格納
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                list[i][j] = Integer.parseInt(sc.next());
            }
        }
        int n = Integer.parseInt(sc.next());
        for (int i = 0, num = 0; i < n; i++) {
            // bの値
            num = Integer.parseInt(sc.next());
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 3; k++) {
                    // bと一致する値が二次元配列に存在する場合
                    if (list[j][k] == num) {
                        // 該当箇所を0に更新(当たりとして扱う)
                        list[j][k] = 0;
                    }
                }
            }
        }
        // 縦横斜め列のいずれか一列の要素が全て0の場合、ビンゴ達成
        if (checkBingoVertical(list) ||
                checkBingoParallel(list) ||
                checkBingoLeftUpToRightDown(list) ||
                checkBingoRightUpToLeftDown(list)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }

    // ビンゴの縦列
    private static boolean checkBingoVertical(int[][] plist) {
        int verticalsize = plist.length;
        int parallelsize = plist[0].length;
        HashSet<Integer> hs = new HashSet<>();
        for (int i = 0; i < verticalsize; i++) {
            hs.clear();
            hs.add(plist[0][i]);
            for (int j = 0; j < parallelsize; j++) {
                hs.add(plist[j][i]);
            }
            if (hs.size() == 1) {
                return true;
            }
        }
        return false;
    }

    // ビンゴの横列
    private static boolean checkBingoParallel(int[][] plist) {
        int verticalsize = plist.length;
        int parallelsize = plist[0].length;
        HashSet<Integer> hs = new HashSet<>();
        for (int i = 0; i < verticalsize; i++) {
            hs.clear();
            hs.add(plist[i][0]);
            for (int j = 0; j < parallelsize; j++) {
                hs.add(plist[i][j]);
            }
            if (hs.size() == 1) {
                return true;
            }
        }
        return false;
    }

    // ビンゴの斜め列(＼：左上から右下)
    private static boolean checkBingoLeftUpToRightDown(int[][] plist) {
        HashSet<Integer> hs = new HashSet<>();
        for (int i = 0, size = plist.length; i < size; i++) {
            hs.add(plist[i][i]);
        }
        // 1列全て0ならば、HashSetの要素は0のみ格納される
        if (hs.size() == 1) {
            return true;
        }
        return false;
    }

    // ビンゴの斜め列(／：右上から左下)
    private static boolean checkBingoRightUpToLeftDown(int[][] plist) {
        HashSet<Integer> hs = new HashSet<>();
        for (int i = 0, size = plist.length; i < size; i++) {
            hs.add(plist[i][size - 1 - i]);
        }
        if (hs.size() == 1) {
            return true;
        }
        return false;
    }

}


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

int main(void){
    string s;
    cin >> s;
    vector<char> ab(26, 0);
    for (int i = 0; i < s.size();i++){
        int num = s.at(i) - 'a';
        ab.at(num)++;
    }
    for (int i = 0; i < 26;i++){
        if(ab.at(i)==0){
            cout << (char)('a' +i)  << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
    }

Measured memory_bytes: 512
#codng utf-8
a,b,c,x,y=map(int,input().split())
ans=0

if x==y:
    ans+=min(a+b,2*c)*x
else:
    if x<y:
        ans+=min(a+b,2*c)*x
        ans+=min(b,2*c)*abs(y-x)
    else:
        ans+=min(a+b,2*c)*y
        ans+=min(a,2*c)*abs(y-x)

print(ans)

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

long long int N, a, b, i, j, p[168] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};

int main(){
    scanf("%lld", &N);
    b = 1;
    for(i : p){
        a = 1;
        j = i;
        while(j <= N){
            a += N / j;
            j *= i;
        }
        b *= a;
        b %= 1000000007;
    }
    cout << b << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache
import heapq

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

MOD = int(1e09) + 7

def main():
    N = cin.int()
    A = cin.mapInt()
    T = [0] * N
    for i in range(N): 
        T[A[i] - 1] = i + 1
    print(*T,sep =" ")
    return

if __name__ == "__main__":
    main()


Measured memory_bytes: 56244
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

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

	ll bef;
	cin >> bef;
	ll ans = 0;
	rep(i,1,n){
		ll t;
		cin >> t;
		if( t - bef < T ) ans += t - bef;
		else ans += T;
		bef = t;
	}

	ans += T;
	cout << ans << endl;
	ret 0;
}

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

#define dv(i) for (int c=0; c<(int)(i).size(); c++) cout<<(i)[c]<<(c==(int)(i).size()-1?"\n":" ")
#define da(i) for (int c=0; c<(int)(sizeof((i))/sizeof((i)[0])); c++) cout<<(i)[c]<<(c==(int)(sizeof((i))/sizeof((i)[0]))-1?"\n":" ")
#define ds(i) for (auto f: i) cout<<f<<"\n";
#define dm(i) for (auto f: i) cout<<f.first<<" "<<f.second<<"\n"
#define F0R(i,a,b) for (int i=a; i<(b); i++)
#define FOR(i,a) for (int i=0; i<(a); i++)
#define F0Rd(i,a,b) for (int i=(b)-1; i>=a; i--)
#define FORd(i,a) for (int i=(a)-1; i>=0; i--)

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

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

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

#define sz(x) (int) x.size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define alp(i) i,i + sizeof(i) / sizeof(i[0])
#define memp(i,x) std::memset(i, x, sizeof i)
#define fils(i,x) std::fill(all(i), x)
#define filp(i,x) std::fill(alp(i), x)
#define dr4 {0, 1, 0, -1}
#define dc4 {1, 0, -1, 0}
#define dr8 {-1, -1, -1, 0, 1, 1, 1, 0}
#define dc8 {-1, 0, 1, 1, 1, 0, -1, -1}
#define inBounds(a,b,c,d) (a >= 0 && a < c && b >= 0 && b < d)

string rem(string s) {if(s[s.size()-1]=='\r')s.erase(s.size()-1);return s;}
vector<string> split(string s, char delim) {replace(s.begin(),s.end(),delim,' ');stringstream ss(s); string buf;vector<string> v;while (ss>>buf) v.push_back(buf);return v;}

const int MOD = 1000000007;
const double EPS = 1e-6;

#ifndef KMPC
    const int MAXN = -1;
#else
    const int MAXN = -1;
#endif

inline vi ints(int x) { vi A(x); FOR(i,x) cin >> A[i]; return A; }
inline vl lls(int x) { vl A(x); FOR(i,x) cin >> A[i]; return A; }
inline vs strs(int x) { vs A(x); FOR(i,x) cin >> A[i]; return A; }

int tc() {


    return 0;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    
    ll A; ld B; cin >> A >> B;
    ll BB = B * 100 + 0.01;

    cout << A * BB / 100 << '\n';
 
    return 0;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
#define ll long long
#define debug(x) {cerr<<#x<<" = "<<(x)<<endl;}
#define M(x) memset(x,0,sizeof(x))
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    string s="ACL";
    int n;
    cin>>n;
    while(n--)
        cout<<s;
    return 0;
}


Measured memory_bytes: 3640
n,m = map(int,input().split())
abc = [list(map(int, input().split())) for i in range(m)]


d = [[0]*n for i in range(n)]
e = [[[-1]for j in range(n)] for i in range(n)]


for i in range(n):
    for j in range(n):
        if i!=j:
            d[i][j]=float('inf')


for i in range(m):
    d[abc[i][0]-1][abc[i][1]-1]=abc[i][2]
    d[abc[i][1]-1][abc[i][0]-1]=abc[i][2]
    e[abc[i][0]-1][abc[i][1]-1]=[i]
    e[abc[i][1]-1][abc[i][0]-1]=[i]


for i in range(n):
    for j in range(n):
        for k in range(n):
            if d[j][k]>d[j][i]+d[i][k]:
                d[j][k] = d[j][i]+d[i][k]
                e[j][k] = e[j][i]+e[i][k]


f = []

for i in range(n):
    for j in range(n):
        for k in range(len(e[i][j])):
            if e[i][j][k] not in f:
                f.append(e[i][j][k])

print(m-len(f)+1)

Measured memory_bytes: 7076
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class C
{
	public static void Main()	
	{
		int N = GetInt();
		int M = GetInt();
		int[,] graph = new int[N+1,N+1];
		for(int i = 0; i < M; i++)
		{
			int a = GetInt();
			int b = GetInt();
			graph[a,b] = 1;
			graph[b,a] = 1;
		}

		int ans = 0;
		int[] perm = new int[N-1];
		for(int i = 2; i <= N; i++)
			perm[i-2] = i;
		do
		{
			if(graph[1, perm[0]] == 0)
				continue;

			bool isOK = true;
			for(int i = 1; i <= N-2; i++)
			{
				if(graph[perm[i-1], perm[i]] == 0)
				{
					isOK = false;
					break;
				}
			}
			if(isOK)
				ans++;

		} while (nextPermutation(ref perm));

		Console.WriteLine(ans);
	}


	private static bool nextPermutation(ref int[] array)
	{
		int len = array.Length;
		int i = len - 2;
		while((i >= 0) && (array[i] > array[i + 1]))
			i--;
		if(i < 0)
			return false;

		int pivot = array[i];
		int j = i + 1;
		while((j < len - 1) && (array[j + 1] > pivot))
			j++;
		
		int tmp = array[i];
		array[i] = array[j];
		array[j] = tmp;
		
		Array.Reverse(array, i + 1, len - i - 1);

		return true;
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	int n,m,d;
	cin >> n >> m >> d;
	double ans = 1.0 * 2 * ( n - d ) * ( m - 1 ) / n / n;
	if(d==0) ans /= 2.0;
	cout<<setprecision(12)<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <math.h>

using namespace std;
#define ll long long

int main()
{
    //freopen("aa_input.txt", "r", stdin);
    ll a, b, c, d;
    cin>>b>>a>>c>>d;
    ll g = (c*d)/__gcd(c,d);
    ll cc = (a/c)-((b-1)/c);
    ll dd = (a/d)-((b-1)/d);
    ll gg = (a/g)-((b-1)/g);
    cout<<(a-b+1)-cc-dd+gg<<endl;
    
    return 0;
}
/*

riaadmorshed@gmail.com

*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
int n,m;
char s;
cin>>n>>s>>m;
if(s=='+'){
    cout<<n+m;
}
else
    cout<<n-m;



    return 0;
}


Measured memory_bytes: 3592
import math

n, m = map(int, input().split())

if abs(n-m) > 1:
    print(0)
elif n == m:
    print(2*math.factorial(n)*math.factorial(m) % (10**9+7))
else:
    print(math.factorial(n)*math.factorial(m) % (10**9+7))


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

using namespace std;

int main(int argc, const char *argv[]) {
  int k;
  vector<int> dis;
  vector<int> point(5);
  cin >> point[0] >> point[1] >> point[2] >> point[3] >> point[4] >> k;

  for(int i = 0; i < 5; i++){
    for (int j = i+1; j < 5; j++) {
      dis.push_back(abs(point[i] - point[j]));
    }
  }
  vector<int>::iterator iter = max_element(dis.begin(), dis.end());
  size_t index = distance(dis.begin(), iter);
  if(dis[index] > k){
    cout << ":(" << endl;
  }else{
    cout << "Yay!" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
X,Y,Z=input().split()
X=int(X)
Y=int(Y)
Z=int(Z)
def swap(a, b):
    temp = a
    a = b
    b = temp
    return a,b

X,Y= swap(X,Y)
X,Z= swap(X,Z)
print(X,Y,Z)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define deb(x) cout<<#x<<" : "<<x<<"\n";
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define deb_arr(a,n) {cout<<#a<<":";for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';}
#define deb_mat(dist,n,m) {cout<<#dist<<"\n";for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}}
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define all(a) (a).begin(),(a).end()
#define bs binary_search
#define sz size()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define clr fflush(stdout);
//#define clr cout.flush();
#define N 200001
#define fpr(i,a,b) for(int i=a;i<b;i++)
#define fdr(i,a,b) for(int i=a;i>b;i--)
#define repp(i,a,b,d) for(int i=a;i<b;i+=d)
#define repd(i,a,b,d) for(int i=a;i>b;i-=d)
#define LLMIN LLONG_MIN
#define LLMAX LLONG_MAX
#define AKASH_PATEL ios_base::sync_with_stdio(false);
#define SVNIT_SURAT cin.tie(NULL);cout.tie(NULL);
#define mset(x,a) memset(x,a,sizeof(x));
#define nl cout<<'\n';
#define print(c) cout<<c<<'\n';
#define setp(n) cout << fixed << setprecision(n)
#define take_arr(a,n) fpr(i,0,n) cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++) {cout<<a[i]<<" ";} cout<<'\n';
#define take_mat(mat,n,m) fpr(i,0,n) fpr(j,0,m) cin>>mat[i][j];
#define set_mat(mat,n,m,k) fpr(i,0,n) fpr(j,0,m) mat[i][j]=k;
#define print_mat(dist,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<dist[i][j]<<" ";}cout<<'\n';}
template< class T > bool inside(T a, T b, T c) { return a<=b && b<=c; }
template< class T > bool odd(T a) { return a&1; }
template< class T > bool even(T a) { return !(a&1); }
ll a,b,c,d;
ll n;
map <ll,ll> m;
ll fun(ll n)
{
    if(n==0)
    {
        return 0;
    }
    if(n==1)
    {
        return d;
    }
    if(m[n])
    {
        return m[n];
    }
    ll v[6];
    v[0]=(n/2)*2;
    v[1]=((n+1)/2)*2;
    v[2]=(n/3)*3;
    v[3]=((n+2)/3)*3;
    v[4]=(n/5)*5;
    v[5]=((n+4)/5)*5;
    ll res=1E18;
    if(res/n>=d)
    {
        res=n*d;
    }
    ll tp[6];
    tp[0]=abs(v[0]-n)*d+a+fun(v[0]/2);
    tp[1]=abs(v[1]-n)*d+a+fun(v[1]/2);
    tp[2]=abs(v[2]-n)*d+b+fun(v[2]/3);
    tp[3]=abs(v[3]-n)*d+b+fun(v[3]/3);
    tp[4]=abs(v[4]-n)*d+c+fun(v[4]/5);
    tp[5]=abs(v[5]-n)*d+c+fun(v[5]/5);
    return m[n]=min(*min_element(tp,tp+6),res);
}
int main()
{
//#ifndef ONLINE_JUDGE
//    freopen("../ip.txt", "r", stdin);
//    freopen("../op.txt", "w", stdout);
//#endif
    AKASH_PATEL;
    SVNIT_SURAT;
    int t=1;
    cin>>t;
    while(t--)
    {
        m.clear();
        cin>>n>>a>>b>>c>>d;
        cout<<fun(n)<<'\n';
    }
    return 0;
}





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

long long GCD(long long a, long long b){ // a < b
    long long temp;
    if(a > b) { temp = a; a = b; b = temp; }
    long long r;
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main(){
    long long A, B; cin >> A >> B;
    long long gcd = GCD(A, B);
    long long x = A * B;
    cout << x/gcd << endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  ll ans = 0;
  rep(i,s.size()){
    if(s[i]=='T') ans++;
    else {
      ll cnt = 1;
      i+=1;
      while(cnt){
        if(i == s.size()) break;
        if(s[i] == 'S') cnt++;
        else cnt--;
        i+=1;
      }
      i-=1;
      // cout<<i<<endl;
      // cout<<ans<<endl;
    ans += cnt;
    }
  }
  cout<<ans<<endl;

}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 720
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] food = new int[5];
        food[0] = Integer.parseInt(sc.nextLine());
        food[1] = Integer.parseInt(sc.nextLine());
        food[2] = Integer.parseInt(sc.nextLine());
        food[3] = Integer.parseInt(sc.nextLine());
        food[4] = Integer.parseInt(sc.nextLine());
        int[] food2 = new int[5];
        System.arraycopy(food,0,food2,0,food.length);
        int num = 0;
        int sum = 0;
        num = calc(food2);
        int mod = 0;
        for(int i = 0;i < 5;i++){
            mod = food[i] % 10;
            if (mod != 0) {
                food[i] = food[i] + (10 -mod);
            }
            sum = sum + food[i];
        }
        System.out.println(sum-num);
    }
    public static int calc(int[] ary) {
        int num = 9;
        int flg = 0;
        ary[0] = ary[0] % 10;
        ary[1] = ary[1] % 10;
        ary[2] = ary[2] % 10;
        ary[3] = ary[3] % 10;
        ary[4] = ary[4] % 10;
        for (int i = 0;i < 4;i++){
            if (ary[i] != 0){
                num = Math.min(num,ary[i]);
                flg = 1;
            }
        }
        if (flg == 0) {
            return 0;
        } else {
            return 10-num;
        }
    }
}


Measured memory_bytes: 22608
from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
t = [list(input()) for _ in range(h)]
d = deque([(Ch, Cw)])
d2 = deque()
ans = 0
a = [(1,0),(-1,0),(0,1),(0,-1)]
b = range(-2, 3)

while True:
  # 移動A
  while len(d) != 0:
    Th, Tw = d.popleft()
    d2.append((Th, Tw))
    if (Th,Tw) == (Dh, Dw):
      print(ans)
      exit()
    for i, j in a:
      _h,_w = Th + i, Tw + j
      _p = (_h, _w)
      if 0 <= _h < h and 0 <= _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
        d.append(_p)
        visited[_h][_w] = 1
  # 移動B
  ans += 1
  while len(d2) != 0:
    Th, Tw = d2.popleft()
    for i in b :
      for j in b :
        _h,_w = Th + i, Tw + j
        _p = (_h, _w)
        if 0 <= _h < h and 0 <=  _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
          d.append(_p)
          visited[_h][_w] = 1
  if len(d) == 0:
    print('-1')
    exit()


Measured memory_bytes: 133232
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
using namespace std;
using vi = vector<int>;

int main(void){
    int k;
    cin >> k;
    vi a(k+1);
    a[1] = 7%k;
    for(int i=2; i<=k; i++) a[i] = (a[i-1]*10+7)%k;
    for(int i=1; i<=k; i++)if(a[i]==0){
        cout << i << '\n';
        return 0;
    }
    cout << -1 << '\n';
    return 0;
}

Measured memory_bytes: 7232
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
	string str;
	int N, Q;

	cin >> N >> Q;
	cin >> str;

	vector<int> cnt(N);
	cnt.at(0) = 0;
	int appearCnt = 0;
	for (int i = 1; i < N; i++) {
		if (str[i - 1] == 'A' && str[i] == 'C') ++appearCnt;
		cnt[i] = appearCnt;
	}

	for (int q = 0; q < Q; ++q) {
		int left, right;

		cin >> left >> right;
		
		cout << cnt[right - 1] - cnt[left - 1] << "\n";
	}
	
	return 0;
}



Measured memory_bytes: 1408
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,K=MI()
    a=[[]for _ in range(N)]
    for i in range(N):
        a[i]=LI()
        
    def matDot(A,B,MOD):
        N,M,L = len(A),len(A[0]),len(B[0])
        
        res = [[0]*L for i in range(N)]

        for i in range(N):
            for j in range(L):
                s = 0
                for k in range(M):
                    s = (s + A[i][k]*B[k][j]) % MOD
                res[i][j] = s
        
        return res

    def matPow(A,x,MOD):
        N = len(A)
        res = [[0]*N for i in range(N)]
        
        for i in range(N):
            res[i][i] = 1
        
        for i in range(x.bit_length()):
            if (x>>i) & 1:
                res = matDot(res,A,MOD)
            A = matDot(A,A,MOD)
    
        return res
    
    to=matPow(a,K,mod)
    ans=0
    for i in range(N):
        for j in range(N):
            ans=(ans+to[i][j])%mod
    print(ans)
    
        

main()


Measured memory_bytes: 41452
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define vi vector<long long>
#define pi pair<long long, long long>
#define watch(x) cout << (#x) << " is " << (x) << endl; cout.flush()
#define endl '\n'
#define _ << ' '
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(min(a, d), min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(max(a, d), max(b, c))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e18+1;

string s;
int a[200001];
int aa[200001];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("B.txt", "r", stdin);
    #endif
    cin >> s;
    int n = s.length();
    for(int i=0; i<n;)
    {
        if(s[i]=='L'){ i++; continue; }
        int cur=0;
        while(s[i]=='R')
        {
            cur++;
            i++;
        }
        a[i-1]=cur;
    }
    for(int i=n-1; i>=0;)
    {
        if(s[i]=='R'){ i--; continue; }
        if(i==0) break;
        int cur=0;
        while(s[i]=='L')
        {
            cur++;
            i--;
        }
        a[i+1]=cur;
    }
    for(int i=0; i<n; i++)
    {
        if(a[i]!=0)
        {
            if(s[i]=='R')
            {
                if(a[i]%2==0)
                {
                    aa[i]+=a[i]/2;
                    aa[i+1]+=a[i]/2;
                }
                else
                {
                    aa[i+1]+=a[i]/2;
                    aa[i]+=a[i]/2+1;
                }
            }
            else
            {
                if(a[i]%2==0)
                {
                    aa[i]+=a[i]/2;
                    aa[i-1]+=a[i]/2;
                }
                else
                {
                    aa[i-1]+=a[i]/2;
                    aa[i]+=a[i]/2+1;
                }
                if(aa[i]!=a[i-1])
                {

                }
            }
        }
    }
    for(int i=0; i<n; i++) cout << aa[i] _;
    return 0;
}


Measured memory_bytes: 1488
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut av = vec![0i64; n];
    for i in 0..n - 1 {
        av[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    av[n - 1] = read(&mut stdin_lock, &mut buf, b'\n');

    let mut bv = vec![0i64; n];
    for i in 0..n {
        bv[i] = av[i] - (i as i64 + 1);
    }
    bv.sort();
    let m = if n % 2 == 0 {
        (bv[n / 2 - 1] + bv[n / 2]) / 2
    } else {
        bv[n / 2]
    };
    let mut ans = 0i64;
    for i in 0..n {
        ans += (av[i] - (m + (i as i64 + 1))).abs();
    }
    println!("{}", ans);
}


Measured memory_bytes: 8444
#include<stdio.h>

int main(){
    int D;
    scanf("%d",&D);
    if (D==25) {
        printf("Christmas\n");
    }
    else if(D==24) {
        printf("Christmas Eve\n");
    }
    else if(D==23) {
        printf("Christmas Eve Eve\n");
    }
    else if(D==22) {
        printf("Christmas Eve Eve Eve\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




int main(){

    int N;
    cin >> N;
    vvi a(N,vi(3));
    rep(i,N) rep(j,3) cin >> a[i][j];
    
    ve<vi> dp(N+1,vi(3,0));
    
    rep(i,N){
        
       rep(k,3){
            
           chmax(dp[i+1][k],max(dp[i][(k+1)%3]+a[i][(k+1)%3],dp[i][(k+2)%3]+a[i][(k+2)%3]));
            
        }
        
    }
    
    cout << max(dp[N][0],max(dp[N][1],dp[N][2])) << endl;
    
    

    return 0;
}


Measured memory_bytes: 11136
# dream dreamer erase eraser
# maerd remaerd esare resare
a = input()
a = a[::-1]



def aaa(a) :
  point = 0
  while point < len(a) :
    if a[point:point + 7] == 'remaerd' :
      point += 7
      continue
    elif a[point:point + 6] == 'resare' :
      point += 6
      continue
    elif a[point:point + 5] == 'maerd' or a[point:point + 5] == 'esare' :
      point += 5
      continue
    else :
      print("NO")
      return False
  print("YES")

aaa(a)

Measured memory_bytes: 3188
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

int main(void) {
	size_t N, M;
	size_t count[30];

	scanf("%zu %zu\n", &N, &M);
	for (size_t i = 0; i < M; i++) {
		count[i] = 0;
	}

	for (size_t row = 0; row < N; row++) {
		size_t K;

		scanf("%zu ", &K);

		for (size_t col = 0; col < K; col++) {
			size_t A;

			scanf("%zu", &A);
			if (col < K - 1) {
				scanf(" ");
			}
			else {
				if (row < N - 1) {
					scanf("\n");
				}
			}

			count[A - 1]++;
		}
	}

	size_t numMeals = 0;

	for (size_t i = 0; i < M; i++) {
		if (count[i] == N) {
			numMeals++;
		}
	}

	printf("%zu\n", numMeals);

	return 0;
}

Measured memory_bytes: 128
// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e15 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;

// int ans, n, m, q, A[15], B[15], C[15], D[15];
// map <deque <int>, int> M;

// int give(deque <int> v) {
//   int temp = 0;
//   for(int i = 1; i <= q; i++) {
//     if(v[B[i]-1]-v[A[i]-1] == C[i]) {
//       temp += D[i];
//     }
//   }
//   return temp;
// }

// void go(deque <int> v, int n) {
//     if(sz(v) == n) {
//       ans = max(ans, give(v));
//       return;
//     }
//     if(M[v]) return;
//     M[v] = 1;
//     for(int i = 1; i <= m; i++) {
//          if(i >= v.back() || v.empty()) {
//            v.pb(i); go(v, n);
//            v.pop_back();
//          }
//     }
// }

void solve() {
  int a, b, n;
  cin >> a >> b >> n;
  if(n < (b-1)) cout << (a*n)/b << '\n';
  else if(a <= b) cout << a-1 << '\n';
  else cout << a-(a+b-1)/b << '\n';
}

signed main() {
    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
    int t = 1; // cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }
}    


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[3],i;
    for(i=0;i<3;i++)
        cin>>a[i];
    sort(a,a+3);
    if(a[0]==5&&a[1]==5&&a[2]==7) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


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

using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;

    map<int, int> m;
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        sum += temp;
        m[temp] += 1;
    }

    int q;
    cin >> q;
    while (q--) {
        int a, b;
        cin >> a >> b;
        sum += (m[a] * (b - a));
        m[b] += m[a];
        m[a] = 0;
        cout << sum << "\n";
    }
}

Measured memory_bytes: 7964
#include <iostream>

int main(){
    int A, B, ans;
    std::cin >> A >> B;
    int max = A, min = B;
    if(max < min){
        max = B;
        min = A;
    }
    ans = max;
    max -= 1;
    if(max < min){
        max = min;
    }
    ans += max;

    std::cout << ans << std::endl;

    return 0;
}


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

#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)

using namespace std;

const int kInf = 1e18;

struct Ver {
  int S;
  int d;
};

int n,m,k;
int black_room[16];
int v[100][100];
int black_room_id[100];

int d[1<<16];

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

void Init(void) {
  rep(i,100) black_room_id[i] = -1;
}

void D_init (void) {
  rep(i,1<<m) {
    d[i] = -1;
  }
}

void PushQueue(int S, int dis, queue<Ver>& que) {
  rep (i,k) {
    int Snext = 0;
    rep (j,m) {
      if ((1 << j) & S) {
        int to = v[black_room[j]][i];
        if (black_room_id[to] < 0) continue;
        Snext = (Snext | (1 << black_room_id[to]));
      }
    }
    if (d[Snext] >= 0) {
      continue;
    }
    d[Snext] = dis;
    que.push((Ver){Snext,dis});
  }
}

void Solve(void) {
  D_init();
  queue<Ver> que;
  d[(1<<m)-1] = 0;
  que.push((Ver){(1<<m)-1, 0});

  while(!que.empty()) {
    Ver ver = que.front();
    que.pop();
    int S = ver.S;
    int d = ver.d;
    PushQueue(S, d+1, que);
  }
  cout << d[0] << endl;
}


signed main (void) {
  cin >> n >> m >> k; 
  Init();
  rep (i,m) {
    int d;
    cin >> d;
    d--;
    black_room_id[d] = i;
    black_room[i] = d;
  }
  rep (i,n) {
    rep (j,k) {
      cin >> v[i][j];
      v[i][j]--;
    }
  }
  Solve();
  return 0;
}


Measured memory_bytes: 4120