akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define UNIQUE(v) do{ (v).erase( unique(begin(v), end(v)), end(v) ); } while(0)

namespace std {
	template<class S, class T> pair<S, T> operator + (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first + b.first, a.second + b.second);}
	template<class S, class T> pair<S, T> operator - (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first - b.first, a.second - b.second);}
	template<class S, class T> pair<S, T>& operator += (pair<S, T> &a, const pair<S, T> &other) {return a = a + other;}
	template<class S, class T> pair<S, T>& operator -= (pair<S, T> &a, const pair<S, T> &other) {return a = a - other;}
	template<class S, class T> ostream& operator << (ostream& ost, pair<S, T> p) {ost << "(" << p.first << ", " << p.second << ")";return ost;}
	template<class T> ostream& print_iterable_container(ostream& ost, T& container) {
		for (auto&& iter = begin(container); iter != end(container); ++iter) ost << (iter == begin(container) ? " [ " : ", ") << (*iter);
		return ost << " ]";
	}
#	define APPLY_PRINT_ITERABLE_CONTAINER(container_type)\
	template<class T> ostream& operator << (ostream& ost, container_type<T>& container) {\
		return print_iterable_container(ost, container);\
	}
	APPLY_PRINT_ITERABLE_CONTAINER(vector);
	APPLY_PRINT_ITERABLE_CONTAINER(list);
	APPLY_PRINT_ITERABLE_CONTAINER(deque);
}

template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

using ld = long double;

template<class T> using VV = vector<vector<T> >;
template<class T> using maxPQ = priority_queue<T>;
template<class T> using minPQ = priority_queue<T, vector<T>, greater<T> >;
template<class T, class U> using uomap = unordered_map<T, U>;
template<class T> using uoset = unordered_set<T>;

const ll INF = 1001001001;
const ll INFll = (ll)INF * INF;
const ll MOD = 1000000007;
const ll MOD_FFT = 998244353;
const ld EPS = 1e-15;

//function<void(int,int)> tensi_no_3p=[&](int v,int d){
//};

