akhauriyash/Code-Regression huggingface dataset:
import collections
import itertools
import operator


class UnionFind:
    def __init__(self, x):
        class KeyDict(dict):
            def __missing__(self, key):
                self[key] = key
                return key

        self.parent = KeyDict()
        self.rank = collections.defaultdict(int)
        self.size = collections.defaultdict(lambda: 1)
        if x is not None:
            for elem in range(x+1):
                _, _, _ = self.parent[elem], self.rank[elem],self.size[elem]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if not self.are_same(x,y):
            xx = self.size[x]
            yy = self.size[y]
            if self.rank[x] < self.rank[y]:
                self.parent[x] = y
                self.size[y] += xx
            else:
                self.parent[y] = x
                self.size[x] += yy
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1

    def Size(self,x):
        return self.size[self.find(x)]

    def are_same(self, x, y):
        '''print(x,y,self.find(x),self.find(y),self.find(x) == self.find(y))'''
        return self.find(x) == self.find(y)

    def grouper(self):
        roots = [(x, self.find(x_par)) for x, x_par in self.parent.items()]
        root = operator.itemgetter(1)
        for _, group in itertools.groupby(sorted(roots, key=root), root):
            yield [x for x, _ in group]

n,m = map(int,input().split())

u = UnionFind(n)
for i in range(m):
	l = list(map(int,input().split()))
	if l[0]:
		print(int(u.are_same(l[1],l[2])))
	else:
		u.unite(l[1],l[2])






Measured memory_bytes: 7280
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long r;
        r = sc.nextLong();

        final Solver solver = new Solver();
        solver.solve(r);
    }
}

class Solver {
    public void solve(long r) {
        System.out.println(3 * r * r);
    }
}



Measured memory_bytes: 22736
#include <iostream>
#include <cmath>
#include <cstring>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cassert>
#include <unordered_map>

#define DEBUG false
#define OJ_DEBUG

#define $(x) {if (DEBUG) {cout << __LINE__ << ": "; {x} cout << endl;}}
#define _(x) {cout << #x << " = " << x << " "; }
const double E = 1e-8;
const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef std::pair<int, int> pii;
typedef unsigned long ul;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string stations;
    cin >> stations;
    if (stations[0] == stations[1] && stations[0] == stations[2]) cout << "No\n";
    else cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
N=int(input())
XYH=list(list(map(int,input().split())) for _ in range(N))
XYH.sort(key=lambda x: -x[2])

for H in range(XYH[0][2],XYH[0][2]+110):
    for Cx in range(101):
        for Cy in range(101):
            if all(h==max(H-abs(x-Cx)-abs(y-Cy),0) for x,y,h in XYH):
                a=H;b=Cx;c=Cy
                break
print(b,c,a)

Measured memory_bytes: 3188
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
//if(strcmp(s[i],"AC")==0)
//if(s[l]=='#')
/*小文字判定
if((moji>= 'a') && (moji<='z')){
    printf("a\n");
    return 0;
  }
  */
//文字列中の一文字⇒数字の時は s[i]-'0'
int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(long long int *a, long long int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

long long int cmp( const void *p, const void *q ) {
    return *(long long int*)p - *(long long int*)q;
}//ちいさい順
//qsort(a,n,sizeof(long long int),cmp);


int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);
//char s[n][11]

long long int GCD(long long int a, long long int b){
  long long int L=a,S=b;
  while(1){
    if(S>L){
      L=S+L;
      S=L-S;
      L=L-S;
    }
    if(L%S==0){
      return S;
    }
    L=L%S;
  }
  
}

long long int LCM(long long int a, long long int b){
  return a*b/(GCD(a,b));
}

int main (void)
{
	long long int n,m,k,x,i,min=100000000, a[13][13],l,max,j,temp=0,c[13]={0},sum_n[13]={0},sum_cost,flag;
scanf("%lld%lld%lld",&n,&m,&x);
for(i=1;i<=n;i++){
  scanf("%lld",&c[i]);
  for(j=1;j<=m;j++){
    
  scanf("%lld",&a[i][j]);
}  
}

  for(i=1;i<=4095;i++){
k=i;
sum_cost=0;
    for(l=1;l<=m;l++){
        sum_n[l]=0;
      }

    for(j=1;j<=n;j++){
          temp=k%2;
    k=k/2;
      for(l=1;l<=m;l++){
        sum_n[l]+=a[j][l]*temp;
      }
      sum_cost+=c[j]*temp;
    }
    flag=1;
    for(j=1;j<=m;j++){
      if(sum_n[j]<x){
        flag=0;
        break;
      }
    }
    if(flag==1&&min>=sum_cost){
      min=sum_cost;
    }
  }
  if(min==100000000){
    printf("-1");
    return 0;
  }
  printf("%lld",min);
return 0;
  }
  


