akhauriyash/Code-Regression huggingface dataset:
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}
#define DEBUG_VLL(vec) REP(i, vec.size()) cerr<<vec[i]<<(i==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vll a(n), b(n);
    priority_queue< P<ll, ll> > pq;
    REP(i, n) cin >> a[i];
    REP(i, n) {
        cin >> b[i];
        if (a[i] != b[i]) pq.push(make_pair(b[i], i));
    }
    ll ans = 0;
    while (!pq.empty()){
        P<ll, ll> q = pq.top(); pq.pop();
        if (b[(q.second-1+n)%n] + b[(q.second+1)%n] >= b[q.second]) {
            cout << -1 << '\n';
            return 0;
        }
        if ((b[q.second]-a[q.second])%(b[(q.second-1+n)%n] + b[(q.second+1)%n]) == 0) {
            ans += (b[q.second]-a[q.second]) / (b[(q.second-1+n)%n] + b[(q.second+1)%n]);
            b[q.second] = a[q.second];
            continue;
        }
        ans += b[q.second] / (b[(q.second-1+n)%n] + b[(q.second+1)%n]);
        b[q.second] %= (b[(q.second-1+n)%n] + b[(q.second+1)%n]);
        if (b[q.second] < a[q.second]) {
            cout << -1 << '\n';
            return 0;
        }
        pq.push(make_pair(b[q.second], q.second));
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 9584
import sys
import time

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def int_to_bits(x):
    return [ 1 if 2**i & x != 0 else 0 for i in range(60) ]

def inv(x, MOD):
    return pow(x, MOD-2, MOD)

start = time.time()

MOD = 10**9+7

debug = False

if debug:
    n = 30 * 10000
    A = list(range(n))
else:
    n,*A = get_all_int()

# ビットごとの出現回数 2**i
bits = [0] * 60

for a in A:
    for i in range(60):
        if 2**i & a != 0:
            bits[i] += 1

# log("bits:", bits)
# log("bits.", time.time() - start)

# ans = 0

ans = sum(( pow(2, i, MOD) * bits[i] * (n-bits[i]) for i in range(60))) % MOD

# for a in A:
#     # a_bits = [ 1 if 2**i & a != 0 else 0 for i in range(60) ]

#     for i in range(60):
#         ans += 2**i * abs(bits[i] - (1 if 2**i & a != 0 else 0) *n)

#     # a_dash = list(map(lambda a: a*(n-1), a_bits))

#     # log("a_dash", a_dash)

#     # bits_dash = [ bits[i] - a_bits[i] for i in range(60)]
#     # log("bits_dash", bits_dash)
#     # ans += sum( ( 2**i * abs(bits_dash[i]-2*a_dash[i])) for i in range(60) )

#     # ans += sum( ( 2**i * abs(bits[i]-2*a_dash[i])) for i in range(60) )

#     # for i in range(60):
#     #     ans = (ans + 2**i * abs(bits_dash[i] - a_dash[i])) % MOD
#     # log(a, ans)

# print(ans//2 % MOD)
print(ans)
# log("end.", time.time() - start)


Measured memory_bytes: 156168
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <numeric>

using namespace std;


void func()
{
	int N;
	cin >> N;
	uint32_t sum = 0;

	for (size_t i = 0; i < N; ++i)
	{
		uint32_t ai;
		cin >> ai;
		sum += ai;
	}

	cout << sum-N << endl;
}

int main() {

//	while(1)
		func();
	return 0;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = 1e9+7;
void no(){
    puts("NO");
    exit(0);
}
void yes(){
    puts("YES");
    exit(0);
}
int main(){
    int n;
    cin >> n;
    vector<ll> arr(n);
    ll sum = 0;
    for(int i = 0; i < n; ++i){
        cin >> arr[i];
        sum += arr[i];
    }
    ll one_time = (ll)n*(n+1)/2;
    if(sum%one_time!=0) no();
    ll times = sum/one_time;
//    cout << times << '\n';
    ll sum_times = 0;
    vector<ll> differences(n);
    for(int i = 0; i < n; ++i){
        differences[i] = -(arr[(i+1)%n]-arr[i]-times);
        if(differences[i]%n!=0 || differences[i] < 0)
            no();
        differences[i]/=n;
//        cout << differences[i] << ' ';
        sum_times += differences[i];
    }
//    cout << '\n';
    if(sum_times%n != times%n)
        no();
    yes();
}


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

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

  vector<ll> m(5);
  for (int i = 0; i < n; i++) {
    char f = s[i][0];
    switch (f) {
    case 'M':
      m[0]++;
      break;
    case 'A':
      m[1]++;
      break;
    case 'R':
      m[2]++;
      break;
    case 'C':
      m[3]++;
      break;
    case 'H':
      m[4]++;
      break;
    }
  }
  vector<ll> P = {0, 0, 0, 0, 0, 0, 1, 1, 1, 2};
  vector<ll> Q = {1, 1, 1, 2, 2, 3, 2, 2, 3, 3};
  vector<ll> R = {2, 3, 4, 3, 4, 4, 3, 4, 4, 4};
  ll sum       = 0;
  for (ll i = 0; i < 10; i++) {
    sum += (m[P[i]] * m[Q[i]] * m[R[i]]);
  }
  cout << sum << endl;
}

Measured memory_bytes: 6144
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        char[] s = sc.next().toCharArray();
        char[] d = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
        char[] t = new char[s.length];
        for (int i = 0 ; i < s.length ; i++) {
            for (int j = 0 ; j < 26 ; j++) {
                if (s[i] == d[j]) {
                    t[i] = d[(j + n) % 26];
                }
            }
        }

        for (int i = 0 ; i < s.length ; i++) {
            System.out.print(t[i]);
        }
        System.out.print("\n");

    }

}

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

