akhauriyash/Code-Regression huggingface dataset:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect

INF = 10**9+7

if __name__ == "__main__":
    k = int(input())
    if k%2 == 0:
        print(-1)
        sys.exit()
    cnt = 1
    a = 7
    d = [a]
    for i in range(10**6+1):
        if d[i]%k == 0:
            print(i+1)
            sys.exit()
        b = 10*d[i]
        b%=k
        b+=7
        b%=k
        d.append(b)
    print(-1)

Measured memory_bytes: 144132
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <deque>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <cassert>
#include <iostream>
#include <stdio.h>
#include <time.h>
 
using namespace std;

typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
 
#define MOD 1000000007

int main(){
  ll n;
  cin>>n;
  vector<ll> v1,v2;
  rep(i,0,n){
    ll a,b;
    cin>>a>>b;
    v1.pb(a);
    v2.pb(b);
  }
  ll flag = 0;
  rep(i,0,n-2){
    ll c = 0;
    rep(j,0,3){
      if(v1[i+j]==v2[i+j])c++;
    }
    if(c==3)flag = 1;
  }
  if(flag==1){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MAX   1e9
#define MIN  -1e9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
struct Interval {int start, end;};
bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}
ll mod=1e9+7;
ll a[2005][2005],b[2005][2005],c[2005][2005],d[2005][2005];
int main()
{
    ll h,w;
    cin>>h>>w;
    string s[h];
    rep(i,h)
    cin>>s[i];
    ll curr=-1;
    rep(i,h)
    {
        rep(j,w)
        {
            if(s[i].at(j)=='#')
            {
                curr=j;
                continue;
            }
            a[i][j]=j-curr-1;
        }
        curr=-1;
    }
    curr=w;
    rep(i,h)
    {
        repD(j,w-1,0)
        {
            if(s[i].at(j)=='#')
            {
                curr=j;
                continue;
            }
            b[i][j]=curr-j-1;
        }
        curr=w;
    }
    curr=-1;
    rep(j,w)
    {
        rep(i,h)
        {
            if(s[i].at(j)=='#')
            {
                curr=i;
                continue;
            }
            c[i][j]=i-curr-1;
        }
        curr=-1;
    }
    curr=h;
    rep(j,w)
    {
        repD(i,h-1,0)
        {
            if(s[i].at(j)=='#')
            {
                curr=i;
                continue;
            }
            d[i][j]=curr-i-1;
        }
        curr=h;
    }
    ll maxi=MIN;
    rep(i,h)
    {
        rep(j,w)
        maxi=max(maxi,a[i][j]+b[i][j]+c[i][j]+d[i][j]+1);
    }
    cout<<maxi;
    return 0;
}


Measured memory_bytes: 129920
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> triple;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define popb()      pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<endl
#define pr2(a)      cout<<a<<" "
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define ast(x,a,b)  assert(x>=a and x<=b)				
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define se          second
#define fi          first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll minize(ll& a,ll b){return a=(a>b?b:a);}
inline ll maxize(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
	sc(n);
	fu(i,1,n){
		sc(A[i]);
		if(A[i]<0)sum++,A[i]=-A[i];
		ans+=A[i];
	}
	if(sum&1){
		sort(A+1,A+1+n);
		ans-=2*A[1];
	}
	pr(ans);
	


	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	ll JUDGE_ONLINE = 1;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	}
	if (!JUDGE_ONLINE) cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";  
		
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n;
    cin >> n;
    rep(i, 3){
        int ans;
        ans = n %10;
        if (ans == 7) {
            cout << "Yes" << endl;
            return 0;
        }
        n /= 10;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3592
s=j=0  #水たまりの総面積#\の箱
a =[] #「\の入った個数」
b =[] #水たまりの個数
d =[] #水たまりのそれぞれの面積

for i, x in enumerate(input()):
  if x == '\\':
    a += [i]
  elif x =='/' and a:
    j = a.pop()
    c = i-j
    s += c
    while b and b[-1] > j:
      c+=d.pop()
      b.pop()
    b +=[j]
    d +=[c]
print(s)
print(len(b), *(d))



Measured memory_bytes: 6248
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;

int dis( P p , P p_ ){
	return abs(p.first-p_.first)+abs(p.second-p_.second);
}

int to_i(string s){
	int n=0;
	for(int i=0 ; i < s.size() ; i++ ){
		n = n*10 + s[i]-'0';
	}
	return n;
}

int main(){
	int w,h;
	while( cin >> w >> h , w||h ){
		string s;
		map<int,vector<P> > f;
		vector< vector<int> > dp;
		int gx,gy,t=0;

		for(int y=0 ; y < h ; y++ ){
			for(int x=0 ; x < w ; x++ ){
				cin >> s;
				if( s == "S" ){
					vector<int> vc;
					vc.push_back( 0 );
					dp.push_back( vc );
					P p(x,y);
					f[0].push_back( p );
				}else if( s == "G" ){
					gx = x;
					gy = y;
				}else if( s != "." ){
					int n = to_i(s);
					t = max( t , n );
					P p(x,y);
					f[n].push_back( p );
				}
			}
		}
		P p(gx,gy);
		f[t+1].push_back( p );
		for(int i=1 ; i <= t+1 ; i++ ){
			vector<int> vc;
			for(int j=0 ; j < f[i].size() ; j++ ){
				vc.push_back( 1000000 );
			}
			dp.push_back( vc );
		}
		for(int i=0 ; i <= t ; i++ ){
			for(int j=0 ; j < f[i].size() ; j++ ){
				for(int k=0 ; k < f[i+1].size() ; k++ ){
					int d = dis( f[i+1][k] , f[i][j] );
					dp[i+1][k] = min( dp[i+1][k] , dp[i][j]+d );
				}
			}
		}
		cout << dp[t+1][0] << endl;
	}
}

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

int main(){
int n;
cin >> n;
vector<int> a(n), b(n),c(n-1);
for(int i= 0; i< n; i++)cin >> a[i];
for(int i= 0; i< n; i++)cin >> b[i];
for(int i= 0; i< n; i++)a[i]--;
for(int i= 0; i< n-1; i++)cin >> c[i] ;
int ans = b[a[0]];
for(int i= 1; i< n; i++){
    ans += b[a[i]];
    if(a[i-1]+1==a[i]) ans += c[a[i-1]];
}
cout <<ans<< endl;
return 0;
}

Measured memory_bytes: 3532
//Largest Square
#include <iostream>
#include <algorithm>

using namespace std;

static const int MAX = 1400;

int dp[MAX][MAX], G[MAX][MAX];
int H, W;

int getLargestSquare() {
    int maxWidth = 0;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            dp[i][j] = (G[i][j] + 1) % 2;
            maxWidth |= dp[i][j];
        }
    }

    for(int i = 1; i < H; i++) {
        for(int j = 1; j < W; j++) {
            if(dp[i][j] == 0) continue;
            dp[i][j] += min(min(dp[i][j - 1], dp[i - 1][j]), dp[i - 1][j - 1]);
            maxWidth = max(maxWidth, dp[i][j]);
        }
    }
    return maxWidth * maxWidth;
}