Measured memory_bytes: 1724
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define per(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define de(x) cout << #x << " = " << x << endl
#define dd(x) cout << #x << " = " << x << " "
#define endl '\n'
#define pw(x) (1ll<<(x))
#define all(x) x.begin(), x.end()
#define sz(x) (int)x. size()
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;

int aa,bb,m;
const int N=1e5+1;
int a[N],b[N];

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

    while(cin>>aa>>bb>>m)
    {
        int ta,tb;
        ta=1e9;
        tb=1e9;
        rep(i,1,aa+1)
        {
            cin>>a[i];
            ta=min(ta,a[i]);
        }
        rep(i,1,bb+1)
        {
            cin>>b[i];
            tb=min(tb,b[i]);
        }
        int ans=ta+tb;
        rep(i,1,m+1)
        {
            int x,y,z;
            cin>>x>>y>>z;
            ans=min(ans,a[x]+b[y]-z);
        }
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	A := readString()
	B := readString()

	if len(A) > len(B) {
		fmt.Println("GREATER")
	} else if len(A) < len(B) {
		fmt.Println("LESS")
	} else {
		if A > B {
			fmt.Println("GREATER")
		} else if A < B {
			fmt.Println("LESS")
		} else {
			fmt.Println("EQUAL")
		}
	}
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}


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

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++) // repマクロ
#define all(v) v.begin(), v.end() // sort等の関数呼び出しを簡潔にする

using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

int main() {
    long long N, A, B;
    cin >> N >> A >> B;

    long long sum, sum1, sum2, hasu;
 
    sum1 = (N / (A+B)) * A;
    hasu = N % (A+B);

    if(hasu >= A){
        sum2 = A;
    }else{
        sum2 = hasu;
    }

    sum = sum1 + sum2;
    cout << sum << endl;

return 0;
}

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

using namespace std;

int main()
{
    int no_of_stones, no_of_steps;
    cin >> no_of_stones >> no_of_steps;

    vector <int> height(no_of_stones + 1, 0);
    for(int i = 1; i <= no_of_stones; i++)
        cin >> height[i];

    const int oo = 1e9;
    vector <int> minimum_cost(no_of_stones + 1, oo);
    minimum_cost[1] = 0;

    for(int i = 2; i <= no_of_stones; i++)
    {
        for(int j = i - 1; j >= max(1, i - no_of_steps); j--)
        {
            minimum_cost[i] = min(minimum_cost[i], minimum_cost[j] + abs(height[i] - height[j]));
        }
    }

    cout << minimum_cost[no_of_stones];
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> a(H, vector<char>(W));
    rep(i, H) rep(j, W) cin >> a[i][j];
    
    vector<bool> h(H, true), w(W, true);
    rep(i, H) {
        bool judge = true;
        rep(j, W) {
            if (a[i][j] == '#') judge = false;
        }
        h[i] = judge;
    }
    rep(i, W) {
        bool judge = true;
        rep(j, H) {
            if (a[j][i] == '#') judge = false;
        }
        w[i] = judge;
    }
    
    rep(i, H) rep(j, W) {
        if (!(h[i] || w[j])) cout << a[i][j];
        if (j == W - 1 && !h[i]) cout << endl;
    }
    return 0;
}


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

using namespace std;