int main() {
	ios_base::sync_with_stdio(false);
	string S; cin >> S;
	int K = S.length() / 2;

	int left = (S.length() - 1) / 2;
	int right = S.length() / 2;
	char hoge = S[left];
	while (S[left] == hoge && S[right] == hoge) {
		left--;
		right++;
		K++;
		if (left < 0) break;
	}
	cout << K << endl;
	return 0;
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            for (int i = 1; i <= 9; i++)
            {
                for (int j = 1; j <= 9; j++)
                {
                    sb.AppendLine(i + "x" + j + "=" + i * j);
                }
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 8936
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let countAB (s: string) =
    let t = s.Replace("AB", "")
    (s.Length - t.Length) / 2

[<EntryPoint>]
let main _ =
    let N = read int
    let SS = List.init N (fun _ -> read string)
    let xa =
        List.filter (fun (x: string) ->
            not (x.StartsWith("B")) && x.EndsWith("A")) SS
        |> List.length
    let bx =
        List.filter (fun (x: string) ->
            x.StartsWith("B") && not (x.EndsWith("A"))) SS
        |> List.length
    let ba =
        List.filter (fun (x: string) ->
            (x.StartsWith("B")) && x.EndsWith("A")) SS
        |> List.length
    let inc = List.sumBy countAB SS

    let m = min xa bx
    let d = abs (xa - bx)
    let n = min d ba

    // eprintfn "*%A" (xa, bx, ba, inc)

    if (xa, bx) = (0, 0) then
        if ba = 0 then
            printfn "%i" inc
        else
            printfn "%i" (inc + ba - 1)
    else
        inc + m + n + (ba - n)
        |> printfn "%i"
    0

Measured memory_bytes: 14300
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

llint n, a, b;

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	for(int i = 0; i < k; i++){
		ret *= n-i, ret %= mod;
		ret *= modpow(i+1, mod-2), ret %= mod;
	}
	return ret;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> a >> b;
	llint ans = modpow(2, n);
	ans += mod-1, ans %= mod;
	
	ans += mod - comb(n, a), ans %= mod;
	ans += mod - comb(n, b), ans %= mod;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz 100002
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define pi pair<int,int>
#define PQ priority_queue<double, vector<double>, greater<double> >q
#define _sort(v) sort(v.begin(),v.end())
#define MP map<ll int,ll int>mp
#define MEM(x) memset(x,0,sizeof(x))
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define VEC() vector<ll int>v
#define VEC(n) ll int x; vector<ll int>v;for(int i=0;i<n;i++){cin>>x;v.pb(x);}
#define TEST() int test;cin>>test; while(test--)
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
//Upper_bound   auto x=upper_bound(v[a].begin(),v[a].end(),les);les=*x; if(x==v[a].end())break;
//ll int LCM(ll int a,ll int b) { ll int gcd=__gcd(a,b);ll int lcm=a*b/gcd;return lcm;}
//ll int bigmod(ll int b, ll int p, ll int m){if(p==0)return 1;if(p%2!=0) return b%m*fun(b,p-1,m)%m;if(p%2==0){ ll int res=fun(b,p/2,m);return (res%m*res%m)%m;}}
//ll mod_inverse(ll a, ll mod){return bigmod(a,mod-2,mod);}
//void seive() { prime[np++]=2;for(i=3; i<=sz; i+=2){if(mark[i]==0){ prime[np++]=i;for(j=i*i; j<=sz; j+=i) mark[j]=1; } }}
//string add(string s1,string s2) {string s;int j=s1.size()-1,c=0,m; for(int i=s2.size()-1; i>=0; i--) {if(j>=0)m=s2[i]-'0'+s1[j]-'0'+c;else m=s2[i]-'0'+c; if(m>9) { s+=m%10+'0';c=m/10; } else {  c=0;s+=m+'0'; }j--; } if(c!=0) {s+=c+'0'; }reverse(s.begin(),s.end());return s;}
//int pos;string mul(int n) {string s;for(int i=0; i<pos; i++) { s+="0"; }pos++;int c=0,m; for(int i=s1.size()-1; i>=0; i--) { m=(s1[i]-'0')*n+c;if(m>9) { s+=m%10+'0';c=m/10;} else { c=0; s+=m+'0';} }while(c!=0) { s+=c%10+'0';c=c/10;}    reverse(s.begin(),s.end());return s;}
int mark[sz*10];

int main()
{
   int n;cin>>n;
   int g=0,x;
   for(int i=0;i<n;i++)
   {
       cin>>x;
       if(i==0)g=x;
       else g=__gcd(x,g);
       mark[x]++;
   }
   int ok=1;
   for(int i=2;i<1000001;i++)
   {
       int cnt=0;
       for(int j=i;j<1000001;j+=i)
       {
           if(mark[j])cnt+=mark[j];
       }
       if(cnt>=2)ok=0;
   }
   if(ok)cout<<"pairwise coprime"<<endl;
   else if(g==1)cout<<"setwise coprime"<<endl;
   else cout<<"not coprime"<<endl;
}


Measured memory_bytes: 7548
def answer(n)
  keta = n.to_s.size - 1
  return n if keta == 0
  left = n.to_s[0].to_i
  (n == (left + 1) * 10**keta - 1) ? keta * 9 + left : keta * 9 + left - 1
end
 
puts answer(gets.to_i)

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
  
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    int Q = Integer.parseInt(sc.next());
    
    int l[] = new int[Q];
    int r[] = new int[Q];
    for (int i = 0; i < Q; i++) {
      l[i] = Integer.parseInt(sc.next());
      r[i] = Integer.parseInt(sc.next());
    }
    final int max = 100000;
    boolean p[] = new boolean[max + 1];
    p[0] = false;
    p[1] = false;
    p[2] = true;
    for (int i = 3; i < max + 1; i++) {
      p[i] = true;
      for (int j = 2; j * j <= i; j++) {
        if (i % j == 0) {
          p[i] = false;
          break;
        }
      }
    }
    int sum[] = new int[max / 2 + 1];
    sum[0] = 0;
    for (int i = 1; i < max / 2 + 1; i++) {
      int N = 2 * i - 1;
      if (p[N] && p[i]) {
        sum[i] = sum[i - 1] + 1;
      } else {
        sum[i] = sum[i - 1];
      }
    }
    
    for (int i = 0; i < Q; i++) {
      System.out.println(sum[(r[i] + 1) / 2] - sum[(l[i] - 1) / 2]);
    }
  }
}

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

int main() {
	int a,b;
	cin >> a >> b;
	if(a<b){
		cout<<"a < b" << endl;
	}else if(a > b){
		cout<< "a > b" <<endl;
	}else{
		cout << "a == b" << endl;
	}
	return 0;
}


Measured memory_bytes: 3108
S = input()
has_N = "N" in S
has_S = "S" in S
has_E = "E" in S
has_W = "W" in S
reachable_NS = has_N and has_S or not has_N and not has_S
reachable_SW = has_E and has_W or not has_E and not has_W
if reachable_NS and reachable_SW:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
class Stack:
    # ???????????????????????§??????top??????????????????????????????Max???isFull??¨????????????stack???????????????????????§???
    def __init__(self):
        self.top = 0
        self.Max = 100
        self.stack = [None]

    def isEmpty(self):
        return self.top == 0
    
    def isFull(self):
        return self.top >= self.Max

    def push(self, x):
        if self.isFull():
            print("Stack overflow!")
        else:
            self.top += 1
            self.stack.append(x)

    def pop(self):
        if self.isEmpty():
            print("Stack underflow!")
        else:
            self.top -= 1
            return self.stack.pop()

d_e = input().split()

accumlator = Stack()

for i in d_e:
    if i in "+-*":
        post_op = accumlator.pop()
        pre_op = accumlator.pop()
        ans = eval(pre_op + i + post_op)
        accumlator.push(str(ans))
    else:
        accumlator.push(i)

print(int(accumlator.pop()))