int main() {
    int c;
    cin >> H >> W;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) cin >> G[i][j];
    }

    cout << getLargestSquare() << endl;
}



Measured memory_bytes: 18380
#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(){
  //素因数列挙
  /*for(int i=2; i*i<=n; i++){
    while(n%i == 0 && n/i != 1){
      cout << i << ' ';
      n /= i;
    }
  }
  cout << n;*/
  //約数の列挙
  /*for(int i=1; i*i<=n; i++){
    if(n%i == 0) cout << i << ' ' << n/i << endl;
  }*/
  int n;
  cin >> n;
  vector<int> ns(n);
  vector<int> ans(n);
  rep(i, n){
    cin >> ns.at(i);
    ans.at(i) = 0;
  }
  for(int i=n; i>0; i--){
    int cou = 0;
    for(int k=2; i*k<=n; k++){
      cou += ans.at(i*k-1);
    }
    if((cou+ns.at(i-1))%2 == 1){
      ans.at(i-1) = 1;
    }else{
      ans.at(i-1) = 0;
    }
  }
  int count = 0;
  rep(i, n){
    if(ans.at(i) == 1) count++;
  }
  cout << count << endl;
  rep(i, n){
    if(ans.at(i) == 1) cout << i+1 << ' ';
  }
  return 0;
}

Measured memory_bytes: 2432
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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

#A
def A():
    s = input()
    if s == "Sunny":
        print("Cloudy")
    elif s == "Cloudy":
        print("Rainy")
    else:
        print("Sunny")
    return

#B
def B():
    s = S()
    for i in range(len(s)):
        if i%2:
            if s[i] not in ["L","U","D"]:
                print("No")
                return
        else:
            if s[i] not in ["R","U","D"]:
                print("No")
                return
    print("Yes")
    return

#C
def C():
    n,k,q = LI()
    a = IR(q)
    f = [k-q]*(n)
    for i in range(q):
        ai = a[i]-1
        f[ai] += 1
    for i in f:
        if i <= 0:
            print("No")
        else:
            print("Yes")
    return

#D
def D():
    n,m = LI()
    a = LI()
    q = []
    for i in range(n):
        heappush(q,-a[i])
    for i in range(m):
        x = heappop(q)
        x *= -1
        x >>= 1
        heappush(q,-x)
    print(-sum(q))
    return