using ll = long long;

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

    ll n, k;
    cin >> n >> k;

    constexpr int MAX_A = 1e5 + 1;
    array<ll, MAX_A> cnt;
    fill(cnt.begin(), cnt.end(), 0);

    for (int i = 0, a, b; i < n; ++i) {
        cin >> a >> b;
        cnt[a] += b;
    }

    ll sum = 0;
    for (int a = 0; a < MAX_A; ++a) {
        sum += cnt[a];
        if (k <= sum) {
            cout << a << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
	string s;
	cin >> s;
	for(int i=0;i<s.size()/2;i++){
		if(s[i]!=s[s.size()-1-i]){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
const int M=2e5+5;
const ll INF=1e12;
ll a[M],f[M];
ll n;ll k;
inline bool check(ll p)
{
    ll now=k;
    for(int i=1;i<=n;i++)
    {
        // af<=p , a<=p/f
        if(p/f[i]>=a[i]) continue;
        ll t=a[i]-p/f[i];
        if(t>now) return 0;
        now-=t;
    }
    return 1;
}
inline ll read()
{
    ll x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); }
    return x*f;
}
int main()
{
    n=read(),k=read();
    for(int i=1;i<=n;i++) a[i]=read();
    for(int i=1;i<=n;i++) f[i]=read();
    sort(a+1,a+n+1); sort(f+1,f+n+1);
    reverse(f+1,f+n+1);
    ll L=0,R=INF,ans=0;
    while(L<=R)
    {
        ll mid=L+R>>1;
        if(check(mid)) R=mid-1,ans=mid;
        else L=mid+1;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3328
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;

int main()
{
    string s; cin>>s;
    int c=0;
    int k=s.size();
    for(int i=0; i<k; i++){
        if(s[i]=='o') c++;
    }
    if(c+15-k>=8) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int x, y;
    cin >> x >> y;

    int ans = x + y / 2;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
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; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(void) {
	int k;
	string s;

	cin >> k >> s;
	
	int a = s.length();

	if (a <= k) {

		cout << s << endl;
	}
	else {
		string temp=s.substr(0,k);

		temp += "...";

		cout << temp << endl;

	}



	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>
#include <cstring>

using namespace std;

#define ll long long
#define MOD 1000000007
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());


int main() {
    int R, G, B, N;

    cin >> R >> G >> B >> N;


    int ans = 0;
    rep(r, N+1) {
        rep(g, N+1) {
            if ((N - (r * R + g * G)) < 0)continue;
            if ((N - (r * R + g * G)) % B == 0) {
                ans++;
            }

        }

    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <list>
#include <set>
using namespace  std;

constexpr int INF = std::numeric_limits<int>::max();

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, h, w;
    cin >> H >> W >> h >> w;

    int ans = H * W - h * W - w * H + h * w;
    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())

a = [0] * n

for i in range(n):
  a[i] = int(input())

a_sorted = sorted(a, reverse=True)
# print(a_sorted)
ans = [0] * n
no1 = a_sorted[0]
no2 = a_sorted[1]

for i in range(n):
  if a[i] == no1:
    ans[i] = no2
  else:
    ans[i] = no1
  
for i in range(n):
  print(ans[i])


Measured memory_bytes: 60504
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int d1 = sc.nextInt();
		int d2 = sc.nextInt();
		int d3 = sc.nextInt();
		int d4 = sc.nextInt();
		int d5 = sc.nextInt();
		int d6 = sc.nextInt();
		String dir = sc.next();
		String[] dirArray = dir.split("");
		int dirlen = dirArray.length;
		int tmp = 0;
		
		for(int i=0; i<dirlen; i++){
			if(dirArray[i].equals("E")){
				tmp = d1;
				d1 = d4;
				d4 = d6;
				d6 = d3;
				d3 = tmp;
			}else if(dirArray[i].equals("N")){
				tmp = d1;
				d1 = d2;
				d2 = d6;
				d6 = d5;
				d5 = tmp;
			}else if(dirArray[i].equals("S")){
				tmp = d1;
				d1 = d5;
				d5 = d6;
				d6 = d2;
				d2 = tmp;
			}else if(dirArray[i].equals("W")){
				tmp = d1;
				d1 = d3;
				d3 = d6;
				d6 = d4;
				d4 = tmp;
			}
		}
		System.out.println(d1);
		
	}
}

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

int main(){
    int n;
    while(cin>>n,n){
        pair<int,int>ma=pair<int,int>(0,0);
        while(n--){
            int p,a,b;
            cin>>p>>a>>b;
            ma=max(ma,pair<int,int>(a+b,p));
        }
        cout<<ma.second<<" "<<ma.first<<endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
const ll INF = 1LL<<60;




using Graph = vector<vector<int>>;

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

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

    // 頂点 s をスタートとした探索
    string ans = "Yes";
    vector<vector<int>> A(N);
    vector<int> dist(N, -1);
    vector<int> prev(N, -1);
    queue<int> que;
    dist[0] = 0, que.push(0);
    while (!que.empty()) {
        int v = que.front(); que.pop();
        for (auto nv : G[v]) {
            if (dist[nv] == -1) {
                dist[nv] = dist[v] + 1;
                prev[nv] = v;
                que.push(nv);
            }
        }
    }

    rep(i,N){
        if(dist[i] == -1){
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
    if(ans == "Yes"){
        rep2(i,1,N) cout << prev[i] + 1 << endl;
    }

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

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

int main()
{
    int N;
    int number = 0;
    cin >> N;
    vector<int> vec(N);
    for (int i = 0; i < N; i++) {
        int a,b;
        cin >> a >> b;
        number += (b-a + 1);
    }
    cout << number << endl;
}


Measured memory_bytes: 256
import fractions

a, b, c, d = list(map(int, input().split()))


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


def ans(x):
    can_div_c_count = x // c
    can_div_d_count = x // d
    can_div_lcm_count = x // lcm(c, d)
    return x - (can_div_c_count + can_div_d_count - can_div_lcm_count)


print(ans(b)-ans(a-1))


Measured memory_bytes: 64748
N = int(input())
H = list(map(int,input().split()))
dp = [0]*N
dp[1]=abs(H[1]-H[0])
for i in range(2,N):
    dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]),dp[i-2]+abs(H[i]-H[i-2]))
print(dp[N-1])

Measured memory_bytes: 13980
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll m = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

ll f[2000010];

ll lcm(ll a,ll b)
{
  return (a*b)/__gcd(a,b);
}
ll binpow(ll a, ll b) {
    a %= m;
   ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
 
ll find_ncr(ll n, ll r)
{
    ll m1=max(r,n-r);
    ll i,j,s,d=1,k;
    s=1;
 
    for(i=m1+1;i<=n;i++)
    {
        s=((s%m)*(i%m))%m;
    }
 
    m1=min(r,n-r);
 
    for(i=1;i<=m1;i++)
    {
        k=binpow(i,m-2);
        d=((d%m)*(k%m))%m;
    }
 
    k=(s%m*(d%m))%m;
 
    return k;
}

int main()
{
  // int x = -1, y = 10000;
  // double z = 0.2;
  // string s2 = "beginner1010";
  // long long b = 1LL << 60;
    
  // // debug(x, y, z, s, b);
    
  // double aux = 1010.0;
  // string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  ll n,a,b;
  cin >> n >> a >> b;
  ll j = binpow(2,n)-1;
  ll k1 = (find_ncr(n,a));
  ll k2 = (find_ncr(n,b));
  j = (j%m-(k1%m+k2%m)%m)%m;
  j = (j+m)%m;
  cout << j;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
const int nMax=1e5+2, MOD=1e9+7;
ULL inv[nMax], fct[nMax], ivf[nMax];
ULL Comb(int n, int r){ return (((fct[n]*ivf[r])%MOD)*ivf[n-r])%MOD; }

int main(){
int n, a, i, c; cin >> n; n++; int b[n]={}; ULL ans=0;
for(i=0; i<n; i++){ cin >> a; if(b[a]){ c=i-b[a]; break; }else{ b[a]=i+1; } }
inv[1]=fct[0]=fct[1]=ivf[0]=ivf[1]=1;
for(i=2; i<nMax; i++){ 
  inv[i]=((MOD-MOD/i)*inv[MOD%i])%MOD;
  fct[i]=(fct[i-1]*i)%MOD; ivf[i]=(ivf[i-1]*inv[i])%MOD;
}
cout << n-1 << "\n";
for(i=2; i<n; i++){
ans=((Comb(n-2, i)+Comb(n-2, i-2))%MOD+2*Comb(n-2, i-1))%MOD;
if(i-1<=n-2-c){ ans=(ans+MOD-Comb(n-2-c, i-1))%MOD; }
cout << ans << "\n";
}
cout << 1 << "\n";
}

Measured memory_bytes: 3968
#include<stdio.h>

int main(){
  int n,i;
  int suuretu[45];
  scanf("%d", &n);

  suuretu[0] = 1;
  suuretu[1] = 1;

  for(i = 2; i <= n; i++){
    suuretu[i] = suuretu[i-1] + suuretu[i-2];
  }

  printf("%d\n", suuretu[n]);

  return 0;
}




Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
const int Max = (2e6) + 5,S = 1 << 21;
int n,a[Max],l,r;
int xchar() {
    static char ibuf[S];
    static int pos = 0,len = 0;
    if(pos == len) 
        pos = 0,len = fread(ibuf,1,S,stdin);
    if(pos == len) return EOF;
    return ibuf[pos++];
}
int read() {
    int c = xchar(),x = 0;
    while(!isdigit(c)) {
        c = xchar();
    }
    do
    {
        x = (x << 3) + (x << 1) + (c & 15);
        c = xchar();
    }while(isdigit(c));
    return x;
}
inline int check(int k){
    if((a[n+1] <= k && a[n] <= k) || (a[n] <= k && a[n-1] <= k))
        return 1;
    if((a[n+1] > k && a[n] > k) || (a[n] > k && a[n-1] > k))
        return 0;
    for(int i = 1;i < n-1;i++){
        if((a[n-i-1] <= k && a[n-i] <= k) || (a[n+i+1] <= k && a[n+i] <= k))
            return 1;
        if((a[n-i-1] > k && a[n-i] > k) || (a[n+i+1] > k && a[n+i] > k))
            return 0;
    }
    return k >= a[1];
}
int main() {
    n = read();
    for(int i = 1;i < (n << 1);++i)
        a[i] = read();
    l = 1;r = (n << 1) - 1;
    while(l < r) {
        int mid = l + r >> 1;
        if(check(mid))
            r = mid;
        else l = mid + 1;
    }
    cout << l << endl;
    return 0;
}

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

using namespace std;
#define int long long

signed main(){
    string c;
    cin >> c;
    
    if(c=="a"||c=="i"||c=="u"||c=="e"||c=="o") cout << "vowel" << endl;
    else cout << "consonant" << endl;
    
    return 0;
}


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

#define INF 1000000000
using namespace::std;

pair<int, string> p[500000] ;//firstに右secondに左


long Lmax(long x, long y) {
	if (x > y)return x;
	return y;
}

int max(int x, int y) {
	if (x > y)return x;
	return y;
}

long Lmin(long x, long y) {
	if (x < y)return x;
	return y;
}


int min(int x, int y) {
	if (x < y)return x;
	return y;
}

int abs(int x) {
	if (x < 0) {
		return -x;
	}
	return x;
}


double houwa;
int N,C,H, M,K,W,al[50][26],ltl[26];
string S,s;
char a[50][50],b[26];
int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int j = 0; j < N; j++) {
		for (int i = 0; i < 26; i++) {
			b[i] = 'a' + i;
			ltl[i] = 100;
			for (int k = 0; k < 50; k++) {
				if (a[j][k] == 'a' + i) {
					al[j][i]++;
				}
			}
		}
	}
for (int i = 0; i < 26; i++) {
	for (int j = 0; j < N; j++) {
		ltl[i] = min(ltl[i], al[j][i]);
		}
	}

for (int i = 0; i < 26; i++) {
	for (int j = 0; j < ltl[i]; j++) {
		cout << b[i];
	}
}
cout <<endl;
	return 0;
}




Measured memory_bytes: 8064
((input) => {
  let [a,b,c,d] = input.split(' ').map(BigInt);
  let arr = [a*c,a*d,b*c,b*d];
  let max = arr.reduce((acc, curr) => {
    return acc > curr ? acc : curr;
  });

  console.log(max.toString());
})(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29644
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define limit 1000000000000000000 //1e18
#define mod 1000000007 //1e9+7
#define llu long long unsigned
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,n)    for(ll i=0; i<n; i++)
#define rep1(i,a,b)    for(ll i=a; i<b; i++)
#define repV(i,n)    for(ll i=0; i<v.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  a,x,mult;
    string b;
    cin>>a>>b;
    x=(b[0]-'0')*100+(b[2]-'0')*10 +(b[3]-'0');
    mult=a*x/100;
    cout<<mult<<endl;

    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
const int N = 55;
const long long M = 1000000007;

int n;

struct ban
{
    long long a[N][N];
    ban()
    {
        memset(a, 0, sizeof a);
    }
};
ban operator*(const ban& a, const ban& b)
{
    ban res;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            for (int k = 0; k < n; ++k)
            {
                res.a[i][j] = (res.a[i][j] + a.a[i][k] * b.a[k][j]) % M;
            }
        }
    }
    return res;
}
ban ast(ban x, long long k)
{
    ban res;
    for (int i = 0; i < n; ++i)
    {
        res.a[i][i] = 1;
    }
    while (k)
    {
        if (k % 2 == 1)
        {
            res = res * x;
            --k;
        }
        x = x * x;
        k /= 2;
    }
    return res;
}

long long k;
ban a;

int main()
{
    cin >> n >> k;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            cin >> a.a[j][i];
        }
    }
    ban t = ast(a, k);
    long long ans = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            ans = (ans + t.a[i][j]) % M;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Math;

class Program{
    static int n;
    static int[] a;
    static SEG seg;

    static void Main(){
        n = int.Parse(Console.ReadLine());
        a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        seg = new SEG(n);
        for (int i = 0;i < n;i++)
            seg[i] = a[i];
        
        int ans = Max(seg.Query(0,n),seg.Query(1,n));
        for (int i = 1;i < n - 1;i++)
            ans = Max(ans,SEG.GCD(seg.Query(0,i),seg.Query(i + 1,n)));
        ans = Max(ans,seg.Query(0,n-1));
        Console.WriteLine(ans);
    }
}

struct SEG
{
    private int n;
    private int[] dat;
    public int Length { get; private set; }
    public int this[int i]
    {
        get
        {
            if (i < 0 || i >= this.Length)
                throw new IndexOutOfRangeException();
            return dat[i + n - 1];
        }
        set { this.Update(i, value); }
    }

    public SEG(int n)
    {
        Length = n;
        this.n = 1;
        while (this.n < n) this.n *= 2;
        dat = new int[2 * this.n];
        for (int i = 0; i < 2 * this.n - 1; i++)
            dat[i] = int.MaxValue;
    }

    /* nを要素数として、すべてNで初期化 */
    public SEG(int n, int N)
    {
        Length = n;
        this.n = 1;
        while (this.n < n) this.n *= 2;
        dat = new int[2 * this.n];
        for (int i = 0; i < 2 * this.n - 1; i++)
            dat[i] = N;
    }

    /* k番目(0-indexed)をaに変更 */
    public void Update(int k, int a)
    {
        k += n - 1;
        dat[k] = a;
        while (k > 0)
        {
            k = (k - 1) / 2;
            dat[k] = GCD(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }

    private int Query_(int a, int b, int k, int l, int r)
    {
        if (r <= a || b <= l) return -1;
        if (a <= l && r <= b) return dat[k];
        int v1 = Query_(a, b, k * 2 + 1, l, (l + r) / 2);
        int v2 = Query_(a, b, k * 2 + 2, (l + r) / 2, r);
        if (v1 < 0) return v2;
        if (v2 < 0) return v1;
        return GCD(v1, v2);
    }

    /* [a,b)のGCDを求める */
    public int Query(int a, int b)
    {
        return Query_(a, b, 0, 0, n);
    }

    public static int GCD(int a, int b) //最大公約数の計算
    {
        return a > b ? GcdRecursive(a, b) : GcdRecursive(b, a);
    }

    private static int GcdRecursive(int a, int b)
    {
        return b == 0 ? a : GcdRecursive(b, a % b);
    }
}

Measured memory_bytes: 25180
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
def check(x):
  if x==0:
    return 0
  else:
    t=0
    for i in range(N):
      t+=math.ceil(A[i]/x)-1
    if t<=K:
      return 10
    else:
      return 0
low=0
high=max(A)
sig=(low+high)//2
while True:
  if check(sig)==10:
    if check(sig-1)==0:
      ans=sig
      break
    else:
      high=sig-1
      sig=(low+high)//2
  else:
    low=sig+1
    sig=(high+low)//2
print(ans)


Measured memory_bytes: 104332
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
using namespace std;
int main(){
// Seiranchan!
    string anss="No";
    string S;
    cin >> S;
    string ans;
    cin >> ans;
    string KOKO;
    int L = ans.size();
    REP(i,L){
        KOKO = S[S.size()-1];
        for(int j=0;j<L-1;j++){
            KOKO += S[j];
        }
        S = KOKO;
        
        if(KOKO==ans) anss="Yes";
    }

    cout << anss << endl;

}

Measured memory_bytes: 256
//#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

void solve()
{
    ll A, P;
    cin >> A >> P;
    cout << ((A * 3) + P) / 2 << endl;

    return;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
ll inf = 100000000;
ll v[205];
ll x[20000005];
ll a[10005], b[10005];
ll dp[10005][10005];
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,1,-1 };
typedef pair<ll, ll> P;

int main() {
	int n;
	cin >> n;
	vector<int>L(n);
	for (int i = 0; i < n; i++) {
		cin >> L[i];
	}
	sort(L.begin(), L.end());
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < i; j++) {
			int ij = L[j] + L[i];
			int r = lower_bound(L.begin(), L.end(), ij) - L.begin();
			int l = i + 1;
			ans +=  r - l;
		}
	}
	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 256
Q, H, S, D = map(int, input().split())
N = float(input())

N = int(N * 4)

q = Q * 8
h = H * 4
s = S * 2
d = D

res = 0

while N > 0:
    if q > d and h > d and s > d:
        res += N // 8 * D
        N %= 8
        d = 10 ** 9
        
    elif q > s and h > s:
        res += N // 4 * S
        N %= 4
        s = 10 ** 9
        
    elif q > h:
        res += N // 2 * H
        N %= 2
        h = 10 ** 9

    else:
        res += N * Q
        N = 0

print(res)

Measured memory_bytes: 9200
N, M, Q = list(map(int, input().split(' ')))
st_ed = {}
for i in range(M):
    l, r = list(map(int, input().split(' ')))
    st_ed[(l, r)] = st_ed.get((l, r), 0) + 1

memo_g = {}
def g(p, q):
    if p == q:
        return st_ed.get((p, q), 0)
    if not (p, q) in memo_g:
        memo_g[(p, q)] = st_ed.get((p, q), 0) + g(p + 1, q)
    return memo_g[(p, q)]

memo_f = {}
# memo[(p, q)] = memo[(p, q-1)] + sum([st_ed.get((i, q), 0) for i in [1,2,3...p]])
def f(p, q):
    if p == q:
        return st_ed.get((p, q), 0)
    if not (p, q) in memo_f:
        temp = f(p, q - 1) + g(p, q)
        memo_f[(p, q)] = temp
    return memo_f[(p, q)]

memo = {}
for i in range(Q):  # 1e5
    p, q = list(map(int, input().split(' ')))
    if not (p, q) in memo:
        temp = f(p, q)
        memo[(p, q)] = temp
    print(memo[(p, q)])



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

int main(){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] != ','){
            cout << s[i];
        }else{
            cout << " ";
        }
    }
    cout << endl;
    return 0;
}

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

