akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var I = G;
		int Y = I[0], X = I[1];
		var queue = new Queue<Data>();
		var dist = new int[X, Y];
		for (var y = 0; y < Y; y++) for (var x = 0; x < X; x++) dist[x, y] = int.MaxValue;
		for (var y = 0; y < Y; y++)
		{
			var S = Str;
			for (var x = 0; x < X; x++) if (S[x] == '#') queue.Enqueue(new Data(new Point(x, y), 0));
		}
		var dx = new int[] { 1, 0, -1, 0, 1 };
		var ans = 0;
		while (queue.Count > 0)
		{
			var t = queue.Dequeue();
			var p = t.P;
			var d = t.D;
			if (p.Get(dist) <= d) continue;
			p.Set(dist, d);
			ans = Max(ans, d);
			for (var i = 0; i < 4; i++)
			{
				var q = new Point(p.X + dx[i], p.Y + dx[i + 1]);
				if (0 <= q.X && q.X < X && 0 <= q.Y && q.Y < Y && q.Get(dist) > d + 1) queue.Enqueue(new Data(q, d + 1));
			}
		}
		WriteLine(ans);
	}
}
struct Data
{
	public readonly Point P;
	public readonly int D;
	public Data(Point p, int d) { P = p; D = d; }
}
struct Point
{
	public readonly int X, Y;
	public T Get<T>(T[,] a) => a[X, Y];
	public T Set<T>(T[,] a, T v) => a[X, Y] = v;
	public Point(int x, int y) { X = x; Y = y; }
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

string a,b;

string dfs(int al,int ar,int bl,int br){
  if(al==ar||bl==br)return "";
  int level=0;
  int an,bn,alr,blr,arl,brl;
  repl(i,al,ar){
    if(a[i]=='(')level++;
    if(a[i]==')')level--;
    if(level==0&&a[i]=='['){
      int j=i;
      while(a[j]!=']')j++;
      an=stoi(a.substr(i+1,j-i-1));
      alr=i-1; arl=j+2;
      break;
    }
  }

  level=0;
  repl(i,bl,br){
    if(b[i]=='(')level++;
    if(b[i]==')')level--;
    if(level==0&&b[i]=='['){
      int j=i;
      while(b[j]!=']')j++;
      bn=stoi(b.substr(i+1,j-i-1));
      blr=i-1; brl=j+2;
      break;
    }
  }
  string res="("+dfs(al+1,alr,bl+1,blr)+")["+to_string(an+bn)+"]("+dfs(arl,ar-1,brl,br-1)+")";
  return res;
}

int main(){
	cin.sync_with_stdio(false);
  cin>>a>>b;
  cout<<dfs(0,a.length(),0,b.length())<<endl;
	return 0;
}

Measured memory_bytes: 3336
// AGC22-A-cpp.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <string>
#include <unordered_map>
#include <cmath>
using namespace std;
int main()
{
	string s;
	cin >> s;
	unordered_map<char, bool> m;
	for (size_t i = 0; i < 26; i++)
	{
		m['a' + i] = true;
	}
	for (size_t i = 0; i < s.size(); i++)
	{
		m[s[i]] = false;
	}
	if (s.size() < 26)
	{	
		for (size_t i = 0; i < 26; i++)
		{
			if (m['a' + i])
			{
				cout << s << char('a' + i) << endl;
				return 0;
			}
		}
	}
	else {
		for (size_t i = 25; i > 0; i--)
		{
			if (s[i] > s[i-1])
			{
				char q = s[i];
				for (auto ss : s.substr(i))
				{
					if (ss > s[i-1]) q = ss < q ? ss : q;
				}
				cout << s.substr(0, i-1) << q << endl;
				return 0;
			}
		}
	}
	cout << -1 << endl;

    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

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

    int N, V[3];
    cin >> N >> V[0] >> V[1] >> V[2];

    vector<int> l(N);
    REP(i, N) cin >> l[i];

    int ans = inf;
    vector<int> v = {0, 1, 2};
    do {
        int u = 0;
        int a = 0;
        REP(i, 3){
            int tmp = inf;
            int tmp_u = 0;
            FOR(j, 1, 1<<N) {
                if (bcnt(u & j) > 0) continue;

                int cnt = 0;
                int s = 0;
                REP (k, N) {
                    if (j >> k & 1) {
                        ++cnt;
                        s += l[k];
                    }
                }
                int cc = 10 * (cnt - 1) + abs(V[v[i]] - s);
                if (tmp > cc) {
                    tmp = cc;
                    tmp_u = j;
                }
            }
            u |= tmp_u;
            a += tmp;
        }

        ans = min(ans, a);

    } while(next_permutation(v.begin(), v.end()));

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    VL a(3);
    ll d;
    cin>>a[0]>>a[1]>>a[2]>>d;
    if(abs(a[2]-a[0])<=d)cout<<"Yes";
    else if(a[0]<=a[1]&&a[1]<=a[2]&&(a[2]-a[1])<=d&&(a[1]-a[0])<=d)cout<<"Yes";
    else if(a[0]>=a[1]&&a[1]>=a[2]&&(a[1]-a[2])<=d&&(a[0]-a[1])<=d)cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;

string s;

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    cin >> s;
    string new_s = ""; char prev_char = 'Z';
    for(int i = 0; i < s.size(); i++)
    {
        if(prev_char == s[i]) continue;
        new_s.push_back(s[i]);
        prev_char = s[i];
    }
    
    cout << new_s.size() - 1 << endl;

    return 0;
}


Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
#define LINF 1e18
typedef long long ll;
typedef pair<int, int> P;

int main() {
    string s; cin >> s;
    int n = sz(s);
    int ans = 0;
    bool flag = false;
    rep(i, n) {
        if (i==0) {
            ans++;
            continue;
        }
        if (i==n-1) {
            if (!flag && s[i] == s[i-1]) ans--;
        }
        if (s[i] != s[i-1] || flag) {
            ans++;
            flag = false;
            continue;
        }
        else {
            i++;
            ans++;
            flag = true;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 640
def solve():
    N = int(input())
    X = list(map(int, input().split()))
    
    sorted_X = sorted(X)
    mid_l = sorted_X[N // 2 - 1]
    mid_r = sorted_X[N // 2]
    
    for xi in X:
        if xi <= mid_l:
            print(mid_r)
        else:
            print(mid_l)


if __name__ == '__main__':
    solve()


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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  int cnt = 0;
  rep(i,n-2) if((p[i+1]-p[i])*(p[i+1]-p[i+2])<0) cnt++;
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b;
	c = a * b;

	if ((c % 2) == 1) {
		cout << "Odd" << endl;
	}
	else {
		cout << "Even" << endl;
	}

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))

using namespace std;

typedef long long ll;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,k;
  cin>>n>>k;
  
  vector<int> p(n);
  
  rep(i,n) cin>>p[i];
  
  sort(all(p));
  
  int sum = 0;
  rep(i,k) sum += p[i];
  cout<<sum;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

string in;
string l,r;
size_t cur;

bool rel[2][2];

bool formula(string &in,int mask){
	int n=in.size();
	while(cur<n){
		if(isupper(in[cur])){
			bool res=(in[cur++]=='T');
			return res;
		}
		if(islower(in[cur])){
			int index=(in[cur++]-'a');
			bool res=((mask&(1<<index))>0);
			return res;
		}
		if(in[cur]=='-'){
			cur++;
			bool res=formula(in,mask)^true;
			return res;
		}
		if(in[cur]=='('){
			cur++;
			bool a=formula(in,mask);
			char op=in[cur++];
			if(op=='-') cur++;
			bool b=formula(in,mask);
			cur++;
			switch(op){
				case '+':
					return a||b;
				case '*':
					return a&&b;
				case '-':
					return rel[a][b];
			}
		}
	}
	return true;
}

bool equation(){
	bool res=true;
	int n=in.size(),s;
	for(s=0;s<n;++s)if(in[s]=='=')break;
	l=in.substr(0,s);
	r=in.substr(s+1,n-s-1);
	rep(mask,1<<11){
		cur=0;
		bool resl=formula(l,mask);
		cur=0;
		bool resr=formula(r,mask);
		res&=(resl==resr);
	}
	return res;
}

int main(void){
	rel[0][0]=rel[0][1]=rel[1][1]=true;
	rel[1][0]=false;
	while(cin >> in){
		if(in=="#")
			break;
		bool ans=equation();
		if(ans)
			puts("YES");
		else
			puts("NO");
	}
	return 0;
}

Measured memory_bytes: 1264
A, B, C, X, Y = [int(i) for i in input().split()]

cost1 = X * A + Y * B

c = X * 2
a = 0
b = max([0, Y - c / 2])
cost2 = a * A + b * B + c * C

c = Y * 2
a = max([0, X - c / 2])
b = 0
cost3 = a * A + b * B + c * C

print(int(min([cost1, cost2, cost3])))



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

using ull = unsigned long long;

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

	ull op_count{}, b_count{};

	for (const auto&e : s) {
		if (e == 'B')
			b_count += 1;
		else
			op_count += b_count;

	}
	std::cout << op_count << "\n";

	return 0;
}

Measured memory_bytes: 1336
inp = input() 
inp_lis = inp.split(" ")
A = int(inp_lis[0])
B = int(inp_lis[1])

add_times = 0
number_of_tap = 1

while number_of_tap < B:
    number_of_tap = number_of_tap + A - 1
    add_times = add_times + 1

print(add_times)


Measured memory_bytes: 2940
#include <stdio.h>

typedef unsigned long long ull;

int main(void)
{
	ull ans = 0, n, i, tmp;

	scanf("%lld", &n);

	i = 1;
	while (i <= n)
	{
		tmp = (int)(n / i); // 項数
		ans += (i + (i * tmp)) * tmp / 2;
		i++;
	}
	printf("%llu", ans);
	return (0);
}


Measured memory_bytes: 1728
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
    sum = 0
    for j in range(M):
        sum += A[i - 1][j - 1] * B[j - 1]
    if sum > - C:
        ans += 1
print(ans)



Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();

        int first = (s.length()-1)/2;
        int second = (s.length()+3)/2;
        System.out.println(isPalindrom(s) && isPalindrom(s.substring(0,first)) && isPalindrom(s.substring(second-1))?"Yes":"No");
    }

    private static boolean isPalindrom(String substring) {
        return new StringBuilder(substring).reverse().toString().equals(substring);
    }
}

Measured memory_bytes: 21844
#include<stdio.h>

int main(void) {

	int time = 0;	scanf("%d", &time);
	//printf("%d\n", time);	//デバック用

	printf("%d:", time / 3600);
	printf("%d:", (time % 3600) / 60);
	printf("%d\n", (time % 3600) % 60);

	return 0;
}


Measured memory_bytes: 2104
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k = LI()
    a = LI()
    ans = float("inf")
    for b in range(1<<(n-1)):
        b <<= 1
        if bin(b).count("1") != k-1:
            continue
        m = a[0]
        s = 0
        for i in range(1,n):
            if not b&(1<<i):
                if m < a[i]:
                    m = a[i]
            else:
                if a[i] <= m:
                    m += 1
                    s += m-a[i]
                else:
                    m = a[i]
        if s < ans:
            ans = s
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 40432
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>


using namespace std;

int main(){
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int answer=0;
  for(int i=0;i<a+1;i++){
    for(int j=0;j<b+1;j++){
      for(int k=0;k<c+1;k++){
        if(x==500*i+100*j+50*k)answer++;
      }
    }
  }



  cout<<(answer);
  return 0;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
C = Counter(A)
A = set(A)
B = [True] * (10 ** 6 + 1)
for a in A:
    for i in range(2 * a,10**6 + 1 ,a):
        B[i] = False
cnt = 0
for a in A:
    if (B[a] == True) and (C[a] == 1):
        cnt += 1
print(cnt)

Measured memory_bytes: 50780
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll i, temp,t, W, H,j, dp[1010][1010];
string s[1010];
int main()
{
    //I am Monim, a tiny creature of Allah
    cin >> H >> W;
    for(i=0;i<H;i++)
        cin >> s[i];
    for(i=0;i<H;i++)
    {
        for(j=0;j<W;j++)
        {
            if(i==0 && j==0)
                dp[i][j] = 1;
            if(s[i][j]=='.')
            {
                if(i>0)
                    dp[i][j] += dp[i-1][j];
                if(j>0)
                    dp[i][j] += dp[i][j-1];
            }
            if(dp[i][j]>1000000007)
                dp[i][j]%=1000000007;
        }
    }
    cout << dp[H-1][W-1] << endl;
    return 0;
}



Measured memory_bytes: 13276
#include <stdio.h>

int main() {
  int i, j;
  int H, W;
  while (1) {
    scanf("%d %d", &H, &W);
    if (H == 0 && W == 0) break;
    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {
        putchar('#');
      }
      putchar('\n');
    }
    putchar('\n');
  }
  return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<vector>
#include<map>

int main() {
	int n = 0,in = 0,count = 0;
	int tcount = 0;
	std::map<int, int> m;
	std::vector<int> type;
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> in;
		if (m[in] == 0) {
		type.push_back(in);
		}
		m[in]++;
	}
	for (int i = 0; i < type.size(); i++) {
		if (m[type[i]] > type[i]){
			count += m[type[i]] - type[i];
		}
		else if (m[type[i]] < type[i]) {
			count += m[type[i]];
		}
	}
	std::cout << count << std::endl;
	return 0;
}

Measured memory_bytes: 5112
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

using P = pair<string, pair<int, int>>;

int main(void){
    Cin(int, n, k);
    Cins(int, n, v);
    
    auto sum = [&](int l, int r){
        int ans = 0;
        for(int i = l; i < r; i ++) ans += v[i];
        return ans;
    };
    auto push = [&](int l, int r, int k){
        int ans = 0;
        vector<int> v2;
        for(int i = 0; i < l; i ++) v2.push_back(v[i]);
        for(int i = n-r; i < n; i ++) v2.push_back(v[i]);
        Sort(v2);
        for(int i = 0; i < k && i < (int)v2.size(); i ++){
            if(v2[i] >= 0) break;
            ans += v2[i];
        }
        return ans;
    };

    int ans = 0;
    for(int l = 0; l <= n && l <= k; l ++){
        int sl = sum(0, l);
        for(int r = 0; l+r <= n && l+r <= k; r ++){
            int sr = sum(n-r, n);
            int sm = push(l, r, k-l-r);
            ans = max(ans, sl + sr - sm);
            // Cout("(", l, ", ", r, ") ", sl + sr - sm);
        }
    }
    Cout(ans);
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;
ll t[101];

ll gcd(ll x, ll y)
{
    ll r;
    if(x == 0 || y == 0)  // 引数チェック
    {
        return 0;
    }
    while((r = x % y) != 0) // yで割り切れるまでループ
    {
        x = y;
        y = r;
    }
    return y;
}
ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0)  // 引数チェック
    {
		        return 0;
		    }