#E
def E():
    n = I()
    s = S()
    l = 0
    r = n
    M = 10**64+1
    b = 26
    alp = list("abcdefghijklmnopqrstuvwxyz")
    f = {}
    for i in alp:
        f[i] = ord(i)-ord("a")
    pb = [pow(b,i,M) for i in range(n+1)]
    while r-l > 1:
        m = (l+r)>>1
        d = defaultdict(lambda : float("inf"))
        hash = 0
        for i in s[:m]:
            hash *= b
            hash += f[i]
            hash %= M
        d[hash] = 0
        t = pb[m]
        for i in range(n-m):
            si = s[i]
            hash *= b
            hash -= t*f[si]
            hash += f[s[i+m]]
            hash %= M
            if d[hash]+m <= i+1:
                l = m
                break
            if i+1 < d[hash]:
                d[hash] = i+1
        else:
            r = m
    print(l)
    return

#F
def F():
    n = I()
    m = 60
    b = [1<<i for i in range(m)]
    a = LI()
    s = 0
    for i in a:
        s ^= i
    for i in range(m):
        if s&b[i]:
            for j in range(n):
                if a[j]&b[i]:
                    a[j] -= b[i]
    k = 0
    for j in range(m):
        bj = b[-j-1]
        for i in range(k,n):
            if a[i]&bj:
                break
        else:
            continue
        a[i],a[k] = a[k],a[i]
        for i in range(n):
            if i == k:
                continue
            if a[i]&bj:
                a[i] ^= a[k]

        k += 1
        if k == n:
            break
    ans = 0
    for i in range(k):
        ans ^= a[i]
    print(s+2*ans)
    return

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


Measured memory_bytes: 72044
#include<bits/stdc++.h>
#define RI(x) x = rit()
#define RII(a,b) a = rit(), b = rit()
#define RIII(a,b,c) a = rit(), b = rit(), c = rit()
#define REP(I, N) for(int I=0;I<int(N);I++)
#define REPP(I, N) for(int I=1;I<=int(N);I++)
#define ll long long
#define SZ(x) (int)(x).size()
#define F first
#define S second
#define PB(x) push_back(x)
inline int rit(){
    int f=0,key=1;
    char ch;
    do{
        ch = getchar();
        if(ch=='-') key=-1;;
    }while(ch<'0'||ch>'9');
    do{
        f = f*10+ch-'0';
        ch = getchar();
    }while(ch>='0'&&ch<='9');
    return f*key;
}
using namespace std;
typedef pair<int,int> P;
string st;
stack<char> stk;
int szz;
int main(void){ ios::sync_with_stdio(0), cin.tie(0);
	cin>>szz>>st;
	REP(i,SZ(st)){
		if(stk.empty()) stk.push(st[i]);
		else{
			if(st[i]=='(') stk.push(st[i]);
			else{
				if(stk.top()=='(') stk.pop();
				else stk.push(st[i]);
			}
		}
	}
	int lf=0, rt=0;
	while(!stk.empty()){
		if(stk.top()=='(') ++lf;
		else ++rt;
		stk.pop();
	}
	REP(i,rt) cout << '(';
	cout << st;
	REP(i,lf) cout << ')';
	cout << "\n";
}



Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(n)]
ans = 0
x = 0
for code in a:
    x+=sum([b[k]*i for k,i in zip(range(m),code)])
    if x+c>0:
        ans+=1
    x=0