isOK = True
if N == 1:
    print('Yes')
else:
    for i in range(N - 1, 0, -1):
        if H[i - 1] - H[i] > 1:
            isOK = False
            break
        elif H[i - 1] - H[i] == 1:
            H[i - 1] -= 1
    if isOK:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 15020
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
H,W,K = map(int,readline().split())
grid = [list(readline().decode().rstrip()) for _ in range(H)]
black_cnt = 0
for i in range(H):
  for j in range(W):
    if grid[i][j] == '#':
      black_cnt += 1
erase_cnt = black_cnt - K
ans = 0
for bit_H in range(1 << H):
    for bit_W in range(1 << W):
        cnt = 0 
        for i in range(H):
            for j in range(W):
                if (((bit_H >> i) & 1) or ((bit_W >> j) & 1)) and grid[i][j] == '#':
                    cnt += 1              
        if erase_cnt == cnt:
            ans += 1
print(ans)         

Measured memory_bytes: 9220
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    int N;
    cin>>N;
    if(N<1000){
        cout<<"ABC"<<endl;
    }
    else{
        cout<<"ABD"<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define mod 1000000007
#define pll pair<long long,long long>
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
bool prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,x,t;
    cin>>n>>x>>t;
    n-=x;
    cout<<((n+x-1)/x)*t+t;
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n,k,x,y;
  cin >> n >> k >> x >> y;
  cout << min(n,k) * x + max((ll)0,n - k) * y << endl;
}