    return (x/gcd(x, y)*y);
}
int main(){
	int n;
	ll ans=1;
	cin>>n;
	rep(i,n){
		cin>>t[i];
		
		ans=lcm(t[i],ans);
	}

	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a=0,b=0,c=0;
    string S;
    cin >> S;
    for(int i=0;i<4;i++){
       if( S.at(i) == S.at(0)){
           a=a+1;
       }
       if(S.at(i) == S.at(1)){
           b=b+1;
       }
       if(S.at(i) == S.at(2)){
           c=c+1;
       }
    }
    if(a==2&&b==2&&c==2){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int arr[n+1] , t[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}
	t[1]=0;
	t[2]=abs(arr[2]-arr[1]);
	for(int i=3;i<=n;i++)
	  t[i]=min(abs(arr[i]-arr[i-1]) + t[i-1] , abs(arr[i]-arr[i-2]) + t[i-2]);
	cout<<t[n]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f;
const ll mod = 998244353LL;
clock_t TIME_START, TIME_END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME_END - TIME_START) / CLOCKS_PER_SEC);
    system("pause");
#endif
}
int n, m, k;
char col[10][10];
char col2[10][10];
int ans;
void Init()
{
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            col2[i][j] = col[i][j];
}
int cnt()
{
    int ret = 0;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            ret += (col2[i][j] == '#');
    return ret;
}