print(ans)

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
D = list(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(N):
        if i > j:
            ans += D[i]*D[j]

print(ans)

Measured memory_bytes: 3060
N=int(input())
List = list(map(int, input().split()))

ans=0

L=0
while 1==1:
    R=L

    if sum(List)!=0 and List[L]==0:
        L=0
        while List[L]==0:
            L+=1

    if sum(List)==0:
        break
    elif R==len(List)-1:
        List[R]=List[R]-1
        ans+=1
    elif List[L]>List[L+1]:
        List[L]=List[L]-1
        ans+=1
    else:
        checkMAX=1
        while 1==1:
            R+=1
            if R==len(List)-1:
                for i in range(L,R+1):
                    List[i]=List[i]-1
                ans+=1
                break
            elif checkMAX>List[R+1]:
                for i in range(L,R+1):
                    List[i]=List[i]-1
                ans+=1
                break
            else:
                checkMAX=List[R+1]
                pass
    if sum(List)!=0 and List[L]==0:
        L=0
        while List[L]==0:
            L+=1
print(ans)

Measured memory_bytes: 3064
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def power(n, r, mod=10**9+7):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod


MOD = 10**9 + 7
N = int(input())
A = list(map(int, input().split()))

l = A[0]
for a in A:
  t = l%a
  if t != 0:
    l = lcm(l, a)

l %= MOD
ans = 0
for a in A:
  ans += (l * power(a, MOD-2)) % MOD
  ans %= MOD

print(ans)

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

namespace AtCoderTemplate {
    class Program {
        static void Main (string[] args) {
            var ABC = ReadInts ();
            var A = ABC[0];
            var B = ABC[1];
            var C = ABC[2];
            Console.WriteLine (Math.Min (B / A, C));
        }
        /* Input & Output*/
        static int ReadInt () {
            return int.Parse (Console.ReadLine ());
        }
        static List<int> ReadInts () {
            return Console.ReadLine ().Split (' ').Select (c => int.Parse (c)).ToList ();
        }
        static List<List<int>> ReadColumns (int n) {
            /*
            入力例
            A1 B1
            A2 B2
            ...
            An Bn

            出力例
            [[A1,A2,...,An], [B1,B2,...,Bn]]
            */
            var seq = Enumerable.Range (0, n).Select (i => ReadInts ()).ToList ();
            return Enumerable.Range (0, seq.First ().Count ()).Select (i => seq.Select (items => items[i]).ToList ()).ToList ();
        }
        static void PrintEnum<T> (IEnumerable<T> list) {
            Console.Write (list.First ());
            foreach (var item in list.Skip (1)) {
                Console.Write ($" {item}");
            }
            Console.Write ("\n");
        }
        static void PrintLnEnum<T> (IEnumerable<T> list) {
            foreach (var item in list) {
                Console.WriteLine (item);
            }
        }

        /* Numeric Function */
        static int Fact (int n) {
            return Enumerable.Range (1, n).Aggregate (1, ((i, k) => i * k));
        }
        static int PermNum (int n, int m) {
            if (m > n) {
                return 0;
            }
            return Enumerable.Range (n - m, m + 1).Aggregate (1, ((i, k) => i * k));
        }
        static int CombNum (int n, int m) {
            return PermNum (n, m) / Fact (m);
        }
        // 最大公約数 (m ≧ n)
        static int GCD (int m, int n) {
            if (n == 0) {
                return m;
            } else {
                return GCD (n, m % n);
            }
        }
        // 最小公倍数 (m ≧ n)
        static int LCM (int m, int n) {
            return GCD (m, n) / (m * n);
        }

    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << x << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ cout << (x[i]) << " ";} cout << endl;

typedef long long ll;

using namespace std;

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

    int N;
    cin >> N;
    vector<string> S(N);
    rep(i,0,N){ cin >> S[i];}

    ll march[5] = {};
    rep(i,0,N){
        if(S[i][0] == 'M'){ march[0]++;}
        else if(S[i][0] == 'A'){ march[1]++;}
        else if(S[i][0] == 'R'){ march[2]++;}
        else if(S[i][0] == 'C'){ march[3]++;}
        else if(S[i][0] == 'H'){ march[4]++;}
    }
    ll ans = 0;
    rep(i,0,5){
        rep(j,0,5){
            rep(k,0,5){
                if(i != j && j != k && i != k && i < j && j < k){
                    ans += march[i] * march[j] * march[k];

                }
            }
        }
    }
    print(ans);
}


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

int main()
{
  //変数の準備
  int h, w;
  cin >> h >> w;
  string S[h];
  string s;
  bool isBrankLine[h] = {false};
  bool isBrankCol[w];
  for(int i = 0; i < w; i++)
    isBrankCol[i] = true;
  
  //入力
  for(int i = 0; i < h; i++)
  {
    cin >> s;
    S[i] = s;
    if(s.find('#') == string::npos)
      isBrankLine[i] = true;
    else
    {
      for(int j = 0; j < w; j++)
      {
        if(isBrankCol[j] && s[j] == '#')
          isBrankCol[j] = false;
      }
    }
  }
  
  //出力
  for(int i = 0; i < h; i++)
  {
    if(!isBrankLine[i])
    {
      for(int j = 0; j < w; j++)
      {
        if(!isBrankCol[j])
          cout << S[i][j];
      }
      cout << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3596
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    a,b,c = readInts()
    for i in range(1001):
        if a&1 or b&1 or c&1: # どれかが奇数
            print(i)
            exit()
        na = (b+c)//2
        nb = (c+a)//2
        nc = (a+b)//2
        a,b,c = na,nb,nc
    print('-1')
if __name__ == '__main__':
  main()


Measured memory_bytes: 5388
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<P,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

ll gcd(ll a,ll b) {
    while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
    }
    return a;
}

P F(ll a, ll b){
    if(a==0&&b==0){return P(0,0);}
    if(a==0)return P(0,1);
    if(b==0)return P(1,0);
    ll x=gcd(llabs(a),llabs(b));
    ll A=a/x;
    ll B=b/x;
    if(A<0){A*=-1;B*=-1;}
    return P(A,B);
}

// a^n mod を計算する
//ただしmodとaが互いにその時のみ
long long modpow(long long a, long long n) {
    ll mod=MOD;
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N,0);
    vector<ll> B(N,0);
    for(ll i=0;i<N;i++)cin>>A[i]>>B[i];
    Map G;
    for(ll i=0;i<N;i++){
        G[P(F(A[i],B[i]))]++;
    }
    ll ans=1;

    ll mark=G[P(0,0)];
    G[P(0,0)]=INF;


    for(auto p: G){
        ll a=p.first.first;
        ll b=p.first.second;
        ll f=p.second;
        //見たらつぶす
        G[P(a,b)]=INF;
        if(f==INF)continue;
        G[P(a,b)]=0;
        ll c;
        if(a==0){
            c=G[P(1,0)];
            G[P(1,0)]=INF;
        }
        else if(b>0){
            c=G[P(b,-a)];
            G[P(b,-a)]=INF;
        }
        else if(b<0){
            c=G[P(-b,a)];
            G[P(-b,a)]=INF;
        }
        else if(b==0){
            c=G[P(0,1)];
            G[P(0,1)]=INF;
        }
        ans*=(modpow(2,f)+modpow(2,c)+MOD-1)%MOD;
        ans%=MOD;
    }
    ans+=mark;
    print((ans-1+MOD)%MOD);

    



    return 0;
}

Measured memory_bytes: 31344
#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define ll long long
#define INF 1e9 + 1
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

struct Card {
    char suit, value;
};

void bubbleSort(struct Card A[], int N) {
    for (int i = 0; i < N; i++) {
        for (int j = N - 1; j > i; j--) {
            if (A[j].value < A[j - 1].value) {
                swap(A[j], A[j - 1]);
            }
        }
    }
}

void selectionSort(struct Card A[], int N) {
    for (int i = 0; i < N; i++) {
        int minj = i;
        for (int j = i; j < N; j++) {
            if (A[j].value < A[minj].value) {
                minj = j;
            }
        }
        if (i != minj) {
            swap(A[i], A[minj]);
        }
    }
}

void print(struct Card A[], int N) {
    for (int i = 0; i < N; i++) {
        if (i) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

bool isStable(struct Card bubble[], struct Card selection[], int N) {
    for (int i = 0; i < N; i++) {
        if (bubble[i].suit != selection[i].suit) return false;
    }
    return true;
}

int main() {
    int N;
    Card C1[50], C2[50];
    cin >> N;
    REP(i, N) cin >> C1[i].suit >> C1[i].value;
    REP(i, N) C2[i] = C1[i];

    bubbleSort(C1, N);
    selectionSort(C2, N);

    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);
    if (isStable(C1, C2, N)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	string s;
	cin >> s;
	int n = s.length();
	bool flag = true;
	vector<int>a(30);
	rep(i, n) {
		char x = s[i];
		int target = x - 'a';
		a[target]++;
	}
	rep(i, 30) {
		if (a[i] >= 2)flag = false;
	}
	if (flag)puts("yes");
	else puts("no");
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            String S = in.next();

            for (int i = 0; i < S.length(); i++) {
                if (i % 2 == 0 && 76 == S.charAt(i)) {
                    out.println("No");
                    return;
                }
                if (i % 2 != 0 && 82 == S.charAt(i)) {
                    out.println("No");
                    return;
                }
            }

            // 出力
            out.println("Yes");

        }

    }
}



Measured memory_bytes: 21460
import collections
def counter_(s):
  counter = collections.Counter(s)
  counter =  [list(e) for e in counter.items()]
  counter.sort()
  return counter

from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
  
N = int(input())
S = []

for i in range(N):
  s = list(input())
  s.sort()
  str_ = ''.join(s)
  S.append(str_)

ans = 0
S_ = counter_(S)
for i in range(len(S_)):
  if(S_[i][1] != 1):
    a = cmb(S_[i][1],2)
    ans += a
print(ans)

Measured memory_bytes: 28852
#include <bits/stdc++.h>
using namespace std;
#define INF 1e9+7
typedef long long int ll;
const int maxn = 200000;
ll mod = INF;

ll n;
ll k;
ll a[maxn];
ll ans;

int main(){

    cin >> n>>k;
    for(int i=0;i<n;i++)cin >> a[i];

    sort(a,a+n);

    ll l=0,r=a[n-1]+1;
    int idx=0;
    ll ans =a[n-1];

    while(r-l>1){
        bool key=true;
        ll mid=(l+r)/2.0;
        ll cnt=0;
        for(int i=0;i<n;i++){
            cnt+=(ll)((a[i]-1)/mid);
        }
        if(cnt>k)key=false;

        if(key){
            ans=(ll)ceil(mid);
            r=mid;
        }else{
            l=mid;
        }
        idx++;
    }

    cout << ans<<endl;

    return 0;
}

Measured memory_bytes: 5156
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = in.readLine().toInt
    val as = in.readLine().split("\\s+").map(_.toInt).sorted

    @tailrec
    def binarySearch(left: Int, right: Int, value: Int): Int = {
      if (left + 1 == right) {
        left
      } else {
        val center = (left + right) / 2
        if (as(center) <= value) {
          binarySearch(center, right, value)
        } else {
          binarySearch(left, center, value)
        }
      }
    }

    val max_a = as.last

    val r = as({
      val m = binarySearch(0, n - 1, max_a / 2)
      if (m == n - 2) {
        m
      } else {
        if (max_a / 2 - as(m) < as(m + 1) - max_a / 2) {
          m
        } else {
          m + 1
        }
      }
    })

    out.println(List(max_a, r).mkString(" "))
    out.flush()
  }
}


