akhauriyash/Code-Regression huggingface dataset:
h,w = map(int,input().split())
a = ''

for i in range(h):
    a += input()
from collections import Counter
c = Counter(a)

if h==1 or w==1:
    odd = 0
    for i in c:
        if c[i]%2==1:
            odd += 1
    print('Yes' if odd<=1 else 'No')
    exit()

x = h*(w%2)+w*(h%2)-(h*w)%2
y = 0
z = 0
for i in c:
    y += c[i]%4
    c[i] = c[i]%4
    if c[i]%2==1:
        z += 1

print('Yes' if y<=x and z<=1 else 'No')

Measured memory_bytes: 68092
#include <stdio.h>
#include <stdlib.h>

int desc(const void *a, const void *b)
{
	double x;
	int k;
	x = *(double *)b - *(double *)a;
	k = x > 0 ? +1 : -1;
	return k;
}

int main(void)
{
	int i, n;
	double v[1001];

	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%lf", &v[i]);
	}
	qsort(v, n, sizeof(double), desc);

	for (i = n - 1; i > 0; i--)
	{
		v[i - 1] = (v[i - 1] + v[i]) / (double)2;
		qsort(v, i, sizeof(double), desc);
	}
	printf("%lf\n", v[0]);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#define maxn 100000+10
using namespace std;
int f[maxn],ans[maxn],n,m,Q,x,y,z,head[maxn],g;
struct xx
{
	int v,next;
}b[maxn<<1];

struct yy
{
	int x,d,col;
}a[maxn];

void add(int u,int v)
{
	b[++g]=(xx){v,head[u]};
	head[u]=g;
}

void dfs(int x,int d,int col)
{
	if (f[x]>=d) return ;
	f[x]=d;
	if (d<=0)return ;
	if (!ans[x])ans[x]=col;
	for (int i=head[x];i;i=b[i].next)
	{
		int v=b[i].v;
		dfs(v,d-1,col);
	}
}

int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;++i)
	  scanf("%d%d",&x,&y),add(x,y),add(y,x);
	scanf("%d",&Q);
	for (int i=1;i<=Q;++i)
	  scanf("%d%d%d",&x,&y,&z),a[i]=(yy){x,y+1,z};
	for (int i=Q;i>=1;--i)
	  dfs(a[i].x,a[i].d,a[i].col);
	for (int i=1;i<=n;++i) printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 4480