void solve()
{
    cin >> n >> m >> k;
    for (int i = 0; i < n; ++i)
        scanf("%s", col[i]);
    for (int st1 = 0; st1 < st(n); ++st1)
    {
        for (int st2 = 0; st2 < st(m); ++st2)
        {
            Init();
            for (int i = 0; i < n; ++i)
            {
                if (st1 & (1 << i))
                {
                    for (int j = 0; j < m; ++j)
                        col2[i][j] = '0';
                }
            }
            for (int j = 0; j < m; ++j)
            {
                if (st2 & (1 << j))
                {
                    for (int i = 0; i < n;++i)
                        col2[i][j] = '0';
                }
            }
            if (cnt() == k)
                ans++;
        }
    }
    cout << ans << '\n';
}

int main()
{
    TIME_START = clock();
    int Test = 1;
    // cin >> Test;
    while (Test--)
        solve();
    TIME_END = clock();
    program_end();
    return 0;
}

Measured memory_bytes: 3760
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int dec[10][10];
  int x,y,size,num,max;
  char a;
  num = 0;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
       dec[i][j]=0;
    }
  }
                 
  while(cin >> y >> a>> x>> a>> size){
    if(size == 1){
      if(x+1 < 10 && x+1 >= 0 && y>=0 && y<10) dec[x+1][y] += 1;
      if(x-1 >=0 && x-1 < 10 && y>=0 && y<10) dec[x-1][y] += 1;
      if(x >= 0 && x < 10 && y+1<10 && y+1 >= 0) dec[x][y+1] += 1;
     if(x >=0 && x< 10 && y-1 <10 && y-1 >=0) dec[x][y-1] += 1;
        dec[x][y] += 1;
        } else if(size == 2){
      for(int i=-1;i<=1;i++){
    for(int j=-1;j<=1;j++){
      if(x+i >=0&& x+i<10 && y+j>=0&& y+j<10) dec[x+i][y+j] +=1;
    }
      }
    }else if(size==3){
      for(int i=-1;i<=1;i++){
    for(int j=-1;j<=1;j++){
      if(x+i >=0&& x+i<10 && y+j>=0&& y+j<10)  dec[x+i][y+j] +=1;
    }
      }
      if(x+2<10 && x+2 >=0 && y>=0 && y<10  )dec[x+2][y] +=1;
      if(x-2>=0 &&x-2 <10 && y>=0 && y<10  )dec[x-2][y] +=1;
      if(x<10 && x >=0 && y+2>=0 && y+2<10  )dec[x][y+2] +=1;
      if(x>=0 && x<10 && y-2>=0 && y-2<10  )dec[x][y-2] +=1;
    }
  }
  max = dec[0][0];
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){ 
      if(dec[i][j]==0)
    num +=1; 
      if(max < dec[i][j])
    max=dec[i][j];
    }
  }
  cout << num << endl << max<<endl;
}

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

