akhauriyash/Code-Regression huggingface dataset:
package main

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func main() {
	io := NewIo()
	defer io.Flush()
	b := io.Next()
	if b == "A"{
		io.PrintLn("T")
	} else if b == "T" {
		io.PrintLn("A")
	} else if b == "C" {
		io.PrintLn("G")
	} else if b == "G" {
		io.PrintLn("C")
	}
}

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

int main() {
  ll n;
  cin >> n;
  ll r = 0;
  for (ll i = 1; i <= n; i++) {
    if (i % 3 && i % 5) r += i;
  }
  cout << r << endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int main()
{
	#define int long long
	int n,m;
	cin >> n >> m;
	int mod = 1000000007;
	int dp[n+1];
	int a[m];
	int broken[n+1] = {0};
	for(int i = 0; i < m; i++)
	{
		cin >> a[i];
		broken[a[i]] = 1;
	}
	dp[0] = 1;
	for(int i = 1; i < n+1; i++)
	{
		if(broken[i])
		{
			dp[i] = 0;
		}
		else if(i == 1)
		{
			dp[i] = dp[i-1];
		}
		else
		{
			dp[i] = ((dp[i-1]%mod)+(dp[i-2]%mod))%mod;
		}
	}
	cout << dp[n] << "\n";
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mat vector<vector<int>>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<n;i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
#define INF (int)1e18

auto max(auto a){auto ans=a[0];for(auto i:a)if(i>ans)ans=i;return ans;}
auto min(auto a){auto ans=a[0];for(auto i:a)if(i<ans)ans=i;return ans;}
void print(auto a){for(auto i:a)cerr<<i<<' ';cerr<<'\n';}



signed main()
{
	fio
	inp(n)
	inpa(h,n)
	inpa(a,n)
	set<pair<int,int>> s;
	s.insert({0,0});
	int ans=0;
	fo(i,n)
	{
		set<pair<int,int>>::iterator itr=s.lower_bound(mp(h[i],(int)0));
		itr--;
		int points=(*itr).S+a[i];
		itr++;
		auto tp=itr;
		while(tp!=s.end())
		{
			if((*tp).S<=points)
			{
				tp++;
			}
			else
				break;
		}
		s.erase(itr,tp);
		s.insert({h[i],points});
		ans=max(ans,points);
	}
	cout<<ans<<'\n';
	printclock;
}

Measured memory_bytes: 15872
N = int(input())
T = [0]*N
A = [0]*N
for i in range(N):
    T[i],A[i] = map(int,input().split())

def aa(a,t,na,nt):
    c = max( (1+(a-1)//na,1+(t-1)//nt) )
    return (na*c,nt*c)
t = T[0]
a = A[0]
for i in range(N):
    a,t = aa(a,t,A[i],T[i])
print(t+a)


Measured memory_bytes: 3064
import fractions as math
A,B,C,D = [int(x) for x in input().split()]
cd = C*D//math.gcd(C,D)
num_c = B//C-(A-1)//C
num_d = B//D-(A-1)//D
num_cd = B//cd-(A-1)//cd
print(B-A+1-(num_c+num_d-num_cd))

Measured memory_bytes: 5048
#include <stdio.h>
#include <math.h>


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

    int cnt = 0;
    for (int i=1; i < n-1; i++){
        if(a[i-1] < a[i] && a[i] < a[i+1])
            cnt++;
        else if(a[i+1] < a[i] && a[i] < a[i-1])
            cnt++;
    }


    printf("%d\n", cnt);


    return 0;
} 




Measured memory_bytes: 128
N = int(input())
h = list(map(int,input().split()))

dp = [float("inf") for _ in range(100010)]

# 1-index で考える
dp[0] = 0

for i in range(1,N):
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i > 1:
        dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[N-1])


Measured memory_bytes: 52976
def main():
    N = int(input())
    T, A = map(int, input().strip().split())
    H = list(map(int, input().strip().split()))
    t = []
    
    for h in H:
        arg_t_a = T - h * 0.006 - A
        t.append(arg_t_a * arg_t_a)
    print(t.index(min(t)) + 1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#include <map>
#include <unordered_set>

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

using namespace std;
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;}

template <class T>
inline bool chmin(T& a, T b)
{
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T& a, T b)
{
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
T GCD(T x, T y)
{
    return (y ? GCD<T>(y, x % y) : x);
}

struct Item{
    Item(ll A, ll B) : A(A), B(B){};
    ll A;
    ll B;
    bool operator<(const Item& another) const {
        return A < another.A;
    }
};
int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    int sum=0;
    rep(i,N){
        cin>>X[i];
    }

    int L=101;
    int R=0;
    rep(i,N){
        L=min(X[i],L);
        R=max(X[i],R);
    }

    int answer=std::numeric_limits<int>::max();
    for(int i=L; i<=R; i++){
        int cost=0;
        rep(j,N) cost+=pow(X[j]-i,2);
        answer=std::min(answer,cost);
    }

    cout<<answer<<endl;

}



Measured memory_bytes: 256
"use strict";
const Main =  (input) => {
	let xs = input.trim().split(' ').map(v=>parseInt(v,10));
    let x = [1,3,5,7,8,10,12];
    let y = [4,6,9,11];
    let z = [2];
    
    if(x.indexOf(xs[0]) != -1 && x.indexOf(xs[1]) != -1 || y.indexOf(xs[0]) != -1 && y.indexOf(xs[1]) != -1 || z.indexOf(xs[0]) != -1 && z.indexOf(xs[1]) != -1){
      console.log('Yes');
    }else{
      console.log('No'); 
    }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
S = input()
ls = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
is_ng = True
idx = 0
tmp = 0
for i in range(len(ls)):
    l = S[:i]
    r = S[-len(ls)+i:]
    if l+r == 'keyence':
        is_ng=False

print('YNEOS'[is_ng::2])


Measured memory_bytes: 3060
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int N = 1e5;
int n,m,a[101];
bool cmp(int x,int y)
{
  return x>y;
}
int main()
{
  int sum=0;
  cin>>n>>m;
  for(int i=1;i<=n;i++)cin>>a[i],sum+=a[i];
  sort(a+1,a+n+1,cmp);
  if(a[m]>=double(sum)/(4*m))
  {
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
  return 0;
}


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

using namespace std;

double dp[3003][3003];

int m;
double arr[3002];
double fun(int n , int cnt ){
    // cout<<n<<" "<<cnt<<endl;
    if(n==0){
        // cout<<cnt << m/2<<endl;
        if(cnt>m/2)return 1;
        return 0;
    }
    // cout<<dp[n][cnt]<<endl;
    if(dp[n][cnt]!=-1)return dp[n][cnt];
    double ans =0 ;
    ans +=arr[n-1]*fun(n-1,cnt+1);
    ans+=(1-arr[n-1])*fun(n-1,cnt);
    return dp[n][cnt]=ans;
    

}

int main(){
    
    cin>>m;
    for(int i =0;i<m;i++){
        cin>>arr[i];
        for(int j =0;j<m+1;j++)dp[i+1][j]=-1;
    }
    cout<<setprecision(15)<<fun(m,0)<<endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    ll c1 = 0, c2 = 0;
    rep(i, 0, s.size()){
        if(s[i]%2 == i%2){
            c1++;
        }else{
            c2++;
        }
    }
    cout << min(c1, c2) << endl;
    return 0;
}

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

int main(){
    long long j;
    int res=0;
    cin>>j;

    j++;
    while(j>9){
        res += 9;
        j /= 10;
    }
    res += (j-1);

    cout<<res<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int INF = 1e9 +7;
signed main(){
    int n;
    cin>>n;
    vector<pair<int,int>> k,k2;
    pair<int,int> p;
    k.push_back(make_pair(1,3));
    k.push_back(make_pair(2,3));
    for(int i=4;i<=n;i++){
        if(i%2==0){
            for(int j=0;j<k.size();j++){
                p=k[j];
                k2.push_back(make_pair(p.first +1,p.second +1));

            }
            for(int j=1;j<i-1;j++){
                k2.push_back(make_pair(1,j+1));
            }
            k=move(k2);
        }else{
            for(int j=1;j<i;j++){
                k.push_back(make_pair(j,i));
            }
        }
    }
    cout <<k.size()<<endl;
    for(int i=0;i<k.size();i++)cout<<k[i].first<<' '<<k[i].second<<endl;

   
   


    return 0;
}

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

int main(void)
{
  int K;
  string S, ans;
  cin >> K;
  cin >> S;

  if(K < S.size()){
    for (int i = 0; i < K;i++){
      ans += S[i];
    }
    ans += "...";
    cout << ans << endl;
  }
  else{
    ans = S;
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3576
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    AB=LLIN(N)
    AB.sort(key=lambda x: x[1])

    now = 0    
    for a,b in AB:
        now += a
        if now > b:
            print("No")
            return
    print("Yes")
if __name__ == '__main__':
    main()


Measured memory_bytes: 56068
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int n, p, r[50], d[50][50]; bool a[50][30];
int main() {
	while (true) {
		scanf("%d", &n);
		if (n == 0) break;
		for (int i = 0; i < n; i++) {
			scanf("%d", &r[i]);
			for (int j = 0; j < 30; j++) {
				a[i][j] = false;
			}
			for (int j = 0; j < r[i]; j++) {
				scanf("%d", &p); a[i][p - 1] = true;
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				d[i][j] = 9999999;
			}
		}
		for (int i = 0; i < n; i++) {
			queue<pair<int, int> > que; que.push(make_pair(0, i)); d[i][i] = 0;
			while (!que.empty()) {
				pair<int, int> state = que.front(); que.pop();
				int dist = -state.first;
				int node = state.second;
				for (int j = 0; j < n; j++) {
					for (int k = dist; k < 30; k++) {
						if (a[node][k] && a[j][k]) {
							if (d[i][j] > k) {
								d[i][j] = k; que.push(make_pair(-k, j)); break;
							}
						}
					}
				}
			}
		}
		int ret = 9999999;
		for (int i = 0; i < n; i++) {
			int res = 0;
			for (int j = 0; j < n; j++) {
				res = max(res, d[j][i]);
			}
			ret = min(ret, res);
		}
		printf("%d\n", ret == 9999999 ? -1 : ret + 1);
	}
	return 0;
}

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

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    string a,b;
    int a1=0;
    int b1=0;
    for(int i=0;i<s.length();++i){
        if(i%2==0){
            if(s[i]=='1')a1++;
            if(s[i]=='0')b1++;
        }
        else{
            if(s[i]=='0')a1++;
            if(s[i]=='1')b1++;
        }
    }
    cout << min(a1,b1) <<endl;
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int max=0,c[510][510]={};
void f(int l,int r,int d){//printf("%d %d %d\n",l,r,d);
  int n=(r-l),i,j;//printf("%d\n",n);
  
  if(max<d)max=d;
  //if(n==1)return ;
  if(n>1)f(l,(l+r)/2,d+1);
  if(n>1)f((l+r)/2,r,d+1);
  for(i=0;i<n/2;i++){
    for(j=n/2;j<n;j++)c[i+l][j+l]=c[j+l][i+l]=d;//,printf("!%d %d %d\n",i+l,j+l,d);
  }
}
int main(){
  int n,i,j;
  scanf("%d",&n);
  f(0,n,0);
  //printf("%d\n",max);
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++)printf("%d%c",c[i][j]+1,j+1==n?'\n':' ');
  }
  return 0;
}
  


Measured memory_bytes: 1408
#include <stdio.h>
int main()
{
    int N,K,i;
    scanf("%d %d",&N,&K);
    int length[N];
    for(i=0; i<N;i++)
    {
       scanf("%d",&length[i]);
    }
    int j,pow,sum;
    for(i=0;i<N;i++)
    {
       for(j=0;j<N;j++)
       {
           if(length[i]>length[j])
           {
               pow=0;
               pow=length[i];
               length[i]=length[j];
               length[j]=pow;
           }
        }
    }
    sum=0;
    for(i=0;i<K;i++)
    {
        sum +=length[i];
    }
    printf("%d",sum);
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define SORT(V) sort((V).begin(),(V).end())

#define ll long long

int main(){
  long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);
  std::vector<long long> H(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&H[i]);
  }

  vector<ll> nice_flag(N,1);
  std::vector<long long> A(M);
  std::vector<long long> B(M);
  for(int i = 0 ; i < M ; i++){
    scanf("%lld",&A[i]);
    scanf("%lld",&B[i]);
      if(H[A[i]-1] > H[B[i]-1]) {
        nice_flag[B[i]-1] = 0;
      } else if(H[A[i]-1] < H[B[i]-1]) {
        nice_flag[A[i]-1] = 0;
      } else {
        nice_flag[A[i]-1] = 0;
        nice_flag[B[i]-1] = 0;
      }
  }
  ll result=0;
  for (ll b = 0; b < nice_flag.size(); b++){
    if(nice_flag[b] == 1) {
      result++;
    }
  }
  cout<<result<<endl;
  return 0;
}


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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
#define sbp(p, n) rep(i, n) { int a, b; scanf("%d %d", &a, &b); p[i] = make_pair(a, b); }
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	int x[5];
	rep(i, 5) cin >> x[i];
	int y[5], m = 10;
	rep(i, 5){
		y[i] = ((x[i] - 1) / 10) * 10 + 10;
		chmin(m, 1 + ((x[i] - 1) % 10));
	}
	int ans = 0;
	rep(i, 5) ans += y[i];
	ans += m;
	cout << ans - 10 << endl;
	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 REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define sz(x) int(x.size())
using ll = long long;
using P = pair<int,int>;
const ll LLINF = numeric_limits<long long>::max();
const int mod = 1000000007;
const int INF = 1001001001;

int main()
{
    long double a,b;
    cin >> a >> b;
    
    ll ans = a*b;

    cout << ans;

    return 0;
}


Measured memory_bytes: 3792
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0;
  cin >> n;
  vector<int> l(n);
  for(int i = 0; i < n; i++){
    cin >> l.at(i);
    sum += l.at(i);
  }
  sort(l.begin(), l.end());
  sum -= l.at(n-1);
  if(sum > l.at(n-1)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<stack>
#include<vector>
#include<cstring>
#include<algorithm>
#include<set>
#include<queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf =0x3f3f3f3f;
#define scn(a) scanf("%d",&a)
#define scd(a) scanf("%lf",&a)
#define scl(a) scanf("%lld",&a)
#define ptf(a) printf("%d\n",a)
#define mes(a,b) memset(a,b,sizeof(a))
#define fon(s,n) for(int i=s;i<=n;i++)
#define range(i,a,b) for(int i=a;i<=b;++i)
#define rerange(i,a,b) for(int i=a;i>=b;--i)
#define maxn 1000010
const int S=20;
ll gcd(ll a,ll b) { return b>0 ? gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll q_pow(ll a,ll b,ll mod)
{
	ll ans=1,res=a;
	while(b){
		if(b&1) ans=ans*res%mod;
		res=res*res%mod;
		b>>=1;
	}
	return ans%mod;
}
ll qmul(ll a,ll b,ll p){
     ll d=0,t=a;
    while(b>0)
    {
        if(b&1) d=(d+t)%p;
        b=b/2;
        t=(t+t)%p;
    }
    return d;

}

ll qmod(ll a,ll b,ll p)//快速幂
{
    ll d=1,t=a;
    while(b)
    {
        if(b&1)
            d=qmul(d,t,p)%p;
        t=qmul(t,t,p)%p;
        b>>=1;
    }return d;
}
int exgcd(int a,int b,int& x,int& y)
{
	if(!b){
		x=1;y=0;
		return a;
	}
	int d=exgcd(b,a%b,y,x);
	y-=(a/b)*x;
	return d;
}

int del[105];
char str[10];
int main(){
    ll a;
    ll b;
    scanf("%lld%s", &a, &str);
    b=(str[0]-'0')*100+(str[2]-'0')*10+str[3]-'0';
    b=a*b/100;
    printf("%lld\n", b);
    return 0;
}

Measured memory_bytes: 3844
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=3010,mod=1e9+7;
const int inv2=(mod+1)/2;
int f[N][N],n;
int A[N],xi[N],m;
int main() {
	int q,x,y; rd(n),rd(q);
	for(int i=1;i<=n;++i) rd(A[i]),xi[i]=A[i];
	sort(xi+1,xi+n+1);
	m=unique(xi+1,xi+n+1)-xi-1;
	for(int i=1;i<=n;++i) A[i]=lower_bound(xi+1,xi+m+1,A[i])-xi;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j) if(i!=j)
			f[i][j]=A[i]>A[j];
	int ax=1;
	while(q--) {
		ax=ax*2ll%mod;
		int x,y; rd(x),rd(y);
		for(int i=1;i<=n;++i) if(i!=x&&i!=y) {
			int tmp1=(f[i][x]+f[i][y])*(ll)inv2%mod;
			f[i][x]=f[i][y]=tmp1;
			int tmp2=(f[x][i]+f[y][i])*(ll)inv2%mod;
			f[x][i]=f[y][i]=tmp2;
		}
		int tmp=(f[x][y]+f[y][x])*(ll)inv2%mod;
		f[x][y]=f[y][x]=tmp;
	}
//	for(int i=1;i<=n;++i,puts(""))
//		for(int j=1;j<=n;++j)
//			printf("%d ",f[i][j]);
	int ans=0;
	for(int i=1;i<=n;++i)
		for(int j=i+1;j<=n;++j)
			ans=(ans+f[i][j])%mod;
	printf("%d",ans*(ll)ax%mod);
	return 0;
}

Measured memory_bytes: 35584
package main

import "fmt"

func main() {
	var S, T string
	fmt.Scan(&S, &T)
	var A, B int
	fmt.Scan(&A, &B)
	var U string
	fmt.Scan(&U)

	if U == S {
		A = A - 1
	}

	if U == T {
		B = B - 1
	}

	fmt.Println(A, B)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 100000;
const int INF = 1e9 + 5;

int dist[10][10];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int M;
	while (scanf("%d", &M) == 1 && M) {
		for (int i = 0; i < 10; i++) {
			fill(dist[i], dist[i] + 10, INF);
			dist[i][i] = 0;
		}
		
		for (int i = 0; i < M; i++) {
			int a, b, c;
			scanf("%d %d %d", &a, &b, &c);
			dist[a][b] = dist[b][a] = min(dist[b][a], c);
		}
		
		for (int k = 0; k < 10; k++) {
			for (int i = 0; i < 10; i++) {
				for (int j = 0; j < 10; j++) {
					dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
				}
			}
		}
		
		int id = -1, ans = INF;
		for (int i = 0; i < 10; i++) {
			int res = 0;
			for (int j = 0; j < 10; j++) {
				if (dist[i][j] != INF) {
					res += dist[i][j];
				}
			}
			if (res != 0 && res < ans) {
				ans = res;
				id = i;
			}
		}
		
		printf("%d %d\n", id, ans);
	}
	
	/**** Note MAXN ****/
}



Measured memory_bytes: 3176
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int x,a,b;
    cin >> x >> a  >> b;
    if(abs(a-x) < abs(b-x))cout << "A" << endl;
    else cout << "B" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void){
    ll h, w;
    cin >> h >> w;
    vector<string> s(h);
    for(ll i = 0; i < h; i++)
        cin >> s[i];
    vector<ll> c(h, 0);
    vector<ll> d(w, 0);
    for(ll i = 0; i < h; i++){
        bool check = true;
        for(ll j = 0; j < w; j++){
            if(s[i][j]=='#'){
                check = false;
                break;
            }
        }
        if(check==false) c[i] = 1;
    }
    for(ll i = 0; i < w; i++){
        bool check = true;
        for(ll j = 0; j < h; j++){
            if(s[j][i]=='#'){
                check = false;
                break;
            }
        }
        if(check==false) d[i] = 1;
    }
    for(ll i = 0; i < h; i++){
        if(c[i]==0) continue;
        for(ll j = 0; j < w; j++){
            if(d[j]==0) continue;
            cout << s[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5+1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
n=int(input())
a=list(map(int,input().split()))
data=[0]*(n+1)
for i in range(n+1):
    data[a[i]]+=1
for i in range(1,n+1):
    if data[i]==2:
        b=i
        break
l=[]
for i in range(n+1):
    if a[i]==b:
        l.append(i)
c=l[1]-l[0]+1
for k in range(1,n+3-c):
    ans=cmb(n+1,k,mod)-cmb(n+1-c,k-1,mod)
    print(ans%mod)
for k in range(n+3-c,n+2):
    ans=cmb(n+1,k,mod)
    print(ans)

Measured memory_bytes: 64036
object Main extends App {
  val Array(w,h,n) = readLine.split(" ").map{_.toInt}
  val (x,y,a) = (1 to n).map{_ =>
    val Array(x_,y_,a_) = readLine.split(" ").map{_.toInt}
  	(x_,y_,a_)
  }.unzip3
  
  val color = Array.ofDim[Int](w,h)
  
  (0 until n).foreach{idx => a(idx) match {
    case 1 => for(i <- 0 until x(idx); j <- 0 until h) color(i)(j) = 1
    case 2 => for(i <- x(idx) until w; j <- 0 until h) color(i)(j) = 1
    case 3 => for(i <- 0 until w; j <- 0 until y(idx)) color(i)(j) = 1
    case 4 => for(i <- 0 until w; j <- y(idx) until h) color(i)(j) = 1
    case _ => 
  }}
  
  println((0 until w).map{i => color(i).count{_ == 0}}.sum)
}

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


#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl


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

	int t, k; cin >> t >> k;
	int sum = 0;
	for (int i = 0; i < t; ++i)
	{
		int a;
		cin >> a;
		if (a >= k)
		{
			sum++;
		}
	}
	cout << sum << endl;
	return 0;

}

Measured memory_bytes: 3604
n,*a=$<.map &:to_i
mod=10**9+7
res=1
c=[0,0]
a.map.with_index{|x,i|[x,i<n ? 0 : 1]}.sort.each{ |x,i| c[i]>0 ? (res=res*c[i]%mod; c[i]-=1) : c[1-i]+=1 }
p res

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

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

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

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    int s[105];
    for(int i=0;i<n;i++)
        scanf("%d",&s[i]);
    sort(s,s+n);
    int sum=0;
    for(int i=0;i<n;i++)
    {
        sum+=s[i];
    }
    if(sum%10!=0)
        printf("%d",sum);
    else
    {
        for(int i=0;i<n;i++)
        {
            if(s[i]%10!=0)
            {
                sum-=s[i];
                break;
            }
        }
        if(sum%10!=0)
            printf("%d",sum);
        else printf("0");
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
 
using namespace std;
 
int main(void)
{
    string b;
 
    cin >> b;
 
    if(b[0]=='A'){
        cout << 'T' << endl;
    }
    else if(b[0]=='T'){
        cout << 'A' << endl;
    }
    else if(b[0]=='C'){
        cout << 'G' << endl;
    }
    else{
        cout << 'C' << endl;
    }
 
    return 0;
}

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

int main() {
   int N;
   std::cin >> N;
   std::vector<int> L(N);
   int max, sum = 0;
   for (int i = 0; i < N; i++) {
      std::cin >> L.at(i);
      sum += L.at(i);
      if(i > 0 && max < L.at(i)) {
         max = L.at(i);
      } else if(i == 0) {
         max = L.at(i);
      }
   }
   if ((sum - (max * 2)) > 0) {
      std::cout << "Yes" << '\n';
   } else {
      std::cout << "No" << '\n';
   }

}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        char [] app = new char[S.length()];
        char [] down = new char[T.length()];
        int [] anc = new int[S.length()-T.length()];
        
        
        for(int i = 0;i < S.length();i++){
            app[i] = S.charAt(i);
        }
        for(int i = 0;i < T.length();i++){
            down[i] = T.charAt(i);
        }
        if(S.length() == T.length()){
            int count = 0;
          	int Min = 0;
            for(int i = 0;i < T.length();i++){
                if(app[i] != down[i]){
                    count++;
                }
                Min = count;
            }
            System.out.println(Min);
        }else{
            for(int i = 0;i < S.length()-T.length();i++){
                int count = 0;
                for(int l = 0;l < T.length();l++){
                    if(app[i+l] != down[l]){
                        count++;
                    }  
                    anc[i] = count;
                }
            }
            int Min = anc[0];
            for(int i = 1 ; i < anc.length; i++){
                if(Min > anc[i]){
                    Min = anc[i];
                    }
                }
                System.out.println(Min);
        }
    }
}


Measured memory_bytes: 36072
N, K = map(int, input().split())
p = list(map(int, input().split()))

S = [0]
E = []

for i in range(0, N):
    S.append(S[i]+p[i])

for i in range(0, N-K+1):
    E.append(S[i+K]-S[i])


print((max(E)+K)/2)

Measured memory_bytes: 25160
#include <stdio.h>

int binarySearch(int a[],int n,int key){
  int left,right,mid;
  left=0;
  right=n;
  while(left<right){
    mid=(left+right)/2;
    if(a[mid]==key){
      return 1;
    }
    else if(key<a[mid]){
     right=mid;
    }
    else{
      left=mid+1;
    }
  }
  return 0;
}

int main(void)
{
  int i,n,a[1000000],q,key,ans;
  ans=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(binarySearch(a,n,key)){
      ans++;
    }
  }
  printf("%d\n",ans);
  
  return 0;
}

Measured memory_bytes: 2156
#include<stdio.h>
#define PIACE 16
int main() {
  int a, b;
  scanf("%d", &a);
  scanf("%d", &b);
  if (a > PIACE / 2){
    printf(":(\n");
    return 0;
  } else if (b > PIACE / 2) {
    printf(":(\n");
    return 0;
  }
  printf("Yay!\n");
  return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  int H,W,A,B; cin >> H >> W >> A >> B;

  int ans[H][W];

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(i < H-B){
        if(j < A){
          ans[i][j] = 0;
        } else {
          ans[i][j] = 1;
        }
      } else {
        if(j < A){
          ans[i][j] = 1;
        } else {
          ans[i][j] = 0;
        }
      }
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(j==W-1){
        cout << ans[i][j] << endl;
      } else {
        cout << ans[i][j];
      }
    }
  }
}


Measured memory_bytes: 7548
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

vector<int> a;
vector<vector<int>> v;
int n,m,q;
int ans = 0;
void dfs(){
   if (a.size() == n){
      int score = 0;
       for (int i = 0;i < q;i++){
          if (a[v[i][1]-1]-a[v[i][0]-1] == v[i][2]) score+=v[i][3];
       }
       ans = max(ans,score); 
       return;
   }
   int prev_last = (a.empty() ? 1 :a.back());
   for (int i = prev_last;i <= m;i++){
      a.push_back(i);
      dfs();
      a.pop_back();
   }
}
int main(){
   cin >> n >> m >> q;
   v.resize(q,vector<int> (4));
   rep(i,q){
      cin >> v[i][0] >> v[i][1] >> v[i][2] >> v[i][3];
   }
   dfs();
   cout << ans << endl;

   
   return 0;
}



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

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

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

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        s: chars
    }
    let v: Vec<usize> = s.iter().rev().map(|c| c.to_digit(10).unwrap() as usize).collect();
    let mut rs = vec![0; 2019];
    rs[0] = 1;
    let mut ans = 0;
    let mut r = 0;
    for i in 0..s.len() {
        r = (r + v[i] * pow_m(10, i, 2019)) % 2019;
        ans += rs[r];
        rs[r] += 1;
    }
    println!("{}", ans);
}

fn pow_m(n: usize, mut p: usize, d: usize) -> usize {
    let mut r = n;
    let mut ret = 1;
    while p > 0 {
        if p % 2 == 0 {
            r = r * r % d;
            p /= 2;
        } else {
            ret = ret * r % d;
            p -= 1;
        }
    }
    ret
}


Measured memory_bytes: 4204
from typing import List


def five_variables(xs: List[int]) -> int:
    i = 0
    for i, x in enumerate(xs):
        if x == 0:
            return i + 1
    raise Exception("Unexpected")


if __name__ == "__main__":
    xs = map(int, input().split())
    ans = five_variables(xs)
    print(ans)


Measured memory_bytes: 10264
import sys
def input(): return sys.stdin.readline().rstrip()
 
def main():
    n=int(input())
    c=list(input())
    hidari=0
    migi=n-1
    ans=0
    while True:
        while c[hidari] != 'W':
            hidari +=1
            if hidari == migi:
                break
        while c[migi] != 'R':
            migi -=1
            if hidari == migi:
                break
        if hidari == migi:
            break
        ans +=1
        hidari +=1
        if hidari == migi:
                break
        migi -=1
        if hidari == migi:
            break
    print(ans)

        
if __name__=='__main__':
    main()

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

using namespace std;

int main(void) {
  string s;
  cin >> s;
  int l = s.length();
  if (l < 5) {
    cout << "NO" << endl;
    return 0;
  }

  int i = 0;
  string st;
  while(l != i) {
    st = s.substr(i, 5);
    if (st == "dream") {
      if (s.substr(i, 7) == "dreamer") {
        if (s.substr(i+5, 5) == "erase") {
          i += 5;
        } else {
          i += 7;
        }
      } else {
        i += 5;
      }
    } else if (st == "erase"){
      if (s.substr(i, 6) == "eraser") {
        i += 6;
      } else {
        i += 5;
      }
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

ll N,A,B,C,D;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N>>A>>B>>C>>D;
    
    rep(i,N){
        ll hig=A+D*i-C*(N-1-i);
        ll low=A+C*i-D*(N-1-i);
        if(hig>=B&&low<=B){
            cout1("YES");
            return 0;
        }
    }
    cout1("NO");
}

Measured memory_bytes: 256
package main
 
import (
	"fmt"
)
 
func main() {
  var s string
  fmt.Scanf("%s", &s)

  ans := "Yes"
  if s[2:3] != s[3:4] {
    ans = "No"
  }
  if s[4:5] != s[5:6] {
    ans = "No"
  }
  
  fmt.Printf("%s\n", ans)
}

Measured memory_bytes: 1836
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
    for (int i = 0; i < 1001; i++) {
      if (a <= k*i && k*i <= b) {
        System.out.println("OK");
        break;
      }
      if (i == 1000) {
        System.out.println("NG");
      }
    }
  }
}


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


public class Main{
    public static void main(String[] args){
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a<b){
            for(int i=0;i<b;i++){
                out.print(a);
            }
        }
        else{
            for(int i=0;i<a;i++){
                out.print(b);
            }
        }


        // out.println(result);
        out.flush();
    }
        
}