Measured memory_bytes: 7764
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vp a(n);
    rep(i,n){
        cin>>a[i].fi;
        a[i].se=i+1;
    }
    sort(all(a));
    rep(i,n)cout<<a[i].se<<sp;
}

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

int main(){
    
    long long X;
    cin >> X;
    long long sum = 0;
    if(X*(X+1)/2>=X){
        for(long long i = 1; i <= X; i++){
            sum += i;
            if(sum == X){
                cout << i <<endl;
                return 0;
            }else if(sum > X){
                cout << i <<endl;
                return 0;
            }
        }
        cout << sum << endl;
    }else{
        cout << X  <<endl;
    }
}

    
    



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lowbit(a) ((a) & -(a))
#define clean(a, b) memset(a, b, sizeof(a))
#define eps (-1e8)
#define make_pair P
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int maxn = 3e5 + 9;

int _;



int main()
{
    int d,t,s;
    scanf("%d%d%d",&d,&t,&s);
    if(s*t>=d) puts("Yes\n");
    else puts("No\n");
    return 0;
}
 

Measured memory_bytes: 3660
#include <iostream>
#include <cstdlib>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <queue>
#include <math.h>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;

const ll INF_MAX = 1e9, MOD = 1000000007;

const ll INF = 1e18;

bitset <10000> u;

ll last[200001], d[200001], d_last[200001], n;

vector <int> a;

int main ()
{
	cin >> n;

	for (int i = 0; i <= 200000; i++)
		last[i] = -1;

	for (int i = 0; i < n; i++)
	{
		int x;

		scanf ("%d", &x);

		d_last[i] = last[x];

		last[x] = i;

		a.push_back (x);
	}

	d[0] = 1;

	for (int i = 1; i < n; i++)
	{
		if (d_last[i] == -1 || d_last[i] == i - 1)
		{
			d[i] = d[i-1];
		}
		else
		{
			d[i] = (d[i-1] + d[d_last[i]]) % MOD;
		}
	}

	cout << d[n-1];
}

Measured memory_bytes: 5876
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b;
    cin>>n>>a>>b;
    cout << (min(b,a*n))<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimization_level 3
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    ll n;
    ll cnt = 0;
    cin >> n;
    vector<int> res;
    ll h = -1;
    ll H = INF;

    rep(i, n) {
        H = h;
        cin >> h;
        if(H >= h) {
            cnt++;
        } else {
            res.push_back(cnt);
            cnt = 0;
        }
    }

    res.push_back(cnt);

    sort(all(res));
    cout << res.at(res.size() - 1);
}


Measured memory_bytes: 892
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

void solve() {
	ll N,M;
  	cin >> N >> M;
  	vector<ll> vec(N,0);
  	rep(i,M) {
      ll input;
      cin >> input;
      vec[input]=1;
    }
  
  	vector<ll> ans(N+1);
  	ans[0]=1;
  	ans[1]=(vec[1]==1 ? 0 : 1);
  
  	for (ll i=2;i<N+1;i++){
      ans[i] = (vec[i-1]==0 ? ans[i-1] : 0) + (vec[i-2]==0 ? ans[i-2] : 0);
      ans[i] %= 1000000007;
    }
  
  	cout << ans[N];
	return;
}

int main() {
	solve();
	cout << endl;
	return 0;
}

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

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

using namespace std;
using ll = long long;

void solve();

int main(void){
    int N; cin >> N;
    ll A[N]; rep(i, N) cin >> A[i];
    sort(A, A+N);
    ll ruiseki[N] = {A[0]}; for(int k = 1; k < N; k++) ruiseki[k] = ruiseki[k-1] + A[k];
    int i;
    for(i = N-2; i >= 0 && ruiseki[i]*2 >= A[i+1]; i--);
    cout << N-i-1 << endl;
    return 0;
}

void solve(){}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

int kaizyo(int x){
    if(x==1)return x;
    else return x*kaizyo(x-1);
}