static const int MAX=1000;
static const int VMAX=10000;

int n, A[MAX],s;
int B[MAX], T[VMAX+1];

int solve(){
    int ans = 0;

    bool V[MAX];
    for(int i=0; i<n; ++i){
        B[i] = A[i];
        V[i] = false;
    }
    sort(B,B+n);
    for(int i=0; i<n; ++i)
        T[B[i]] = i;
    
    for(int i=0; i<n; ++i){
        if(V[i])
            continue;
        int cur = i;
        int S=0;
        int m=VMAX;
        int an = 0;
        while( true ){
            V[cur] = true;
            an++;
            int v = A[cur];
            m = min(m,v);
            S += v;
            cur = T[v];
            if( V[cur] )
                break;
        }
        ans += min(S+(an-2)*m,m+S+(an+1)*s);
    }
    return ans;
}

int main(){
    cin >> n;
    s = VMAX;
    for(int i=0; i<n; i++){
        cin >> A[i];
        s= min(s,A[i]);
    }
    int ans = solve();
    cout << ans << endl;
}


Measured memory_bytes: 3188
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <set>
#include <vector>
using namespace std;
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        set<int>st;
        vector<int>v;
        for(int i=0;i<n;i++)
        {
           int a;
           cin>>a;
           if(st.count(a))
           {
               st.erase(a);
               v.push_back(a);
           }
           else
           {
               st.insert(a);
           }
        }

        sort(v.begin(),v.end());

        if(v.size()<2)
        {
            printf("0\n");
        }
        else
        {
            int num=(int)v.size();
            printf("%lld\n",1ll*(v[num-1]) *(v[num-2]));
        }
    }
    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define LL long long
