akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(x)-1; i >= (int)(n); i--)
#define INF 1e9
using ll = int64_t;
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 waru 1000000007

std::int64_t gcd(std::int64_t a, std::int64_t b) {
  // a >= b && b != 0
  std::int64_t c;
  do {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb) {
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0) {
    return -1;
  }
  do {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}
void rle(std::vector<std::pair<char, std::int64_t>> &data, std::string str) {
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++) {
    if (i == str.size()) {
      data.push_back(make_pair(str[i - 1], count));
      break;
    } else if (now != str[i]) {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return;
}

#define MAX_NUM 200001

void Main() {
  //自動整形防止用コメント
  int x, a, b;
  cin >> x >> a >> b;
  if (a - b >= 0)
  {
    std::cout << "delicious" << std::endl;
  } else if (x + a - b >= 0)
  {
    std::cout << "safe" << std::endl; 
  } else
  {
    std::cout << "dangerous" << std::endl;
  }

  return;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
    int N,X,Y; cin>>N>>X>>Y;

    vector<vector<int>> G(N+1);
    rep(i,N+1){
        if(i>=2){
            G.at(i).push_back(i-1);
        }
        if(i<N){
            G.at(i).push_back(i+1);
        }
    }
    G.at(X).push_back(Y);
    G.at(Y).push_back(X);
    
    vector<int> cost_list(N,0);



    for (int i = 1; i < N + 1; i++)
    { //i:start_position

        int start_pos = i;
        vector<int> cost_vec(N + 1, INT_MAX);
        //    cost_vec.at(start_pos) = 0;

        priority_queue<P, vector<P>, greater<P>> pq;
        pq.push(make_pair(0, start_pos));
        while (!pq.empty())
        {
            P next_pos = pq.top();
            pq.pop();
            int cost, position;
            tie(cost, position) = next_pos;

            if (cost_vec.at(position) < cost)
                continue;
            cost_vec.at(position) = cost;

            vector<int> next_candidates = G.at(position);
            for (int next_can : next_candidates)
            {
                int new_cost = cost + 1;
                if (cost_vec.at(next_can) < new_cost)
                    continue;
                pq.push(make_pair(new_cost, next_can));
            }
        }

        for(int j=1;j<N+1;j++){
            cost_list.at(cost_vec.at(j))++;
        }
    }
    for(int j=1;j<N;j++){
        cout<<cost_list.at(j)/2<<endl;
    }



}

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

string a[8] = {" ","SAT","FRI","THU","WED","TUE","MON","SUN"},day;

int main()
{
    cin>>day;
    for(int i = 1;i <= 7;i++)
    if(a[i] == day)
    {
        cout<<i;
        return 0;                
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )

const double PI = acosl(-1.0);


int main() {

	string n;
	string s[] = {"pon", "pon", "hon", "bon", "hon", "hon", "pon", "hon", "pon", "hon"};

	cin >> n;

	cout << s[n.back() - '0'] << endl;

	return 0;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

#define size(v) v.size()

template <class U, class C> struct ssp {
  struct edge {
    int to;
    U cap;
    C cost;
  };
  const U inf = numeric_limits<U>::max(), eps = 1e-10;
  int n, s, t;
  vector<edge> es;
  vector<vector<int>> g;
  vector<C> d;
  vector<int> pe;
  ssp(int _n, int _s, int _t) : n(_n), s(_s), t(_t), g(n), d(n), pe(n) {}
  void add(int from, int to, U cap, C cost) {
    g[from].push_back(size(es)), es.push_back({to, cap, cost});
    g[to].push_back(size(es)), es.push_back({from, 0, -cost});
  }
  bool spfa() {
    static vector<bool> in(n);
    static vector<int> que;
    fill(begin(d), end(d), numeric_limits<C>::max());
    que.clear();
    d[s] = 0, in[s] = true, que.push_back(s);
    for (int bg = 0; bg < (int)size(que); ) {
      int v = que[bg++];
      in[v] = false;
      for (int id : g[v]) {
        auto&& e = es[id];
        if (e.cap > eps and d[v] + e.cost < d[e.to]) {
          d[e.to] = d[v] + e.cost, pe[e.to] = id;
          if (not in[e.to]) in[e.to] = true, que.push_back(e.to);
        }
      }
    }
    return d[t] < numeric_limits<C>::max();
  }
  C min_cost_max_flow() {
    U flow = 0;
    C cost = 0, res = 0;
    while (spfa()) {
      U df = inf;
      for (int v = t; v != s; v = es[pe[v] ^ 1].to) df = min(df, es[pe[v]].cap);
      for (int v = t; v != s; v = es[pe[v] ^ 1].to)
        es[pe[v]].cap -= df, es[pe[v] ^ 1].cap += df;
      flow += df, cost += df * d[t];
      res = min(res, cost);
    }
    return res;
  }
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  auto v = a;
  v.insert(end(v), begin(b), end(b));
  sort(begin(v), end(v));
  v.erase(unique(begin(v), end(v)), end(v));
  auto zip = [&](int e) {
    return lower_bound(begin(v), end(v), e) - begin(v);
  };
  ssp<int, int> g(5 * n + 2, 5 * n, 5 * n + 1);
  for (int i = 0; i < n; ++i) {
    g.add(g.s, i, 1, 0);
    g.add(i, n + i, 1, 0);
    g.add(i, 2 * n + i, 1, 0);
    g.add(n + i, 3 * n + zip(b[i]), 1, -a[i]);
    g.add(2 * n + i, 3 * n + zip(a[i]), 1, -b[i]);
    g.add(3 * n + i, g.t, 1, 0);
    g.add(4 * n + i, g.t, 1, 0);
  }
  cout << -g.min_cost_max_flow() << '\n';
}



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

const int N = 110;
char s[N];

int main(){
	cin >> s;
	int length = strlen(s);
	int cnt = 0;
	for(int i = 0; i < length / 2; i++){
		if(s[i] != s[length - 1 - i])
			cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<deque>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
using ll=long long;

int n;
string s;

ll gcl(ll x,ll y){
    if(x<y) swap(x,y);
    while(y>0){
        ll t=x%y;
        x=y;
        y=t;
    }
    return x;
}

ll fac(int n){
    if(n==0||n==1) return 1;
    return n*fac(n-1);
}

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

    int count=0;
    rep(i,1,s.size()){
        if(s[i]!=s[i-1]) count++;
    }
    cout<<count<<endl;
}

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

int main() {
    int n;
    char S[105];
    cin >> n >> S;

    set<char> L, R;
    int cnt_max = 0;
    for (int i = 0; i <= n - 2; i++) {
        int cnt = 0;
        L.clear();
        R.clear();
        for (int j = 0; j <= i; j++) {
            L.insert(S[j]);
        }
        for (int j = i + 1; j <= n - 1; j++){
            R.insert(S[j]);
        }

        for (char c = 'a'; c <= 'z'; c++) {
            if (L.find(c) != L.end() && R.find(c) != R.end()) {
                cnt++;
            }
        }
        cnt_max = max(cnt, cnt_max);
    }

    cout << cnt_max << endl;

    return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MM 1000000007
using namespace std;

int main()
{
	int n;
	cin>>n;
	
	int arr[n],ans[n];
	
	memset(ans,0,sizeof(ans));
	for (int i=0;i<n-1;i++)
	cin>>arr[i];
	
	ans[0]=arr[0];
	
	for (int i=0;i<n-1;i++)
	{
		ans[i]=min(arr[i],ans[i]);
		ans[i+1]=max(arr[i],ans[i+1]);
	}
	
	//for (int i=0;i<n;i++)
	//cout<<ans[i]<<" ";
	
	int anss=0;
	for (int i=0;i<n;i++)
	anss+=(ans[i]);
	
	cout<<anss;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL); \
    cout.tie(NULL)
#define inc(x, y, i) for (int i = x; i <= y; i++)
#define dec(x, y, i) for (int i = x; i >= y; i--)
#define repeat(n) for (int i = 0; i<n;i++)

#define ll long long
#define ld long double
#define ull unsigned long long
#define infl LONG_MAX
#define infi INT_MAX
#define nl cout<<'\n'

#define all(v) v.begin(),v.end()
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define mkpr make_pair
#define pq priority_queue


void printAr(int a[],int n)  // print the array
{
    for(int *i = a; i!=a+n; ++i)cout << *i << " ";
    cout << endl;
}

const int N = 300+2;
//int a[N],cum[N];
int n,k,m;
int a[N][N] = {};
int main()
{
    fastio;
    cin >> n;
    int ac = 0,re = 0,tle = 0,wa = 0;
    string s;
    for(int i = 0;i < n;i++){
        cin >> s;
        if(s=="WA")wa++;
        else if(s=="AC")ac++;
        else if(s=="TLE")tle++;
        else if(s=="RE")re++;
    }
    cout << "AC x " << ac << endl;
    cout <<"WA x " << wa << endl;
    cout <<"TLE x " << tle << endl;
    cout <<"RE x " << re << endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a,b,tur=0,t; double sum;
cin>>a>>b; t=b;
while(b!=0){
b/=10;
tur++;
}
sum=a*pow(10,tur)+t;
if(sqrt(sum)-int(sqrt(sum))==0) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}

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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	int n;
	 cin >> n;
	 int p[n];
	 rep(i, 0, n) {
		 cin >> p[i];
		 p[i]--;
	 }

	 int cnt = 0;
	 if(p[0] == 0) {
		 swap(p[0], p[1]);
		 cnt++;
	 }

	 rep(i, 1, n - 1) {
		 if(i == p[i]) {
			 swap(p[i], p[i + 1]);
			 cnt++;
		 }
	 }
	 if(p[n - 1] == n - 1) cnt++;

	 cout << cnt << endl;

}


Measured memory_bytes: 640
from math import factorial
N = int(input())
A = list(map(int,input().split()))
t, j = float("INF"), -1
max_A = max(A)
A.remove(max_A)
for i in range(N-1):
  if abs(max_A//2 - A[i]) < t:
    t = abs(max_A//2 - A[i])
    j = i
print(max_A, A[j])

Measured memory_bytes: 14180
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    ll len = S.size();
    string sa, sb;
    REP(i, 0, len) {
        if (i & 1) {
            sa.push_back('0');
            sb.push_back('1');
        } else {
            sa.push_back('1');
            sb.push_back('0');
        }
    }
    ll ansa = 0, ansb = 0;
    REP(i, 0, len) {
        if (S[i] != sa[i]) {
            ansa++;
        }
        if (S[i] != sb[i]) {
            ansb++;
        }
    }
    cout << min(ansa, ansb) << endl;
}


Measured memory_bytes: 720
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
string a;
void solve()
{
    int len=a.length();
    //cout << len << endl;
    len--;
    if(len%2==1)
    {
        len--;
    }
    for(int i=len;i>=2;i-=2)
    {
        if(a.compare(0,i/2,a,i/2,i/2)==0)
        {
            int ans=i;
            cout << ans << endl;
            return ;
        }
    }
}
int main()
{
    cin>>a;
    solve();
    return 0;
}


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

int main(void) {
	int n, d;
	cin >> n >> d;
	vector<vector<int>> x(n, vector<int>(d));
	rep(i,n) {
		rep(j,d) cin >> x[i][j];
	}
	int ans = 0;
	rep(i,n)rep(j,i) {
		int sq = 0;
		rep(k,d) {
			int s = x[i][k] - x[j][k];
			sq += s*s;
		}
		int s = sqrt(sq) + 0.5;
		if (s*s == sq) ans++;
	}
	cout << ans << endl;
	return 0;
}


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

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

  int ans = 0;
  for (int i = 1; i <= n; i += 2) {
    int count = 0;
    for (int j = 1; j <= i; j++) {
      if (i % j == 0) {
        count++;
      }
    }
    if (count == 8) {
      ans++;
    }
  }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define TYPE int
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}

int main(void){
	int n=in();
	if(n/10==9||n%10==9)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 128
import glob


# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\158\\A'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):

        N = self.input_data()

        if "A" in N and "B" in N:
            print("Yes")
        else:
            print("No")


solver = Solver(REL_PATH)
solver.exec_resolve()


Measured memory_bytes: 4084
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

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

    int black = 0;
    int white = 0;
    int ba[n+1];
    int wa[n+1];
    int m = 1 << 30;
    for(int i = 0; i < n; i++){
        if(s[i] == '#'){
            black++;
        }
        ba[i] = black;
    }
    ba[n] = black;
    for(int i = n-1; i >= 0; i--){
        if(s[i] == '.'){
            white++;
        }
        wa[i] = white;
    }
    wa[n] = 0;
    for(int i = 1; i <= n; i++){
        cerr << m << endl;
        cerr << "(" << ba[i-1] << " " << wa[i] << ")" << endl;
        m = min(ba[i-1]+wa[i], m);
        if(ba[i-1]+wa[i] == n){
            m = min(m, wa[i]);
        }
    }
    if(black == n){
        m = 0;
    }

    cout << m << endl;
    
    return 0;
}


Measured memory_bytes: 2300
from decimal import Decimal, getcontext
getcontext().prec = 200
n, d, x = map(Decimal, input().split())
ans = 0
for i in range(1, int(n) + 1):
    i = Decimal(str(i))
    ans += Decimal(str((int(n) - int(i) + 1))) / Decimal(str(i)) * (d + x * Decimal(str(int(n) * 2 - 1)) / Decimal("2"))
print(ans)

Measured memory_bytes: 10048
import sys, random, math
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
    inf = 10 ** 20

#    t = int(input())
#    t, a, b = map(int, input().split())
    t = 1
    
    for _ in range(1, t+1):
    #    print("Case #{}: ".format(_), end = '')
        
        n = int(input())
        a, b = [0]*n, [0]*n
        for i in range(n):
            a[i], b[i] = map(int, input().split())
        
        a.sort()
        b.sort()
        
        if(n & 1):
            print(b[(n>>1)] - a[(n>>1)] + 1)
        else:
            l2, r2 = a[(n>>1)], b[(n>>1)]
            l1, r1 = a[(n>>1)-1], b[(n>>1)-1]
            
            print((r2-l2+1)+(r1-l1))
        
main()

Measured memory_bytes: 84532
from collections import deque


def isPalindrome(s):
    L = len(s)
    return all(s[i] == s[L - 1 - i] for i in range(L // 2))


N = int(input())
S = []
for _ in range(N):
    s, c = input().split()
    S.append((s, int(c)))

path = [dict() for _ in range(2)]
q = deque()
S.sort(key=lambda x: x[1])
for s, c in S:
    if s not in path[0] or path[0][s] > c:
        path[0][s] = c
        q.append((0, s, c))

INF = 10 ** 15
ans = INF
while q:
    side, s0, c0 = q.popleft()
    if isPalindrome(s0):
        ans = min(ans, c0)
    else:
        for s1, c1 in S:
            if side == 0:
                l, r = s0, s1
            else:
                l, r = s1, s0

            L = len(l)
            R = len(r)
            isCandidate = False
            if L > R:
                if all(l[i] == r[-1 - i] for i in range(R)):
                    ns = l[len(r):]
                    nc = c0 + c1
                    nside = 0
                    isCandidate |= True
            elif L < R:
                if all(l[i] == r[-1 - i] for i in range(L)):
                    ns = r[:-len(l)]
                    nc = c0 + c1
                    nside = 1
                    isCandidate |= True
            else:
                if all(l[i] == r[-1 - i] for i in range(L)):
                    ns = ''
                    nc = c0 + c1
                    nside = 0
                    isCandidate |= True
            if isCandidate and (ns not in path[nside] or path[nside][ns] > nc):
                path[nside][ns] = nc
                q.append((nside, ns, nc))
if ans < INF:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 75948
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgrammingContest_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var e = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long n = e[0], a = e[1], b = e[2];
            var X = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long ans = 0;
            for (int i = 0; i < X.Length - 1; i++)
            {
                long diff = X[i + 1] - X[i];
                if (diff * a <= b)
                {
                    ans += diff * a;
                }
                else
                {
                    ans += b;
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 14552
import math

N, D = map(int, input().split())
zahyo = []
for i in range(N):
    zahyo.append(list(map(int, input().split())))
    
ans = 0

for i in range(N):
    if(D >= math.sqrt(zahyo[i][0]**2+zahyo[i][1]**2)):
        ans += 1
print(ans)


Measured memory_bytes: 45380
N = gets.to_i
a = N.times.map{gets.split.map(&:to_i)}

INFTY = 1<<21
n = 100

@m = Array.new(n){Array.new(n){0}}
@d = Array.new(N){INFTY}

def bfs(s)
  q = []
  q.push(s)

  @d[s] = 0

  while !q.empty?
    u = q.shift

    (0...N).each do |v|
      next if @m[u][v] == 0
      next if @d[v] != INFTY

      @d[v] = @d[u] + 1
      q.push(v)
    end
  end

  (0...N).each do |i|
    puts "#{i + 1} #{@d[i] == INFTY ? -1 : @d[i]}"
  end
end

(0...N).each do |i|
  u, k = a[i][0], a[i][1]
  u -= 1

  (0...k).each do |j|
    v = a[i][j + 2]
    v -= 1

    @m[u][v] = 1
  end
end
bfs(0)


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

int main()
{
	int n;
	cin>>n;
	set<int> s;
    set<int>::iterator it;
	while(n--){
		int a;
		cin>>a;
		it=s.find(a);
		if(it!=s.end())
              s.erase(a);
		else s.insert(a);
	}
	int ans=0;
	for(int i=0;i<s.size();i++) ans++;
	cout<<ans<<endl;
}


Measured memory_bytes: 4864
n=int(input())
w=[[int(_) for _ in input().split()] for __ in range(n)]
w.sort(key=lambda x: x[1])
t=0
for i in range(n):
    t += w[i][0]
    if t > w[i][1]:
        print('No')
        break
else:
    print('Yes')

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

void printArray(int arr[], int N) {
    for (int i = 0; i < N; ++i) {
        if (i) cout << " ";
        cout << arr[i];
    }
    cout << endl;
}

void insertionSort(int arr[], int N) {
    for (int i = 0; i < N; ++i) {
        int tmp = arr[i];
        int j = i-1;
        while (j >= 0 && arr[j] > tmp) {
            arr[j+1] = arr[j];
            j--;
        }
        arr[j+1] = tmp;
        printArray(arr, N);
    }
}

int main() {
    int N; cin >> N;
    int arr[N];
    for (int i = 0; i < N; ++i) cin >> arr[i];

    insertionSort(arr, N);
    
    return 0;
}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {

fast();

{
  string s;
  cin>>s;
  sort(s.begin(),s.end());
  if(s[0]=='a'&&s[1]=='b'&&s[2]=='c')
  {
    Yes
  }
  else
  {
    No
  }
  
  

}
return 0;
}


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


ans = 10 ** 11
for  i in range(2 ** N):
    if bin(i).count("1") != K:
        continue
    max_height = 0
    height_num = 0
    for j in range(N):
        if i >> j & 1:
            if a[j] <= max_height:
                height_num += (max_height + 1 - a[j])
                max_height += 1
            else:
                max_height = a[j]
        else:
            max_height = max(max_height, a[j])
    ans = min(ans, height_num)

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <memory>

using namespace std;

struct node{
  int key;
  node *next;
  node *prev;
//  ~node(){cout << "[delete" << key << "]" << endl;}
};

void print_nodes(node *p){
  if(!p){
    cout << endl;
    return;
  }
  cout << p->key;
  node *q;
  if(q = p->next)
    while(auto r = q)
    {
      cout << " " << r->key;
      q = r->next;
    }
  cout << endl;
}

int main(){
  ios::sync_with_stdio(false);
  node *np;
  node *npl;
  np = nullptr; npl = nullptr;
  int n, key;
  string str;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> str;
    if(str == "insert"){
      cin >> key;
      node *p = new node();
      p->key = key;
      p->prev = nullptr;
      if(np == nullptr){
        p->next = nullptr;
        np = p;
        npl = p;
      } else{
        p->next = np;
        np->prev = p;
        np = p;
      }
    }else if(str == "delete"){
      cin >> key;
      node *search = np;
      for(;;){
        if(!search)
          break;
        if(search->key == key){
          if(np == npl){
            delete np;
            np = nullptr;
            npl = nullptr;
          }else{
            if(search != npl)
              search->next->prev = search->prev;
            else
              npl = npl->prev;
            if(search != np)
              search->prev->next = search->next;
            else
              np = np->next;
            delete search;
          }
          break;
        }
        search = search->next;
      }
    }else if(str == "deleteFirst"){
      if(np != npl){
        np = np->next;
        delete np->prev;
        np->prev = nullptr;
      }else{
        delete np;
        np = nullptr;
        npl = nullptr;
      }
    }else if(str == "deleteLast"){
      if(np != npl){
        npl = npl->prev;
        delete npl->next;
        npl->next = nullptr;
      } else{
        delete np;
        np = nullptr;
        npl = nullptr;
      }
    }
  }
  print_nodes(np);
  node* p = np;
  while(node* q = p){
    p = p->next;
    delete q;
  }
  return 0;
}

Measured memory_bytes: 32472
#include <bits/stdc++.h>
//using
using intl = long long;
using itnl = long long;//typo用
using uintl = unsigned long long;
using itn = int;//typo用
using ld = long double;
using namespace std;

//関数マクロ
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a) - 1; i >= (intl)(b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define debug(x) cout << #x << ":" << x << endl

//定数マクロ
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>

//定数
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = acos(-1);

//テンプレート関数
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; }
//intl gcd(intl a, intl b){ if(!b)return a; return gcd(b, a % b); } //c++17からある
//intl lcm(intl a,intl b){ return a / gcd(a, b) * b; } //c++17からある

//自作テンプレート関数
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}//Yes,Noの出力を楽にするよう
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}//上の関数のYes,Noを任意の文字列でできるようにしたもの
intl fact(intl k){ intl a = 1; for(int i = 2; i <= k; i++){ a *= i; } return a; }//k!を求める関数,O(N)
intl digit10(intl a){ intl b = 0; do{ a /= 10; b++; }while(a); return b; }//aを10進数で表したときの桁数を求める関数,O(logN)



signed main(){
    cout << fixed << setprecision(10);
    intl n;
    cin >> n;
    intl a[n];
    rep(i,n)cin >> a[i];
    sort(a, a + n);
    intl cnt = 1;
    if(!(n % 2)){
        for(intl i = 0; i < n - 1; i += 2){
            if(a[i] != a[i + 1]){
                cout << 0 << endl;
                return 0;
            }
            cnt *= 2;
            cnt %= MOD;
        }
    }
    else {
        if(a[0]){
            cout << 0 << endl;
            return 0;
        }
        for(intl i = 1; i < n - 1; i += 2){
            if(a[i] != a[i + 1]){
                cout << 0 << endl;
                return 0;
            }
            cnt *= 2;
            cnt %= MOD;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 4404
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
int main(){
	int a, b, c, d;;
	cin >> a >> b >> c >> d;
	a = a + b;
	b = c + d;
	if (a < b){
		cout << "Right" << endl;
	}
	if (a>b){
		cout << "Left" << endl;
	}
	if (a == b){
		cout << "Balanced" << endl;
	}
	return 0;
}


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


int main()
{
    int a, b, c, d, i=-1;
    cin>>a>>b>>c>>d;
    while(c>0 && a>0){
        i++;
        if(i%2==0){
            c -= b;
        }else{
            a -= d;
        }
    }
    if(i%2==0)  cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

const int mod = 1000000007;
auto func=[](ll i, ll j) { return abs(i) < abs(j); };

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  // プラスとマイナスに分ける
  vector<ll> ps;
  vector<ll> ms;
  for(auto v : a) {
    if(v >= 0) {
      ps.push_back(v);
    } else {
      ms.push_back(v);
    }
  }

  vector<ll> ans_vec;

  if(k == n) {
    for(auto v : a) {
      ans_vec.push_back(v);
    }
  }
  else if(ps.size() == 0 && k % 2 == 1) {
    sort(a.begin(), a.end(), func);
    rep(i, k) {
      ans_vec.push_back(a[i]);
    }
  }
  else {
    sort(ps.begin(), ps.end(), greater<ll>());
    sort(ms.begin(), ms.end(), less<ll>());

    int ps_cur = 0;
    int ms_cur = 0;
    while(ans_vec.size() < k) {
      ll p = -1;
      if(ps_cur+1<ps.size()) {
        p = ps[ps_cur] * ps[ps_cur+1];
      }
      ll m = -1;
      if(ms_cur+1<ms.size()) {
        m = ms[ms_cur] * ms[ms_cur+1];
      }
      if(p > m || ans_vec.size() + 1 == k) {
        ans_vec.push_back(ps[ps_cur]);
        ps_cur += 1;
      } else {
        ans_vec.push_back(ms[ms_cur]);
        ans_vec.push_back(ms[ms_cur+1]);
        ms_cur += 2;
      }
    }
  }

  ll ans = 1;
  for(auto v : ans_vec) {
    ans *= v;
    ans %= mod;
  }
  if(ans<0) {
    cout << ans + mod << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 9424
#include <bits/stdc++.h>
#define V 1007
#define E 100007
#define INF 1000000007
using namespace std;
int H,W,S,T,nodes,e,head[V],nxt[E],to[E],f[E],op[E],dis[V],cnt[V];
void add(int x,int y,int w){
	nxt[++e]=head[x],to[head[x]=e]=y,f[e]=w,op[e]=e+1;
	nxt[++e]=head[y],to[head[y]=e]=x,f[e]=0,op[e]=e-1;
}
int sap(int x,int delta){
	if(x==T)return delta;
	int sum=0,mindis=nodes;
	for(int i=head[x];i;i=nxt[i]){
		if(f[i] && dis[x]==dis[to[i]]+1){
			int save=sap(to[i],min(f[i],delta-sum));
			sum+=save,f[i]-=save,f[op[i]]+=save;
			if(dis[S]>=nodes || sum==delta)return sum;
		}
		if(f[i])mindis=min(mindis,dis[to[i]]);
	}
	if(!sum)
		if(!--cnt[dis[x]])dis[S]=nodes;
		else ++cnt[dis[x]=mindis+1];
	return sum;
}
int main(){
    scanf("%d%d",&H,&W);
    S=0,T=H+W+1,nodes=T+1;
    for(int i=1;i<=H;++i)
        for(int j=1;j<=W;++j){
            char c=getchar();
            while(c!='.' && c!='o' && c!='S' && c!='T')c=getchar();
            if(c=='o')add(i,H+j,1),add(H+j,i,1);
            if(c=='S')add(S,i,INF),add(S,H+j,INF);
            if(c=='T')add(i,T,INF),add(H+j,T,INF);
        }
    int flow=0;
    while(dis[S]<nodes)flow+=sap(S,INF);
    if(flow>=INF)puts("-1");
    else printf("%d\n",flow);
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
 
int main(void){
  int num;
  std::cin >> num;
  double money;
  std::string str;
  
  double sum = 0;
  for(int i = 0; i < num; i++){
    std::cin >> money >> str;
    if(str == "JPY")
      sum += money;
    else
      sum += money * 380000.0;
  }
  
  std::cout << sum;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int fact[10];
int N;
int D[120], A[120];
int dp[120][5040];

int f(std::list<int> &perm){
    int s = 0, k = 6, v = 0;

    for(int i : perm){
        v += fact[k] * (i - __builtin_popcount(s & ((1 << i) - 1)) - 1);
        s |= 1 << i;
        k -= 1;
    }

    return v;
}

int rec(int idx, std::list<int> order){
    if(idx == N + 7){
        return 0;
    }

    int fv = f(order);

    if(dp[idx][fv] >= 0){
        return dp[idx][fv];
    }

    int mx = 0;

    for(int i=0;i<=7;++i){
        int v = 0;

        auto it = order.begin();

        for(int j=0;j<7;++j){
            if(j < i){
                if(idx <= idx - *it + D[idx - *it]){
                    v += A[idx - *it];
                }
            }else{
                if(idx - *it >= 7 && idx - D[idx] <= idx - *it){
                    v += A[idx];
                }
            }
            
            std::advance(it, 1);
        }

        std::list<int> newOrder(order);
        std::transform(newOrder.begin(), newOrder.end(), newOrder.begin(), [](int n){return n + 1;});
        newOrder.insert(std::next(newOrder.begin(), i), 1);
        newOrder.remove(8);

        v += rec(idx + 1, newOrder);

        mx = std::max(mx, v);
    }

    return dp[idx][fv] = mx;
}

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

    fact[0] = 1;
    for(int i=1;i<=6;++i){
        fact[i] = i * fact[i - 1];
    }

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> D[i + 7];
    }

    for(int i=0;i<N;++i){
        std::cin >> A[i + 7];
    }

    std::list<int> order(7);
    std::iota(order.begin(), order.end(), 1);

    memset(dp, -1, sizeof(dp));

    int mx = rec(7, order);
    std::cout << mx << std::endl;
}



Measured memory_bytes: 5584
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;
 
vector<int> len;
vector<map<int, int> > value;
 
int dfs(string& s, int& k)
{
    if(isdigit(s[k])){
        int ret = 0;
        while(k < s.size() && isdigit(s[k])){
            ret *= 10;
            ret += s[k] - '0';
            ++ k;
        }
        return ret;
    }
 
    char c = s[k];
    k += 2;
    int a = dfs(s, k);
    ++ k;
 
    if(k < s.size() && s[k] == '='){
        ++ k;
        if(a == -1 || a >= len[c])
            return -1;
        else
            return value[c][a] = dfs(s, k);
    }else{
        if(a == -1 || value[c].find(a) == value[c].end())
            return -1;
        else
            return value[c][a];
    }
}
 
int substitute (string& s)
{
    char c=s[0];
    int k=2;
    int a=dfs(s,k);
    if(a==-1 || len[c]<=a) return -1;
  
    k += 2;
    int res=dfs(s,k);
    if(res == -1)
        return -1;
    value[c][a]=res;
    return 0;
}
 
int solve(vector<string>& s)
{
    len.assign(128, 0);
    value.assign(128, map<int, int>());
 
    int n = s.size();
    for(int i=0; i<n; ++i){
        if(s[i].find('=') == string::npos){
            int k = 2;
            len[s[i][0]] = dfs(s[i], k);
        }else{
            int k = 0;
            if(substitute(s[i]) == -1)
                return i + 1;
        }
    }
 
    return 0;
}
 
int main()
{
    for(;;){
        vector<string> s;
        for(;;){
            string t;
            cin >> t;
            if(t == ".")
                break;
            s.push_back(t);
        }
 
        if(s.empty())
            return 0;
 
        cout << solve(s) << endl;
    }
}

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

int main(){
  int N;
  cin >> N;
  int n = N % 10;
  
  if (n==2 || n==4 || n==5 || n==7 || n==9){
    cout << "hon" << endl;
  }
  else if (n==0 || n==1 || n==6 || n==8){
    cout << "pon" << endl;
  }
  else {
    cout << "bon" << endl;
  }
}

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

int len , K , sa[5005] , rk[5005] , he[5005] ;
int tp[5005] , buc[5005] ;
char ss[5005] ;

bool cmp( int *rk , int x , int y , int d ){
	return rk[x] != rk[y] || ( rk[x] == rk[y] && rk[x+d] != rk[y+d] ) ;
}

void Rsort( int *tp , int *rk , int M ){
	for( int i = 0 ; i <= M ; i ++ ) buc[i] = 0 ;
	for( int i = 1 ; i <= len ; i ++ ) buc[ rk[i] ] ++ ;
	for( int i = 1 ; i <= M ; i ++ ) buc[i] += buc[i-1] ;
	for( int i = len ; i ; i -- ) sa[ buc[rk[tp[i]]] -- ] = tp[i] ;
}

void getSA(){
	int *tp = ::tp , *rk = ::rk , m = 127 ;
	for( int i = 1 ; i <= len ; i ++ ) tp[i] = i , rk[i] = ss[i] ;
	Rsort( tp , rk , m ) ;
	for( int l = 1 , p = 0 ; ; l <<= 1 , p = 0 ){
		for( int i = len - l + 1 ; i <= len ; i ++ ) tp[++p] = i ;
		for( int i = 1 ; i <= len ; i ++ )
			if( sa[i] > l ) tp[++p] = sa[i] - l ;
		Rsort( tp , rk , m ) , swap( tp , rk ) , rk[ sa[1] ] = 1 ;
		for( int i = 2 ; i <= len ; i ++ )
			rk[ sa[i] ] = rk[ sa[i-1] ] + cmp( tp , sa[i] , sa[i-1] , l ) ;
		if( rk[ sa[len] ] == len ) break ;
		m = rk[ sa[len] ] ;
	} if( rk != ::rk ) memcpy( ::rk , rk , sizeof( rk ) ) ;
	for( int i = 1 , j , k = 0 ; i <= len ; he[rk[i]] = k , i ++ )
		for( k=k?k-1:k , j = sa[rk[i]-1] ; ss[i+k] == ss[j+k] ; k ++ ) ;
}

pair<int,int> Query( int K ){
	for( int i = 1 ; i <= len ; i ++ ){
		if( len - sa[i] - he[i] + 1 >= K )
			return make_pair( sa[i] , sa[i] + he[i] + K - 1 ) ;
		else K -= len - sa[i] - he[i] + 1 ;
	}
}

void solve(){
	len = strlen( ss + 1 ) ;
	getSA() ;
	pair<int,int> intval = Query( K ) ;
	for( int i = intval.first ; i <= intval.second ; i ++ )
		printf( "%c" , ss[i] ) ;
}

int main(){
	scanf( "%s%d" , ss + 1 , &K ) ;
	solve() ;
}


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

using namespace std;

int getArea(string str, vector<int> mp, int st, int ed, int wht) {

	float area = 0;

	for (int i = st; i < ed;i++) {
		int dp = min(mp[i], mp[i + 1]);
		float tmp = wht - dp;;

		if (mp[i] != mp[i + 1]) {
			tmp -= 0.5;
		}
		area += tmp;
	}

	int a = (int)area;
	return a;
}

int main() {

	string str = "";
	cin >> str;


	int  icnt = 0;
	vector<int> mp(str.length() + 1);
	vector<int> area;

	int ht = 0;
	for (int i = 0;i < str.length();i++) {

		if (str[i] == '\\') {
			mp[i] = ht;
			ht--;
		}
		else if (str[i] == '/') {
			mp[i] = ht;
			ht++;
		}
		else if (str[i] == '_') {

			mp[i] = ht;
		}
		icnt++;
	}
	mp[icnt] = ht;

	for (int i = 0;i < mp.size() - 1;i++) {
		if (mp[i] > mp[i + 1]) {
			for (int j = i + 1;j < mp.size();j++) {

				if (mp[i] == mp[j]) {
					area.push_back(getArea(str, mp, i, j, mp[i]));

					i = j - 1;
					break;
				}
			}
		}


	}


	string 	p = "";
	int isf = 0;
	int ttl = 0;
	for (int i = 0;i < area.size();i++) {
		if (isf++)	p += " ";
		p += to_string(area[i]);
		ttl += area[i];
	}

	if (p.size() > 0) p = " " + p;
	cout << ttl << endl;
	cout << area.size() << p << endl;

	return 0;
}



Measured memory_bytes: 3392
#include <bits/stdc++.h>
#include <unordered_map>
#define mem(ara, a) memset(ara, a, sizeof(ara))
#define fo freopen("output.txt", "w", stdout)
#define fi freopen("bruh.txt", "r", stdin)
#define int long long
#define sp " "
#define pb push_back
#define ff first
#define sz(x) x.size();
#define len(x) x.length();
#define ss second
#define vi vector<int>
#define double long double
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pii pair<int, int>


long long inf = 2e18;
long long minf = -inf;
int ans = 0;
using namespace std;

signed main() {
set<char >SET;
for (int i=0;i<3;i++){
char ch;
cin >> ch;
SET.insert(ch);
}
if (SET.size()==2){
    cout << "Yes" << endl;
}
else {
    cout << "No" << endl;
}

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    int n,x,y;
    cin>>n>>x>>y;
    int num[20000]={0};
    rep(i,n)for(int j=i+1;j<n;j++) num[min(j-i,abs(j+1-y)+abs(i+1-x)+1)]++;
    rep(i,n-1) cout<<num[i+1]<<"\n";
}

Measured memory_bytes: 384
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: i64,
        k: i64,
    }

    let mut cnt = 0;
    for i in 1..n+1 {
        let mut j = 1;
        while j <= n {
            let d = i / j;
            let y = i % j;

            if d == 0 {
                if i >= k {
                    cnt += max(n-i, 0);
                    // debug!(i, j, d, max(n-i, 0));
                }
                break;
            } else {
                if y == 0 {
                    if k == 0 { cnt += 1 }
                } else {
                    if y >= k {
                        cnt += 1 + (y-k)/d;
                        // debug!(i, j, d, 1 + (y-k)/d);
                    }
                }
                j = i/d + 1;
            }
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 4352
x, y = map(int, input().split())
s = 0
if x == 1:
    s += 300000
    if y == 1:
        s += 400000
elif x == 2:
    s += 200000
elif x == 3:
    s += 100000
else:
    pass

if y == 1:
    s += 300000
elif y == 2:
    s += 200000
elif y == 3:
    s += 100000

print(s)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){
    int a,b,c;
    int count = 0;
    cin>>a>>b>>c;
    for(int i = a;i<= b;i++){
        if(c % i == 0){
           count++; 
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3088
sx, sy, tx, ty = map(int,input().split())
x = tx - sx
y = ty - sy
s = ''
#一周目
s += 'R'*x
s += 'U'*y
s += 'L'*x
s += 'D'*y
#2周目
s += 'D'
s += 'R'*(x+1)
s += 'U'*(y+1)
s += 'L'
s += 'U'
s += 'L'*(x+1)
s += 'D'*(y+1)
s += 'R'
print(s)

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
int ok[213456];
signed main() {
	int n, m, a = 0, b = 0; string s; cin >> s;
	for (int h = 0; h < s.size(); h++) {
		if (s[h] == 'C')a = 1;
		if (s[h] == 'F' && a == 1)b = 1;
	}
	if (b == 1) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
using ll = long long;
int main() {
    ll n, m;
    cin>>n>>m;
    priority_queue<ll> L;
    priority_queue<ll, vector<ll>, greater<ll>> R;
    for(int i = 0; i < m; i++) {
        ll a, b;
        cin>>a>>b;
        L.push(a);
        R.push(b);
    }
    ll lmax = L.top();
    ll rmin = R.top();
    ll sub = max(rmin - lmax + 1, (ll)0);
    cout<<sub<<endl;

    return 0;
}

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

int main() {
    string s, t; cin >>s >>t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

    cout << ((s < t) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  int N; cin >> N;
  cout << N+N*N+N*N*N << endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc,char* argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a,b;cin>>a>>b;
    if(a>=0 and a<=9 and b<=9 and b>=0)
    cout<<a*b<<endl;
    else cout<< -1<<endl;

    return 0;
}

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

    ll ans=0;
    ll tmp=10;
    while(tmp<=n){
        ans+=n/tmp;
        tmp*=5;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256