Measured memory_bytes: 3592
N = gets.to_i
W = gets.chomp.split(" ").map(&:to_i)

s1 = W[0]
s2 = W[1...N].inject(:+)
ans = (s2 - s1).abs
(1..N-2).each{|t|
  s1 += W[t]
  s2 -= W[t]
  ans = (s2 - s1).abs if ans > (s2 - s1).abs
  break if s2 - s1 < 0
}

puts ans


Measured memory_bytes: 1916
fun main(args:Array<String>):Unit{
    val (t,d,l) = readLine()!!.split(' ').map(String::toInt)
    f(t, d, l)
}
tailrec fun f(t:Int, d:Int, l:Int):Unit{
    if (t != 0 && d != 0 && l != 0){
        var prev = 1 - d
        var timeSum = - d
        for (time in 1 .. t){
            val x = readLine()!!.toInt()
            if (x >= l){
                if (time - prev > d){
                    timeSum += d
                    prev = time
                }else{
                    timeSum += time - prev
                    prev = time
                }
            }
        }
        if (t - prev > d){
            timeSum += d
        }else{
            timeSum += t - prev
        }
        println(timeSum)
        val (tt, dd, ll) = readLine()!!.split(' ').map(String::toInt)
        f(tt, dd, ll)
    }
}


Measured memory_bytes: 66180
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int limit = 100000;
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];
void dfs(int v, int p, ll d) {
  depth[v] = d;
  for (auto &e : tree[v]) {
    if (e.to != p) {
      dfs(e.to, v, d + e.cost);
    }
  }
}
int main(void) {
  int n;
  edge tmp;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    tmp.to = b;
    tmp.cost = c;
    tree[a].push_back(tmp);
    tmp.to = a;
    tree[b].push_back(tmp);
  }
  int q, k;
  cin >> q >> k;
  k--;
  dfs(k, -1, 0);
  for (int i = 0; i < q; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    cout << depth[x] + depth[y] << endl;
  }
  return 0;
}