/*input
abracadabra
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

int freq[26];

void solve(){
  	int n;
  	string s;
  	cin >> s;n = s.size();
  	s = "$"+s;
  	int ans = 0;
  	int dd = 0;
  	RE(i,n){
  		freq[s[i]-'a']++;
  	}
  	REP(i,26){
  		REP(j,i){
  			ans += freq[i]*freq[j];
  		}
  	}
  	cout << ans+1;

}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}

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

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	int x[3];
	x[0] = a; x[1] = b; x[2] = c;

	sort(x, x + 3, greater<int>());

	cout << x[0] * 10 + x[1] + x[2] << endl;

	return 0;
}


Measured memory_bytes: 256
import math
import sys
minint = -sys.maxint - 1
maxint = sys.maxint

n = int(raw_input())
a = []
m = [0]*2
mx, mx2, ind, ind2 = minint, minint, 0, 0
for i in range(n):
  v = int(raw_input())
  if v > mx:
    mx, ind = v, i
  elif v > mx2:
    mx2, ind2 = v, i
  a += [v]
for i in range(n):
  if i == ind:
    print(mx2)
  else:
    print(mx)

Measured memory_bytes: 16744
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
#include <tuple>
#include <string.h>
#include <map>
#include <iomanip>
#include <time.h>
using namespace std;
typedef long long ll;

int main() {
    ll n, a[100010], inf = 1e9 + 7;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];

    ll b[100010] = {}, ans = 1;
    b[0] = 3;
    for (int i = 0; i < n; i++) {
        b[a[i] + 1]++;
        ans *= b[a[i]]--;
        ans %= inf;
    }
    cout << ans << endl;

}

Measured memory_bytes: 1792
main :: IO()
main = do
 let givenList = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 k <- read <$> getLine :: IO Int
 print $ givenList !! (k - 1)

Measured memory_bytes: 3852
import math
a, b, C = map(float, input().split())
S = 0.5 * a * b * math.sin(math.radians(C))
L = a + b + (a**2 + b**2 - 2*a*b*math.cos(math.radians((C))) )**0.5
h = 2 * S / a

print(S)
print(L)
print(h)



Measured memory_bytes: 5700
time = 0

def dfs_visit(g, u):
    global time
    time += 1
    u[2] = time
    u[1] = 'g'

    for v in u[0]:
        ch = g[v]
        if ch[1] == 'w':
            ch[4] = u[5]
            dfs_visit(g, ch)
    u[1] = 'b'
    time += 1
    u[3] = time

n = int(input())

g = {}
s = 0
stack = []
for i in range(n):
    x = list(map(int, input().split()))
    g[x[0]] = [x[2:], 'w', 0, 0, None, x[0]]
    if i == 0:
        s = x[0]

for k, v in g.items():
    if v[1] == 'w':
        dfs_visit(g, v)


for i in range(n):
    node = g[i+1]
    print("{} {} {}".format(i+1, node[2], node[3]))

Measured memory_bytes: 7804
import java.util.*;
import static java.lang.System.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = Math.max(a*b, a+b);
		ans = Math.max(ans, a-b);
		out.println(ans);
	}
}

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

using namespace std;

typedef long double ld;

int main() {
  ld a, b, x, atheta, theta;
  cin >> a >> b >> x;
  atheta = (2 * b - 2 * x / a / a);
  if(atheta > b + 1e-8) {
    theta = b * b * a / 2 / x;
    theta = atan(theta) * 180 / M_PI;
  }
  else {
    theta = atan2(atheta, a) * 180 / M_PI;
  }
  cout << fixed << setprecision(10) << theta << '\n';
}


Measured memory_bytes: 256
h, w = map(int, input().split())
ans=(h//2)*(w//2)*2
if h==1 or w==1:
    print(1)
else:
    if h%2==1:
        ans+=w//2
    if w%2==1:
        ans+=h//2
    if h%2==1 and w%2==1:
        ans+=1
    print(ans)

Measured memory_bytes: 3060
def main():
    N = int(input())
    A = [input()[0] for i in range(N)]
    from collections import Counter
    from itertools import combinations
    c = Counter(A)
    d = ('M', 'A', 'R', 'C', 'H')
    ans = 0
    for (a1, a2, a3) in combinations(d, 3):
        ans += c[a1] * c[a2] * c[a3]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 83084
n=int(input())
a=[ii+1 for ii in range(n)]
b=[0]*n
b[:]=map(int,input().split())
import numpy as np
l=np.argsort(b)
"""
print(a)
print(b)
print(l)
"""
print(" ".join([str(a[l[ii]]) for ii in range(n)]))

Measured memory_bytes: 27904
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	void solve() {
		int N, X, Y;
		cin >> N >> X >> Y;
		if( X > Y ) { swap( X, Y ); }

		vector<int> ans(N);
		for( int i = 1; i <= N-1; ++i ) {
			for( int j = i+1; j <= N; ++j ) {
				int d = min( j-i, abs( X-i ) + 1 + abs( j-Y ) );
				ans[d] += 1;
			}
		}

		for( int i = 1; i < N; ++i ) {
			cout << ans[i] << '\n';
		}
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
  long n;
  cin >> n;
  int r;
  r = (int)sqrt(n) + 1;
  vector<vector<long>> v(1, vector<long>(3));
  v.at(0).at(0) = 1;
  v.at(0).at(1) = n;
  v.at(0).at(2) = 1 + n;
  for(int i = 1; i < r; i++){
    if(n % i == 0 && (i + n / i) < v.at(0).at(2) ){
      v.at(0).at(0) = i;
      v.at(0).at(1) = n / i;
      v.at(0).at(2) = i + n / i; 
    }
  }
  cout << v.at(0).at(2) - 2 << endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()

l = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]

Alice = l.index(A)
Bob = l.index(B)

if Alice > Bob:
	print("Alice")
elif Bob > Alice:
	print("Bob")
else:
	print("Draw")


Measured memory_bytes: 5144
#include <iostream>
#include <utility>
#include <vector>
#include <string.h>
#include <algorithm>

#define DEBUG

#define MAX 100000

using namespace std;


int main(void)
{
  int N;
  cin >> N;
  int a[N], b[N];
  
  //vector<piar<int, int> > v;
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i];
    //int a, b;
    //cin >> a >> b;
    //v.push_back(make_pair(a,b));
  }

  for (int i = N+1; i >= 2; i--) {
    int f = 0;
    for (int j = 0; j < N; j++) {
      if (a[j] <= i && i <= b[j])
	f++;
    }
    if (f >= i-1) {
      cout << i-1<< endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 3868
/*"Success isn't permanent, failure isn't fatal,
                                      it's the courage to continue that counts"*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=1e9+7;         
const int N=2e6+4;

int main()
{
	int k; string s;

	cin>>k>>s;

	if(s.size()>k)
	{
		s=s.substr(0,k); s+="...";
	}

	cout<<s;

	return 0;
}

Measured memory_bytes: 3632
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

int N;
long long int num[100000];
long long int sum;
long long int ans;
long long int box;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++)cin >> num[i];
	long long int odd = 0;
	long long int even = 0;
	for (int i = 0; i < N; i++) {
		if (i % 2) {
			odd += num[i];
			if (odd*-1 - even <= 0) {
				ans += even - odd*-1 + 1;
				odd -= (even - odd*-1 + 1);
			}
		}
		else {
			even += num[i];
			if (even - odd *-1 <= 0) {
				ans += odd*-1 - even + 1;
				even += odd*-1 - even + 1;
			}
		}
	}
	even = 0;
	odd = 0;
	for (int i = 0; i < N; i++) {
		if (i % 2) {
			odd += num[i];
			if (odd - even*-1 <= 0) {
				box += even*-1 - odd + 1;
				odd += even*-1 - odd + 1;
			}
		}
		else {
			even += num[i];
			if (even*-1 - odd <= 0) {
				box += odd - even*-1 + 1;
				even -= (odd - even*-1 + 1);
			}
		}
	}
	cout << min(ans, box) << endl;
	return 0;
}


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

int n;
ll a[55];

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	for(int i=0;i<n;++i) cin>>a[i];
	ll res=0;
	while(true){
		bool has=false;
		for(int i=0;i<n;++i) 
			if(a[i]>=n){
				has=true;
				ll dec=a[i]/n;
				a[i]%=n;
				for(int j=0;j<n;++j)
					if(i!=j) a[j]+=dec;
				res+=dec;
			}
		if(!has) break;
	}
	cout<<res<<'\n';
}




Measured memory_bytes: 3616
#include <algorithm>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int H, W, K;
vector<string> grid;
vector<vector<int>> cuts;

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

    cin >> H >> W >> K;
    grid.resize(H);

    for (string &row : grid)
        cin >> row;

    vector<int> previous(W, 0);
    bool first = true;
    int current = 0;

    for (string &row : grid) {
        vector<int> strawberries;

        for (int i = 0; i < W; i++)
            if (row[i] != '.')
                strawberries.push_back(i);

        if (strawberries.empty()) {
            cuts.push_back(previous);
            continue;
        }

        current++;
        int upper = current + strawberries.size() - 1;
        vector<int> cut(W, 0);

        for (int i = 0; i < W; i++) {
            cut[i] = current;

            if (row[i] != '.')
                current = min(current + 1, upper);
        }

        cuts.push_back(cut);

        if (first) {
            for (auto &prev_cut : cuts)
                prev_cut = cut;

            first = false;
        }

        previous = cut;
    }

    for (int h = 0; h < H; h++)
        for (int w = 0; w < W; w++)
            cout << cuts[h][w] << (w < W - 1 ? ' ' : '\n');
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(v) (v).begin(),(v).end()

using namespace std;

typedef pair<int,int>P;

struct edge{
    int u;	//?????????
    int v;	//??°??????
    int cost;	//??????
    //???????????????????????§?????§?°???¢????????????
    bool operator<(const edge& another) const {
        return cost < another.cost;
    }
};

const int MAX_N = 1002;
const int MAX_M = 10002;

int n,m;
edge es[MAX_M];
int par[MAX_N];
int rrank[MAX_N];

void initial(int n){		//?????????
	rep(i,n){
		par[i] = i;
		rrank[i] = 0;
	}
}

int find(int x){		//??¨??????????±???????
	if(par[x] == x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}

void unite(int x,int y){	//x???????????¨??¨y???????????¨?????????
	x = find(x);	//x???????????¨??????????????????x??¨??????
	y = find(y);	//y???????????¨??????????????????y??¨??????
	if(x == y) return;
	if(rrank[x] < rrank[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if(rrank[x] == rrank[y])
			rrank[x]++;
	}
}

bool same(int x,int y){	//x,y???????????¨???????????§?????????
	return find(x) == find(y);
}

P kruskal(int n,int m){
    vector<int> vec;
	initial(n);
	int res = 0;
	rep(i,m){
		edge e = es[i];
		if(!same(e.u,e.v)){
			unite(e.u,e.v);
            vec.push_back(e.cost);
			res += e.cost;
		}
	}
    if(vec.size() % 2 == 0){
        int hoge = vec.size() / 2 - 1;
        int sm = vec[hoge] + vec[hoge+1];
        if(sm % 2 == 0){
            return P(sm/2,0);
        }else{
            return P(sm/2,1);
        }
    }else{
        return P(vec[(vec.size()-1)/2],0);
    }
}

int main()
{
    while(1){
        scanf("%d%d",&n,&m);
        if(n == 0){
            break;
        }
        rep(i,m){
            int p,q,r;
            scanf("%d%d%d",&p,&q,&r);
            es[i] = (edge){p-1,q-1,r};
        }
        sort(es,es+m);
        P p = kruskal(n,m);
        if(p.second == 0){
            cout << p.first << "\n";
        }else{
            cout << p.first + 0.5 << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 3268
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;

int Judge(string &s){
	if(s[0] != '>') return -1;
	if(s.size() < 2) return -1;
	if(s[1] == '\''){
		if(s[s.size()-1] != '~') return -1;
		int len = sz(s) - 3;
		if(len < 3 || len % 2 == 0) return -1;
		FOR(i,(len-1)/2){
			if(s[2+i] != '=' || s[2+len/2+1+i] != '=') return -1;
		}
		if(s[2+len/2] != '#') return -1;
		return 0;
	} else if(s[1] == '^'){
		if(s[s.size()-1] != '~' || s[s.size()-2] != '~')return -1;
		int len = sz(s) - 4;
		if(len < 2 || len % 2 != 0) return -1;
		FOR(i,len/2){
			if(s[2+2*i] != 'Q' || s[2+2*i+1] != '=') return -1;
		}
			return 1;
	} else {
		return -1;
	}
}

int main(){
	int n; cin>>n;
	string out[] = {"NA","A","B"};
	FOR(i,n){
		string s; cin>>s;
		int a = Judge(s);
		cout << out[a+1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int i, j, k, l,m;
		Scanner sc = new Scanner(System.in);
		String[] sentence = sc.nextLine().split(" ");
		String str1,str2;
		str1=str2="";
		int[] cnt = new int[sentence.length];
		for(m = 0; m < sentence.length; m++){
			cnt[m] = 0;
		}
		for (i = 0; i < sentence.length; i++) {
			for (j = 0; j < sentence.length; j++) {
				if (sentence[j].equals(sentence[i])) {
					cnt[j]++;
				}
			}
		}
		int max = 0;
		for (k = 0; k < sentence.length; k++) {
			if (cnt[k] > max) {
				max = cnt[k];
				str1 = sentence[k];
			}
		}
		int longest = 0;
		for (l = 0; l < sentence.length; l++) {
			if (sentence[l].length() > longest) {
				longest = sentence[l].length();
				str2 = sentence[l];
			}
		}
		System.out.println(str1 + " " + str2);
	}
}

Measured memory_bytes: 18008
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> intpair;
typedef std::pair<long long, long long> llpair;

#define mod 1000000007
#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i, n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using namespace std;

ll gcdt(ll m, ll n) {
	ll g = 1;

	while (m != 0) {
		if (m < n) swap(m, n);

		if (m & 1) {
			if (n & 1) {
				m = (m - n) >> 1;
			}
			else {
				n = n >> 1;
			}
		}
		else {
			if (n & 1) {
				m = m >> 1;
			}
			else {
				n = n >> 1;
				m = m >> 1;
				g = g << 1;
			}
		}
	}

	return g * n;
}

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

	int n;
	cin >> n;
	ll* a;
	a = new ll[n];
	rep(i, n) cin >> a[i];

	ll* left;
	ll* right;
	left = new ll[n - 1];
	right = new ll[n - 1];

	left[0] = a[0];
	right[0] = a[n - 1];
	REP(i, 1, n - 1) {
		left[i] = gcdt(left[i - 1], a[i]);
		right[i] = gcdt(right[i - 1], a[n - 1 - i]);
	}

	ll ans = max(left[n - 2], right[n - 2]);

	REP(i, 1, n-1) {
		ans = max(ans, gcdt(left[i - 1], right[n - 2 - i]));
	}

	cout << ans << "\n";
 }


Measured memory_bytes: 2560
#include <iostream>
int main(){
  int a, b, c;
  int count=0;
  int x[10000];

  std::cin >> a >> b >> c;
  for(int i=a; i<=b; i++) {
    if( c % i == 0 ) {
      count++;
    }
  }
  std::cout << count << std::endl;
  return 0;
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll Q,H,S,D,N,ans;

int main(){
    cin >> Q >> H >> S >> D >> N;
    ll price1 = min(4*Q,min(2*H,S));
    ll price2 = min(2*price1,D);
    if(price2 > 2*price1) ans = price1*N;
    else ans = price2*(N/2) + price1*(N%2);
    cout << ans << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
using namespace std;
 
int main(){
    
    double N,ans;
    cin >> N;

    ans = ceil(N/111) * 111 ;
    
    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
import static java.lang.Math.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int x = in.nextInt(), a = in.nextInt(), b = in.nextInt();
			out.println(abs(x-a) < abs(x-b) ? "A" : "B");

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


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

using namespace std;

#define INF 1000000000
#define INFLL 0x3f3f3f3f3f3f3f3fLL 
#define EPS 10e-9
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define st first
#define nd second
#define sz(v) int(v.size())
#define all(X) (X).begin(), (X).end()
#define FOR(I, A, B) for(int I = A; I < B; I++)
#define RFOR(I, A, B) for(int I = A; I >= B; I--)

typedef long long ll;
typedef pair<ll,ll> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<iii> viii;
typedef vector<ll> vll;

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

ll poww(ll x, ll e){
	if(e == 0){
		return 1;
	}
	ll ans = poww(x, e/2);
	ans *= ans; ans %= MOD;
	if(e%2){
		ans *= x; ans %= MOD;
	}
	return ans;
}

ii norm(ii &x){
	if(x.st < 0){
		x.st *= -1;
		x.nd *= -1;
	} else if(x.st == 0){
		if(x.nd < 0) x.nd *= -1;
	}
	ll g = gcd(abs(x.st), abs(x.nd));
	x.st /= g;
	x.nd /= g;
	return x;
}

ii getRival(ii x){
	ii y = x;
	swap(y.st, y.nd);
	y.st *= -1;
	norm(y);
	return y;
}

bool isZero(ii x){
	return x.st == 0 && x.nd == 0;
}

ll soma(ll a, ll b){
	return (a+b)%MOD;
}
ll sub(ll a, ll b){
	a%=MOD;
	b%=MOD;
	a-=b;
	if(a < 0) a+=MOD;
	return a%MOD;
}

int main(){
	int n;
	scanf("%d", &n);
	vii sard(n);

	map<ii, ll> qnt;
	int contzeros = 0;
	for(int i = 0; i < n; i++){
		scanf("%lld %lld", &sard[i].st, &sard[i].nd);
		if(isZero(sard[i])){
			contzeros++;
		} else {
			norm(sard[i]);
			qnt[sard[i]] = 0;
			qnt[getRival(sard[i])] = 0;
		}
	}
	for(ii x:sard){
		if(!isZero(x)) qnt[x]++;
	}

	vii rivs;
	for(auto el : qnt){
		ii x = el.st;
		ll f = el.nd;
		if(f == 0) continue;
		ii rival = getRival(x);
		ii toput;
		toput.st = f;
		toput.nd = qnt[rival];
		qnt[rival] = 0;
		rivs.pb(toput);
	}

	ll ans = 1;
	for(ii x : rivs){
		ans *= sub(soma(poww(2,x.st), poww(2, x.nd)),1);
		ans %= MOD;
	}
	printf("%lld\n" ,soma(sub(ans,1), contzeros));
	
	return 0;
}



Measured memory_bytes: 35484
n=int(input())
s=input()
st=''
mod=10**9+7
for i in range(2*n):
    if i%2==0:
        if s[i]=='B':
            st+='W'
        else:
            st+='B'
    else:
        st+=s[i]

cnt=0
ans=1
for i in range(2*n):
    if st[i]=='W':
        cnt+=1
    else:
        ans*=cnt
        ans%=mod
        cnt-=1
if cnt!=0:
    print(0)
    exit()
for i in range(1,n+1):
    ans*=i
    ans%=mod
print(ans)

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

int main(int argc, char const *argv[]) {
    /* code */
    stack <int> n;
    int a,b;
    string s;
    while(cin>>s){
        if(s=="+"){
            a=n.top();
            n.pop();
            b=n.top();
            n.pop();
            n.push(a+b);
        }
        else if(s=="-"){
            a=n.top();
            n.pop();
            b=n.top();
            n.pop();

            n.push(b-a);
        }
        else if(s=="*"){
            a=n.top();
            n.pop();
            b=n.top();
            n.pop();
            n.push(a*b);
        }
        else{
            n.push(atoi(s.c_str()));
        }
    }
    cout << n.top() <<endl;
    return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<queue>