#define db double

using namespace std;
const int N=5000+10;
int rd()
{
    int x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();}
    return x*w;
}
/*
f[x][y]=num of bar=x sum of length=y,last bar's length=0

      o
      o
  ooooo
_oooooo
|<-x->|  sum of o = y
ans= \sum_{i=0}^{n-1} f[n/2+1][i],2|n
     \sum_{i=0}^{n-1} f[n/2+1][i]*((n-1-i)/(n/2+1)+1),otherwise
*/
int n,mod,f[2][N];
void ad(int &x,int y){x+=y,x-=x>=mod?mod:0;}

int main()
{
//aha
	n=rd(),mod=rd();
	int nw=1,la=0;
	f[la][0]=1;
	for(int i=1;i<=n/2;++i)
	{
		for(int j=0;j<n;++j)
		{
			if(!f[la][j]) continue;
			for(int k=j,l=1;k<n;k+=i,++l) ad(f[nw][k],1ll*f[la][j]*l%mod);
			f[la][j]=0;
		}
		nw^=1,la^=1;
	}
	int ans=0;
	if(n&1)
	{
		for(int i=0;i<n;++i)
			ad(ans,1ll*f[la][i]*((n-1-i)/(n/2+1)+1)%mod);
	}
	else
	{
		for(int i=0;i<n;++i)
			ad(ans,f[la][i]);
	}
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()


int main(){
    string s;
    cin >> s;
    string ans = "No";
    int A[4] = {0};
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'N') A[0] = 1;
        if(s[i] == 'S') A[1] = 1;
        if(s[i] == 'E') A[2] = 1;
        if(s[i] == 'W') A[3] = 1;
    }
    bool ns = A[0] && A[1], ew = A[2] && A[3], xns = !A[0] && !A[1] , xew = !A[2] && !A[3];
    if((ns && ew) || (ns && xew) || (xns && ew)) ans = "Yes";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
const ll MOD=1000000007;