vector<int> v(10);
bool f=true;
bool dfs(int i,int top1,int top2){
    if(!f)return false;
    if(i==10)return true;
    
    
    if(top1>v[i]&&top2>v[i]){
        f=false;
        //return false;
    }
    else if(top1<v[i]&&top2>v[i]) {
        if(!dfs(i+1,v[i],top2))f= false;
        //return true;
    }
    else if(top1>v[i]&&top2<v[i]){
        if(!dfs(i+1,top1,v[i]))f= false;
        //return true;
    }
    else if(top1<v[i]&&top2<v[i]){
        if(top1<top2){if(!dfs(i+1,top1,v[i]))f=false;}
        else if(!dfs(i+1,v[i],top2))f= false;
        //return true;
    }
    if(f)return true;
    else return false;
}
int main() {
    int n;
    cin>>n;
    rep(i,0,n){
        rep(i,0,10){
            cin>>v[i];
        }
        if(dfs(0,0,0))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3104
#include <stdio.h>

int main(void){
    int a,b;
    int sum;
    int dig;
    while ( scanf("%d %d",&a,&b) != EOF){
        dig =0;
        sum = a+b;
        while (sum != 0){
            dig++;
            sum  = sum / 10;
        }
        printf("%d\n",dig);
    }
    return 0;
}

Measured memory_bytes: 1848
n,w=map(int,input().split())
dp=[-1]*(w+1)
dp[0]=0
for _ in range(n):
  a,d=map(int,input().split())
  for b in range(w,a-1,-1):
    if dp[b-a]!=-1:
    	dp[b]=max(dp[b],d+dp[b-a])
print(max(dp))

Measured memory_bytes: 41708
#include <stdio.h>
#include <algorithm>
#include <cstring>

using namespace std;

typedef long long LL;

char S[55], T[55];

int check(int p, int n) {
	for (int i = p ; i < n; i++) {
		int j = i-p;
		if (S[i] != '?' && S[i] != T[j])
			return 0;
	}

	return 1;
}

int main()
{
	//freopen("input.txt", "rt", stdin);
	//freopen("output.txt", "wt", stdout);

	scanf("%s", S);
	scanf("%s", T);

	int nS = strlen(S);
	int nT = strlen(T);

	if (nT > nS) {
		printf("UNRESTORABLE");
		return 0;
	}


	int i = nS-nT;
	while (i >= 0) {
		if (check(i,i+nT))
			break;
		i--;
	}

	if (i < 0) {
		printf("UNRESTORABLE");
		return 0;
	} else {
		for (int j = i; j < i+nT; j++) {
			int k = j-i;
			S[j] = T[k];
		}

		for (int j = 0; j < nS; j++)
			if (S[j] == '?')
				S[j] = 'a';
	}

	printf("%s", S);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<limits.h>

#define MOD 1000000007
#define DEBUG 0


using namespace std;

long long int modpow(long long int a, int n) {

	if (n == 0)return 1;
	if (n == 1) return a;

	long long int wk = modpow(a, n / 2);

	long long int ret = 0;
	if (n % 2 == 0) {
		ret = 1;
	}
	else {
		ret = a;
	}

	return (((ret * wk) % MOD) * wk) % MOD;

}

long long int gcd(long long int a, long long int b) {
	long long int tmp;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	long long int r = a % b;

	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

long long int lcm(long long int a, long long int b) {

	long long int wk_int;

	wk_int = (a * b) % MOD;
	
	long long int ret;

	ret = (wk_int * modpow(gcd(a, b), MOD - 2)) % MOD;

	return ret;

}

bool isPrime(int n) {
	if (n == 1)return false;
	if (n == 2)return true;

	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}

	return true;
}




int dis[10][10];





int main()
{

	int n;
	string str;
	cin >> n;
	cin >> str;
	
	int higasi = 0;

	for (int i = 0; i < str.size(); i++) {
		if (str[i] == 'E')higasi++;
	}



	int wk_nisi = 0;

	int ans = INT_MAX;
	int wk_ans;

	for (int i = 0; i < n; i++) {
		wk_ans = 0;
		if (str[i] == 'W') {

			wk_ans += (wk_nisi + higasi);

			wk_nisi++;
		}
		else {
			higasi--;

			wk_ans += (wk_nisi + higasi);

		}

		if (wk_ans < ans)ans = wk_ans;
	}

	cout << ans << endl;

	return 0;

}



Measured memory_bytes: 900
# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import math
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

PPP = 1000000007

# 整数の入力
n = int(input())

# スペース区切りの整数の入力
#a = [int(x) for x in input().split()]
#print("a", a, file=sys.stderr)
#n, d = map(int, input().split())
#print("sp", n, k, file=sys.stderr)
#p, q, r = map(int, input().split())
#s = [int(x) for x in input().split()]
#t = [int(x) for x in input().split()]

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))
#  a.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]
#a.sort()
#print(l, file=sys.stderr)

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def ss(x1, y1, x2, y2):
  print(x1, y1, x2, y2, file=sys.stderr)
  ss2 = x2 * y2 * 2 - x1 * y1 - x2 * (y2 - y1) - (x2 - x1) * y2
  return ss2


MX = 1000000000
def doit(s):
  if s <= MX:
    print(0, 0, 0, 1, s, 0, file=sys.stderr)
#    return

  r = int(math.ceil(math.sqrt(s)))
  print(r, file=sys.stderr)
  diff = r ** 2 - s
  print(diff, file=sys.stderr)
  if diff == 0:
    print(r, 0, 0, r, r, r)
    return
    
  for x in range(1,r):
    if diff % x == 0:
      if diff / x <= r:
        print(r-x, 0, 0, int(r-diff/x), r, r)
        return
      
  print(0, 0, 0, 1, s, 0)
  

def yn():
  if doit():
    return "Yes"
  else:
    return "No"

#print(doit([0] * 4))
#doit(a)
#print(doit())
try:
  doit(n)
  #print(doit())
  #print(yn())
except Exception as e:
  print("e", e, file=sys.stderr)


Measured memory_bytes: 5532
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

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

    int m = -1;
    rep(i, 1000) {
        if(i*(i+1)/2 == n) {
            m = i;
        }
    }
    if(m == -1) {
        cout << "No" << endl;
        return 0;
    }

    vvi ans(m+1);
    queue<int> q;
    rep(i, n) {
        q.push(i+1);
    }

    rep(i, m+1) {
        int x = 1;
        for(int j = ans[i].size(); j < m; ++j) {
            int now = q.front();
            q.pop();
            ans[i].push_back(now);
            ans[i+x++].push_back(now);
        }
    }
    cout << "Yes" << endl;
    cout << m+1 << endl;

    rep(i, m+1) rep(j, m) {
        if(!j) cout << m << ' ';
        cout << ans[i][j] << (j == m-1?'\n':' ');
    }
}