Measured memory_bytes: 14336
//include,namespace
 #include<bits/stdc++.h>
#include<iostream> 
#include <queue>
#include <vector>
#include <string>
 using namespace std;
//REPmacro
 #define all(x) (x).begin(),(x).end()             //ソート
 #define FOR(i,x,n)for(int i=(x);i<(n);i++)
 #define FOR_R(i,x,n) for(int i=(n-1);i>=(x);i--)
 #define REP(i, n) FOR(i, 0, n)
 #define REP_R(i, n) FOR_R(i, 0, n)
//long long(define)
 using ll = long long;
 typedef long long ll;
 typedef long long int64;
 typedef long long lint;
 typedef long long lli;


////////////////いろいろあるよ//////////////////////////////////
 
int main(){
  int N;
  cin >> N;
  map<string,int> data;
  REP(i,N){
    string a;
    cin >> a;
    if(data.count(a))data[a]++;
    else data[a]=1;
  }
  priority_queue<pair<int,string>> B;
  for (auto p : data) {
      	auto k=p.first;
    	auto v=p.second;
    	B.push(make_pair(v,k));
    
	}
  
  
  pair<int,string> piyo=B.top();
  priority_queue<string, vector<string>, greater<string> > ANS;
  int max=piyo.first;
  while(!B.empty()){
    auto s=B.top();
    int hikaku=s.first;
    if(hikaku!=max)break;
    string ans=s.second;
  	ANS.push(ans);
    B.pop();
  }
  while(!ANS.empty()){
  	cout << ANS.top() << endl;;
    ANS.pop();
  }
  
}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;