int main(){
    string S;
    cin >> S;
    bool n=false,w=false,s=false,e=false;
    rep (i,S.size()){
        if (S[i]=='N'){
            n=true;
        }
        else if (S[i]=='W'){
            w=true;
        }
        else if (S[i]=='S'){
            s=true;
        }
        else {
            e=true;
        }
    }
    if ((n&&w&&s&&e)||(n&&!w&&s&&!e)||(!n&&w&&!s&&e)){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<map>
#define REP(i, n) for(int i = 0;i < n;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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const int z = 1000000007;
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
int main() {
    int n,m;
    llong k;
    cin >> n >> m >> k;
    vector<llong> veca(n), vecb(m);
    REP(i, n) {
        cin >> veca[i];
    }
    REP(i, n-1) {
        veca[i + 1] += veca[i];
        if (veca[i + 1] < 0) {
            for (int ii = i+1; ii < n - 1; ++ii) {
                veca[ii] = LLONG_MAX;
            }
        }
    }
    REP(i, m) {
        cin >> vecb[i];
    }
    REP(i, m-1) {
        vecb[i + 1] += vecb[i];
        if (vecb[i + 1] < 0) {
            for (int ii = i + 1; ii < m - 1; ++ii) {
                vecb[ii] = LLONG_MAX;
            }
        }
    }
    int ans = distance(vecb.begin(), upper_bound(vecb.begin(), vecb.end(), k));
    
    REP(i, n) {
        llong left = k - veca[i];
        if (left < 0) {
            continue;
        }
        int b_num = distance(vecb.begin(),upper_bound(vecb.begin(), vecb.end(),left));
        if (i + 1 + b_num > ans) {
            ans = i + 1 + b_num;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6348
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PI 3.14159265359

using namespace std;

/*ll powMod(ll a, ll y)
{
    ll ans = 1;
    
    while (y > 0) 
    { 
        if (y & 1) 
            ans = (ans*a) % MOD; 
  
        y = y>>1;
        a = (a*a) % MOD; 
    } 
    return ans;
}*/

/*ll modInv(ll a)
{
    return powMod(a, MOD-2);	
}*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int x;
    cin>>x;
    cout << (1000 - x%1000)%1000;
    return 0;
}




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

	int tsP[1001 * 1001];
	int main() {
		int N, M;
		int P[1001];
		int ans;
		int cnt;

		P[0] = 0;

		//cin >> N >> M;
		while (cin>>N>>M,N&&M) {
			ans = 0;
			cnt = 0;
			for (int i = 1; i <= N; i++) {
				cin >> P[i];
			}

			for (int i = 0; i <= N; i++) {
				for (int j = i; j <= N; j++) {
					if (P[i] + P[j] <= M) {
						tsP[cnt++] = P[i] + P[j];
					}

				}
			}
			sort(tsP, tsP + cnt);
			for (int i = 0; i < cnt; i++) {
				//for (int j = i; j < cnt; j++) {
					//if (tsP[i] + tsP[j] <= M) {
						ans = max(ans, /*tsP[i] + tsP[j]*/tsP[i] + *(upper_bound(tsP, tsP + cnt, M - tsP[i]) - 1));
					//}
				//}
			}
			cout << ans << endl;
		}
		return 0;
	}


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


int main(){


  int n,k;
  cin>>n>>k;
  
  long long answer=0;
  
  

  if (k%2!=0){
    answer=pow(n/k,3);
  }
  
  else {
    answer=pow(n/k,3)+pow((n+(k/2))/k,3);
  }
  
  cout<<answer<<endl;
  
  
    
      
   
    
  
  
  

    
    
    

  
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n); i >= 0; i--)
#define revrepr(i, a, b) for (int i = (a); i >= b; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

int main() {
    string s;
    cin >> s;
    rep(i, (int)s.size()) cout << 'x';
    cout << endl;
}

Measured memory_bytes: 256
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 = sc.nextInt();
        if ((10 * b + c) % 4 == 0 ) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

}

Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>
#define MAX 100005
#define NIL -1

int parent[MAX],left[MAX],right[MAX];
int n,D[MAX];