Measured memory_bytes: 4316
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;



signed main(){

	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;
	int a[1234], b[1234], c[1234];
	rep(i, X) cin >> a[i];
	rep(i, Y) cin >> b[i];
	rep(i, Z) cin >> c[i];
	sort(a, a + X, greater<>());
	sort(b, b + Y, greater<>());
	sort(c, c + Z, greater<>());

	vector<int> AB;
	rep(i, X)rep(j, Y){
		AB.push_back(a[i] + b[j]);
	}
	sort(AB.begin(), AB.end(), greater<>());

	vector<int> ans;
	for (int i = 0; i < min(3000LL, X*Y); i++){
		for (int j = 0; j < Z; j++){
			ans.push_back(AB[i] + c[j]);
		}
	}
	sort(ans.begin(), ans.end(), greater<>());

	rep(i, K)
		cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 43364
s = input()
t = 'keyence'
if(s[:7] == t or s[-7:] == t):
    print('YES')
else:
    for i in range(7):
        if(s[:i+1] == t[:i+1] and s[-7+i+1:] == t[-7+i+1:]):
            print('YES')
            exit()
    print('NO')

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

string s, t;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> s >> t;
    int n = s.length();
    int m = t.length();
    for (int i = n - 1; i >= 0; --i) {
        if ((s[i] == t[0] || s[i] == '?') && n - i >= m) {
            bool ok = true;
            for (int j = 0; j < t.length(); ++j) {
                if (s[i + j] != '?' && s[i + j] != t[j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                for (int j = 0; j < m; ++j) {
                    s[i + j] = t[j];
                }
                for (int i = 0; i < n; ++i) {
                    if (s[i] == '?')
                        s[i] = 'a';
                }
                cout << s << endl;
                exit(0);
            }
        }
    }
    cout << "UNRESTORABLE" << endl;

    return 0;
}



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

int main() {
	long long n,a,b,ans;
	cin >> a >> b;
	for(int i=1; i<=10000; i++){
		if((i*8)/100==a && (i*10)/100==b){
			cout << i << endl; return 0; 
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>

using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;
const ll MOD=1e9+7;

int main()
{
	ll n;
	cin>>n;
	if(n==1){
		cout<<1<<endl;
		return 0;
	}
	if(n==2){
		cout<<4<<endl;
		return 0;
	}
	ll dp[2000001], sum[2000001];
	dp[n]=n;
	dp[n-1]=n*n%MOD;
	for(int i=n+1; i<=2*n; i++) dp[i]=1;
	sum[2*n]=1;
	for(int i=2*n-1; i>=n-1; i--) sum[i]=(sum[i+1]+dp[i])%MOD;
	for(int i=n-2; i>=1; i--){
		dp[i]=(dp[i+1]+(n-1)*(n-1)+sum[i+3]+MOD-sum[n+i+2])%MOD;
		sum[i]=(sum[i+1]+dp[i])%MOD;
	}
	cout<<dp[1]<<endl;
    return 0;
}

Measured memory_bytes: 31488
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int s;
    cin >> s;
    ll cnt=1;
    while(((s!=4)&&(s!=2))&&(s!=1)){
      if(s%2==0){
        s=s/2;
      }else{
        s=3*s+1;
      }
      cnt++;
    }
    cout << cnt+3;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <set>
#include <map>
#include <numeric>
#include <string>

int main() {
  size_t N, K;
  scanf("%zu %zu", &N, &K);

  int inf = 100;
  std::vector<std::vector<int>> g(N, std::vector<int>(N, inf));
  for (size_t i = 0; i < N; ++i) g[i][i] = 0;

  std::vector<std::pair<size_t, size_t>> es;
  for (size_t i = 1; i < N; ++i) {
    g[0][i] = g[i][0] = 1;
    es.emplace_back(0, i);
  }

  for (size_t k = 0; k < N; ++k)
    for (size_t i = 0; i < N; ++i)
      for (size_t j = 0; j < N; ++j)
        if (g[i][j] > g[i][k] + g[k][j])
          g[i][j] = g[i][k] + g[k][j];

  size_t count = 0;
  for (size_t i = 0; i < N; ++i)
    for (size_t j = 0; j < i; ++j)
      if (g[i][j] == 2) ++count;

  if (K > count) return puts("-1"), 0;

  if (K < count) {
    for (size_t i = 0; i < N; ++i)
      for (size_t j = 0; j < i; ++j)
        if (g[i][j] == 2) {
          es.emplace_back(i, j);
          if (--count == K) goto end;
        }
    end:;
  }

  printf("%zu\n", es.size());
  for (auto const& p: es) {
    size_t s, d;
    std::tie(s, d) = p;
    ++s;
    ++d;
    printf("%zu %zu\n", s, d);
  }
}


Measured memory_bytes: 512
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<map>
#include<queue>
#include<iostream>
#include<cmath>
//#define int long long 
using namespace std;
inline int gi(){char tmp=getchar();int flag=1;while(tmp<'0'||tmp>'9'){if(tmp=='-'){flag=-1;tmp=getchar();break;}tmp=getchar();}int ans=0;while(tmp<='9' and tmp>='0') {ans=ans*10+tmp-'0';tmp=getchar();}return ans*flag;}
inline void write(int x){static int stk[100], top = 0;if (x == 0) { putchar('0'); putchar(' ');return; }if (x < 0) { x = -x; putchar('-'); }while (x) { stk[++top] = x % 10; x /= 10; }while (top) { putchar(stk[top--] + '0'); }putchar(' ');}
#define line() putchar('\n');
#define Mem(Arr,V) memset(Arr,V,sizeof Arr);
#define Mcpy(Arr,qwq) memcpy(Arr,qwq,sizeof qwq);
#define max3(a,b,c) max(max(a,b),c)
#define max4(a,b,c,d) max4(max3(a,b,c),d);
#define in(a) a=gi()
#define in2(a,b) in(a),in(b)
#define in3(a,b,c) in2(a,b),in(c)
#define in4(a,b,c,d) in3(a,b,c),in(d)
#define write2(a,b) write(a),write(b)
#define write3(a,b,c) write2(a,b),write(c)
#define write4(a,b,c,d) write3(a,b,c),write(d)
#define smin(a,b) a=min(a,b)
#define smax(a,b) a=max(a,b)
signed main()
{
	char s=getchar();
	if(s=='S')
		puts("Cloudy");
	if(s=='C')
		puts("Rainy");
	if(s=='R')
		puts("Sunny");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int []a = new int [n+2];
		
		a[0] = 0;
		a[n+1] = 0;
		
		for(int i = 1; i <= n ; i++) {
			a[i] = sc.nextInt();
		}
		int []s1 = new int [n+1];
		int []s2 = new int [n];
		int sum = 0;
		
		for(int i = 0; i < n+1 ; i++) {
			s1[i] = Math.abs(a[i+1] -a[i]);
			sum += s1[i];
		}
		
		for(int i = 0; i < n ; i++) {
			s2[i] = Math.abs(a[i+2] - a[i]);
		}
		
		for(int i = 1 ; i <= n ; i++) {
			int ans = sum;
			ans = ans + s2[i-1] -(s1[i] + s1[i-1]);
			
			System.out.println(ans);
			
		}
		
		
	}

}


Measured memory_bytes: 64044
import math
x=int(input())
ans=[1]
for i in range(2,x+1):
    #print(i)
    k=int(math.log(x,i))
    if k>=2:
        if i**(k+1) <= x:
            ans.append(i**(k+1))
        else:
            ans.append(i**k)
print(max(ans))
#print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

int calc(vector<int> v) {
  int n = v.size();
  int res = 0;
  REP(i,n) (res += (2*i+MOD-n+1)*((MOD+v[i])%MOD)%MOD) %= MOD;
  return res;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n,m;
  cin >> n >> m;
  vector<int> x(n),y(m);
  REP(i,n) cin >> x[i];
  REP(i,m) cin >> y[i];
  cout << calc(x) * calc(y) % MOD << endl;

  return 0;
}

Measured memory_bytes: 3456
#include "bits/stdc++.h"
using namespace std;

int main()
{
  int n;
  string s;
  cin>>n>>s;
  vector<int> a(s.size());
  for(int i=0;i<s.size();i++)
  {
    a.at(i)=(int)s.at(i);
    a.at(i)+=n;
    if(a.at(i)>90)
      a.at(i)-=26;
    cout<<(char)a.at(i);
  }
}

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


using namespace std;
inline bool odd(int n){
    int countt=0;
    while(n!=0){
        n=n/10;
        countt++;
    }
    if(countt%2!=0){
        return true;
    }
    else{
        return false;
    }
}

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

    // code comes here
    int n,countt=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        if(odd(i)){
            countt++;
        }

    }
    cout<<countt<<endl;


    return 0;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct node
{
    int x,y,id;
}a[100005];
bool cmp(node p1,node p2)
{
    if(p1.x==p2.x) return p1.y<p2.y;
    else return p1.x<p2.x;
}
string ans[100005];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%d%d",&a[i].x,&a[i].y),a[i].id=i;
    sort(a+1,a+1+m,cmp);
    int p=0,x=a[1].x;
    for(int i=1;i<=m;i++)
    {
        if(x==a[i].x) ++p;
        else p=1,x=a[i].x;
        string s="";
        int t=a[i].x,l=0;
        while(t) s=(char)(t%10+'0')+s,t/=10,l++;
        string k="";
        for(int j=1;j<=6-l;j++) k+='0';
        k+=s;
        s="";
        t=p,l=0;
        while(t) s=(char)('0'+t%10)+s,t/=10,l++;
        for(int j=1;j<=6-l;j++) k+='0';
        k+=s;
        ans[a[i].id]=k;
    }
    for(int i=1;i<=m;i++)
        cout<<ans[i]<<'\n';
}


Measured memory_bytes: 9728
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z)                                                        \
  cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z  \
       << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair< int, int >
#define ld long double
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vec< int > a(3 * N);
  REP(i, 3 * N) cin >> a[i];
  sort(ALL(a));
  int ans = 0;
  REP(i, N) ans += a[N + i * 2];
  print(ans);
}

