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

int main(){
  int n,k; scanf("%d%d",&n,&k); 
  vector<int> a(n); 
  for(auto &x:a){
    scanf("%d",&x); 
  }
  vector<int> dp(k+1,0); 
  for(int stones=0;stones<=k;stones++){
    for(int x:a){
      if(stones-x>=0 && !dp[stones-x]){
        dp[stones]=1; 
      }
    }
  }
  printf("%s\n", (dp[k])?"First":"Second");
}

Measured memory_bytes: 640
n = gets.strip

mx = 0
count = 1
prev = ''
n.chars do |c|
    if prev == ''
        count = 1
    end
    if prev == c
        count += 1
    else
        count = 1
    end
    prev = c
    mx = [mx, count].max
end

puts mx >= 3 ? 'Yes' : 'No'

Measured memory_bytes: 1788
/**
 *    author:  DFLMKWR
 */

#include <iostream>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  double d, t, s;
  cin >> d >> t >> s;
  if (d / s - t > 0) cout << "No";
  else cout << "Yes";
  cout << "\n";
  return 0;
}


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

using namespace std;

#define forn(i, x, n) for (int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for (int i = int(n); i >= int(x); --i)
#define F first
#define S second
#define pb push_back

typedef long long ll;
typedef pair <int, int> pii;
typedef long double ld;
typedef vector <int> vi;

const int N = 2e5 + 1;
const ll INF = 1e18 + 9;
const int B = 1e9 + 7;
const int K = 1e3;

int n, m;
int f[N], t[N];
int u[K][K], shit[K];

int main() {
    #ifdef black
    freopen("in", "r", stdin);
    #endif // black
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> m;
    forn(i, 1, m)
        cin >> f[i] >> t[i];
    forn(i, 1, n) {
        u[i][i] = 1;
        for1(j, m, 1) {
            int a = f[j], b = t[j];
            if (!u[i][a] && !u[i][b]) continue;
            if (u[i][a] && u[i][b]) {
                shit[i] = 1;
                break;
            }
            u[i][a] = 1, u[i][b] = 1;
        }
    }
    int ans = 0;
    forn(i, 1, n) {
        forn(j, i + 1, n) {
            if (shit[i] || shit[j]) continue;
            bool fuck = 0;
            forn(k, 1, n)
                if (u[i][k] && u[j][k])
                    fuck = 1;
            if (!fuck) ++ans;
        }
    }
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 4480
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>
 
using namespace std;
 
typedef long long ll;
 
const int N = 2e5 + 7;
const int K = 51;
 
int dp[N][K];
 
const int Inf = 1e9 + 228;
 
int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n, t;
  cin >> n >> t;
  vector <int> have;
  vector <int> a, b;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    if (x == 0) have.push_back(y);
    else {
      a.push_back(x);
      b.push_back(y);
    }
  }
  sort(have.begin(), have.end());
  int m = have.size();
  vector <ll> pref(m + 1);
  for (int i = 0; i < m; ++i) pref[i + 1] = pref[i] + have[i];
  n = a.size();
  vector <int> p(n);
  iota(p.begin(), p.end(), 0);
  sort(p.begin(), p.end(), [&] (int i, int j) {
    return (ll)a[i] * (b[j] + 1) > (ll)a[j] * (b[i] + 1);
  });
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j < K; ++j) {
      dp[i][j] = Inf;
    }
  }
  dp[0][0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < K; ++j) {
      if (dp[i][j] == Inf) continue;
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      int need = min((ll)Inf, dp[i][j] + 1 + (ll)(dp[i][j] + 1) * a[p[i]] + b[p[i]]);
      if (j + 1 < K) dp[i + 1][j + 1] = min(dp[i + 1][j + 1], need);
    }
  }
  int ans = 0;
  for (int i = 0; i < K; ++i) {
    if (dp[n][i] > t) continue;
    int hv = t - dp[n][i];
    int l = 0, r = m + 1;
    while (r - l > 1) {
      int mid = (l + r) >> 1;
      if (pref[mid] + mid <= hv) l = mid;
      else r = mid;
    }
    ans = max(ans, i + l);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 42732
import sys

def solve():
    file_input = sys.stdin
    N, K = map(int, file_input.readline().split())
    
    G = [[] for i in range(10)]
    for line in file_input:
        c, g = map(int, line.split())
        G[g - 1].append(c)
    
    for genre in G:
        genre.sort(reverse=True)
        for i, p in zip(range(1, len(genre)), genre):
            genre[i] += p + 2 * i # Recording cumulative price
    
    C = [0] * (K + 1)
    for genre in G:
        pre_C = C.copy()
        for n, p in zip(range(len(genre), 0, -1), genre[::-1]):
            for i, vals in enumerate(zip(pre_C[n:], C)):
                v1, v2 = vals
                v1 += p
                if v1 > v2:
                    C[i] = v1
    print(C[0])

solve()


Measured memory_bytes: 5724
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]

ans=-1
for i in range(1000):
    moji=str(i)
    if(len(moji)!=n):continue
    for s,c in sc:
        if(moji[s-1]!=str(c)):break
    else:
        ans=i
        break
print(ans)

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;