vector<ll> rolling_hash_search(string s, string t) {
	vector<ll> index_list;
	ll SL = s.size();
	ll TL = t.size();

	// b, hは互いに素 (gcd == 1)
	ll b = 1e7 + 7;
	ll h = 1e11 + 7;

	// 蟻本でいう、bのm乗
	ll a = 1;
	FOR(i, 0, TL) {
		a *= b;
		a %= h;
	}

	// 先頭のローリングハッシュ
	ll s_hash = 0;
	FOR(i, 0, TL) {
		s_hash = s_hash * b + s[i];
		s_hash %= h;
	}

	ll t_hash = 0;
	FOR(i, 0, TL) {
		t_hash = t_hash * b + t[i];
		t_hash %= h;
	}

	// sの始点を1つずつ進めながらハッシュ値をチェック
	FOR(i, 0, SL - TL + 1) {
		if (s_hash == t_hash) {
			index_list.push_back(i);
		}

		if (i + TL < SL) {
			s_hash = s_hash * b - s[i] * a + s[i + TL];
			s_hash %= h;
		}
	}

	return index_list;
}



int main() {

	int n;
	cin >> n;
	string s;
	cin >> s;

	int ok = n;
	int ng = -1;
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		bool b = false;
		REP(i, n - mid * 2+1) {
			if (b)continue;
			string t = s.substr(i, mid);
			
			string u = s.substr(i + mid);
			if (t.size() != mid)continue;
			if (u.size() < mid)continue;
			VLL a = rolling_hash_search(u, t);
			if (a.size() > 0)b = true;
		}
		if (b)ng = mid;
		else ok = mid;
	}
	if (ok != 1)cout << ng << endl;
	else {
		VI a(26, 0);
		REP(i, n) {
			a[s[i] - 'a']++;
			if (a[s[i] - 'a'] != 1) {
				cout << 1 << endl;
				return 0;
			}
		}
		cout << 0 << endl;
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
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; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    a *= 100;b *= 100;
    ld dense = -1;
    int sugar = 0, water = 0;
    for(int i = 0; a*i <= f;i++){
        for(int j = 0; a*i+b*j<=f;j++){
            if(i==0 && j==0) continue;
            for(int k = 0; a*i+b*j+c*k<=f; k++){
                for(int l = 0; a*i+b*j+c*k+d*l<=f;l++){
                    ld nowwater = a*i+b*j;
                    ld nowsugar = c*k+d*l;
                    if(nowsugar/(nowwater/100) > e) continue;
                    ld nowdense = nowsugar/(nowwater+nowsugar);
                    if(dense < nowdense){
                        dense = nowdense;
                        water = nowwater;
                        sugar = nowsugar;
                    }
                }
            }
        }
    }
    cout << water+sugar << " " << sugar << endl;

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    private static Scanner sc;
    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int T = sc.nextInt();

            System.out.println(T / A * B);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 21844
using System;
using System.Linq;

namespace Graph_I
{
    class Depth_First_Search
    {
        static int n;
        static int[] times;

        static void Main(string[] args)
        {
            n = int.Parse(Console.ReadLine());
            var G = new bool[n][];
            times = new int[2 * n];
            for (int i = 0; i < n; i++)
            {
                var token = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                var row = token[0] - 1;
                G[row] = new bool[n];
                for (int j = 0; j < token[1]; j++)
                    G[row][token[2 + j] - 1] = true;
            }

            var t = 0;
            for (int i = 0; i < n; i++)
            {
                t = DepthFirstSearch(G, i, 0, t);
            }

            for (int i = 0; i < n; i++)
            {
                Console.WriteLine("{0} {1} {2}", i + 1, times[2 * i], times[2 * i + 1]);
            }
        }

        static int DepthFirstSearch(bool[][] graph, int row, int col, int time)
        {
            if (times[2 * row] != 0) return time;
            else times[2 * row] = ++time;
            for (int i = 0; i < n; i++)
                if (graph[row][i]) time = DepthFirstSearch(graph, i, i, time);
            if (times[2 * row + 1] == 0) times[2 * row + 1] = ++time;
            return time;
        }
    }
}

Measured memory_bytes: 9800