Measured memory_bytes: 2560
#include<iostream>
#include<fstream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
string a;
int main()
{
     cin>>a;
	 for(int i=0;i<a.size();i++)
	 {
	 	if(a[i]=='C')
	 	{
	 		for(int j=i+1;j<a.size();j++)
	 		{
	 			if(a[j]=='F')
	 			{
	 				cout<<"Yes";
	 				return 0;
	 			}
	 		}
	 	}
	 }
	 cout<<"No";
    return 0;
}

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

m = max(lis)
ind = lis.index(m)
s = 0
for i in range(len(lis)):
    if i == ind: pass
    else:
        s += lis[i]

if m < s:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    ll r=0,g=0,b=0;
    rep(i,n){
      if(s[i]=='R') r++;
      if(s[i]=='G') g++;
      if(s[i]=='B') b++;
    }
    ll ans=0;
    ans=r*g*b;
    rep(j,n){
      rep(i,j){
        ll k=j+(j-i);
        if(k<n){
          if(s[i]==s[j]) continue;
          if(s[j]==s[k]) continue;
          if(s[i]==s[k]) continue;
          ans--;
        }
      }
    }    
    cout << ans << endl;
}

Measured memory_bytes: 3660
def main():
    import sys
    import collections
    input = sys.stdin.readline
    N = int(input())
    S = [input() for i in range(N)]
    c = collections.Counter(S)
    max_num = c.most_common(1)[0][1]
    ss = [cc[0] for cc in c.most_common() if cc[1] == max_num]
    ss.sort()
    print("\n".join(ss))