using namespace std;

#define INF 999999999
#define REP(i,n) for(int i=0; i<(int)(n); i++)

int main(){
	int i, j, n, m, w[1501], h[1501];
	vector<int> ww, hh;
	int ans;
	
	w[0]=0;
	h[0]=0;
	while(1){
		cin >> n >> m;
		if(!n) break;
		ans = 0;
		ww.clear();
		hh.clear();
		REP(a,n){
			cin >> w[a+1];
			w[a+1]+=w[a];
		}
		REP(a,m){
			cin >> h[a+1];
			h[a+1]+=h[a];
		}
		REP(a,n)for(i=a+1;i<=n;i++) ww.push_back(w[i]-w[a]);
		REP(a,m)for(i=a+1;i<=m;i++) hh.push_back(h[i]-h[a]);
		sort(ww.begin(),ww.end());
		sort(hh.begin(),hh.end());
		int x, y;
		i=0, j=0;
		while(i<ww.size()&&j<hh.size()){
			if(ww[i]<hh[j])i++;
			else if(ww[i]>hh[j])j++;
			else if(ww[i]==hh[j]){
				x=1, y=1;
				while(ww[i]==ww[i+1]){
					x++;
					i++;
				}
				while(hh[j]==hh[j+1]){
					y++;
					j++;
				}
				//cout<<hh[j]<<"~"<<x<<"~"<<y<<endl;
				ans += x*y;
				i++;
				j++;
			}
		}
		cout << ans <<endl;
	}
	return 0;
}