void print(int u){
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",parent[u]);
  printf("depth = %d, ",D[u]);
  if(parent[u]==NIL) printf("root, ");
  else if (left[u]==NIL)printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  for(i=0,c=left[u];c!=NIL; i++, c=right[c]){
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}
  void rec(int u,int p){
    D[u]=p;
    if(right[u]!=NIL){  rec(right[u],p);}
    if(left[u]!=NIL) {  rec(left[u],p+1);}
  }

  int main(){
    int i,j,d,v,c,l,r;
    scanf("%d",&n);
    for (i=0;i<n;i++) {
      parent[i]=left[i]=right[i]=NIL;
    }
    for (i=0;i<n;i++){
      scanf("%d %d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0)left[v]=c;
      else right[l]=c;
      l=c;
      parent[c]=v;
    }
  }
  for (i=0;i<n;i++){
    if (parent[i]==NIL)r=i;
  }
  rec(r,0);

  for (i=0;i<n;i++) print(i);
  return 0;
}



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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18;
const int INF = 1e9;
const double EPS = 0.000000001;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

bool pC(const P& pair1, const P& pair2) {
    return pair1.second > pair2.second;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, a, b;
  cin >> n >> a >> b;
  VI x(n);
  REP(i, n){
    cin >> x[i];
  }
  ll ans = 0;
  REP(i, n-1){
    ans += min(a * (x[i+1] - x[i]), b);
  }
  out(ans);
  return 0;
}


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

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

  int n;
  cin >> n;
  ll a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  ll l = 0, r = 0;
  ll tmp = a[0];
  ll cnt = 0;
  ll b[n] = {};
  b[0] = a[0];
  for (int i = 1; i < n; i++) b[i] += a[i] + b[i - 1];
  while (l < n) {
    while ((tmp & a[r + 1]) == 0 && r + 1 < n) {
      r++;
      tmp |= a[r];
    }
    cnt += r - l + 1;
    l++;
    r = max(r, l);
    tmp = b[r] - b[l - 1];
  }
  cout << cnt << endl;
  return 0;
}


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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

template<typename T>
T GCD(T a, T b) {
  if(a > b) std::swap(a, b);
  if(a == 0) return b;
  else return GCD(b % a, a);
}

template<typename T>
T LCM(T a, T b) {
  if(a > b) std::swap(a, b);
  if(a == 0) return 0;
  else return a / GCD(a, b) * b;
}

int f(ll x) {
  int res = 0;
  while(x%2 == 0) {
    x /= 2;
    ++res;
  }
  return res;
}

int main() {
  int N;
  ll M;
  std::cin >> N >> M;

  std::vector<ll> a(N);
  rep(i, N) {
    std::cin >> a[i];
    a[i] /= 2;
  }

  int t = f(a[0]);
  rep(i, N) {
    if(f(a[i]) != t) {
      std::cout << 0 << '\n';
      return 0;
    }
    a[i] >>= t;
  }
  M >>= t;

  ll l = 1;
  rep(i, N) {
    l = LCM(l, a[i]);
    if(l > M) {
      std::cout << 0 << '\n';
      return 0;
    }
  }

  M /= l;
  int ans = (M + 1) / 2;
  std::cout << ans << '\n';

}


Measured memory_bytes: 1024
n = int(input())
s = [input() for _ in range(n)]

count = {}
max_v = 0
max_lst = []
for i in range(n):
    word = s[i]
    if word in count.keys():
        count[word] += 1
    else:
        count[word] = 1
    if max_v < count[word]:
        max_v = count[word]

# max_v = max(count.values())
# max_lst = [kv[1] for kv in count.items() if kv[1] == max_v]
for kv in count.items():
    if kv[1] == max_v:
        max_lst.append(kv[0])

max_lst.sort()
for w in max_lst:
    print(w)


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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:usize,
        xn:[usize;n],
    }
    let mut ans = 0;
    let mut cnt = 0;
    for i in 1..n {
        if xn[i-1] >= xn[i] {
            cnt += 1;
        } else {
            ans = max(ans,cnt);
            cnt = 0;
        }
    }
    ans = max(ans,cnt);
    println!("{}",ans);
}


fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


Measured memory_bytes: 4352
var
	i,a,t:Longint;
	s:String;
begin
	readln(i);
	readln(s);
	for i:=1 to length(s) do begin
		if s[i]='I' then inc(t) else dec(t);
		if a<t then a:=t;
	end;
	writeln(a)
end.


Measured memory_bytes: 128
X = int(input())

V = (100, 101, 102, 103, 104, 105)
#V = (3, 4, 8, 11)
Memo = [0] * (X+1)

if X < min(V):
    print (0)
    exit()

for i in range(len(V)):
    if V[i] > X:
      continue
    Memo[V[i]] = 1
    for j in range(1, X+1):
        if j - V[i] > 0:
            Memo[j] |= Memo[j-V[i]]

print (Memo[X])
#print (Memo)


Measured memory_bytes: 3828
#include <bits/stdc++.h>  // ver1.9.4
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a[a.size()-1]<<endl;
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