class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 21972
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>
#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
//const ll mod = 1000000007LL;
const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222



ll a[MAX];


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


  double x = 1;
  cin >> n;
  rep(i, n) cin >> a[i];
  rep(i, n) x *= a[i];
  double y = 0;
  rep(i, n) y += x / a[i];
  cout << double(x) / y << endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
 
using namespace std;
 
int main(){
    int a, b, c, K;
    cin >> a >> b >> c;
    cin >> K;
    if (a == max({a, b, c})){
        cout << (b+c+(a*pow(2, K))) << endl;
    }else if (b == max({a, b, c})){
        cout << (a+c+(b*pow(2, K))) << endl;
    }else {
    cout << (a+b+(c*pow(2, K))) << endl;
    }
}

Measured memory_bytes: 256
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define f(i,a,b) for(int i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

#pragma endregion 

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

	st s;
	cin >> s;
	int p = 0, myp = 0;
	f(i, 0, size(s)) {
		if (s[i] == 'p') {
			p++;
		}
	}
	myp = size(s) / 2;
	cout << myp - p;
	return 0;
}

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

using namespace std;
using ll = long long int;
#define vll vector<ll>

#define FOR(i, b, e) for(int i = (b); i < (e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define REV(v) reverse((v).begin(), (v).end())
#define IN(v) cin >> (v);
#define VIN(v, n) REP(i, n) cin >> v[i];
#define OUT(v) cout << (v) << endl;
#define YN(b) OUT((b) ? "YES" : "NO")
#define Yn(b) OUT((b) ? "Yes" : "No")
#define yn(b) OUT((b) ? "yes" : "no")