if __name__ == "__main__":
    main()

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

int main(){
  ll X;
  cin >> X;
  ll a = X / 500;
  ll b = (X % 500) / 5;
  cout << a * 1000 + b * 5 << endl;
}

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

int main() {
  int a,b,c;
  cin >>a>>b;
  c=a/500*500;
  if (a-c>b){
    cout <<"No"<<endl;
  }
  else if (a-c<=b){
    cout <<"Yes"<<endl;
  }// ここにプログラムを追記
}

Measured memory_bytes: 256
H, W = map(int, input().split())

A = ['' for i in range(H)]
dp = [[1 for i in range(W)] for j in range(H)]

for i in range(H):
  A[i] = input()

for i in range(0, H):
  for j in range(0, W):
    if i+j == 0:
      continue
    if A[i][j] == '#':
      dp[i][j] = 0
    else:
      if (A[i-1][j] == '#') or (i == 0): x=0
      else: x = dp[i-1][j]
      if (A[i][j-1] == '#') or (j == 0): y=0
      else: y = dp[i][j-1] 
      dp[i][j] = x+y

print(dp[-1][-1] % (10**9+7))

Measured memory_bytes: 167876
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{


	class Program
	{
		static void Main(string[] args)
		{
			// スペース区切りの整数の入力
			var S = Console.ReadLine();
			var answer = "";

			for(int i = 0;i < S.Length; i++)
			{
				answer += "x";
			}

			Console.WriteLine(answer);
		}


	}
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

ll calc(ll a, ll b, ll c, ll d){
  ll mi=a;
  ll ma=a;
  mi = min(mi, b);
  mi = min(mi, c);
  mi = min(mi, d);
  ma = max(ma, b);
  ma = max(ma, c);
  ma = max(ma, d);

  return ma-mi;
}

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

  ll n;
  cin>>n;
  vll a(n);
  REP(i,n)cin>>a[i];

  vll rem(n+1);
  REP(i,n)rem[i+1]=rem[i]+a[i];

  //[0,bd), [bd,n)
  ll ans=LLINF;
  for(ll bd=2; bd<=n-2; bd++){
    ll p,q;
    ll pq = rem[bd];
    ll limpq=pq/2+pq%2;
    auto it = lower_bound(rem.begin(), rem.end(), limpq);
    if(it==rem.begin())
      p=*(it+1);
    else if(it-rem.begin()==bd)
      p=*(it-1);
    else if(abs(pq-2*(*it)) > abs(pq-2*(*(it-1))))
      p=*(it-1);
    else
      p=*it;
    q=pq-p;

    ll rs=rem[n]-rem[bd];
    ll limrs = rs/2+rs%2+rem[bd];
    auto it2 = lower_bound(rem.begin(), rem.end(), limrs);
    ll r,s;
    if(it2==rem.begin()+bd)
      r=*(it2+1)-rem[bd];
    else if(it2==rem.begin()+n)
      r=*(it2-1)-rem[bd];
    else if(abs(rs-2*(*it2-rem[bd])) > abs(rs-2*(*(it2-1)-rem[bd])))
      r=*(it2-1)-rem[bd];
    else
      r=*it2-rem[bd];
    s=rs-r;

    ans = min(ans,calc(p,q,r,s));
  }

  cout<<ans<<endl;
}



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