Measured memory_bytes: 46708
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ll Pow(ll a , ll b){
	if(b == 0) return 1 ;
	ll c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c)% mod )) % mod ;
	return (c * c) % mod ;
}
bool f(pll a , pll b){
	return a.y < b.y ;
}
//check modulo
int main(){
	IOS;
	cout.precision(30) ;
	int n ;ll m; cin >> n >> m; 
	vector<pll> v(n);
	ll a , b ; 
	for(int i = 0 ; i < n ; i++) {cin >> a >> b ; v[i] = mp(a , b) ;}
	sort(v.rbegin() , v.rend() , f) ;
	ll ans = 0 ;
	map<ll , bool> maap ;
	for(int i = 0 ; i <= m ; i++) maap[i] = true ;
	for(int i = 0 ; i < n ; i++){
		auto it = maap.lower_bound(m - v[i].x) ;
		if(it->x == m - v[i].x){
			ans += v[i].y  ;
			maap.erase(it) ;
		}
		else if(it != maap.begin()){
			it-- ;
			ans += v[i].y ;
			maap.erase(it) ;
		}
	}
	cout << ans << endl ; 
	return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int H, W, m;
	cin >> H >> W >> m;
	
	vector<int> row(H, 0), col(W, 0);
	set< pair<int, int> > st;
	for(int i = 0; i < m; ++i) {
		int h, w;
		cin >> h >> w;
		h--; w--;
		row[h]++; col[w]++;
		st.insert( {h, w} );
	}

	int maxRow = *max_element(row.begin(), row.end());
	int maxCol = *max_element(col.begin(), col.end());
	
	vector<int> r, c;
	for(int i = 0; i < (int)row.size(); ++i) {
		if( row[i] == maxRow ) r.push_back(i);
	}
	
	for(int i = 0; i < (int)col.size(); ++i) {
		if( col[i] == maxCol ) c.push_back(i);
	}
	
	int ans = maxRow + maxCol - 1;
	for(auto& i : r) {
		for(auto& j : c) {
			if( st.find( {i, j} ) == st.end() ) {
				cout << ans + 1 << endl;
				return 0;
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 23876
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int loop = 0;
		String[] command;
		int[] dice = new int[6];

		Scanner sc = null;
		Dice di = new Dice();

		try {
			sc = new Scanner(System.in);

			//??????????????????
			for (int i = 0; i < 6; i++) {
				dice[i] = sc.nextInt();
			}
			//?????????????????????
			String line = sc.next();
			command = line.split("");
			loop = command.length;

			dice = di.diceroll(dice, command);

			//???????????????
			/*int n = 0;
			for (int i = 0; i < loop; i++) {
				switch (command[i]) {
				case "N":
					n = dice[0];
					dice[0] = dice[1];
					dice[1] = dice[5];
					dice[5] = dice[4];
					dice[4] = n;
					break;

				case "S":
					n = dice[0];
					dice[0] = dice[4];
					dice[4] = dice[5];
					dice[5] = dice[1];
					dice[1] = n;
					break;

				case "W":
					n = dice[0];
					dice[0] = dice[2];
					dice[2] = dice[5];
					dice[5] = dice[3];
					dice[3] = n;
					break;

				case "E":
					n = dice[0];
					dice[0] = dice[3];
					dice[3] = dice[5];
					dice[5] = dice[2];
					dice[2] = n;
					break;

				default:
					System.out.println("other");
					break;
				}
			}*/
			System.out.println(dice[0]);
		} finally {
			sc.close();
		}
	}

}

class Dice{
	public int[] diceroll(int[] di , String[] com){
		int loop;
		int n = 0;
		int[] dice = di;

		loop = com.length;
		//???????????????
		for (int i = 0; i < loop; i++) {
			switch (com[i]) {
			case "N":
				n = dice[0];
				dice[0] = dice[1];
				dice[1] = dice[5];
				dice[5] = dice[4];
				dice[4] = n;
				break;

			case "S":
				n = dice[0];
				dice[0] = dice[4];
				dice[4] = dice[5];
				dice[5] = dice[1];
				dice[1] = n;
				break;

			case "W":
				n = dice[0];
				dice[0] = dice[2];
				dice[2] = dice[5];
				dice[5] = dice[3];
				dice[3] = n;
				break;

			case "E":
				n = dice[0];
				dice[0] = dice[3];
				dice[3] = dice[5];
				dice[5] = dice[2];
				dice[2] = n;
				break;

			default:
				System.out.println("other");
				break;
			}
		}
		return dice;

	}
}

Measured memory_bytes: 26244
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N,A,B = map(int,input().split())
X = list(map(int,input().split()))

ans = 0
for i in range(N-1):
    d = X[i+1] - X[i]
    if d*A > B:
        ans += B
    else:
        ans += d*A

print(ans)

Measured memory_bytes: 14172
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main() {
  string s;
  cin >> s;
  int n = s.size(), p = 0;
  rep(i, n) if(s[i] == 'p') p++;
  cout << (n / 2) - p << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstring>
#define MN 5020
#define mod 1000000007

int f[MN][MN], cur[MN], siz[MN];
int fac[MN], inv[MN], mi[MN], w[MN];
int h[MN], nxt[2 * MN], to[2 * MN], K = 0;

void ins(int u, int v) {nxt[++K] = h[u]; h[u] = K; to[K] = v;}

void dfs(int x, int fa)
{
	siz[x] = 1; f[x][1] = 1;
	for(int i = h[x]; i; i = nxt[i])
	{
		if(to[i] == fa) continue;
		dfs(to[i], x);
		for(int j = 1; j <= siz[x]; j++)
			for(int k = 0; k <= siz[to[i]]; k++)
				cur[j + k] = (cur[j + k] + 1ll * f[x][j] * f[to[i]][k]) % mod;
		siz[x] += siz[to[i]];
		memcpy(f[x], cur, sizeof(int) * (siz[x] + 1));
		memset(cur, 0, sizeof(int) * (siz[x] + 1));
	}
	for(int i = 2; i <= siz[x]; i += 2)
		f[x][0] = (f[x][0] - 1ll * f[x][i] * w[i] % mod + mod) % mod;
}

int main()
{
	int n; scanf("%d", &n);
	fac[0] = inv[0] = inv[1] = mi[0] = 1;
	for(int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
	for(int i = 2; i <= n; i++) inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod;
	for(int i = 1; i <= n; i++) inv[i] = 1ll * inv[i] * inv[i - 1] % mod; 
	for(int i = 1; i <= n; i++) mi[i] = 1ll * mi[i - 1] * (mod + 1 >> 1) % mod; 
	for(int i = 0; i <= n; i += 2) w[i] = 1ll * fac[i] * inv[i >> 1] % mod * mi[i >> 1] % mod;
	for(int i = 1; i < n; i++)
	{
		int u, v; scanf("%d%d", &u, &v);
		ins(u, v); ins(v, u);
	}
	dfs(1, 0);
	printf("%d\n", (mod - f[1][0]) % mod);
}

Measured memory_bytes: 98304
from pprint import pprint
import sys

N = int(sys.stdin.readline().strip())

ans = ""
while N:
    pos = (N - 1) % 26
    char = chr(ord("a") + pos)    
    ans = char + ans
    # print(pos, char)
    N = (N - 1) // 26

print(ans)

Measured memory_bytes: 9952
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<numeric>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> A(m);
    rep(i, m) cin >> A.at(i);

    int sum = accumulate(A.begin(), A.end(), 0);
    if(sum > n){
        cout << -1 << endl;
    }else{
        cout << n-sum << endl;
    }
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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

template <typename T1, typename T2> 
inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  map<string,int> ss;
  rep(i, n) ss[s[i]]++;
  int maxN = 0;
  for (auto x : ss) {
    chmax(maxN,x.second);
  }
  vector<string> ans;
  for (auto x : ss) {
    if (maxN == x.second) ans.push_back(x.first);
  }
  sort(all(ans));
  for(string x: ans){
    cout << x << endl;
  }
  return 0;
}


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

int main()
{
    int N, K;
    cin >> N >> K;
    vector<long long> height(N);
    for (int i=0; i<N; i++) cin >> height[i];
    
    long long ans = 100000000000;
    // 最終的に見えるようにする建物を選択する
    // 選択されてない建物が見えないとは限らないが.....
    // 余計に伸ばした場合最適解に駆逐されるのでかまわない
    for (int i=0; i<pow(2, N); i++)
    {
        long long cost=0;
        vector<long long> tmp_height(N);
        copy(height.begin(), height.end(), tmp_height.begin());
        if (__builtin_popcount(i)>=K)
        {
            long long h=0; //j-1本目までに見える建物の高さの最大値
            for (int j=0; j<N; j++) //j番目の建物に行う操作
            {
                if (i&(1<<j)) //見えるべきかどうか
                {
                    if (tmp_height[j]<=h) //見えてないならお金払って伸ばす
                    {
                        cost += h-tmp_height[j]+1;
                        tmp_height[j] = h+1;
                    }
                }
                h = max(h, tmp_height[j]);
            }
            //cout << cost << endl;
            ans = min(ans, cost);
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 4104
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def mera(n: int, hp:list, a:int, b:int) -> bool:
    hp = [hpi - n*b for hpi in hp]
    
    center = 0
    for hpi in hp:
        if hpi <= 0:
            continue
        else:
            center += (hpi//(a-b) + bool(hpi%(a-b)))

    if center > n:
        return False
    else:
        return True
    

n,a,b = li()
hp = [ni() for _ in range(n)]

# 二分探索
low = 0
high = max(hp)//b+1

while high - low > 1:
    mid = (high+low) // 2
    if mera(mid,hp,a,b):
        high = mid
    else:
        low = mid
        

print(high)


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;

class UnionFind {
public:
    vector<int> par;
    vector<int> rank;
    int N;
    vector<ll> size_;
    UnionFind(int N_){
        N = N_;
        par = vector<int>(N, -1);
        rank = vector<int>(N, 0);
        for (int i = 0; i < N; i++){
            par[i] = i;
        }
        size_ = vector<ll>(N, 1);
    }

    int find(int x) {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = find(par[x]);
        }

    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        ll s = size(x) + size(y);
        

        if (x == y) return;
        if (rank[x] < rank[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if (rank[x] == rank[y]) rank[x]++;
        }
        size_[find(x)] = s;
    }
    ll size(int x){
        return size_[find(x)];
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);

    ll N, M;
    cin >> N >> M;
    vi A(M), B(M);
    rep(i, M){
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }

    ll ans = N*(N-1)/2;
    vector<ll> ansv;
    ansv.pb(ans);
    UnionFind uf(N);
    for(int i = M-1; i >= 1; i--){
        int a = A[i], b = B[i];
        if(uf.same(a,b)){
        }
        else {
            ans -= uf.size(a) * uf.size(b);
            uf.unite(A[i], B[i]);
        }
        ansv.pb(ans);
    }
    
    reverse(all(ansv));
    rep(i, M)cout << ansv[i] << "\n";
    return 0;
}

Measured memory_bytes: 5608
let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init (n + 1) @@ fun _ -> Scanf.scanf " %d" (+) 0
let bs = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let r, ans = ref a_s.(0), ref 0
let _ = Array.iteri (fun i b -> ans := !ans + min b (!r + a_s.(i + 1)); r := max 0 @@ a_s.(i + 1) - (b - min !r b)) bs; Printf.printf "%d\n" !ans

Measured memory_bytes: 6016
package main

import (
	"fmt"
)

func main() {
	var D, N int
	fmt.Scan(&D, &N)
	S := 1
	for i := 0; i < D; i++ {
		S *= 100
	}
	if N <= 99 {
		fmt.Println(S * N)
	} else {
		fmt.Println(S * 101)
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0) u += m;
    //cout << u << endl;
    return u;
}

ll paty_counter(ll level, ll x){
    ll size = pow(2, level+2) - 3;
    ll pmi = pow(2, level) - 1;
    if(x == 0){
        return 0;
    }else if(level == 0){    
        return 1;
    }else{
        if(x <= (size - 1)/2){
            return paty_counter(level-1, x-1);
        }else{
            return pmi + 1 + paty_counter(level-1, x - pow(2, level+1) + 3 - 2);
        }
    }

}
 
using namespace std;
using Graph = vector<vector<int>>;

// 深さ優先探索
vector<bool> seen;
static ll x;
void dfs(const Graph &G, int v) {
    seen[v] = true;
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue;
        dfs(G, next_v); // 再帰的に探索
        x ++;
    }
}

int main() {
    // 頂点数と辺数
    ll N, M;
    cin >> N >> M;

    // グラフ入力受取
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        a -=1;
        b -=1;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    // 全頂点が訪問済みになるまで探索
    //int count = 0;
    seen.assign(N, false);
    ll ma_x = 0;
    for (int v = 0; v < N; ++v) {
        if (seen[v]) continue; // v が探索済みだったらスルー
        x = 0;
        dfs(G, v); // v が未探索なら v を始点とした DFS を行う
        ma_x = max(ma_x, x+1);
        //++count;
    }
    //cout << count << endl;
    //cout << ma_x * (ma_x - 1) / 2 << endl;
    cout << ma_x << endl;
}



Measured memory_bytes: 23432