const ll MOD = 1000000007;

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

  string s;
  cin >> s;
  if (s[0] == '7' || s[1] == '7' || s[2] == '7') cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static long Solve(string A)
        {
            var memo = new long[26];
            foreach (char a in A) { ++memo[a - 'a']; }
            int len = A.Length;
            long sum = 1;
            foreach (char a in A)
            {
                --len;
                --memo[a - 'a'];
                sum += len - memo[a - 'a'];
            }
            return sum;
        }
        static void Main(string[] args)
        {
            Console.WriteLine(Solve(Read()));
        }
    }
}


Measured memory_bytes: 13664
#include <iostream>
using namespace std;
int main()
{
	int a, b, c, d, e, k = 0;
	cin >> a >> b >> c >> d >> e >> k;
	if ((e - a) > k)
	{
		cout << ":(" << endl;
	}
	else
	{
		cout << "Yay!" << endl;
	}
	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++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int n;
    cin >> n;
    int a;
    int ans = 0;
    rep(i,n){
        cin >> a;
        if(i%2 == 1) continue;
        if(a%2 == 1){
            ans++;
        }
    } 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3564
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
typedef pair<int, int> P;
signed main() {
	string s; cin >> s;
	
	if (s.size()<=9) {
		for (int i = 0; i < 1 << (s.size()+1); i++) {
			string res;
			rep(j, s.size()+1) {
				if (i&(1 << j))res.push_back('A');
				if (j < s.size())res.push_back(s[j]);
			}
			if (res == "AKIHABARA") {
				puts("YES");
				return 0;
			}
		}
	}
	puts("NO");
}

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

typedef long long ll;
typedef long double ld;
#define endl "\n"
#define deb(x) cerr << #x << ":" << x << "\n"

int main()
{

    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t = 1;
    // cin >> t;
    while (t--)
    {
        ll n, m, i, j, k = 0;
        cin >> n;
        string s;
        map<string, ll> M;
        for (i = 0; i < n; i++)
        {
            cin >> s;
            M[s]++;
            k = max(k, M[s]);
        }
        for (auto x : M)
        {
            if (x.second == k)
            {
                cout << x.first << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 23808