int main() {
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A), b(B);
  for (int i = 0; i < A; ++i) cin >> a[i];
  for (int i = 0; i < B; ++i) cin >> b[i];
  vector<int> x(M), y(M), c(M);
  for (int i = 0; i < M; ++i) cin >> x[i] >> y[i] >> c[i];

  int minA, minB;
  minA = *min_element(a.begin(), a.end());
  minB = *min_element(b.begin(), b.end());
  int minTotal = minA + minB;

  for (int i = 0; i < M; ++i) {
    int total = a[x[i] - 1] + b[y[i] - 1] - c[i];
    if (total < minTotal) minTotal = total;
  }
  cout << minTotal << endl;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> H(N);
  int loop,ans=1;
  for(loop=0;loop<N;loop++){
    cin >> H[loop];
  }
  for(loop=N-1;loop>0;loop--){
    if(H[loop]<H[loop-1]){
      if(H[loop]==H[loop-1]-1){
        H[loop-1]-=1;
        continue;
      }else{
        ans=0;
        break;
      }
    }else{
      continue;
    }
  }
  if(ans){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main() {
  int two[7] = {1, 2, 4, 8, 16, 32, 64};
  int N, res;
  cin >> N;
  for(int i = 0; i < 7; i++) {
    if(two[i] <= N) res = two[i];
  }
  cout << res << endl;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define mod 1000000007
#define mk make_pair
vector<vector<int>> bk;
vector<vector<ll> >dp;
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;bk.resize(n+1);dp.resize(n+1);
    for(int i=0;i<=n;i++)
   
    {bk[i].resize(n+1);dp[i].resize(n+1);}
    ll a[n+1]={0};
    for(int i=1;i<=n;i++)
    cin>>a[i];
     ll psum[n+1]={0};psum[1]=a[1];
    for(int i=2;i<=n;i++)
    psum[i]=psum[i-1]+a[i];
    
    for(int i=0;i<=n;i++)
    {
        dp[0][i]=0;dp[i][0]=0;
      
        dp[i][i]=0;
    }
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        bk[i][j]=-1;
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j+i<=n;j++)
        {
            if(i==1)
            {
                dp[j][j+i]=a[j]+a[j+1]; bk[j][i+j]=j;
            }
            else if(i==2)
            {
                dp[j][i+j]=min(2*dp[j][j+1]+a[j+i],2*dp[j+1][i+j]+a[j]);
                if(dp[j][i+j]==2*dp[j][j+1]+a[i+j])
                        bk[j][i+j]=j+1;
                else
                bk[j][i+j]=j;
                
            }
            else
            {
                dp[j][j+i]=psum[j+i]-psum[j-1]+dp[j+1][i+j];bk[j][i+j]=j;
                for(int k=j+1;k<i+j;k++)
                 {
                         dp[j][i+j]=min(dp[j][i+j],psum[j+i]-psum[j-1]+dp[j][k]+dp[k+1][i+j]);
                        if(dp[j][i+j]==psum[j+i]-psum[j-1]+dp[j][k]+dp[k+1][i+j])
                        bk[j][i+j]=k;
                 }
            }
        }
    }
     cout<<dp[1][n];
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    string S; cin >> S;
    if(S.size() >= 4 && S.substr(0, 4) == "YAKI"){
        cout << "Yes";
    }else{
        cout << "No";
    }
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
int x[100];
using namespace std;

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

    for(int i=0; i<n; i++)
        scanf("%d",&x[i]);




    int i, key, j;
    for(int k = 0;k < n; k++){
		if(k != n-1){
			printf("%d ",x[k]);
		}else{
			printf("%d\n",x[k]);
		}
	}

    for (i = 1; i < n; i++)
    {
        key = x[i];
        j = i - 1;

        while (j >= 0 && x[j] > key)
        {
            x[j + 1] = x[j];
            j = j - 1;

        }
        x[j + 1] = key;
        //printf(" \n");
        /*
        for(int i=0; i<n; i++)
            printf("%d ",x[i]);*/
        for(int k = 0;k < n; k++){
		if(k != n-1){
			printf("%d ",x[k]);
		}else{
			printf("%d\n",x[k]);
		}
	}

    }

    return 0;
}



Measured memory_bytes: 3184
fun main(args:Array<String>){
    val (appleTree, intD) = readLine()!!.split(" ").map(String::toInt)
    var treeOrder = 1
    var ans = 0
    while(1 > treeOrder - intD){
        treeOrder++
    }
    for(i in 1..appleTree){
        if((treeOrder + intD) * i >= appleTree){
            ans = i
            break
        }
    }
    print(ans)

}

Measured memory_bytes: 36412