double EPS=1e-9;
int INF=1000000005;
long long INFF=1000000000000000005ll;
double PI=acos(-1);
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 };
const ll MOD = 1000000007;

ll sum() { return 0; }
template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define OUTH(x) cout << x << " "
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a=max(a, b)
#define MIN(a, b) a=min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;

void solve() {
	
}

int main()
{
    FAST_INP;
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt","r", stdin);
//    freopen("output.txt","w", stdout);
//    #endif

//    int tc; cin >> tc;
//    TC(tc) solve();
	string s;
	cin >> s;
	int n = s.size();
	if(s[n-1]=='s') s+="es";
	else s+="s";
	OUT(s);
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	for(auto &i:a)
	{
		cin >> i;
	}
	ll l=0,r=0;
	sort(a.rbegin(),a.rend());
	for(int i = 0;i<n-1;i++)
	{
		if(a[i]==a[i+1])
		{
			l = r;
			r = a[i];
			i++;
		}
		if(l)break;
	}
	cout<<l*r<<endl;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

unsigned int _gcd(unsigned int a, unsigned int b) {
  if (b == 0) return a;
  return _gcd(b, a % b);
}

unsigned int gcd(unsigned int a, unsigned int b) {
  if (a>b) return _gcd(a, b);
  else return _gcd(b, a);
}

int main (){
  unsigned int K;
  long long int ans=0;
  cin >> K;
  for (int i=1; i<=K; i++)
    for (int j=1; j<=K; j++)
      for (int k=1; k<=K; k++)
        ans += gcd(gcd(i, j), k);

  cout << ans << endl;
}

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

int main() {
  double D,T,S;
  cin >> D >> T >> S;
  // D = (double)D;
  // T = (double)T;
  // S = (double)S;
  if(D/S <= T){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3716
X, K, D = map(int, input().split())

abs_x = abs(X)
num = int(abs_x / D)


def calc_min():
    if K < num:
        # マイナス方面or+方面に向かうだけで回数の上限
        if X < 0:
            return X + D * K
        return X - D * K

    # これより先は距離Dを行ったり来たりするだけ
    base_pos = X - D * num if X > 0 else X + D * num

    if (K - num) % 2 == 0:
        return base_pos
    else:
        return base_pos - D if base_pos > 0 else base_pos + D


print(abs(calc_min()))


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = 200005;
int aa[N], bb[N], a[N], b[N*2], f[N];

void compute(int n){
	f[0] = 0;
	int i = 1, j = 0;
	while(i < n){
		if(a[i] == a[j]){
			f[i] = j + 1;
			i++; j++;
		}else if(j){
			j = f[j - 1];
		}else{
			f[i] = 0;
			i++;
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	for(int i = 0; i < n; i++){
		cin>>a[i]; aa[i] = a[i];
	}
	for(int i = 0; i < n; i++){
		cin>>b[i]; bb[i] = b[i];
		b[i + n] = b[i];
	}
	if(n == 1){
		cout<<1<<'\n';
		exit(0);
	}
	for(int i = 0; i + 1 < n; i++){
		a[i] = a[i]^a[i + 1];
	}
	for(int j = 0; j + 1 < 2*n; j++){
		b[j] = b[j]^b[j + 1];
	}
	int len1 = n - 1;
	int len2 = 2*len1;
	compute(len1);
	vector<pair<int, int> > ans;
	int i = 0, j = 0;
	while(i < len2){
		if(j == len1){
			int k = i - len1;
			k = (2*n - k)%n;
			ans.push_back({k, aa[k]^bb[0]});
			j = f[j - 1];
		}else if(b[i] == a[j]){
			i++; j++;
		}else if(j){
			j = f[j - 1];
		}else{
			i++;
		}
	}
	if(j == len1){
		int k = i - len1;
		k = (2*n - k)%n;
		ans.push_back({k, aa[k]^bb[0]});
	}
	sort(ans.begin(), ans.end());
	for(auto x : ans){
		cout<<x.first<<" "<<x.second<<endl;
	}

	return 0;
}

Measured memory_bytes: 9840
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mp make_pair
#define pb push_back
#define pll pair<ll,ll>
ll INF = 1000000007;

//-----------------//
  #define amin main
//-----------------//

ll exp(ll x, ll n)
{if(n==0) return 1;if(n==1) return x%INF;if(n%2==0) return exp((x*x)%INF,n/2); else return(x*exp((x*x)%INF,n/2))%INF;}


int amin()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t,i,j;
	ll n,k;
	cin>>n>>k;
	ll arr[n];
	for(i=0;i<n;i++)
		cin>>arr[i];
	ll cur = 0;

	for(i=k;i<n;i++)
	{
		if(arr[i]>arr[cur])
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
		cur++;
	}


	


	
	

	
	


	
	return 0;
}

Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
map<int,int> ps;
typedef long long ll;
int nn,x, z;
int p = 1000000007;
ll f[100005];
ll inv[100005];

ll quick_power(ll a, ll b) {
    ll ans = 1;
    while (b) {
        if (b&1) ans = ans * a % p;
        b /= 2;
        a = a * a % p;
    }
    return ans;
}

void init() {
    f[1] = 1;
    inv[1] = 1;
    inv[0] = 1;
    for (int i = 2; i <= nn; i++) {
        f[i] = f[i-1] * i % p;
        inv[i] = quick_power(f[i], p-2);
    }
}
ll C(int m, int n) {
    if (m < n) return 0;
    return f[m] * inv[n] % p * inv[m-n] % p;
}
int main() {
    ios::sync_with_stdio(false);
    cin >> nn;
    nn++;
    init();
    for (int i = 0; i < nn; i++) {
        int temp;
        cin >> temp;
        if (ps[temp]) {
            x = ps[temp] - 1;
            z = nn - i - 1;
            break;
        } else {
            ps[temp] = i + 1;
        }
    }
    cout << nn - 1 << "\n";
    for (int i = 2; i < nn; i++) {
        ll ans = C(nn, i);
        ans = (ans - C(x + z, i-1)) % p;
        if (ans < 0) ans += p;
        cout << ans << "\n";
    }
    cout << 1 << "\n";
    return 0;
}


Measured memory_bytes: 7424
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
int main(){
  ll n;cin>>n;
  ll er=n*(n+1)/2;
  ll sum=0;
  vector<ll> a(n),c(n);
  bool can=true;
  for(int i=0;i<n;i++){
      cin>>a[i];
      sum+=a[i];
  }
  if(sum%er!=0){
      cout<<"NO"<<endl;
      return 0;
  }
  ll times=sum/er;
  for(int i=0;i<n;i++)c[i]=a[(i+1)%n]-a[i]-times;

  for(int i=0;i<n;i++){
      if(c[i]>0)can=false;
      if(c[i]%n!=0)can=false;
  }
  if(can)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}
  


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

using namespace std;

int mod = 1e9+7;

int main() {

    int n, k;
    cin >> n >> k;
    vector<long long int> v(n+1);
    for (int i = 1; i <= n; i++) {
        cin >> v[i];
    }

    vector<vector<long long int>> dp(n + 1, vector<long long int>(k + 1));

    for (int i = 0; i <= k; i++) {
        dp[0][i] = 0;
    }

    for (int i = 1; i <= n; i++)
        dp[i][0] = 1;

    for(int i=1;i<=1;i++){
        for(int j=1;j<=v[1];j++){
            dp[i][j]=1;
        }
    }

    for (int i = 2; i <=n; i++) {
        for (int j = 1; j <= k; j++) {
            dp[i][j] = (dp[i][j - 1] + dp[i - 1][j])%mod;
            if (j - v[i] - 1 >= 0) {
                dp[i][j] = (dp[i][j]+mod- (dp[i - 1][j - v[i] - 1]))%mod;
            }
        }
    }

//    for(int i=0;i<=n;i++){
//        for(int j=0;j<=k;j++){
//            cout<<dp[i][j]<<" ";
//        }
//        cout<<endl;
//    }
   cout<<dp[n][k];
    return 0;
}


Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define REP(i, n) for(int i=0; i<n; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9+7;

struct edge{
    int to;
    int cost;
};
using graph = vector<vector<edge>>;

int main(){
    int n; cin >> n;
    priority_queue<int, vector<int>, less<int>> q;
    int ans = 0;
    int tmp;
    REP(i, n){
        cin >> tmp;
        q.push(tmp);
    }
    ans += q.top()/2;
    q.pop();
    while(!q.empty()){
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import math
inputa = input().split()
inputa[0] = int(inputa[0])
inputa[1] = int(inputa[1])
tempa = []
tempb = float(inputa[1])
tempc = []
res = float(0)
if tempb == 1:
	print(1)
	exit()
while tempb >= 0.5:
	#print(tempb)
	if tempb <= inputa[0]:
		tempa.append(math.floor(inputa[0] - tempb + 1))
	else:
		tempa.append(0)
	tempb /= 2

i = 1
tempc.append(tempa[0])
#print(tempa)
while i < len(tempa):
	tempc.append(tempa[i] - tempa[i - 1])
	i += 1
#print(tempc)
for i, num in enumerate(tempc):
	#print(num / inputa[0] / (2 ** i))
	res += num / inputa[0] / (2 ** i)

print(res)

Measured memory_bytes: 3064
use std::io::BufRead;
fn main() {
 let x = "#.".repeat(151);
 let s=std::io::stdin();
 for l in s.lock().lines(){
  let v:Vec<usize>=l.unwrap().split_whitespace()
   .map(|x|x.parse().unwrap())
   .collect();
  if v==[0,0]{break}
  for (a, b) in (0..2)
   .cycle()
   .map(|a|(a, a+v[1]))
   .take(v[0]){
    println!("{}",&x[a..b]);
  }
  println!();
 }
}


Measured memory_bytes: 5028
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;

vector<int>vec;
int main(){
    for(int i=0;i<10;i++){
        int m;
        cin>>m;
        vec.push_back(m);
    }
    sort(vec.begin(),vec.end());
    for(int i=1;i<4;i++){
        cout<<*(vec.end()-i)<<endl;
    }
}

Measured memory_bytes: 1220
A = input().split()
a1 = [int(a) for a in A]
A = input().split()
a2 = [int(a) for a in A]
A = input().split()
a3 = [int(a) for a in A]
ass = set(a1+a2+a3)

N = int(input())
Bs = []
for i in range(N):
  Bs.append(int(input()))

bs = set(Bs)

c = list(ass & bs)

if len(c) < 3:
  print('No')
else:
  if a1[0] in bs and a1[1] in bs and a1[2] in bs:
    print('Yes')
  elif a2[0] in bs and a2[1] in bs and a2[2] in bs:
    print('Yes')
  elif a3[0] in bs and a3[1] in bs and a3[2] in bs:
    print('Yes')
  elif a1[0] in bs and a2[0] in bs and a3[0] in bs:
    print('Yes')
  elif a1[1] in bs and a2[1] in bs and a3[1] in bs:
    print('Yes')
  elif a1[2] in bs and a2[2] in bs and a3[2] in bs:
    print('Yes')
  elif a1[0] in bs and a2[1] in bs and a3[2] in bs:
    print('Yes')
  elif a1[2] in bs and a2[1] in bs and a3[0] in bs:
    print('Yes')
  else:
    print('No')


Measured memory_bytes: 3064
object Main extends App {
    val s = io.StdIn.readLine
    val n = s.length

    def isACGT(char: Char): Char = char match {
        case 'A' | 'C' | 'G' | 'T' => char
        case _ => 'x'
    }

    val buf = new StringBuilder
    for (count <- 0 until n) {
        val char = s(count)
        if (count != 0) {
            if (!(isACGT(char) == 'x' && buf.last == 'x')) buf += isACGT(char)
        } else {
            buf += isACGT(char)
        }
        
    } 
    val formatted = buf.toString

    if (formatted == "x") println(0)
    else {
        val array = formatted.split("x")
        val answer = array.map(_.length).max
        println(answer)
    }
}

Measured memory_bytes: 25408
n = int(input())
S = []
for _ in range(n):
    S += [list(input())]

t = list('abcdefghijklmnopqrstuvwxyz')
count = []
x = 0
for i in t:
    x += 1
    # print (i, x)
    tmp = 50
    for j in S:
        tmp = min(tmp, j.count(i))
    count += [tmp]
# print (count)
for k in range(26):
    for l in range(count[k]):
        print (t[k], end = '')

print ()


Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func intMin(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func f(A []int) int {
	N := len(A)
	S := 0
	for i := 0; i < N - 1; i++ {
		S += A[i]
		S %= MOD
	}
	R := A[N - 1] * (N - 1) - S
	R %= MOD
	for i := N - 2; i >= 0; i-- {
		S -= A[i]
		if S < 0 {
			S += MOD
		}
		R += A[i] * i - S
		R %= MOD
	}
	return R
}

const (
	MOD = 1000000007
)

func main() {
	io := NewIo()
	defer io.Flush()
	N := io.NextInt()
	M := io.NextInt()
	X := make([]int, N)
	Y := make([]int, M)
	for i := 0; i < N; i++ {
		X[i] = io.NextInt()
	}
	for i := 0; i < M; i++ {
		Y[i] = io.NextInt()
	}
	A := f(X)
	B := f(Y)
	io.PrintLn((A * B) % MOD)
}


Measured memory_bytes: 12544
N, M = list(map(int, input().split()))

is_solved = [False] * N
wa_count = [0] * N
wa_total = 0

for _ in range(M):
    p, s = list(input().split())
    p = int(p) - 1

    if s == 'AC':
        if not is_solved[p]:
            is_solved[p] = True
            wa_total += wa_count[p]
    else:
        wa_count[p] += 1

print(sum(is_solved), wa_total)

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

int main() {
    int A, B, C, D, L, R;
    cin >> A >> B >> C >> D;
    
    L = A + B;
    R = C + D;
    
    if (L > R) {
        cout << "Left" << endl;
    }
    else if (L == R) {
        cout << "Balanced" << endl;
    }
    else {
        cout << "Right" << endl;
    }
}


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

int main(void){
	long long N,M;
	cin >> N >> M;
	vector<pair<long long , long long >> v;
	for(int i=0;i<N;i++){
		long long a,b;
		cin >> a >> b;
		v.push_back({a,b});
	}
	sort(v.begin(),v.end());
	long long ans = 0;
	for(int i=0;i<N;i++){
		if(M>=v[i].second){
			ans += v[i].first*v[i].second;
			M -= v[i].second;
		}else{
			ans += M*v[i].first;
			break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 2420
import java.util.*;
 
public class Main{
     public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
	    String S = sc.next();
	    long K = sc.nextLong();
        int oneCount = 0;
        String ans = null;
    for(int i = 0; i < S.length();i++){
    	if("1".equals(S.substring(i,(i+1)))){
          oneCount += 1;
          continue;
        }
      break;
  	}
    
    if(oneCount >= K){ans = "1";
    }else{ ans = S.substring(oneCount,(oneCount+1));}
    
    System.out.println(ans);
    }
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int N;
	cin >> N;
	vector<int> H(N), res(N);
	for (int& h : H) cin >> h;
	for (int i = N - 2; ~i; --i) if (H[i] >= H[i + 1]) res[i] = res[i + 1] + 1;
	cout << *max_element(res.begin(), res.end()) << endl;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A, B, C;
    cin >> A >> B >> C;
    if (A >= B && A >= C){
        cout << A * 10 + B + C << endl;
    }else if (B >= C && B >= A){
        cout << B * 10 + A + C << endl;
    }else{
        cout << C * 10 + A + B << endl;
    }
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;
const ll MAXN = 50 + 5;
const ll MAXK = 1e5 + 10;

const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

int main() {
    ll H, W, K;
    cin >> H >> W >> K;
    vector<vector<ll>> dp(H + 1, vector<ll>(W));
    dp[0][0] = 1;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            for (int k = 0; k < 1 << (W - 1); ++k) {
                bool ok = true;
                for (int l = 0; l < W - 2; ++l) {
                    if (((k >> l) & 1) && ((k >> (l + 1)) & 1)) {
                        ok = false;
                        break;
                    }
                }
                if (ok) {
                    if (j >= 1 && ((k >> (j - 1)) & 1)) {
                        dp[i + 1][j - 1] += dp[i][j];
                        dp[i + 1][j - 1] %= MOD;
                    } else if (j <= W - 2 && ((k >> j) & 1)) {
                        dp[i + 1][j + 1] += dp[i][j];
                        dp[i + 1][j + 1] %= MOD;
                    } else {
                        dp[i + 1][j] += dp[i][j];
                        dp[i + 1][j] %= MOD;
                    }
                }
            }
        }
    }
    cout << dp[H][K - 1] << endl;
    return 0;
}

Measured memory_bytes: 256
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

#define N 262144
#define P ((int)1e9+7)

int p[N];
int a[N], t[N], tm;

void touch(int k)
{
    if(t[k] != tm) a[k] = 0, t[k] = tm;
}

void set_mir(int u, int k)
{
    while(u)
    {
        k = (lli)k*u % P;
        touch(u);
        a[u] = (a[u] + k) % P;
        u>>=1;
    }
}

void dfs_set(int u, int k, int n)
{
    k = (lli)k*u % P;
    if(u >= n) return set_mir(p[u],k);
    int l = u<<1, r = l+1;
    dfs_set(l, k, n);
    dfs_set(r, k, n);
}

int get_mir(int u)
{
    touch(u);
    int res = a[u], k = u, dir;
    while(dir = u&1, u>>=1)
    {
        k = (lli)k*u % P;
        touch(u<<1|(dir^1));
        res = (res + (lli)a[u<<1|(dir^1)] * k) % P;
    }
    return res;
}

int dfs_get(int u, int n)
{
    if(u >= n) return (lli)get_mir(p[u])*u % P;
    int l = u<<1, r = l+1;
    int res = dfs_get(l, n) + dfs_get(r, n);
    return (lli)res*u % P;
}

int dfs(int u, int n)
{
    if(u >= n) return 0;
    int l = u<<1, r = l+1;
    ++tm;
    dfs_set(l, u, n);
    int res = dfs_get(r, n);
    dbg_pri("poi 1: %d %d\n", u, res);
    res = (res + dfs(l,n)) % P;
    res = (res + dfs(r,n)) % P;
    return res;
}

int main()
{
    int h, n;
    scanf("%d", &h), n = 1<<h-1;
    for(int i=n;i<n*2;++i)scanf("%d", &p[i]), p[i]+=n-1;
    int ans = dfs(1,n);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 4292
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll MOD=100000007;
const ll INF=1000000000000000001;
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数
        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N/=a;
        }
        //その結果をpush
        res.push_back({a,ex});
    }
    //残った数について
    if(N!=1)res.push_back({N,1});
    return res;
}
int main(){
   ll n;cin>>n;
   int cnt=0;
   const auto &res=prime_factorize(n);
   for(auto p:res){
       int b=1;
       while (b<=p.second)
       {
           p.second-=b;
           b++;
           cnt++;
       }
   }
   cout<<cnt<<endl;
}

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

#define _LL long long

int _m[10 * 10];

int main()
{
    int h, w, k;
    cin >> h >> w >> k;

    for(int j = 0; j < h; j++)
    {
        string s;
        cin >> s;
        for( int i = 0; i < w; i++ )
        {
            int index = i + w * j;
            if( s[i] == '.' )
            {
                _m[index] = 1;
            } 
            else
            {
                _m[index] = 0;
            }            
        }
    }

    int ans = 0;
    for(int hbit = 0; hbit < (1 << h); hbit++ )
    {
        for(int wbit = 0; wbit < (1 << w); wbit++ )
        {
            int count = 0;
            for( int j = 0; j < h; j++ )
            {
                if( ( hbit & (1 << j)) == 0 ) continue;
                for( int i = 0; i < w; i++ )
                {
                    if( ( wbit & (1 << i)) == 0 ) continue;
                    if( _m[i + w * j] == 0 ) count++;
                }
            }
            if( count == k ) 
            {
//                cout << wbit << "," << hbit << endl;
                ans++;
            }
        }
    }

    cout << ans;
}

Measured memory_bytes: 3620
S = input()

dic = {}


for i in S:

    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

bul = True

for i in dic:

    if len(dic)!=2 or dic[i] != 2:
        bul = False

if bul:
    print ("Yes")
else:
    print ("No")
        


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

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

    set<int> st;
    for (int i = 0; i < (1 << n); i++) {
        int sum = 0;
        for (int j = 0; j < n; j++) {
            if (i & (1 << j)) sum += A[j];
        }
        st.insert(sum);
    }

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int m;
        cin >> m;
        cout << (st.count(m) ? "yes" : "no") << endl;
    }
}


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

int main() {
    string s;
    cin>>s;
    string c="CODEFESTIVAL2016";
    int misscount=0;
    rep(i,16){
        if(s.at(i)!=c.at(i)){
            misscount+=1;
        }
    }
    cout<<misscount<<endl;
return 0;}
/*
g++ code.cpp
./a.out
*/

Measured memory_bytes: 256
//#pragma comment(linker,"/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
#define _rep(i, a, b) for (int i = (a); i <= b; ++i)
const int max_number = 1000000;

int main()
{
    int h, w; //记得什么时候要初始化
    while (true) {
        scanf("%d%d", &h, &w);
        if (h == 0 && w == 0)
            return 0; //break 只能用在循环中，if语句不可以

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++)
                printf("#");
            printf("\n");
        }

        printf("\n");
    }

    return 0;
}


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

int main() {
  int N;
  string a;
  cin >> N;
  
  for (int i=0; i<N; i++){
    cin >> a;
    if(a== "Y")
      break;
  }
  if(a!= "Y")
    cout << "Three" << endl;
  else  cout << "Four" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <cstdlib> 
#include <string.h>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <ctime>
#include <algorithm>
#include <cmath>
#define PI 3.1415926535897932384626433832795l
#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define deci(n) cout<<fixed<<setprecision(n);
#define F first
#define S second
#define mk make_pair
#define pb push_back
#define ALPHA 27
#define ll long long int
#define ld long double
#define mmset(arr, n) memset(arr, n, sizeof arr)
#define debug(x) cerr << '#' << ' ' << x << '\n'
#define len(s) s.length()
#define ForA(i,a,b) for(int i = a; i < b; i++)
#define ForA1(i,a,b) for(int i = b - 1; i >= a; i--)
#define ForB1(i,a,b) for(int i = b; i > a; i--)
#define ForB(i,a,b) for(int i = a; i <= b; i++)
#define INT_SIZE 18 
#define maxn 55
#define Maxn 100010

using namespace std;

const ll INF = (ll)(8e18);
const ll MOD = 1000000007;

int freq[ALPHA];

int main()
{
    IOS;       
    int n; cin >> n;
    string s; cin >> s;
    ForB(i,0,n - 1) freq[s[i] - 'a']++;
    ll ans = 1;
    ForB(i,0,ALPHA - 1){
        if(freq[i] > 0){
           ans *= (freq[i] + 1);
           ans %= MOD;
        }
    }
    cout << (ans - 1 + MOD) % MOD << '\n';
    #ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0 ;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
using namespace std;
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/*************************************/

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  vector<int> a(n);
  int p = 1;
  for (int &x : a) {
    cin >> x;
    if (x == p) {
      ++p;
    }
  }
  if (p == 1) kek(-1);
  kek(n - p + 1);
  
}


Measured memory_bytes: 1024
module Main where

import Control.Applicative
import Data.List

main :: IO ()
main = do
  [w,h,x,y,r]<-map (read::String->Int).words<$>getLine
  putStrLn $ if x-r>=0&&x+r<=w&&y-r>=0&&y+r<=h then "Yes" else "No"

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

int main()
{
  int r, c;
  cin >> r >> c;
  int t[101][101];
  for (int i=0; i<=r; i++) t[i][c] = 0;
  for (int i=0; i<c; i++) t[r][i] = 0;
  for (int i=0; i<r; i++) {
    for (int j=0; j<c; j++) {
      cin >> t[i][j];
      t[i][c] += t[i][j];
      t[r][j] += t[i][j];
      t[r][c] += t[i][j];
    }
  }
  for (int i=0; i<=r; i++) {
    for (int j=0; j<=c; j++) {
      if (j) cout << ' ';
      cout << t[i][j];
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3132
n = input()
s = list(input())
 
ans = len(s)

sharp = 0
dot = 0
for string in s:
	if(string == "#"):
		sharp += 1
	else:
		dot += 1 

left_sharp = 0
right_dot = dot

for i in range(len(s)):
	temp_ans = left_sharp + right_dot
	ans = min(ans,temp_ans)
	if(s[i] == "."):
		right_dot -= 1
	else:
		left_sharp += 1

ans = min(ans, len(s) - dot) 

print(ans)

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

int main() {
  int sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  int x=tx-sx;
  int y=ty-sy;
  for(int i=0;i<y;i++){
    cout<<"U";
  }
  for(int i=0;i<x;i++){
    cout<<"R";
  }
  for(int i=0;i<y;i++){
    cout<<"D";
  }
  for(int i=0;i<x;i++){
    cout<<"L";
  }
  cout<<"L";
  for(int i=0;i<y+1;i++){
    cout<<"U";
  }
  for(int i=0;i<x+1;i++){
    cout<<"R";
  }
  cout<<"D";
  cout<<"R";
  for(int i=0;i<y+1;i++){
    cout<<"D";
  }
  for(int i=0;i<x+1;i++){
    cout<<"L";
  }
  cout<<"U";


}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static int n;
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    n = sc.nextInt();
    int[] A = new int[n];
    for(int i=0;i<n;i++){
      A[i] = sc.nextInt(); 
    }
    int q = sc.nextInt();
    for(int i=0;i<q;i++){
      int m = sc.nextInt();
    if(solve(A, 0, m)){
        System.out.println("yes");
      }else{
        System.out.println("no");
      }
    }
  }
  public static boolean solve(int[] A, int i, int x){
    if(x == 0) return true;
    if(i >= n) return false;
    boolean res = solve(A, i+1, x) || solve(A, i+1, x-A[i]);
    return res;
  }
}



Measured memory_bytes: 26812
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 10000000000000000
#define endl '\n'
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
int n;
string s,st,en;
signed main(){
	cin>>n;
	cout<<0<<endl;
	cin>>s;
	if(s=="Vacant")return 0;
	st=s;
	cout<<n-1<<endl;
	cin>>s;
	if(s=="Vacant")return 0;
	en=s;
	int l=0,r=n-1;
	while(true){
		int m=(l+r)/2;
		cout<<m<<endl;
		cin>>s;
		if(s=="Vacant")return 0;
		if((m-l)%2==0&&st!=s){
			r=m;
			en=s;
		}
		if((m-l)%2==1&&st==s){
			r=m;
			en=s;
		}
		if((r-m)%2==0&&en!=s){
			l=m;
			st=s;
		}
		if((r-m)%2==1&&en==s){
			l=m;
			st=s;
		}
	}
	return 0;
}

Measured memory_bytes: 852
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
# from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, sin, pi, tan
from collections import defaultdict as dd, deque, Counter as C
# from itertools import combinations as comb, permutations as perm
# from bisect import bisect_left as bl, bisect_right as br, bisect
# from time import perf_counter
# from fractions import Fraction

# sys.setrecursionlimit(pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353


def data(): return sys.stdin.readline().strip()


def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)


def l(): return list(sp())


def sl(): return list(ssp())


def sp(): return map(int, data().split())


def ssp(): return map(str, data().split())


def l1d(n, val=0): return [val for i in range(n)]


def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


n = data()
if int(n[-1]) in [2, 4, 5, 7, 9]:
    out("hon")
    exit()
if int(n[-1]) in [0, 1, 6, 8]:
    out("pon")
    exit()
out("bon")


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

int main()
{
    int n;
    cin>>n;
    int a[n+1],b[n+1],c[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i]>>b[i]>>c[i];
        
    int dp[n+1][3];
    dp[1][0]=a[1];
    dp[1][1]=b[1];
    dp[1][2]=c[1];
    for(int i=2;i<=n;i++)
    {
        dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
        dp[i][1]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
        dp[i][2]=max(dp[i-1][1]+c[i],dp[i-1][0]+c[i]);
    }
    
    cout<<max(max(dp[n][0],dp[n][1]),dp[n][2]);
    return 0;
    
    
}

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

int main(){
	long long int n;
	std::cin>>n;

	std::vector<std::string> v;

	std::map<std::string, int> mp;

	for (int i = 0; i < n; i++) {
		std::string str;
		std::cin >> str;

		mp[str] = mp[str] + 1;
	}

	int max = 0;

	for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
		int num = itr->second;
		
		if (max < num) {
			max = num;
		}
	}

	for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
		if (max == itr->second) {
			v.push_back(itr->first);
		}
	}

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

	for (int i = 0; i < v.size(); i++) {
		std::cout << v[i] << std::endl;
	}
	return 0;
}

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

void Show(int s){
    
    int i=1,l,r;
    while(1){
        if(i == 1){
            l = 100;
            r = 111;
        }
        else{
            r = 100 * i + 10 * i + i;
            l = r - 110;
        }
        
        if(l <= s && s <= r){
            cout << i << i << i << endl;
            break;
        }
        i++;
    }
}
int main(void){
  
  int s;
  cin >> s;
  Show(s);
}

Measured memory_bytes: 3612
package main

import (
	"fmt"
	"math"
	"sort"
)

func intMin(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func main() {
	var H, W int
	fmt.Scan(&H, &W)

	if (H*W)%3 == 0 {
		fmt.Println(0)
		return
	}

	ans := H * W
	for i := 1; i < H; i++ {
		tmp := []int{i * W, (H - i) * (W / 2), (H - i) * (W - W/2)}
		sort.Ints(tmp)
		ans = intMin(ans, tmp[2]-tmp[0])
	}
	for i := 1; i < W; i++ {
		tmp := []int{i * H, (W - i) * (H / 2), (W - i) * (H - H/2)}
		sort.Ints(tmp)
		ans = intMin(ans, tmp[2]-tmp[0])
	}
	ans = intMin(ans, H)
	ans = intMin(ans, W)
	fmt.Println(ans)
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

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

  int a, z;
  REP(i, s.size()) {
    if(s[i] == 'A') {
      a = i;
      break;
    }
  }
  for(int i=s.size()-1; i>=0; i--) {
    if(s[i] == 'Z') {
      z = i;
      break;
    }
  }

  cout << z-a+1 << endl;

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  ll ans = 0;
  rep(i,n){
    int b;
    cin >> b;
    if(a[i]<=b){
      ans += a[i];
      b-=a[i];
      a[i] = 0;
    }else{
      ans += b;
      a[i] -= b;
      b = 0;
    }

    if(a[i+1]<=b){
      ans += a[i+1];
      b-=a[i+1];
      a[i+1] = 0;
    }else{
      ans += b;
      a[i+1] -= b;
      b = 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <stdio.h>
int main()
{
  int i,j,k,count;
  scanf("%1d%1d%1d",&i,&j,&k);
  if(i == 1){
    count++;
  }
  if (j == 1){
    count++;
  }
  if (k == 1){
    count++;
  }

  printf("%d",count);

  return 0;

}


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

int n, pos;
vector<int> pre, in, post;

void rec(int l, int r) {
  if ( l >= r ) return;
  int root = pre[pos++];
  int m = distance(in.begin(), find(in.begin(), in.end(), root));
  rec(l, m);
  rec(m + 1, r);
  post.push_back(root);
}

void solve() {
  pos = 0;
  rec(0, pre.size());
  for ( int i = 0; i < n; i++ ) {
    if ( i ) cout << " ";
    cout << post[i];
  }
  cout << endl;
}

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

  for ( int i = 0; i < n; i++ ) {
    cin >> k;
    pre.push_back(k);
  }

  for ( int i = 0; i < n; i++ ) {
    cin >> k;
    in.push_back(k);
  }

  solve();

  return 0;
}


Measured memory_bytes: 3140
#include <cstdio>
#include <cstring>
#include <algorithm>

int max[26];

int main()
{
  int n;
  scanf("%d", &n);
  char s[51];
  int count[26];
  memset(max, 0x7F, 26 * sizeof(int));
  for (int i = 0; i < n; ++i)
  {
    memset(count, 0, 26 * sizeof(int));
    scanf("%s", s);
    for (char *p = s; *p; ++p)
    {
      count[*p - 'a']++;
    }
    for (int j = 0; j < 26; ++j)
    {
      max[j] = std::min(max[j], count[j]);
    }
  }
  for (int i = 0; i < 26; ++i)
  {
    while (max[i] > 0)
    {
      putc(i + 'a', stdout);
      max[i]--;
    }
  }
  puts("");
  return 0;
}


Measured memory_bytes: 128
n = int(input())
a = list(map(int, input().split()))
s = [0]
b = 1
c = 0

for i in range(n):
    s.append(s[i] + a[i])
s.sort()
s.append('\0')

for i in range(1, len(s)):
    if s[i] == s[i-1]:
        b += 1
        continue
    c += int(b*(b-1)/2)
    b = 1
print(c)


Measured memory_bytes: 26720
#include<iostream>
#include<cstring>
using namespace std;
int main() {
	char str[] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZDEFGHIJKLMNOPQRSTUVWXYZABC" };
	char str2[1000];
	cin >> str2;
	int len = strlen(str2);
	for (int i = 0; i < len; i++) {
		for (int j = 26; j < 53; j++) {
			if (str2[i] == str[j]) {
				str2[i] = str[j - 26];
				break;
			}
		}
	}
	for (int i = 0; i < len; i++) {
		cout << str2[i];
	}
	cout << endl;
}

Measured memory_bytes: 3040
#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#define INF 1e8
using namespace std;
int main(void){
set<long long> s;
int n, count=0, min=1e9+5;
cin>>n;
for(int i=0;i<n;++i){
    int a;
    cin>>a;
    if(a <min)
    {
        count++;
        min=a;
    }
    
}
cout<<count;
}



Measured memory_bytes: 3124
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
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; }
using namespace std;


int main(){
  ll N;
  cin>>N;
  vector<ll> X;
  REP(i,N){
    ll a;
    cin>>a;
    X.push_back(a);
  }
  
  
  ll ans=INF,cnt=0;
  
  for(int i=1; i<=100; ++i){
    cnt=0;
    for(int j=0; j<N; ++j){
      cnt+=(X.at(j)-i)*(X.at(j)-i);
    }
    ans=min(ans,cnt);
  }
  
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
const lines=readlines()
const N=parse(Int,shift!(lines))
const G=[Pair{Int,Int}[] for _=1:N]
const ans=zeros(Int,N-1)
function dfs(u,p,pc)
	nc=1
	for (v,id)=G[u]
		if v==p
			continue
		end
		if nc==pc
			nc+=1
		end
		ans[id]=nc
		dfs(v,u,nc)
		nc+=1
	end
end
function main()
	id=0
	for s=lines
		u,v=map(x->parse(Int,x),split(s))
		id+=1
		push!(G[u],v=>id)
		push!(G[v],u=>id)
	end
	dfs(1,0,0)
	println(maximum(ans))
	println.(ans)
end
main()


Measured memory_bytes: 173680
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,D; cin >> N >> D;
    int ans = 0;
    int fi = 0;
    while(1){
        fi = fi + 1 + 2 * D;
        ans++;
        if(fi >= N) break;
    }
    cout << ans << endl;

}


Measured memory_bytes: 256