akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String N = in.readLine();
		String S = in.readLine();

		int dif=0;
		int n = Integer.parseInt(N);
		for(int i=0;i<n;i++){
			if(S.charAt(i)=='R'){
				dif--;
			}else{
				dif++;
			}
		}
		String ans = "";
		if(dif>=0){
			ans = "No";
		}else{
			ans = "Yes";
		}
		System.out.println(ans);
	}


}


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

using namespace std;
using ll = long long;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int d, t, s;
    cin >> d >> t >> s;
    if(t * s >= d) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
    return 0;
}

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

int main(){
	int n;
	cin>>n;
	string a;
	cin>>a;
	int top=0;
	for(int i=0;i<n-1;i++){
		while(a[i]==a[i+1]){
			i++;
		}
		top++;
	}
	if(a[n-2]!=a[n-1])
	top++;
	cout<<top;
	return 0;
}

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

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var s = input.ReadLine();

        StringBuilder bu = new StringBuilder();
        StringBuilder bu2 = new StringBuilder();
        int idx = 0;

        int lr = 0;
        while (idx < n) {
            var c = s[idx];

            if(c=='('){
                bu.Append(c);
                lr++;
                idx++;
            }else if (c == ')') {
                if(lr < 1) {
                    //bu.Append('(');
                    bu2.Append('(');
                    lr++;
                } else {
                    bu.Append(c);
                    lr--;
                    idx++;
                }
            }
        }

        while(lr > 0) {
            bu.Append(')');
            lr--;
        }

        return bu2.Append(bu);
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 13140
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

char s[100005];
int n;

int min( int a, int b ){
	if ( a < b ) return a;
  	return b;
}

int main(){
  	scanf("%s",&s);
  	n = strlen(s);
  
  	int ans1 = 0, ans2 = 0;
  	for ( int i = 0 ; i < n; i++ ){
    	if ( i & 1 ){
        	if ( s[i] == '0' ) ans1++;
          	if ( s[i] == '1' ) ans2++;
        } else {
          	if ( s[i] == '1' ) ans1++;
          	if ( s[i] == '0' ) ans2++;
        }
    }
  
  	printf("%d\n",min(ans1,ans2));
	return 0;
}

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