Measured memory_bytes: 17656
#include <stdio.h>
#include <string.h>
#define LEN 100005
 
typedef struct pp {
  char name[100];
  int t;
} P;
 
P Q[LEN];
int head, tail, n;
 
void enqueue(P x) {
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}
 
P dequeue() {
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}
 
int min(int a,int b) {
  return a < b ? a : b; 
}
 
int main() {
  int elaps = 0, c;
  int i, q;
  P u;
  char str[64];
  
  scanf("%d %d",&n ,&q);
  for(i=1; i<=n; i++) {
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;
 
  while(head != tail) {
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if(u.t > 0) enqueue(u);
    else {
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}



Measured memory_bytes: 11880
//In the name of God
//SMani24
#include<bits/stdc++.h>
using namespace std;

int a, b, ch[3];

int main() {
	cin >> a >> b;
	a--, b--;
	ch[a] = ch[b] = 1;
	for (int i = 0; i < 3; i++)
		if (!ch[i])
			cout << i + 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int) n;i++)
#define rep1(i,m,n) for(int i=(int) m;i<(int) n;i++)
#define fix(n) cout << fixed << setprecision((int)n)

void absll(ll &x) {
    if(x>=0) return ;
    else x=-x; return;
}

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

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

const ll INF = 1LL << 60;

int N;

//DPテーブル
vector<ll> dp(100010);

int main() {
    int n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n){cin>>a.at(i);}
    sort(a.begin(),a.end());
    ll ans=1;
    if(a.at(0)==0){
        ans=0;
    } else {
        rep(i,n){
            if(a.at(i)>1000000000000000000/ans){
                ans=-1;
                break;
            } else {
                ans*=a.at(i);
            }
        }
    }
    cout<<ans<<endl;
}

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

using namespace std;

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

	for (int a = 1; a <= 9; a++) {
		for (int b = 1; b <= 9; b++) {
			if (a * b == N) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

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

		int a = sc.nextInt();
		int b = sc.nextInt();

		int c = 6 - (a + b);
		System.out.println(c);

		sc.close();
	}

}


Measured memory_bytes: 19924
#include <iostream>

using namespace std;
using ll = long long;

int main() {
  ll N, ans;
  cin >> N;
  for (int n = 1; n <= N; ++n) {
    ans = 0;
    for (int x = 1; x * x < n; ++x) {
      int xx = x * x;
      for (int y = 1; xx + y * y < n; ++y) {
        int yy = y * y;
        for (int z = 1; xx + yy + z * z < n; ++z) {
          int f = xx + yy + z * z + x * y + y * z + z * x;
          if (f == n)
            ++ans;
          else if (f > n)
            break;
        }
      }
    }
    cout << ans << endl;
  }
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define PB push_back

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVi;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;

int main(){
	ios::sync_with_stdio(false);
    string s;
    string ans="";
    cin>>s;
    rep(i,s.size()){
        if(s[i] == '0'){
            ans+='0';
        }
        else if(s[i] == '1'){
            ans+='1';
        }
        else{
            if(ans.size() == 0){

            }
            else{
                ans.erase(ans.end()-1);
            }

        }
    }
    cout<<ans<<endl;

    return 0;
}


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

int main() {
  int N = 0;
  bool Flag = 0;
  string S,T;
  cin >> N;
  getline(cin,S);
  getline(cin,T);
  for (int i = 0; i < 2*(N-1)+1; i = i+2){
   if(T.at(i) == 'Y')
     Flag = 1;
  }
  if(Flag == 1)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,k;
	cin>>n>>k;
	ll ans = k;
	for(int i =2 ; i<= n; i++)
		 ans *= (k-1);
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
  int N, K;
  std::cin >> N >> K;
  std::vector<int> arrayKun(N);
  
  for(int i = 0; i < K; ++i)
  {
    int d;
    std::cin >> d;
    for(int j = 0; j < d; ++j)
    {
      int num;
      std::cin >> num;
      arrayKun[num-1] = 1;      
    }
  }
  
  int cnt = 0;
  for(const auto& k : arrayKun)
  {
    if(k == 0)
      ++cnt;
  }
  
  std::cout << cnt << std::endl;
  
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<P> stu(n);
    rep(i, n){
        stu[i].second = i+1;
        cin >> stu[i].first;
    }
    sort(ALL(stu));
    rep(i, n) cout << stu[i].second << " ";
    cout << endl;
}

Measured memory_bytes: 1664
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned LL
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector< PII >
#define VVI vector< VI >
#define MP make_pair
#define PB push_back
#define F first
#define S second
const int INF=1e9;
const int MOD=1e9+7;
// >.<
int x,a,b;
int main(){
    scanf("%d %d %d",&x,&a,&b);
    if(b<=a)puts("delicious");
    else if(b<=x+a)puts("safe");
    else puts("dangerous");
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<cstdlib>
#include<map>
#include<vector>
#include<ctime>
#include<stack>
#define mp make_pair
#define pa pair<int,int>
#define INF 0x3f3f3f3f
#define inf 0x3f
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ull unsigned long long

using namespace std;

inline ll read()
{
	long long f=1,sum=0;
	char c=getchar();
	while (c<'0' || c>'9')
	{
		if (c=='-')	f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9')
	{
		sum=sum*10+c-'0';
		c=getchar();
	}
	return sum*f;
}
const int MAXN=15;
char s[MAXN];
map <char,int> mmp;
int a[MAXN];
int main()
{
	int n;
	mmp['M']=1;
	mmp['A']=2;
	mmp['R']=3;
	mmp['C']=4;
	mmp['H']=5;
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%s",s+1);
		a[mmp[s[1]]]++;
	}
	ll ans=0;
	for (int i=1;i<=5;i++)
		for (int j=i+1;j<=5;j++)
			for (int k=j+1;k<=5;k++)
				ans+=(ll)a[i]*a[j]*a[k];
	cout<<ans;	
	return 0;
}


Measured memory_bytes: 256
N,A,B = [int(i) for i in input().split()]
N_str = str(N)

sum = 0
S = 0
for i in range(N+1):
    i_str=str(i)
    for k in range(len(i_str)):
        sum += int(i_str[k])
    if(sum >= A and sum <=B):
        S += i
    sum = 0
print(S)


Measured memory_bytes: 2940
using System;
namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string b;
            
            b = Console.ReadLine();

            if (b[2]==b[3] && b[4]==b[5])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 25892
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pi>
#define vpl vector<pl>
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005
#define int ll

int n,q,a[100005],x,s[100005],p[100005];

int f(int x, int d){
	int A,B,l,r;
	l=1,r=n;
	while(l!=r){
		int mid=(l+r)/2;
		if(x-a[mid]<=d+1) r=mid;
		else l=mid+1;
	}
	A=l;
	l=1,r=n;
	while(l!=r){
		int mid=(l+r+1)/2;
		if(a[mid]-x<=d) l=mid;
		else r=mid-1;
	}
	B=l;
	if(A<=B && a[A]<=x+d && a[B]>=x-d-1) return B-A+1;
	else return 0;
}

int32_t main(){
	ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
#ifdef LOCAL_DEFINE
	ifstream cin("input.in");
#endif
	
	cin >> n >> q;
	for(int i=1;i<=n;i++){
		cin >> a[i]; s[i]=a[i];
		if(i>2) s[i]+=s[i-2];
	}
	for(int i=n;i>=1;i--){
		p[i]=p[i+1]+a[i];
	}
	for(int i=1;i<=q;i++){
		cin >> x;
		if(x>=a[n]){
			cout << s[n] << '\n';
			continue;
		}
		int l=1,r=n;
		while(l!=r){
			int mid=(l+r)/2;
			if(a[mid]<=x){
				l=mid+1;
				continue;
			}
			int cnt=f(x,a[mid]-x-1);
			if(cnt>=n-mid) r=mid;
			else l=mid+1;
		}
		//cout << l << ' ';
		cout << p[l]+((2*l-n-2>0)?s[2*l-n-2]:0) << '\n';
	}
	
#ifdef LOCAL_DEFINE
	cerr << "\nTime elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << " \n";
#endif
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

void code()
{
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll ans=0;
    for(ll i=0;i<n-2;i++)
    {
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
            ans++;
    }
    cout<<ans;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    // cin>>t
    while(t--)
    {
        code();
    }
}


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

public class Main
{
	public static void main(String[] args)
	{
		Scanner cin = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		
		int t;
		while(cin.hasNext())
		{
			t = cin.nextInt();
			
			if(t==0)
			{
				System.out.println(stack.pop());
			}
			else
			{
				stack.push(t);
			}
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

int N;

void process(string str, int depth, int limit)
{
	if (depth == N)
	{
		cout << str << "\n";
		return;
	}

	for (int i = 0; i <= limit; i++)
	{
		str.push_back('a' + i);
		process(str, depth + 1, max(i + 1, limit));
		str.pop_back();
	}
}

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

	cin >> N;

	process("", 0, 0);

	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll N=1e6+5;
int n,m;
vector<double>v(N);
bool check(int p)
{
	int sum=0;
    for(int i=0;i<n;++i)
    {
        sum+=ceil(v[i]/p)-1;
    }
    if(sum<=m) return true;
    return false;
}
int main()
{
    cin>>n>>m;
    double ma=0;
    for(int i=0;i<n;++i)
    {
        cin>>v[i];
        ma=max(ma,v[i]);
    }
    int left=0,right=ma;
    while(right-left>1)
    {
        ll mid=(right+left)/2;
        if(check(mid))
        {
            right=mid;
        }
        else
        {
            left=mid;
        }
    }
    cout<<right<<endl;
	return 0;
}


Measured memory_bytes: 11028
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let s: Vec<char> = itr.next().unwrap().chars().collect();
    let t: Vec<char> = itr.next().unwrap().chars().collect();

    let mut ok = true;
    for i in 0..s.len() {
        if s[i] != t[i] {
            ok = false;
        }
    }
    println!("{}", if ok { "Yes" } else { "No" })
}


Measured memory_bytes: 2104
n=int(input())
l=list(map(int,input().split()))
f="Yes"
stair=l[0]
mi=0
for i in range(1,n):
    if mi==0:
        if stair-1==l[i]:
            stair=l[i]
            mi=1
        elif  stair<=l[i]:
            stair=l[i]
        else:
            f="No"
            break
    else:
        if stair==l[i]:
            stair=l[i]
            mi=1
        elif stair<l[i]:
            stair=l[i]
            mi=0
        else:
            f="No"
            break
print(f)

Measured memory_bytes: 14704
#include<stdio.h>
int main()
{
    int A,B,C;
    // 整数の入力
    scanf("%d %d %d", &A,&B,&C);
    // 条件判断
    if (A == B)
       printf("%d\n",C);
    else if (A == C)
       printf("%d\n",B);
    else
       printf("%d\n",A);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

const int64 mod = 1000000007;

int64 mpow(int64 xx, int64 yy)
{
	if(yy == 0)
	{
		return 1;
	}
	int64 tmp = mpow(xx, yy / 2);
	tmp %= mod;
	tmp = tmp * tmp;
	tmp %= mod;
	if(yy % 2 == 1)
	{
		tmp *= xx;
		tmp %= mod;
	}
	return tmp;
}

int main()
{
	int64 nn;
	cin >> nn;
	int64 aa, bb, cc;
	aa = mpow(10, nn);
	bb = mpow(9, nn);
	cc = mpow(8, nn);
	bb *= 2;
	if(bb < aa)
	{
		bb += mod;
	}
	bb -= aa;
	bb %= mod;
	if(cc < bb)
	{
		cc += mod;
	}
	cc -= bb;
	cc %= mod;
	cout << cc << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;

ll calc(string x){
    ll rtn = 0;
    for(char c : x) {
        rtn += c - '0';
    }
    return rtn;
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    vector<string> svx;
    while(true){
        string x;
        cin >> x;
        if(x == "0") break;
        svx.push_back(x);
    }

    for(string x : svx){
        cout << calc(x) << endl;
    }
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    int A, B, C;
    cin >> A >> B >> C;
    cout << min(C, B / A) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
const int INF = 0x3f3f3f3f;
const int N = 100000 + 5;
 
int main()
{
	int n,m;
	cin >> n >> m;
	int ans1 = n*(n-1)/2;
	int ans2 = m*(m-1)/2;
	cout << ans1+ans2 << endl;
    return 0;
}

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

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


Measured memory_bytes: 3616
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: Chars,
    }
    if n[0]==n[2] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2128
#include <iostream>
using namespace std;
int main(){
  int N, INF = 10000000;
  while(cin >> N, N){
    int T[N][N+1];
    for(int i = 0; i < N; ++i)
      for(int j = 0; j <= N; ++j)
	cin >> T[i][j];
    int M = (1<<N);
    int dp[M];
    fill(dp,dp+M,INF);
    dp[0] = 0;
    for(int i = 0; i < M; ++i){
      int t = dp[i];
      for(int j = 0; j < N; ++j){
        if(i & 1<<j){
          t = min(t, dp[i-(1<<j)] + T[j][0]);	  
          for(int k = 0; k < N; ++k){
            if(k != j && (i & (1<<k)))
              t = min(t, dp[i-(1<<j)] + T[j][k+1]);
          }
        }
      }
      dp[i] = t;
    }
    cout << dp[M-1] << endl;
  }
  return 0;
}



Measured memory_bytes: 3344
#include<bits/stdc++.h>
using namespace std;
int flag=0;
int n,vec[210000];

int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>vec[i];
    }
    sort(vec,vec+n);
    for(int i=0;i<n-1;i++)
    {
        if(vec[i]==vec[i+1])
        {
            flag=1;
            break;
        }
    }
    if(flag!=1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int fun(int x){
    int y=0,k=x;
    while(k){
        y=y*10+k%10;
        k/=10;
    }
    return x==y ? 1 : 0;
}

int main(){
    int a,b;
    cin >> a >> b;
    int ans=0;
    for(int i=a;i<=b;i++){
        if(fun(i)) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int n, x; cin >> n >> x;
    vector<int> d(n);
    for (int i = 0; i < n; i++) {
        int p; scanf("%d", &p);
        d[i] = abs(x - p);
    }
    
    int g;
    if (n > 1) {
        g = __gcd(d[0], d[1]);
    } else {
        g = d[0];
    }

    for (int i = 2; i < n; i++) {
        g = __gcd(g, d[i]);
    }
    cout << g << endl;
    return 0;
}

Measured memory_bytes: 768
r, c = map(int, input().split())

res = [0] * c

for i in range(r):
    a = list(map(int, input().split()))
    s = sum(a)
    for j in range(c):
        res[j] += a[j]
    a.append(s)
    print(*a)
    
s = sum(res)
res.append(s)
print(*res)


Measured memory_bytes: 5628
d = {}
l = ''
s = input()
for i in s.split():
    if not i in d:
        d[i] = 0
    else:
        d[i] += 1
    if len(str(l)) < len(str(i)):
        l = i

print(sorted(d.items(), key=lambda x: x[1])[-1][0], l)

Measured memory_bytes: 5560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin,(a).rend()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a, b, x;
	cin >> a >> b >> x;
	ll c = a / x;
	ll d = b / x;
	ll ans = d - c;
	if (a % x == 0) ans++;
	dunk(ans);
	return 0;
}

Measured memory_bytes: 256