const int MOD_CONST = 1000000007;

using namespace std;


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

	
	vector<long long> facto(n + k+1);
	vector<long long> inv_mod(n + k+1);
	vector<long long> inv_facto(n + k+1);

	facto[0] = 1;
	facto[1] = 1;
	inv_mod[0] = -1;
	inv_mod[1] =1;
	inv_facto[0] = 1;
	inv_facto[1] = 1;


	for (int i = 2; i <= n + k; i++) {
		facto[i] = (facto[i - 1] * i) % MOD_CONST;

		if (inv_mod[MOD_CONST %i] < 0) {
			inv_mod[i] = 1;
		}
		else {
			inv_mod[i] = (MOD_CONST - ((MOD_CONST / i)*inv_mod[MOD_CONST%i]) % MOD_CONST) % MOD_CONST;
		}

		if (inv_facto[i - 1]  < 0|| inv_mod[i] <0) {
			inv_facto[i] = -1;
		}
		else {
			inv_facto[i] = (inv_facto[i - 1] * inv_mod[i]) % MOD_CONST;
		}


	}

	for (int i = 1; i <= k; i++) {
		long long ans = 0;

		if (n - k +1>= i) {
			ans = (facto[n - k + 1] * inv_facto[i]) % MOD_CONST;
			ans = (ans * inv_facto[n - k + 1 -i]) % MOD_CONST;
		}

		ans = (ans * facto[k - 1]) % MOD_CONST;
		ans = (ans * inv_facto[i - 1]) % MOD_CONST;
		ans = (ans * inv_facto[k  - i]) % MOD_CONST;

		cout << ans << endl;
	}



}

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