signed main() {
  cout << fixed << setprecision(15);
  int n;
  cin >> n;
  Vi a(n);
  rep(i,0,n) cin >> a[i];
  int minn = a[0],ans=0;
  
  rep(i,1,n){
    if(minn > a[i]) {minn = a[i];continue;}
    ans = max(a[i]-minn,ans);
  }
  if(ans>0) {cout << ans << endl;return 0;}
  
  int ans2=(-1)*INF;
  rep(i,0,n-1){
    ans2 = max(ans2,a[i+1]-a[i]);
  }
  cout << ans2<<endl;
  return 0;
}



Measured memory_bytes: 4360
[h,w] = [int(i) for i in input().split()]
s = []
tate = [[0] * (h+2) for i in range(w+2)]
yoko = [[0] * (w+2) for i in range(h+2)]
s.append("#"*(w+2))
for i in range(h):
    tmp = input()
    s.append(tmp.join(["#","#"]))
s.append("#"*(w+2))

#横
for i in range(1,h+1):
    tmp = 1
    before = 1
    while tmp < w+2:
        if s[i][tmp] == "#":
            before += 1
            tmp += 1
        else:
            while s[i][tmp] != "#":
                tmp += 1
                if tmp == w+2:
                    break
            yoko[i][before:tmp] = [tmp-before] * (tmp - before)
            before = tmp

for i in range(1,w+1):
    tmp = 1
    before = 1
    while tmp < h+2:
        if s[tmp][i] == "#":
            before += 1
            tmp += 1
        else:
            while s[tmp][i] != "#":
                tmp += 1
                if tmp == h+2:
                    break
            tate[i][before:tmp] = [tmp-before] * (tmp - before)
            before = tmp
ans = 0
for i in range(1,h+1):
    for j in range(1,w+1):
        ans = max(ans,tate[j][i]+yoko[i][j]-1)
print(ans)


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

int n;

long long sum=0;
long long ucln(long long a,long long b){
if (b==0) return a;
return ucln(b,a%b);
}
int main(){
cin>>n;
for (int i=1;i<=n;i++){
    for (int j=1;j<=n;j++){
        for (int p=1;p<=n;p++){
            sum+=ucln(ucln(i,j),p);
        }
    }
}
cout<<sum;
}


Measured memory_bytes: 3632
n=int(input())
h=[int(x) for x in input().rstrip().split()]
ans=0
cnt=0
for i in range(1,n):
    if h[i]<=h[i-1]:
        cnt+=1
    else:
        ans=max(ans,cnt)
        cnt=0
ans=max(ans,cnt)    
print(ans)

Measured memory_bytes: 20036
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    if(s[k-1] == 'A') s[k-1] = 'a';
    else if (s[k-1] == 'B') s[k-1] = 'b';
    else s[k-1] = 'c';
    cout << s << endl;
}
        

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >>r;
    
    if(x - r < 0 || x + r > W || y - r < 0 || y + r > H ){
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD=1e9+7ll;
int n,a,b,ans;

inline int pow(int a,int n)
{
	int res=1ll;
	while (n)
	{
		if (n&1ll) res=res*a%MOD;
		a=a*a%MOD;
		n>>=1ll;
	}
	return res%MOD;
}

inline int C(int n,int m)
{
	if (n<m) return 0ll;
	if (m<n-m) m=n-m;
	int a=1ll;
	for (register int i=m+1; i<=n; ++i) a=a*i%MOD;
	int b=1ll;
	for (register int i=1; i<=n-m; ++i) b=b*i%MOD;
	return a*pow(b,MOD-2ll)%MOD;
}

inline int Lucas(int n,int m)
{
	if (n<m) return 0ll;
	if (n==m && !m) return 1ll;
	return C(n/MOD,m/MOD)*C(n%MOD,m%MOD)%MOD;
}

signed main(){
	scanf("%lld%lld%lld",&n,&a,&b);
	ans=((pow(2ll,n)-Lucas(n,a)-Lucas(n,b)-1ll)%MOD+MOD)%MOD;
	printf("%lld\n",ans);
return 0;	
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import numpy as np
N = int(input())
X = np.array([int(x) for x in input().split()])
Y = np.sort(X)
right = N // 2
left = right - 1
right, left = Y[right], Y[left]
for i in range(N):
    if X[i] <= left:
        print(right)
    else:
        print(left)

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

int main(){
 int N,H,W,count=0;
  cin >> N >> H >> W;
  for(int i=0;i<N;i++){
    int A,B;
    cin >> A >> B;
    if(A>=H && B>=W){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3592
s = str( input() )

n = len( s )
s_l = s[:(n-1)//2]
s_r = s[(n+1)//2:]

if s == s[::-1] and s_l == s_l[::-1] and s_r == s_r[::-1]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060