int main(){
  int n;
  string s;
  cin >> n >> s;
  
  int max=0;
  string alphabet="abcdefghijklmnopqrstuvwxyz";
  for(int i=1;i<n;i++){
    string x = s.substr(0,i);
    string y = s.substr(i,n-i);
    int count = 0;
    
    rep(j,26){
      char c = alphabet[j];
      if(x.find(c)!=string::npos && y.find(c)!=string::npos){
        count++;
      }
    }
    
    if(count > max) max = count;
  }
  
  cout << max << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
int n;
ll a[100000];
ll sm[100000];

bool ok(int z){
  ll w=sm[z];
  int i=z+1;
  while(i<n){
    if(w*2>=a[i])
      w+=a[i];
    else
      break;
    ++i;
  }
  return (w==sm[n-1]);
}

int main(){
  scanf("%d",&n);
  for(int i=0;i<n;++i)
    scanf("%lld",a+i);
  sort(a,a+n);
  sm[0]=a[0];
  for(int i=1;i<n;++i)
    sm[i]=sm[i-1]+a[i];
  int x=0,y=n-1;
  for(int i=0;i<30;++i){
    int z=(x+y)/2;
    if(ok(z))
      y=z;
    else
      x=z;
  }
  printf("%d\n",n-y);
  return 0;
}


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

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

    if(s[2] == s[3] && s[4] == s[5] ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
#define pi 3.14159265358979
ll n,a,b;
int main()
{
	cin >> n >> a >> b;
	ll s = n /(a+b) *a;
	if(n%(a+b)>=a) s+=a;
	else {
		s+=n%(a+b);
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np


# いっこ入力
n =int(input())
i = 0
a = []
while n != 0:
    if n % 2 == 1:
        a.append(1)
    else:
        a.append(0)
    n = n // 2
    n = -n

#print(len(a))
#print(a)
if len(a) == 0:
    print(0)
    exit
for i in range(0,len(a)):
    print(a[len(a)-i-1], end='')



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

using namespace std;

const int max_n = 100111, inf = 1000111222;

int n, m, v, p, a[max_n];
long long sum[max_n];

long long get_sum(int l, int r) {
    if (l == 0) {
        return sum[r];
    }
    return sum[r] - sum[l - 1];
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d%d%d%d", &n, &m, &v, &p);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    sort(a, a + n);
    reverse(a, a + n);
    sum[0] = a[0];
    for (int i = 1; i < n; ++i) {
        sum[i] = sum[i - 1] + a[i];
    }
    int ans = p;
    int pos = p - 1;
    for (int i = p; i < n; ++i) {
        int x = a[i] + m;
        if (x < a[p - 1]) {
            break;
        }
        while (pos < n && x - a[pos] <= m) {
            ++pos;
        }
        long long sum = 1LL * (pos - p + 1) * x - get_sum(p - 1, pos - 1);
        sum += 1LL * (n - pos) * m;
        sum -= min(x - a[i], m);
        //cout << i << ": " << sum << "  " << pos << endl;
        if (sum >= 1LL * m * (v - p)) {
            ++ans;
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  int ans = 0;
  int cnt = 0;
  rep(i, 3){
    if (s[i] == 'R') cnt += 1;
    else cnt = 0;
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3620
N = gets.to_i
A = gets.split.map(&:to_i)

B = Array.new(100001, 0)
A.each do |a|
  B[a] += 1
end

ans = 0
(0...100000).each do |i|
  x = B[i - 1] + B[i] + B[i + 1]
  ans = x if x > ans
end
puts ans
  

Measured memory_bytes: 8836
unittest
{
	assert( [ "81 58" ].parse.expand.solve == 110 );
	assert( [ "4 54" ].parse.expand.solve == 31 );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto xy = input.front.split.to!( long[] );
	return tuple( xy[ 0 ], xy[ 1 ] );
}

auto solve( long x, long y )
{
	return x + y / 2;
}


Measured memory_bytes: 256
n,m = [ int (it ) for it in input().split() ]
lip =[]
lia =[ [] for i in range(n)]
lib =[ [] for i in range(n)]
for i in range(m):
  a,b = [ int(it)-1 for it in input().split() ]
  lip.append((a,b))
  lia[a].append(b)
  lib[b].append(a)


anow = 0
bnow = 0
mi = 1000000
s = 0
for i in range(n):
  #print (mi)
  if (len(lia[i])>0):
    _mi = min(lia[i])
    mi = min(_mi,mi)
  if (i==mi):
    s+=1
    #print ("+",i)
    if (len(lia[i])>0):
      mi = min(lia[i])
    else:
      mi = 1000000
print (s)

Measured memory_bytes: 76576
N = int(input())
As = list(map(int, input().split()))
o = [0]*(N**2)
INF = 10**19
from itertools import accumulate
aa = [0] + list(accumulate(As))

for i in range(1, N+1):
    for j in range(N-i+1):
        span = (i-1)*N+j
        # 長さi, 開始位置jの合成コスト+構成要素の和
        if i == 1:
            o[span] = As[j]
            continue
        C = INF
        for k in range(1, i):
            # 長さ,開始位置=(k,j)と(i-k,j+k)
            span1, span2 = (k-1)*N+j, (i-k-1)*N+j+k
            C = min(C, o[span1]+o[span2])
        o[span] = C + aa[(j+i-1)+1] - aa[(j-1)+1]
print(o[span]-aa[-1])

Measured memory_bytes: 44148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P> > vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(long long S, long long W) {
    if (S <= W)
        cout << "unsafe" << endl;
    else
        cout << "safe" << endl;
}

int main() {
    long long S;
    scanf("%lld", &S);
    long long W;
    scanf("%lld", &W);
    solve(S, W);
    return 0;
}


Measured memory_bytes: 3688
#include<stdio.h>
main(){
  int a[10],i,j,tmp;

  for(i=0;i<10;i++){
    scanf("%d",&a[i]);
  }

  for(i=0;i<9;i++){
    for(j=9;j>i;j--){
      if(a[j]<a[j-1]){
	tmp=a[j];
	a[j]=a[j-1];
	a[j-1]=tmp;
      }
    }
  }

  printf("%d\n%d\n%d\n",a[9],a[8],a[7]);

  return 0;
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    vector<int> a(3);
    cin >> a.at(0) >> a.at(1) >> a.at(2);
    sort(a.begin(), a.end());
    cout << a.at(0) + a.at(1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
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; }

string s;

int check(string x, int lr) {
    int xlen = x.length();
    int now = 0;
    while(now < xlen) {
        // cout << "now " << now << endl;
        if(x[now] == '(' || x[now] == '[') {
            int ch = -1;
            if(x[now] == '(') ch = 0;
            else ch = 1;
            int res = check(x.substr(now+1, xlen-now+1), ch);
            if(res == -1) return -1;
            else now += (res+1);
        }else if(x[now] == ')' || x[now] == ']') {
            if(lr == 0) {
                if(x[now] == ')') return now;
                else return -1;
            }else if(lr == 1) {
                if(x[now] == ']') return now;
                else return -1;
            }else return -1;
        }
        now++;
    }
    if(lr == -1) return now;
    else return -1;
}

int main() {
    while(1) {
        getline(cin, s);
        if(s == ".") break;
        int ans = check(s, -1);
        if(ans == -1) cout << "no" << endl;
        else cout << "yes" << endl;
    }
}


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

int main(){
    int n, m, p;
    cin >> n >> m >> p;
    vector<pair<pair<int,int>,int>> edges;

    for(int i=0;i<m;i++){
        int a, b, c;
        cin >> a >> b >> c;
        edges.push_back({{a, b}, p-c});
    }

    int64_t best[2501], tmp[2501];
    for(int i=1;i<=n;i++) best[i] = INT32_MAX;
    best[1] = 0;

    for(int i=0;i<=n;i++){
        for(auto e:edges){
            if(best[e.first.second] > best[e.first.first]+e.second){
                best[e.first.second] = best[e.first.first]+e.second;
            }
        }
    }

    int64_t candidate = best[n];
    for(int i=1;i<=n;i++) tmp[i] = best[i];

    for(int i=0;i<=n;i++){
        for(auto e:edges){
            if(best[e.first.second] > best[e.first.first]+e.second){
                best[e.first.second] = best[e.first.first]+e.second;
            }
        }
    }

    bool checked[2501] = {false};
    queue<int> q;
    q.push(1);
    checked[1] = true;
    while(!q.empty()){
        int t = q.front();
        q.pop();
        for(auto e: edges){
            if(e.first.first != t) continue;
            if(checked[e.first.second]) continue;
            q.push(e.first.second);
            checked[e.first.second] = true;
        }
    }

    if(!checked[n]){
        cout << -1 << endl;
        return 0;
    }
    for(int i=1;i<=n;i++) checked[i] = !checked[i];

    q.push(n);
    checked[n] = true;
    while(!q.empty()){
        int t = q.front();
        q.pop();
        if(tmp[t] != best[t]){
            cout << -1 << endl;
            return 0;
        }
        for(auto e: edges){
            if(e.first.second != t) continue;
            if(checked[e.first.first]) continue;
            q.push(e.first.first);
            checked[e.first.first] = true;
        }
    }

    cout << max((int64_t)0, -best[n]) << endl;

    return 0;
}

Measured memory_bytes: 512
N=int(input())
T,A=map(int,input().split())
pos=list(map(int,input().split()))
 
minPos = 0
minDiff = abs( A- ( T - pos[0] * 0.006) )
 
for i in range(1,len(pos)):
  if (minDiff > abs( A- ( T - pos[i] * 0.006) )):
    minDiff = abs( A- ( T - pos[i] * 0.006) )
    minPos = i 
 
print(minPos+1)

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

int main() {
    int n;
    cin>>n;
    int ans=0;
    ans+=3*5*7<=n;
    ans+=3*5*11<=n;
    ans+=3*5*13<=n;
    ans+=3*3*3*5<=n;
    ans+=3*3*3*7<=n;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
class DSU {
private:
    vector<int> fa;
    int find(int x) {
        while (fa[x] >= 0 && fa[fa[x]] >= 0)
            x = fa[x] = fa[fa[x]];
        return fa[x] >= 0 ? fa[x] : x;
    }
public:
    DSU(int n) {fa.assign(n, -1);}
    bool query(int x, int y) {return find(x) == find(y);}
    void merge(int x, int y) {
        x = find(x);
        y = find(y);
        if (x != y) {
            if (fa[x] > fa[y])
                swap(x, y);
            fa[x] += fa[y];
            fa[y] = x;
        }
    }
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, q;
    cin >> n >> m >> q;
    int mod;
    cin >> mod;
    int g = mod;
    vector<tuple<int, int, int>> edges(m);
    for (int i = 0; i < m; ++i) {
        int u, v, w;
        cin >> u >> v >> w;
        edges[i] = make_tuple(--u, --v, w);
        g = __gcd(g, w - get<2>(edges[0]));
    }
    g = abs(g);
    mod = __gcd(mod, 3 * g);
    int z = get<2>(edges[0]) % g;
    DSU s(6 * n);
    for (int i = 0; i < m; ++i) {
        int u, v, w;
        tie(u, v, w) = edges[i];
        w = (w - z) / g;
        for (int p = 0; p <= 1; ++p) {
            for (int q = 0; q <= 2; ++q) {
                s.merge(6 * u + 3 * p + q, 6 * v + 3 * (1 - p) + (2 * q + w) % 3);
                s.merge(6 * v + 3 * p + q, 6 * u + 3 * (1 - p) + (2 * q + w) % 3);
            }
        }
    }
    vector<vector<bool>> can(2);
    for (int i = 0; i < 2; ++i)
        can[i].resize(mod);
    for (int i = 0, j = z; i < 2 * mod; ++i, j = 2 * j % mod)
        can[i % 2][j] = true;
    for (int i = 0; i < q; ++i) {
        int u, v, r;
        cin >> u >> v >> r;
        --u;
        --v;
        bool ok = false;
        for (int p = 0; p <= 1; ++p)
            for (int q = 0; q <= 2; ++q)
                ok |= s.query(6 * v, 6 * u + 3 * p + q) && can[p][(r + z + (3 - q) * g) % mod];
        if (ok) {
            cout << "YES" << "\n";
        } else {
            cout << "NO" << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <algorithm>

int main(void)
{
    int P, Q, R;

    std::cin >> P;
    std::cin >> Q;
    std::cin >> R;

    std::cout << P + Q + R - std::max({P, Q, R}) << std::endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = sS[0];
            if (sS[0] == sS[1]) { sOut = sS[2]; }
            if (sS[0] == sS[2]) { sOut = sS[1]; }

            // 出力
            Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <cstdlib>
#include <string>
#include <typeinfo>
#include <cstring>
#include <iostream>
#define MAX 2000001
#define VMAX 10000
using namespace std;

int main(){
    unsigned short *A,*B;
    int C[VMAX + 1];
    int n,i,j;
    cin >> n;
    A = static_cast<unsigned short*>(malloc(sizeof(short) * n+1));
    B = static_cast<unsigned short*>(malloc(sizeof(short) * n+1));
    for(i = 0; i <= VMAX; i++)C[i] = 0;
    for(i = 0; i < n; i++){
        cin >> A[i+1];
        C[A[i+1]]++;
    }
    for(i = 1;i <= VMAX; i++)C[i] = C[i] + C[i - 1];
    for(j = 0;j <= n; j++){
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }
    for(i = 1; i <= n; i++){
        if(i > 1)cout << " ";
        cout << B[i];
    }
    cout << endl;
    return 0;
}



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

#define fs first
#define sc second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair

const int N = 2e5+10;
const ll MAX = ll(1e18) + 111;
const ll MOD = 1e9+7;


ll a[N], b[N];

int main()
{
    ll n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    ll balance = 0;
    for(int i = 0; i < n; i++){
        if(a[i] < b[i]) {
	    ll add = (b[i] - a[i]);
            add -= add&1;
            balance += add;
        }
        else balance -= (a[i] - b[i])*2ll;
    }
    //cout << balance << endl;
    if(balance > -1) cout << "Yes";
    else cout << "No";
	return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


map<string,ll> mp;

int main() {
  int N;
  cin >> N;
  vector<string> s(N);
  rep(i,N) {
    string s;
    cin >> s;
    sort(all(s));
    mp[s]++;
  }
  ll ans = 0;
  for(auto itr : mp){
    ll n = itr.second;
    ans += n*(n-1)/2;
  }
  cout << ans << endl;
  return 0;
}










Measured memory_bytes: 11904
#include <iostream>
#include <string.h>
#include <math.h>
#include <stdlib.h>
using namespace std;

int main(void) {
	// your code goes here
	int n;
	cin >> n;
	for(int i=1;i<=9;i++) {
		if(111*i>=n) {
			cout << 111*i << endl;
			return 0;
		}
	}
	return 0;
}


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

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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> mp;

const int MOD = 1e9 + 7;


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

    int n;
    cin >> n;
    map<string, int> ms;
    rep(i, n){
        string s;
        cin >> s;
        ms[s]++;
    }

    int m = 0;
    for (auto &p : ms) {
        if(p.second > m) m = p.second;
    }

    for (auto &p : ms) {
        if(p.second == m) {
            cout << p.first << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 23808
// Problem : C - Repsept
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int k;
    cin>>k;
    if(k % 2 == 0){
        cout<<-1<<endl;
        return;
    }
    int cnt = 1, cur = 0;
    while(cnt <= k){
        cur *= 10;
        cur += 7;
        cur %= k;
        if(cur == 0) break;
        cnt++;
    }
    if(cnt == k+1) cout<<-1;
    else cout<<cnt;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PL = pair<long long, long long>;
const int INF = 1001001007;

int main(){
    int n; cin >> n;
    vector<int> ar(n);
    rep(i,n) cin >> ar[i];
    sort(ar.begin(), ar.end());
    cout << ar[n/2] - ar[n/2-1] << endl;
}

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

int a[503][503];

signed main () {
    int h, w;
    cin >> h >> w;
    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) 
            cin >> a[i][j];
    }
    vector < pair < pair < int, int >, pair < int, int > > > ans;
    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) {
            if (a[i][j] & 1) {
                if (i < h && j < w) {
                    if (a[i + 1][j] & 1) {
                        ++a[i + 1][j];
                        ans.push_back(make_pair(make_pair(i, j), make_pair(i + 1, j)));
                    }
                    else {
                        ++a[i][j + 1];
                        ans.push_back(make_pair(make_pair(i, j), make_pair(i, j + 1)));
                    }
                }
                else if (j < w) {
                    ++a[i][j + 1];
                    ans.push_back(make_pair(make_pair(i, j), make_pair(i, j + 1)));
                }
                else if (i < h) {
                    ++a[i + 1][j];
                    ans.push_back(make_pair(make_pair(i, j), make_pair(i + 1, j)));
                }
            }
        }
    }
    cout << int(ans.size()) << '\n';
    for (auto uv: ans) {
        int xu = uv.first.first, yu = uv.first.second;
        int xv = uv.second.first, yv = uv.second.second;
        cout << xu << ' ' << yu << ' ' << xv << ' ' << yv << '\n';
    }
}


Measured memory_bytes: 5104
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int N;
int M;
int A[10000];
int main(){
  rd(N);
  rd(M);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(M);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  {
    int e98WHCEY;
    int cTE1_r3A;
    if(M==0){
      cTE1_r3A = 0;
    }
    else{
      cTE1_r3A = A[0];
      for(e98WHCEY=(1);e98WHCEY<(M);e98WHCEY++){
        cTE1_r3A += A[e98WHCEY];
      }
    }
    N -=cTE1_r3A;
  }
  if(N < 0){
    N = -1;
  }
  wt_L(N);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200430-1

// --- original code ---
// int N, M, A[1d4];
// {
//   rd(N,M,A(M));
//   N -= sum(A(M));
//   if(N < 0) N = -1;
//   wt(N);
// }


Measured memory_bytes: 3724
from itertools import combinations
n, m, x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]

ans = 10**9
for i in range(1,n+1):
  for j in combinations(ca, i):
    s = [0]*(m+1)
    for k in j:
      for l in range(m+1):
        s[l] += k[l]
    if min(s[1:]) >= x:
      ans = min(ans, s[0])
if ans == 10**9:
  print(-1)
else:
  print(ans)

Measured memory_bytes: 9144
(defun split (sep str &key (start 0))
  (let ((index (position sep str :start start)))
    (if index
        (progn
          (cons (subseq str start index)
                (split sep str :start (1+ index))))
        (list (subseq str start )))))

(defun compare (l1 l2)
  (cond
    ((and (null l1) (null l2)) 0)
    ((null l1) -1)
    ((null l2) 1)
    ((< (car l1) (car l2)) -1)
    ((= (car l1) (car l2)) (compare (cdr l1) (cdr l2)))
    ((> (car l1) (car l2)) 1)
    (t (error))))

(defun main ()
  (let ((ymd (mapcar #'read-from-string (split #\/ (read-line)))))

    (if (<= (compare ymd '(2019 4 30)) 0)
        (format t "Heisei~%")
        (format t "TBD~%"))))

(main)

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

int main() {
    int a, b, k;
    cin >> a >> b >> k;

    for (int i = a; i <= b; i++) {
        if (i <= a + k-1 ||  b-k+1 <= i)
            cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    ll W,H,x,y;
    cin >> W >> H >> x >> y;
    
    if(W / 2 == x && H / 2 == y && W % 2 == 0 && H % 2 == 0)
        cout << W * H / 2.0 << " " << 1 << endl;
    else
        cout << W * H / 2.0 << " " << 0 << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>

using namespace std;

int main(){
	int n,a,b;
	cin >> n;
	if(n==1){
		cout << "Hello World" << endl;
		return 0;
	}
	cin >> a >> b;
	int ans=a+b;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
const int mod=1e9+7;
int n,k;
int a[200005],maxx,minn,num=0;
bool flags=1;
long long ans=1;
long long ksm(long long x,long long n)
{
	long long ans=1;
	while(n)
	{
		if(n&1) ans=ans*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return ans;
}
bool cmp(int x,int y)
{
	return abs(x)>abs(y);
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) if(a[i]>=0) flags=0;
	sort(a+1,a+n+1,cmp);
	if(flags)
	{
		if(k&1) for(int i=n;i>=n-k+1;i--) ans=ans*a[i]%mod;
		else for(int i=1;i<=k;i++) ans=ans*a[i]%mod;
		ans=(ans%mod+mod)%mod;
		printf("%lld\n",ans);
		return 0;
	}
	if(n==k)
	{
		ans=1;
		for(int i=1;i<=k;i++) ans=ans*a[i]%mod;
		ans=(ans%mod+mod)%mod;
		printf("%lld\n",ans);
		return 0;
	}
	ans=1;
	for(int i=1;i<=k;i++)
	{
		ans=ans*a[i]%mod;
		if(a[i]<0) num++,maxx=a[i];
		if(a[i]>0) minn=a[i];
	}
	if(!ans)
	{
		printf("%lld\n",ans);
		return 0;
	}
	if(!(num&1)) printf("%lld\n",ans);
	else
	{
		long long u=0,v=0,u2=0,v2=0;
		v=-maxx,v2=minn;
		for(int i=n;i>k;i--)
		if(a[i]>0) u=a[i];
		else u2=-a[i];
		if(!v2) ans=ans*ksm(-v,mod-2)%mod*u%mod;
		else
		{
			if(u*v2>u2*v) ans=ans*ksm(-v,mod-2)%mod*u%mod;
			else ans=ans*ksm(v2,mod-2)%mod*-u2%mod;
		}
		ans=(ans%mod+mod)%mod;
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 4520
#include<iostream>
#include<string>
using namespace std;
int main() {
	string s, t;
	cin >> s >> t;
	int count = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s.at(i) == t.at(i)) {
			count++;
		}
	}
	cout << s.size() - count << endl;
}

Measured memory_bytes: 3848
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    int sum = 0;
    for(int i = 0;i<N.length();i++){
      sum+=Integer.parseInt(N.substring(i,i+1));
      sum=sum%9;
    }
    if(sum == 0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

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

typedef long long LL;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<pair<LL,LL>> AB(N);
	for (int i = 0; i < N; ++i) {
		cin >> AB[i].first >> AB[i].second;
	}

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

	LL ans = 0;
	LL cnt = 0;
	int i = 0;
	while(cnt < M) {
		cnt += AB[i].second;
		ans += AB[i].first * AB[i].second;
		++i;
	}

	--i;
	
	ans -= AB[i].first * (cnt - M);

	cout << ans << endl;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cerr<<' ';cout<<elem;}cerr<<endl;}

template<class Type_k,class Type_p>
Type_p mod_pow(long long n,Type_k k,Type_p p){//n^k(mod p).
	if(k==0) return 1;
	long long res=mod_pow(n*n%p,k/2,p);
	if(k&1) res=res*n%p;
	return res;
}

int main(){
	const llong inf=1e18;
	
	int n,k;
	cin>>n>>k;
	
	vi a(n);
	int num=0;//負の数.
	REP(i,n){
		cin>>a[i];
		if(a[i]<0) num++;
	}
	
	if(k==n){//全部選ぶ場合.
		llong ans=1;
		REP(i,n) ans=ans*(MOD+a[i])%MOD;
		cout<<ans<<endl;
		return 0;
	}
	
	if(num==n and k%2){//ansが負になる場合.
		llong ans=1;
		sort(ALL(a),greater<int>());
		REP(i,k) ans=ans*(MOD+a[i])%MOD;
		cout<<ans<<endl;
		return 0;
	}
	
	llong ans=1;
	int cnt=0;
	auto f=[](int x,int y){
		return abs(x)>abs(y);//絶対値が大きい順にソート.
	};	
	sort(ALL(a),f);
	REP(i,k){
		ans=ans*(MOD+a[i])%MOD;
		if(a[i]<0) cnt++;
	}
	
	if(cnt%2==0){//非負ならok.
		cout<<ans<<endl;
		return 0;
	}
	
	llong pl,pr,ml,mr;
	pl=pr=ml=mr=inf;
	REP(i,k){
		if(a[i]<0) ml=a[i];
		else pl=a[i];
	}
	for(int i=n-1;i>=k;--i){
		if(a[i]<0) mr=a[i];
		else pr=a[i];
	}
	
	//「非負の数割って負の数かける」,または「負の数割って非負の数かける」.
	if(pl==inf or mr==inf) ans=ans*mod_pow(MOD+ml,MOD-2,MOD)%MOD*pr%MOD;
	else if(ml==inf or pr==inf) ans=ans*mod_pow(pl,MOD-2,MOD)%MOD*(MOD+mr)%MOD;
	else{
		if(ml*mr<pl*pr) ans=ans*mod_pow(MOD+ml,MOD-2,MOD)%MOD*pr%MOD;
		else ans=ans*mod_pow(pl,MOD-2,MOD)%MOD*(MOD+mr)%MOD;
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 4048
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
typedef vector<vector<int> > VVI;
const int INF = 1e9;
const double EPS = 1e-6;

int sum;
int N, M, K;

void solve(int n, int s)
{
		if (n >= N) {
		sum += max(s-K, 1);
		return;
	}
	
	for (int i=1; i<=M; i++) {
		solve(n+1, s+i);
	}
}

int main()
{
	while (cin>>N>>M>>K, N) {
		sum = 0;
		solve(0, 0);
		cout << fixed << setprecision(8) << sum/pow(M, N) << endl;
	}
}

Measured memory_bytes: 1280
#include <vector>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <algorithm>
#define EPS (1e-10)
#define equal(a,b) (fabs((a)-(b))<EPS)
using namespace std;
static const int COUNTER_CLOCKWISE=1;
static const int CLOCKWISE=-1;
static const int ONLINE_BACK=2;
static const int ONLINE_FRONT=-2;
static const int ON_SEGMENT=0;

class Point
{
public:
    double x,y;

    Point(double x=0,double y=0):x(x),y(y){}

    Point operator + (Point p){
        return Point(x+p.x,y+p.y);
    }

    Point operator - (Point p){
        return Point(x-p.x,y-p.y);
    }

    Point operator * (double a){
        return Point(a*x,a*y);
    }

    Point operator / (double a){
        return Point(x/a,y/a);
    }

    double norm(){
        return x*x+y*y;
    }

    double abs(){
        return sqrt(norm());
    }

    bool operator < (const Point &p) const
    {
        return x!=p.x?x<p.x:y<p.y;
    }

    bool operator == (const Point &p) const
    {
        return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
    }
};
typedef Point Vector;
typedef vector<Point> Polygon;

//??????a???b???????§?
double dot(Vector a,Vector b) {
    return a.x*b.x+a.y*b.y;
}

//??????a???b???????§?
double cross(Vector a,Vector b){
    return a.x*b.y-a.y*b.x;
}

int ccw(Point p0,Point p1,Point p2){
    Vector a=p1-p0;
    Vector b=p2-p0;
    if(cross(a,b)>EPS)
        return COUNTER_CLOCKWISE;
    if(cross(a,b)<-EPS)
        return CLOCKWISE;
    if(dot(a,b)<-EPS)
        return ONLINE_BACK;
    if(a.norm()<b.norm())
        return ONLINE_FRONT;
    return ON_SEGMENT;
}

Polygon andrewScan(Polygon s){
    Polygon u,l;
    if(s.size()<3)
        return s;
    sort(s.begin(),s.end());

    //?°?x???????°????2???????????????u
    u.push_back(s[0]);
    u.push_back(s[1]);
    //?°?x????????§???2???????????????l
    l.push_back(s[s.size()-1]);
    l.push_back(s[s.size()-2]);

    //?????????????????¨
    for(int i=2;i<s.size();i++){
        for(int n=u.size();n>=2&&ccw(u[n-2],u[n-1],s[i])==COUNTER_CLOCKWISE;n--)
            u.pop_back();
        u.push_back(s[i]);
    }

    //?????????????????¨
    for(int i=s.size()-3;i>=0;i--){
        for(int n=l.size();n>=2&&ccw(l[n-2],l[n-1],s[i])==COUNTER_CLOCKWISE;n--)
            l.pop_back();
        l.push_back(s[i]);
    }


    //????????¶????????????????????????????????????
    reverse(l.begin(),l.end());
    if(s.size()>l.size())
        for(int i=u.size()-2;i>=1;i--)
            l.push_back(u[i]);

    Point min(10001,10001);
    int pos=0;
    int size=l.size();
    for(int i=0;i<size;i++)
        if(equal(min.y,l[i].y)?min.x-l[i].x>EPS:min.y-l[i].y>EPS){
            min=l[i];
            pos=i;
        }

    //cout<<min.x<<' '<<min.y<<endl<<endl;

    Polygon ans;

    for(int i=pos;i<size;i++)
        ans.push_back(l[i]);

    for(int i=0;i<pos;i++)
        ans.push_back(l[i]);

    return ans;
}

int main(){
    int n,x,y,size;
    cin>>n;
    Polygon s;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        s.push_back(Point(x,y));
    }
    s=andrewScan(s);

    size=s.size();
    cout<<size<<'\n';
    for(int i=0;i<size;i++){
        cout<<(int)s[i].x<<' '<<(int)s[i].y<<'\n';
    }
}

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

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

using namespace std;
using lint=long long;

int main(){
	int n;
	lint p; scanf("%d%lld",&n,&p);
	vector<int> w(n),b(n);
	rep(i,n) scanf("%d%d",&w[i],&b[i]);

	vector<lint> a(n);
	lint r=0;
	rep(i,n){
		a[i]=(100-p)*w[i]+p*b[i];
		r+=p*b[i];
	}
	sort(a.rbegin(),a.rend());

	lint sum=0;
	rep(i,n){
		sum+=a[i];
		if(sum>=r){
			printf("%d\n",i+1);
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] ch = s.toCharArray();
        Set<Character> hs = new HashSet<>();
        for (char c : ch)
            hs.add(c);
        if (hs.size() >= 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35500
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut x = buf.trim_right().split_whitespace();
    let n: u32 = x.next().unwrap().parse().unwrap();
    let a: u32 = x.next().unwrap().parse().unwrap();
    let b: u32 = x.next().unwrap().parse().unwrap();
 
    let mut total = 0;
    for j in 1..n + 1 {
        let mut t = j;
        let mut s = 0;
        while t > 0 {
            s += t % 10;
            t /= 10;
        }
        if s >= a && s <= b {
            total += j;
        }
    }
    println!("{}", total);
}

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

typedef long long ll;

int digit9(int n)
{
	int d=0;
	while(n)
	{
		n/=10;
		d++;
	}
	
	return d;
}


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

	for(int i=1;i<=n;i++)
	{
		if(digit9(i)%2) d++;
	}
	
	cout<<d;
	
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	long double ans=0;
	for(ll i=0;i<n;i++){
		long double now;
		cin>>now;
		now=1.0/now;
		ans+=now;
	}
	ans=1.0/ans;
	cout <<ans;
	return 0;
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int n;
	while (cin >> n, n) {
		int m; cin >> m;
		string s; cin >> s;
		string p = "I";
		rep(i, 0, n)p += "OI";
		int ans(0);
		for (int i = 0; i + p.size()-1 < m; i++) {
			if (p == s.substr(i, p.size()))ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3916
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    string s;
    cin >> s;
    rep(i,s.size())cout << "x";
    cout << endl;
}


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

namespace CSharpSample01
{

    

    class Program
    {
        
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int C = int.Parse(str[2]);

            int cnt = B / A;

            if(cnt >= C)
            {
                Console.WriteLine(C);
            }
            else
            {
                Console.WriteLine(cnt);
            }
            
        }
    }
}


Measured memory_bytes: 13140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace ABC076
{
    class C
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string t = Console.ReadLine();

            bool isMatch = true;
            List<string> sList = new List<string>();

            var indexT = 0;
            var indexS = 0;
            for (int i = 0; i < s.Length - t.Length + 1; i++)
            {
                isMatch = true;
                indexS = i;
                indexT = 0;

                while (indexT < t.Length)
                {
                    if (s[indexS] != '?' && s[indexS] != t[indexT]) { isMatch = false; break; }
                    indexS++;
                    indexT++;
                }

                if (isMatch)
                {
                    string front = s.Substring(0, i);
                    string rear = s.Substring(i + t.Length, s.Length - front.Length - t.Length);

                    string res = front + t + rear;
                    res = res.Replace('?', 'a');
                    sList.Add(res);
                }
            }

            sList = sList.OrderBy(x => x).ToList();

            //Console.WriteLine(string.Join(" ", sList));

            if (0 < sList.Count) Console.WriteLine(sList[0]);
            else Console.WriteLine("UNRESTORABLE");

        }
    }
}


Measured memory_bytes: 13536
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		int a = t.length();
		int b = s.length();
		
		String x = t.substring(0,a-1);
		
		if(s.equals(x) && b+1 == a) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		
		
		

	}
}


Measured memory_bytes: 35720
// AOJ 3031 Ghost Legs
// 2018.3.29 bal4u

#include <stdio.h>

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

char p[3][3][3];

int main()
{
	int N, w, i, ans;
	int a[3], t;

	N = in();
	for (i = 0; i < N; i++) {
		a[0] = 0, a[1] = 1, a[2] = 2;
		w = in();
		while (w--) {
			if (in()) t = a[1], a[1] = a[2], a[2] = t;
			else      t = a[0], a[0] = a[1], a[1] = t;
		}
//printf("--> %d %d %d\n", a[0], a[1], a[2]);
		p[a[0]][a[1]][a[2]]++;
	}

	ans = p[0][1][2] ||
		  p[0][2][1] >= 2 || p[1][0][2] >= 2 || p[2][1][0] >= 2 ||
		  p[1][2][0] >= 3 || p[2][0][1] >= 3 || (p[1][2][0] && p[2][0][1]) ||
		  ((p[0][2][1] && p[1][0][2] || p[0][2][1] && p[2][1][0] ||
			     p[1][0][2] && p[2][1][0]) && (p[1][2][0] || p[2][0][1]));

	puts(ans? "yes": "no");
	return 0;
}


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

int main() {
  map<string, int> M;

  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    M[s]++;
  }

  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    string s;
    cin >> s;
    M[s]--;
  }

  int ans = 0;
  for (auto &i : M) {
    if (i.second > 0) ans = max(ans, i.second);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    long long K,A,B; cin >> K >> A >> B;
    if(B-A <= 2){
        cout << K+1 << endl;
    }else if(K<=A-1){
        cout << K+1<< endl;
    }else{
        cout << A+((K-A+1)/2)*(B-A)+(K-A+1)%2 << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
using namespace std;

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

    vector<int> m;
    for (int i = 0; i < n; i++){
        int t;
        cin >> t;
        m.push_back(t);
    }

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

    int minv = accumulate(m.begin(), m.end(), 0);
    int r = (x - minv) / m.front();

    cout << n + r << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin>>t;
	ll ans = 0;
	while(t--)
	{
		int l,r;cin>>l>>r;
		ans += r-l+1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256