int main(){
  string s;
  cin>>s;
  sort(s.begin(),s.end());
  if(s.at(0)==s.at(1)&&s.at(2)==s.at(3)&&s.at(0)!=s.at(2)){
    cout<< "Yes" <<endl;
  }
  else{
    cout <<"No" <<endl;
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int a;
            float b, c;
            //a = int.Parse(Console.ReadLine()); //標準入力
            string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
            b = float.Parse(str[0]);  //数値で受け取りたい場合は変換する
            c = float.Parse(str[1]);

            var d = (b + c) / 2.0f;

            int e = (int)(d + 0.5);

            Console.WriteLine("{0}",e);
            //Console.Write("改行なし a = {0} b = {1} c = {2}", a, b, c);//改行なし出力
            //Console.WriteLine("改行あり a = {0} b = {1} c = {2}", a, b, c);//改行付き出力
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
#include <string.h>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

char s[1234567];
vector<pair<char, int>>ss;

int main()
{
	scanf("%s", s);
	int lastsame = 1;
	char thlett = s[0];
	int n = strlen(s);
	for (int i = 1; i < n; ++i)
	{
		if (thlett != s[i])
		{
			ss.push_back(make_pair(thlett,lastsame));
			thlett = s[i];
			lastsame = 1;
		}
		else
		{
			++lastsame;
		}
	}
	ss.push_back(make_pair(thlett, lastsame));
	if (ss.size() < 3)return 0 * printf("0\n");
	int ans = 0;
	for (int j = 0; j < ss.size() - 2; ++j)
	{
		if (ss[j].first == 'J' && ss[j + 1].first == 'O' && ss[j + 2].first == 'I')
		{
			if (ss[j + 1].second <= min(ss[j].second, ss[j + 2].second))
			{
				ans = max(ans, ss[j + 1].second);
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 11656
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

#define rep(i, n) for(int i=0; i<(int)(n); i++)

using namespace std;

int main(){
    string str;
    cin >> str;
    int a, b, c;
    a = stoi(str);
    b = a % 100;
    c = a / 100;

    if (b >= 1 && b<= 12){
        if (c >= 1 && c <= 12){
            cout << "AMBIGUOUS" << endl;
        }else{
            cout << "YYMM" << endl;
        }
    }else{
        if (c >= 1 && c <= 12){
            cout << "MMYY" << endl;
        }else{
            cout << "NA" << endl;
        }
    }


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  int N;
  scanf("%d", &N);
  vector<int> b;
  for (int i = 0; i < N; ++i) {
    int input;
    scanf("%d", &input);
    b.PB(input);
  }
  vector<int> ans;

  while(!b.empty()){
    FORD(i,b.size()-1,0){
      if(b[i]==i+1){
        ans.PB(i+1);
        b.erase(b.begin()+i);
        goto hank;
      }
    }
    cout << -1 << endl;
    return 0;
    hank:;
  }

  reverse(ans.begin(),ans.end());
  FOR(i,0,N-1) cout << ans[i] << endl;



  



}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18

priority_queue<llint,vector<llint>,greater<llint>> que;
priority_queue<llint> q;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

llint k;
llint gcd(llint a, llint b){
  if (a<b){
      a ^= b;
      b ^= a;
      a ^= b;
  }
  return b ? gcd(b, a % b) : a;
}

void solve(){
	cin >>k;
	llint ans=0;
	for(llint i=1;i<=k;i++){
		ans+=gcd(i,i);
	}
	for(llint i=1;i<=k;i++){
		for(llint j=1;j<=k;j++){
			if(i==j)continue;
			else ans+=gcd(i,j)*3;
		}
	}
	for(llint i=1;i<=k;i++){
		for(llint j=1;j<=k;j++){
			if(i==j)continue;
			for(llint l=1;l<=k;l++){
				if(i==l || j==l)continue;
				else ans+=gcd(i,gcd(j,l));
			}
		}
	}
cout << ans << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n,k;
    cin >> n >> k;
    VI a(n);
    REP(i,0,n) cin >> a[i];
    vector<double> ru(n+1);
    REP(i,0,n) ru[i+1] = ru[i] + (1.0 * a[i] + 1) / 2;
    double maxv = 0;
    REP(i,k-1,n) {
        double sum = ru[i+1] - ru[i+1-k];
        maxv = max(maxv, sum);
    }
    //cout << 1.0 * (maxv + k) / 2 << endl;
    printf("%.06lf\n", maxv);
}

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

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
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; }
using Graph = vector<vector<int>>;
signed main(){
string a;
  cin>>a;
  int b=0;
  if(a.size()%2==0){
  rep(i,a.size()/2){
  if(a[i]!=a[a.size()-1-i])
    b++;
  }
    cout<<b;
  }
    else{
      rep(i,(a.size()-1)/2){
  if(a[i]!=a[a.size()-1-i])
    b++;
  }
    cout<<b;
    }
}


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

/// easy access -------------
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<int,int> pi;
typedef tuple<int, int, int> tp;
///-------------------------

int main()
{
    Phuong_; /// <3333
    int k;
    cin >> k;
    string s;
    cin >> s;
    if (s.length() > k)
    {
        for(int i=0; i<k; ++i) cout << s[i];
        cout << "...";
    } else cout << s;
    return 0;
}


Measured memory_bytes: 3624
#include <cstdio>

char matsubi(char S[]) {
    char ans = '\0';
    int i = 0;
    while (S[i] != '\0') {
        ans = S[i];
        i++;
    }
    return ans;
}

bool same_string(char S[], char T[]) {
    int i = 0;
    while (true) {
        if (S[i] != T[i]) return false;
        if (S[i] == '\0') return true;
        i++;
    }
}

int main()
{
    int N;
    char W[100][11];

    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%s", W[i]);
    }

    bool ans = true;
    for (int i = 1; i < N; i++) {
        if (W[i][0] != matsubi(W[i - 1])) {
            //            printf("debug: matsubi\n    %s %s\n", W[i], W[i-1]);
            ans = false;
        }
        for (int j = 0; j < i; j++) {
            if (same_string(W[i], W[j])) {
                //  printf("debug: same!\n");
                ans = false;
            }
        }
    }
    if (ans) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
        
}


Measured memory_bytes: 128
/**
 *   author: malviyanshiv
 *   created: 12 January 2019  09:41:47
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define MAX 100005

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

void fastscan(int &x){
    bool neg=false;
    register int c;
    x =0;
    c=getchar();
    if(c=='-'){
        neg = true;
        c=getchar();
    }
    for(;(c>47 && c<58);c=getchar())
        x = (x<<1) + (x<<3) +c -48;
    if(neg)
        x *=-1;
}

void optimizeIO(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

vector< vector<ll> > dp(MAX, vector<ll>(2, -1));
vector<bool> leaf(MAX, false);
vector<bool> vis(MAX, false);
vector< int > adj[MAX];

void dfs(int n){
	vis[n] = true;
	bool is_leaf = true;
	for(int ne: adj[n])
		if(!vis[ne]){
			is_leaf = false;
			dfs(ne);
		}
	if( is_leaf ){
		dp[n][0] = dp[n][1] = 1;
		leaf[n] = true;
	}
}

ll cal(int idx, int color, int par){
	ll &res = dp[idx][color];
	if( res != -1 )
		return res;
	res = 1;
	ll tres;
	for(int ne : adj[idx]){
		tres = 0;
		if( ne != par){
			tres = tres + cal(ne, 1-color, idx);
			if( color == 0 )
				tres = tres + cal(ne, color, idx);
			res = (res * tres)%MOD;
		}
	}
	return res;
}

int main(){
	optimizeIO();

	int n, a, b;
	cin >> n;
	REP(i, 0, n-1){
		cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}

	dfs(1);
	cout << (cal(1, 0, -1)+cal(1, 1, -1))%MOD << endl;
	/*REP(i, 1, n+1)
		cout << i << " " << leaf[i] << " " << dp[i][0] << " " << dp[i][1] << endl;*/
	
	return 0;
}

Measured memory_bytes: 18176
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

template <class T>void Sort(vector<T> & a) { sort(a.begin(), a.end()); }
template <class T>void ReSort(vector<T>& a) { sort(a.rbegin(), a.rend()); }
template <class T>void Reverse(vector<T>& a) { reverse(a.begin(), a.end()); }
template <class T>void Unique(vector<T>& a) { a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T>T Sum(vector<T> a, T init = 0) { return accumulate(a.begin(), a.end(), init); }

//INPUT//
void CINPUT() {}
template<class H, class ...T> void CINPUT(H&& h, T&& ...t) { cin >> h; CINPUT(forward<T>(t)...); }
#define in(...) int __VA_ARGS__; CINPUT(__VA_ARGS__);
#define In(T,...) T __VA_ARGS__; CINPUT(__VA_ARGS__);
#define Vin(T,name,n) int n; cin>>n; vector<T> name(n); rep(i,n)cin>>name[i];
#define VIn(T,name,n) vector<T> name(n); rep(i,n)cin>>name[i];
#define VIn2(T,name,name2,n) vector<T> name(n),name2(n); rep(i,n)cin>>name[i]>>name2[i];

//OUTPUT//
void print() { cout << endl; }
template <class H> void print(H&& h) { cout << h << endl; }
template <class H, class... T> void print(H&& h, T&& ... t) { cout << h << " "; print(forward<T>(t)...); }
template<class T>void out(T n) { cout << n << endl; }
template<class T>void out(vector<T> a, string sep = " ", string end = "\n") { for (int i = 0; i < (int)a.size(); ++i)cout << a[i] << (i == (int)a.size() - 1 ? end : sep); }
void yes(bool f) { puts(f ? "yes" : "no"); }
void Yes(bool f) { puts(f ? "Yes" : "No"); }
void YES(bool f) { puts(f ? "YES" : "NO"); }
void poss(bool f) { puts(f ? "possible" : "impossible"); }
void Poss(bool f) { puts(f ? "Possible" : "Impossible"); }
void POSS(bool f) { puts(f ? "POSSIBLE" : "IMPOSSIBLE"); }

int main() {
	in(a, b);
	out(a * b - a - b + 1);
}

Measured memory_bytes: 256
from operator import itemgetter
from bisect import bisect_right
import sys
input = sys.stdin.readline

n, d, a = map(int, input().split())
monster = [tuple(map(int, input().split())) for _ in range(n)]
monster.sort(key=itemgetter(0))
xx = [xi for xi, hi in monster]

# 尺取
d_range = [-1] * n
idx = 0
for i, (xi, hi) in enumerate(monster):
    while idx < n and xx[idx] - xi <= 2 * d:
        idx += 1
    d_range[i] = idx

ans = 0
imos = [0] * (n + 1)
for i, (xi, hi) in enumerate(monster):
    hi -= imos[i]
    if hi > 0:
        c = (hi + a - 1) // a
        ans += c
        idx = d_range[i]
        imos[i] += c * a
        imos[idx] -= c * a

    # update imos
    imos[i + 1] += imos[i]

print(ans)


Measured memory_bytes: 47408
import sys
sys.setrecursionlimit(10**7)

l=input()
n = len(l)
mod = 10**9+7

p3 = [1]
for _ in range(len(l)+5):
    p3.append((p3[-1]*3)%mod)

def dfs(k,f):
    if k == n:
        return 1
    if not f:
        return p3[n-k]
    if l[k] == "1":
        return (dfs(k+1,False)+dfs(k+1,True)*2)%mod
    else:
        return dfs(k+1,True)%mod

print(dfs(0,True))

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


int main()
{
  int n, m, k;
  cin >> n >> m >> k;
  vector<ll> cs_a(n + 1, 0), cs_b(m + 1, 0);
  rep(i, n)
  {
    int a;
    cin >> a;
    cs_a[i+1] = cs_a[i] + a;
  }
  rep(i, m)
  {
    int b;
    cin >> b;
    cs_b[i+1] = cs_b[i] + b;
  }
  int ans = 0;
  rep(i, n + 1)
  {
    if (cs_a[i] > k)
      break;
    int l = 0;
    int r = m + 1;
    while (l + 1 < r)
    {
      int mid = (l + r) / 2;
      if (cs_b[mid] <= k - cs_a[i])
        l = mid;
      else
        r = mid;
    }
    ans = max(ans, i + l);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6332
from collections import deque
import math


def main():
    n = int(input())
    if n == 1:
        print('a')
        return
    digits = deque()
    alpha = ord('a') - 1
    maxex = int(math.log(n-1, 26))
    ex = 1
    for ex in range(1, maxex + 2):
        bb = pow(26, ex - 1)
        aa = bb * 26
        rem = n % aa // bb
        n -= bb * rem
        if rem == 0:
            if n == 0:
                break
            rem += 26
            n -= aa
        digits.appendleft(chr(alpha + rem))

    [print(d, end='') for d in digits]
    print()


if __name__ == '__main__':
    main()


Measured memory_bytes: 9468
#include <bits/stdc++.h>
#define int long long
#define N 110
using namespace std;
const int INF = 1LL<<55;
int Max(int &a,int b){return a=max(a,b);}
int Min(int &a,int b){return a=min(a,b);}
struct dat{int cnt, num_door , dis;};
vector<int> G[N];
vector<int> rec;
vector<dat> A;

bool can_add_edge(int a,int b,int r){
  return A[a].cnt && A[b].cnt && A[a].dis - A[b].dis == r;
}

void add_edge(int a,int b){
  assert(A[a].cnt-- && A[b].cnt--);
  G[a].push_back(b);
  G[b].push_back(a);
  sort(G[a].begin(),G[a].end());
  sort(G[b].begin(),G[b].end());
}

void dfs(int idx,int num){
  if(idx >= (int)rec.size()) return;
  int pos = num;

  while(idx<(int)rec.size() && rec[idx]<0){
    for(int i=0;i<(int)A.size()-1;i++){
      if(!can_add_edge(i,pos,rec[idx])) continue;
      add_edge(i,pos);
      idx++;
      break;
    }
    while(pos && A[pos].cnt == 0) pos--;
  }
  if(idx >= (int)rec.size()) return;

  while(A[pos].cnt == 0) pos--;
  A.push_back((dat){rec[idx],rec[idx],A[pos].dis+1});
  add_edge(pos,num+1);
  dfs(idx+1,num+1);
}

signed main(){
  int q;
  cin>>q;
  while(q--){
    for(int i=0;i<N;i++) G[i].clear();    
    rec.clear();
    for(int a;cin>>a,a;)rec.push_back(a);

    A.clear();
    A.push_back((dat){rec[0],rec[0],0});
    dfs(1,0);

    for(int i=0;i<(int)A.size();i++){
      cout<<i+1;
      for(int a:G[i]) cout<<" "<<a+1;
      cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s1;
  cin >> s1;
  //文字が英小文字かどうか判定
if(s1[0] >= 'a' && s1[0] <= 'z'){
  cout << "a" << endl;

//文字が英大文字かどうか判定
}else if(s1[0] >= 'A' && s1[0] <= 'Z'){
  cout << "A" << endl;
}
}


Measured memory_bytes: 3624
import math

while 1:
    d, e = map(int, input().split())
    if d == 0:
        break

    ans = 10**9
    for x in range(d+1):
        y = d - x
        diff = abs(math.sqrt(x**2+y**2) - e)
        if diff < ans:
            ans = diff

    print(ans)



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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol a, b, c, d; cin >> a >> b >> c >> d;
    //lol k; cin >> k;
    /*
    vector<lol> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    */
    bool fl = true;
    while(fl)
    {
        c -= b;
        if(c <= 0)
        {
            fl = false;
            break;
        }
        a -= d;
        if(a <= 0)
        {
            fl = false;
            result = 1;
        }
    }

    if(!result)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3600
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define P pair<ll,ll>
#define fs first
#define sc second

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

int main(){
	const int N = 1000000;
	int n; cin >> n;
	vector<bool> av(N+1, true);
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	sort(all(a));
	a.push_back(0);
	//print(a);
	int ans = 0;
	rep(i,n){
		if(av[a[i]]){
			if(a[i] != a[i+1]){
			ans++;
			//cerr << i << endl;
			
			}
			for(int j=1; a[i]*j <= N; j++){
				//cerr << j << endl;
				av[a[i]*j] = false;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 4896
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int n,k;
    cin >> n >> k;
    vector<ll>a(n);
    rep(i,n)cin >> a[i];
    ll ans = 1LL << 60;
    for(int i = 0;i < 1 << n;i++){
        ll cnt = 0;
        ll tallest = 0;
        ll sum = 0;
        rep(j,n){
            if(1 & i >> j){
                cnt++;
                if(tallest >= a[j]){
                    tallest++;
                    sum += tallest - a[j];
                }
                
            }
            tallest = max(tallest,a[j]);
        }
        if(cnt >= k)ans = min(sum,ans);
        //cout << ans << endl;
    }
    int x = 0;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << '\n';
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) {
        std::cout << i << ' ';
        vdeb(da[i]);
    }
    std::cout << '\n';
}

template<typename T>
struct BIT{
    std::vector<T> li;
    int size;
    BIT (int n){
        li=std::vector<T>(n+1,0);
        size=n;
    }
    T sum (int i){
        assert(0 <= i && i < size);
        ++i;
        int s=0;
        while(i>0){
            s+=li[i];
            i-=i & -i;
        }
        return s;
    }
    void add(int i,T x){
        assert(0 <= i && i < size);
        ++i;
        while(i<=size){
            li[i]+=x;
            i+=i & -i;
        }
    }
    void deb() {
        rip(i,size,0) {
            if(i == size-1) printf("%d\n", sum(i));
            else printf("%d ", sum(i));
        }
    }
};

using namespace std;

int main() {
    int n, q; cin >> n >> q;
    vector<int> da(n);
    rip(i,n,0) cin >> da[i];
    vector<int> me(n+1,0);
    rip(i,n,0) {
        int tmp = da[i];
        da[i] = me[da[i]];
        me[tmp] = i+1;
    }
    vector<Pii> li(n+q*2);
    vector<int> kk(q);
    rip(i,n,0) li[i] = {i+1, da[i]};
    rip(i,q,0) {
        int l, r; cin >> l >> r;
        kk[i] = l;
        li[n+i*2] = {l, -i-1};
        li[n+i*2+1] = {r, 1100110+i};
    }
    // vdeb(da);
    sort(all(li));
    vector<int> ans(q);
    BIT<int> bt(n+3);
    rip(i,li.size(),0) {
        if(0 <= li[i].second && li[i].second <= n) {
            bt.add(li[i].second+1, 1);
            bt.add(li[i].first+1, -1);
            // printf("0 ");
        }
        else if(li[i].second < 0) {
            ans[-1-li[i].second] -= bt.sum(li[i].first);
            // printf("1 ");
        }
        else {
            int now = li[i].second - 1100110;
            ans[now] += bt.sum(kk[now]);
            // printf("2 ");
        }
        // bt.deb();
    }
    rip(i,q,0) {
        printf("%d\n", ans[i]);
    }
}

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

int main() {
    string S, T;
    
    cin >> S >> T;
    
    if(S.size() + 1 == T.size() && S == T.substr(0, S.size())){
        
        cout << "Yes";
    }else{
        cout << "No";
    }
    
    return 0;
    
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
using namespace std;

template<typename T>
void pop_front(vector<T>& vec) {
    if(!vec.empty())
    	vec.erase(vec.begin());
}

int main() {
	vector<char> A;
	vector<char> B;
	vector<char> C;
	string str1, str2, str3;
	getline(cin, str1);
	getline(cin, str2);
	getline(cin, str3);

	for (int i=0; i<str1.length(); i++) {
		A.push_back(str1[i]);
	}

	for (int i=0; i<str2.length(); i++) {
		B.push_back(str2[i]);
	}

	for (int i=0; i<str3.length(); i++) {
		C.push_back(str3[i]);
	}

	char prev = '_';
	int winner = -1;
	while (prev!='E') {
		if (prev=='_' || prev=='a') {
			if (!A.empty())
				prev = A[0];
			else {
				winner = 0;
				prev = 'E';
			}
			pop_front(A);
		}
		else if (prev=='b') {
			if (!B.empty())
				prev = B[0];
			else {
				winner = 1;
				prev = 'E';
			}
			pop_front(B);
		}
		else if (prev=='c') {
			if (!C.empty())
				prev = C[0];
			else {
				winner = 2;
				prev = 'E';
			}
			pop_front(C);
		}
	}

	if (winner==0) cout << 'A' << endl;
	else if (winner==1) cout << 'B' << endl;
	else cout << 'C' << endl;
	return 0;
}

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

int main() {
    int w, h, n;
    cin >> w >> h >> n;
    int max1 = 0, min2 = w, max3 = 0, min4 = h;
    for (int i = 0; i < n; i++) {
        int x, y, a;
        cin >> x >> y >> a;
        if (a == 1) max1 = max(max1, x);
        else if (a == 2) min2 = min(min2, x);
        else if (a == 3) max3 = max(max3, y);
        else min4 = min(min4, y);
    }

    int wide = max(0, min2 - max1), hight = max(0, min4 - max3);
    cout << hight * wide << endl;
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    string A, B, C, a, b; cin >> A >> B >> C;
    if (A[A.size()-1] == B[0] and B[B.size()-1] == C[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int main()
{
    int n,m,ans=0;
    cin >> n>>m;
    bool connect[8][8];
    m0(connect);
    
    for(int i = 0; i < m; i++)
    {
        int a,b;
        cin >> a>>b;
        a--;
        b--;
        connect[a][b]=true;
        connect[b][a]=true;
    }

    vector<int> v(n);
    
    for(int i = 0; i < n; i++)
    {
        v.at(i)=i;
    }
    
    do
    {
        if(v.at(0)!=0)
        {
            break;
        }
        bool ok = true;
        
        for(int i = 0; i < n-1; i++)
        {
            if(connect[v.at(i)][v.at(i+1)]== false)
            {
                ok = false;
                break;
            }
        }
        if(ok)
        {
            ans++;
        }
    }while(next_permutation(all(v)));
    

    cout << ans<<endl;

    return 0;
}

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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());


signed main()
{
    gearup;
    string s1,s2,s3; cin >> s1 >> s2 >> s3;
    cout << (char)toupper(s1[0]) << (char)toupper(s2[0]) << (char)toupper(s3[0]) << endl;
}

Measured memory_bytes: 3564
#include <stdio.h>
int main()
{
	char str[1001], meirei[10], p[1001], c;
	int q, i, j, k, a, b;
	scanf("%s", str);
	scanf("%d", &q);
	for(i=0; i<q; i++){
		scanf("%s", meirei);
		if(strcmp(meirei, "print")==0){
			scanf("%d %d", &a, &b);
			for(j=a; j<b+1; j++){
			printf("%c", str[j]);
			}
			printf("\n");
		} else if(strcmp(meirei, "reverse")==0){
			scanf("%d %d", &a, &b);
			for(j=0; j<b-a; j++){
				for(k=b-j; k>a; k--){
					c=str[a];
					str[a]=str[k];
					str[k]=c;
				}
			}
		} else if(strcmp(meirei, "replace")==0){
			scanf("%d %d %s", &a, &b, p);
			for(j=0; j<b-a+1; j++){
				c=str[a+j];
				str[a+j]=p[j];
			}
		}
	}
	return 0;
}


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

int main() {
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
    if((e-a) <= k){
        cout << "Yay!" << endl;
    }
    else{
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<set>
#include<functional>
#include<list>
#include<bitset>
#include<numeric>
#include<utility>
#define INF (int)1e9
#define MOD 1000000007
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> p;
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	vector<ull> abc(s.size()+5),ab(s.size()+5),a(s.size()+5),d(s.size()+5);
	abc[0]=0; // index0は始まる前
	ab[0]=0;
	a[0]=0;
	d[0]=1;
	
	for(int i=0;i<s.size();i++){
		if (s[i] == '?') {
			a[i + 1] = (3*a[i] + d[i])%MOD;
			ab[i + 1] = (3*ab[i] + a[i])%MOD;
			abc[i + 1] = (3*abc[i] + ab[i])%MOD;
			d[i+1]=3*d[i]%MOD;
		}
		else if (s[i] == 'A') {
			a[i + 1] = (a[i] + d[i])%MOD;
			ab[i + 1] = ab[i];
			abc[i + 1] = abc[i];
			d[i+1]=d[i];
		}
		else if (s[i] == 'B') {
			a[i + 1] = a[i];
			ab[i + 1] = (ab[i] + a[i])%MOD;
			abc[i + 1] = abc[i];
			d[i+1]=d[i];
		}
		else {
			a[i + 1] = a[i];
			ab[i + 1] = ab[i];
			abc[i + 1] = (abc[i]+ab[i])%MOD;
			d[i+1]=d[i];
		}
	}
	// for (int i = 0; i <= s.size(); i++) {
	// 	cout << a[i] << " " << ab[i] << " " << abc[i] << endl;
	// }
	cout<<abc[s.size()];
	return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    rep(i,5){
        int x;
        cin >> x;
        if(x == 0){
            cout << i+1 << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3588
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var swr = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(swr);
            var c = char.Parse(Console.ReadLine());
            int code = (int)c;
            code++;
            c = (char)code;
            Console.WriteLine(c);
            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 11092
#include <cstdio>
#include <algorithm>
using namespace std;

int n, k, a[100010];

int gcd(int p, int q){
//	printf("%d %d\n", p, q);
	if(p % q == 0) return q;
	return gcd(q, p % q);
}

void solve(){
	for(int i=0; i<n; ++i)
		if(a[i] == k){
			printf("POSSIBLE\n");
			return;
		}
	if(a[n-1] < k){
		printf("IMPOSSIBLE\n");
		return;
	}
	int g = a[0];
	for(int i=1; i<n; ++i)
		g = gcd(g, a[i]);
	if(k % g == 0) printf("POSSIBLE\n");
	else printf("IMPOSSIBLE\n");
	return;
}

int main(){
	scanf("%d %d", &n, &k);
	for(int i=0; i<n; ++i) scanf("%d", &a[i]);
	sort(a, a+n);
	solve();
}

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


int main(){
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> vec(n);
    int ac = 0;
    int wa = 0;
    rep(i, m){
        int p;
        string s;
        cin >> p >> s;
        if (vec[p-1].first == 0){
            if (s == "AC"){
                vec[p-1].first = 1;
                ac++;
                wa += vec[p-1].second;
            }else if(s == "WA"){
                vec[p-1].second++;
            }
        }
    }
    
    cout << ac << " " << wa << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main() {
	int i, j, N, a, b, c, d, x, count = 0,ans = 0;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		x = i;
		for (j = 1; j <= 6; j++) {
			x = x /10;
			if (x > 0)
				count += 1;
		}
			if ((count + 1) % 2 == 1)
				ans += 1;
			count = 0;
	}
	printf("%d", ans);
	return 0;
}
	

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;
vector<int> G[MAX];
vector<int> dp(MAX,INF);
int ans[MAX],A[MAX];

void DFS(int u,int p,int maxi){
    
    for(int to:G[u]){
        if(to==p) continue;
        
        auto it=lower_bound(all(dp),A[to]);
        
        int a,b;
        
        if(it-dp.begin()>maxi){
            ans[to]=it-dp.begin();
        }else{
            ans[to]=maxi;
        }
        
        a=it-dp.begin();
        b=*it;
        dp[a]=A[to];
        
        DFS(to,u,ans[to]);
        
        dp[a]=b;
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    for(int i=0;i<N;i++) cin>>A[i];
    for(int i=0;i<N-1;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dp[0]=0;
    dp[1]=A[0];
    ans[0]=1;
    
    DFS(0,-1,1);
    
    for(int i=0;i<N;i++){
        cout<<ans[i]<<"\n";
    }
    
}


Measured memory_bytes: 30848
#include <stdio.h>

int main(void)
{
	int a;
	int sum;
	int i;
	
	sum = 0;
	for (i = 0; i < 4; i++){
		scanf("%d", &a);
		sum += a;
	}
	
	printf("%d\n%d\n", sum / 60, sum % 60);
	
	return (0);
}

Measured memory_bytes: 0
import copy
s=list(input())
if len(s)>=10 or len(s)<=3:
    print('NO')
else:
    n=len(s)
    cnt=''.join(s)
    ans=[cnt]
    for i in range(2**(n+1)):
        c=copy.deepcopy(s)
        cc=0
        #print(c)
        for j in range(n+1):
            if (i >> j) & 1:
                c.insert(j+cc,'A')
                cc+=1
        cnt=''.join(c)
        ans.append(cnt)
    if 'AKIHABARA'in ans:
        print('YES')
    else:
        print('NO')
    #print(ans)
    

Measured memory_bytes: 44124
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N; ll C;
ll X[int(1e5 + 5)], V[int(1e5 + 5)];
ll DPL[2][int(1e5 + 5)], DPR[2][int(1e5 + 5)];

int main(){
  scanf("%d%lld", &N, &C);
  for (int i = 1; i <= N; i++) {
    scanf("%lld%lld", X + i, V + i);
  }

  ll ans = 0, sum = 0;
  for (int i = 1; i <= N; i++){
    sum += V[i];
    DPR[0][i] = sum - X[i];
    DPR[1][i] = max(DPR[1][i - 1], sum - 2 * X[i]);
  }
  
  sum = 0;
  for (int i = N; i >= 1; i--){
    sum += V[i];
    DPL[0][i] = sum - (C - X[i]);
    DPL[1][i] = max(DPL[1][i + 1], sum - 2 * (C - X[i]));
  }

  for (int i = 1; i <= N; i++){
    ans = max(ans, DPR[0][i] + DPL[1][i + 1]);
  }
  for (int i = N; i >= 1; i--){
    ans = max(ans, DPL[0][i] + DPR[1][i - 1]);
  }

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

  return 0;
}


Measured memory_bytes: 8500
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
#include<numeric>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main() {
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  
  int64_t x, y, lcm, ans;
  x = b - (b/c) - (b/d);
  y = (a-1) - ((a-1)/c) - ((a-1)/d);
  lcm = c*d;
  
  if (c < d) {
    int64_t tmp = c;
    c = d;
    d = tmp;
  }
  int64_t r = c % d;
  while (r != 0) {
    c = d;
    d = r;
    r = c % d;
  }
  
  lcm /= d;
  x += (b/lcm);
  y += ((a-1)/lcm);
  ans = x - y;
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin >> a;
    int len = a.size();
    int i;
    int x = 0,y = 0,ans = 0;
    for(i = 0;i < len;i++){
        if (x == y){
            x++;
            if(a[i] == 'p') 
                ans--; 
        }
        else{
            y++;
            if (a[i] == 'g') 
                ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>

using namespace std;

int main(){
  long a,b;
  long d,r;
  double f;
  cin >>a >>b;
  d=a/b;
  r=a%b;
  f=1.0*a/b;
  printf("%d %d %.5lf\n",d,r,f);
}


Measured memory_bytes: 3200
#include<stdio.h>
#include<stdlib.h>
 
typedef struct{
    int r;
    int m;
    int k;
}Node;
 
void Preorder(int);
void Inorder(int);
void Postorder(int);
 
Node *node;
 
int main(void){
    int n,sd,rt;
    int i;
 
    scanf("%d",&n);
 
    node=(Node*)malloc(n*sizeof(Node));
 
    for(i=0;i<n;i++){
        node[i].r=-1;
        node[i].m=-1;
        node[i].k=-1;
    }
 
    for(i=0;i<n;i++){
        scanf("%d",&sd);
 
        scanf("%d",&node[sd].m);
        if(node[sd].m != -1) node[node[sd].m].r=sd;
 
        scanf("%d",&node[sd].k);
        if(node[sd].k != -1) node[node[sd].k].r=sd;
    }
 
    for(i=0;i<n;i++){
        if(node[i].r==-1) rt=i;
    }
 
    printf("Preorder\n");
    Preorder(rt);
    printf("\n");
 
    printf("Inorder\n");
    Inorder(rt);
    printf("\n");
 
    printf("Postorder\n");
    Postorder(rt);
    printf("\n");
 
    free(node);
 
    return 0;
}
 
void Preorder(int sd){
    printf(" %d",sd);
    if(node[sd].m != -1) Preorder(node[sd].m);
    if(node[sd].k != -1) Preorder(node[sd].k);
}
 
void Inorder(int sd){
    if(node[sd].m != -1) Inorder(node[sd].m);
    printf(" %d",sd);
    if(node[sd].k != -1) Inorder(node[sd].k);
}
 
void Postorder(int sd){
    if(node[sd].m != -1) Postorder(node[sd].m);
    if(node[sd].k != -1) Postorder(node[sd].k);
    printf(" %d",sd);
}



Measured memory_bytes: 2052