akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var A = cin.ReadIntArray(N);
            var ans = A.Select(a => (double)1 / a).ToArray();
            WriteLine((double)1 / ans.Sum());
        }

        public long C(int X, int Y)
        {

            if (Y == 0 || Y == X)
            {
                return 1;
            }
            if (X < Y)
            {
                return 0;
            }
            var Pascal = new long[X + 1, X + 1];
            for (int i = 0; i <= X; i++)
            {
                Pascal[i, 0] = 1L;
                Pascal[i, i] = 1L;
            }
            for (int i = 2; i <= X; i++)
            {
                for (int j = 1; j < i; j++)
                {
                    Pascal[i, j] = Pascal[i - 1, j] + Pascal[i - 1, j - 1];
                }
            }
            return Pascal[X, Y];
        }

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


Measured memory_bytes: 13524
#include <iostream>
#include <algorithm>
#include <iterator>

using namespace std;


int main()
{
    int a[3];
    cin >> a[0] >> a[1] >> a[2];

    sort(a, a+3);

    ostream_iterator<int> out (cout, " ");
    copy(a, a+2, out);
    cout << a[2] << endl;
}


Measured memory_bytes: 3080
import copy
x=int(input())
y=list(map(int, input().split()))
z=copy.deepcopy(y)
y.sort()
n=[0]*(len(y)+1)
t=0
ans=0
for i in range(len(y)):
	t=y[i]
	n[t]=n[t]+1

for i in range(len(n)):
	ans=ans+((n[i]*(n[i]-1))//2)

for i in range (len(z)):
	t=z[i]
	k=n[t]
	print(ans-((k*(k-1))//2)+(((k-1)*(k-2))//2))

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

#define OUT(x)  cerr << #x << " = " << x << endl;
#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define pll     pair<long long, long long>
#define ll      long long

//long long extgcd(long long a, long long b, long long& x, long long& y) { //拡張gcdによる逆元
//        long long d = a;
//        if (b != 0) {
//                d = extgcd(b, a % b, y, x);
//                y -= (a / b) * x;
//        } else {
//                x = 1;
//                y = 0;
//        }
//        return d;
//}
//long long inv(long long a) {
//        long long x, y;
//        extgcd(a, MOD, x, y);
//        return (x % MOD + MOD) % MOD;
//}
//long long inv(long long a) { //フェルマーの小定理と繰り返し2乗法による逆元
//        long long res = 1;
//        long long n = MOD - 2;
//        while (n > 0) {
//                if (n & 1) res = res * a % MOD;
//                a = a * a % MOD;
//                n >>= 1;
//        }
//        return res;
//}
//
//long long nCr(long long n, long long r) {
//        if (n < r) return 0;
//        if (n - r < r) r = n - r;
//        long long ret = 1;
//        for (int i = 0; i < r; i ++) {
//                ret = ret * n % MOD;
//                n --;
//                ret = ret * inv(i + 1) % MOD;
//        }
//        return ret;
//}
long long fact[202020];
long long nCr(long long n, long long r){
        long long ans = fact[n];
        ans /= fact[r] * fact[n - r];
        return ans;
}

//long long nHr(long long n, long long r) { //n個のものから重複を許してr個をとる場合の数
//        return nCr(n + r - 1, r);
//}

void init() {
        fact[0] = 1;
        for (int i = 1; i < 202020; i ++) fact[i] = fact[i - 1] * i;
}

int main() {
        init();
        string s;
        cin >> s;
        vector<long long> cnt(26, 0);
        long long n = s.size();
        for (int i = 0; i < n; i ++) {
                cnt[s[i] - 'a'] ++;
        }
        long long ans = 1;
        ans += n * (n - 1) / 2;
        for (int i = 0; i < 26; i ++) {
                if (cnt[i] < 2) continue;
                ans -= cnt[i] * (cnt[i] - 1) / 2;
        }
        cout << ans << endl;
        return 0;
}



Measured memory_bytes: 2180
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int x,n;
  cin>>x>>n;
  vector<int>d(102);
  rep(i,n){
    int p;
    cin>>p;
    d[p]++;
  }
  P ans(99999,-1);
  for(int i=0;i<=101;i++){
    if(d[i]) continue;
    ans=min(ans,P(abs(x-i),i));
  }
  cout<<ans.sc<<endl;
}

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

#define ll long long
#define ld long double
#define db double
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
#define tc int tt=1;cin>>tt;while(tt--)

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr<<name<<" : "<<arg1<<nl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const ld pi=2*acos(0.0);

int main(){
    nimble
    int a,b;
    cin>>a>>b;
    a=a*b;
    cout<<a;
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		if (n == m) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
}

Measured memory_bytes: 35724
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            // in
            int x = Integer.parseInt(sc.next());
            int y = Integer.parseInt(sc.next());

            if (y % 2 == 0 && 2*x <= y && y <= 4*x) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}


Measured memory_bytes: 35748
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n;
	cin >> n;
	vector<int>l(n);
	rep(i, n) {
		cin >> l[i];
	}
	sort(l.begin(), l.end());
	int ans = 0;
	rep(i, n) {
		FOR(j,i+1, n) {
			FOR(k,j+1 ,n) {
				if(l[i] == l[j])continue;
				if(l[j] == l[k])continue;
				if(l[k] == l[i])continue;
				if (l[i] + l[j] > l[k])ans++;
			}
		}
	}
	print(ans);
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
void YN(bool ans){
    if(ans)cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
    return;
}

int main(){
    ll N;
    cin>>N;
    ll m = 0;
    bool ans = false;
    rep(i,0,N){
        ll a,b;
        cin>>a>>b;
        if(a==b)m++;
        else m=0;
        if(m==3)ans = true;
    }

    YN(ans);
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int m = 0;
		while (sc.hasNext()) {
			m++;
			int n = sc.nextInt();
			double[] x = new double[51];
			double[] y = new double[51];
			if (n == 0) {
				break;
			}
			for (int i = 0; i < n; i++) {
				x[i] = sc.nextDouble();
				y[i] = sc.nextDouble();
			}
			double s = x[0] * y[n - 1] - x[n - 1] * y[0];
			for (int i = 0; i < n - 1; i++) {
				s += x[i + 1] * y[i] - x[i] * y[i + 1];
			}
			System.out.printf("%d %.1f", m, s / 2);
			System.out.println();
		}
	}
}

Measured memory_bytes: 23260
import java.util.Scanner;

class Main{
	
	static int top;
	static int [] stack = new int[1000];
  
	static void push(int x){
		stack[++top] = x;
	}

	static int pop(){
		top--;
		return stack[top + 1];
	}
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s;
		int a,b;
		top = 0;
		while(sc.hasNext()){ 
            		s = sc.next();
            		if(s.equals("+")){
                		a = pop();
                		b = pop();
                		push(a + b);
            		}
            		else if(s.equals("-")){
                		a = pop();
                		b = pop();
                		push(b - a);
            		}
            		else if(s.equals("*")){
                		a = pop();
                		b = pop();
                		push(a * b);
            		}
            		else{
                		push(Integer.parseInt(s));	
            		}
		}

		System.out.println(pop());
	}
}

Measured memory_bytes: 26188
// AOJ DPL_1_H Huge Knapsack Problem
// 2018.5.11 bal4u
 
#include <stdio.h>
#include <stdlib.h>

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

long long inLL()
{
    long long n = 0, c = gc();
    do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
    return n;
}

#define MAX  ((1<<20)+5)

typedef struct { long long v, w; } TBL;
TBL a[42]; int c;
TBL a1[MAX]; int c1, c2;

long long binarysearch_upper(long long x)
{
	int m, l = 0, r = c2;

    while (l < r) {
        m = (l+r) >> 1;
		if (a1[m].w == x) return a1[m].v;
		if (a1[m].w < x) l = m + 1; else r = m;
    }
	if (!l) l = 1;
	return a1[l-1].v;
}

int cmp(TBL *a, TBL *b)
{
	if (a->w == b->w) {
		if (a->v > b->v) return -1;
		return (a->v < b->v);
	}
	if (a->w < b->w) return -1;
	return (a->w > b->w);
}

int main()
{
	int N, i, j, m1, m2, lim;
	long long W, x, y, t, ans;

	N = in(), W = inLL();

	c = 0; for (i = 0; i < N; i++) {
		a[c].v = inLL(), a[c].w = inLL();
		if (a[c].w <= W) c++;
	}

	m1 = c / 2, lim = 1 << m1;
	c1 = 0; for (i = 0; i < lim; i++) {
		x = 0, y = 0;
		for (j = 0; ; j++) {
			if (j == m1) {
				a1[c1].v = x, a1[c1++].w = y;
				break;
			}
			if ((i >> j) & 1) {
				if ((y += a[j].w) > W) break;
				x += a[j].v;
			}
		}
	}

	qsort(a1, c1, sizeof(TBL), cmp);

	c2 = 1;
	for (i = 1; i < c1; i++) {
		if (a1[c2-1].v < a1[i].v) a1[c2++] = a1[i];
	}

	ans = 0;
	m2 = c - m1, lim = 1 << m2;
	for (i = 0; i < lim; i++) {
		x = 0, y = 0;
		for (j = 0; ; j++) {
			if (j == m2) {
				t = x + binarysearch_upper(W-y);
				if (t > ans) ans = t;
				break;
			}
			if ((i >> j) & 1) {
				if ((y += a[m1+j].w) > W) break;
				x += a[m1+j].v;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int cnt[4] = {0, 0, 0, 0};
    inc(i, 0, 3){
        int a, b;cin >> a >> b;a--;b--;
        cnt[a]++;
        cnt[b]++;
    }
    string ans = "YES";
    inc(i, 0, 4){
        if(cnt[i] > 2) ans = "NO";
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    int n, m, t; cin >> n >> m >> t;
    int a[n]; rep(i, n) cin >> a[i];
    int now = a[0];
    int sum = max(0, a[0] - m);
    rep3(i, 1, n) { //一旦帰るかそのままいとくか
        if (2 * m <= a[i] - now) { //帰った方がいい
            sum += a[i] - now - 2 * m;
        }
        now = a[i];
    }
    sum += max(0, t - now - m);
    out(sum);
}



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

using namespace std;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int ans = max({a,b,c});
  if((ans + a + b + c) % 2 != 0) ans++;
  cout << (3 * ans - a - b - c) / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define P 1000000007
#define inf 1e18
int main()
{
    string s;
    cin >> s;
    ll n = s.length();

    vector<ll> v;
    for (ll i = 0; i < s.length(); i++)
    {
        if (s[i] == 'W')
            v.push_back(i + 1);
    }

    ll k = (v.size() * (v.size() + 1)) / 2;
    for (ll i = 0; i < v.size(); i++)
        k = k - v[i];

    cout << -1 * k << "\n";

    return (0);
}


Measured memory_bytes: 5456
import java.io.IOException;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {
        // write your code here
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i += 2) {
            sb.append(s.charAt(i));
        }
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 26180
N,D=map(int, input().split())
X=list(list(map(int, input().split())) for _ in range(N))
import itertools
import math
tmp=0
ans=0
for x1,x2 in list(itertools.combinations(X,2)):
    for d in range(D):
        tmp+=(x1[d]-x2[d])**2
    tmp=math.sqrt(tmp)
    tmp1=math.ceil(tmp)
    if tmp==tmp1:
        ans+=1
    tmp=0
print(ans)

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

int main() {

    int N;
    cin >> N;
    string s[N];
    rep(i, N) cin >> s[i];

    int M;
    cin >> M;
    string t[M];
    rep(i, M) cin >> t[i];

    map<string, int> m;
    rep(i,N) {
        m[s[i]] = 0;
    }

    rep(i,N) {
        m[s[i]] += 1;
    }

    rep(i,M) {
        m[t[i]] -= 1;
    }

    int ma = 0;

    for (auto kv : m) {
        ma = max(ma, kv.second);
    }

    cout << ma << endl;



    return 0;
}

Measured memory_bytes: 3616
# -*- coding: utf-8 -*-

# 桁数
N = int(input())
# 文字列
S = input()

max_v = 0
for i in range(1,N):
    sXY = set(list(''.join(list(S[:i])))) & set(list(''.join(list(S[i:]))))
    if max_v < len(sXY):
    	max_v = len(sXY)

print(max_v)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	int k;
	cin>>a>>b>>c;
	cin>>k;
	if(a>=b&&a>=c){
		for(int i=1;i<=k;i++){
			a=a*2;
		}
	}
	if(b>=a&&b>=c){
		for(int i=1;i<=k;i++){
			b=b*2;
		}
	}
	if(c>=b&&c>=a){
		for(int i=1;i<=k;i++){
			c=c*2;
		}
	}
	int sum;
	sum=a+b+c;
	cout<<sum;
}

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

void Main()
{
    long n;
    cin >> n;

    long sum = 0;
    for (int i = 1; i <= n; i++)
    {
        sum += (n/i)*(n/i+1)/2 * i;
    }
    
    cout << sum << endl;
}

// 1 1
// 2 1 2
// 3 1   3
// 4 1 2   4
// 5 1       5
// 6 1 2 3     6
// 7 1           7
// 8 1 2   4       8
// 9 1   3           9


int main(int argc, char **argv)
{
    Main();
    return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define ll long long
#define pi acos(-1)
using namespace std;
vector<int>G[200005];

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=2;i<=n;i++)
    {
        int x;
        scanf("%d",&x);
        G[i].push_back(x);
        G[x].push_back(i);
    }
    for(int i=1;i<=n;i++)
    {
        if(i==1)printf("%d\n",G[i].size());
        else printf("%d\n",G[i].size()-1);
    }
//    int T;
//    scanf("%d",&T);
//    while(T--)
//    {
//        int n;
//        scanf("%d",&n);
//        for(int i=1;i<=n;i++)
//        {
//            scanf("%d",&a[i]);
//        }
//    }
}


Measured memory_bytes: 15180
#include <iostream>
#include <algorithm>
using namespace std;
#define MAX 100001

int N, K;
long int h[MAX];

int main(){
    cin >> N >> K;
    for (int i = 0; i < N; i++){
        cin >> h[i];
    }
    // sort
    sort(h, h + N);
    // for (int i = 0; i < N; i++){
    //     cout << h[i];
    // }

    int left = 0;
    int right = K -1 ;
    long int distance = 10000000001;
    while(right < N){
        if (distance > h[right] - h[left]){
            distance = h[right] - h[left];
        }
        right ++;
        left ++;
    }
    cout << distance << endl;
    return 0;
}

Measured memory_bytes: 1024
// G++ MACRO.CPP -STD=C++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template <class T = ll>
T IN(){T x;cin>>x;return (x);}

template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}

template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}

#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int

#define P pair<int,int>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>

#define pb(a) push_back(a)
#define mp make_pair


int main(){

  //n^m通りのパターンがある
  //m-1個分の比較パートがある
  //重なり合うパターンは、(m-1) * ((n-d) + (n-d));
  LCIN(n,m,d);
  //各i<mごとに、確率は(n - d) / (n * 2)
  double pat = double(m-1) * double((n-d) + (d == 0 ? 0 : (n-d))) / double(n*n);
  printf("%.15lf\n", pat);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#include <set>
#include <climits>
#include <bitset>

#define mod 1e9+7
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
using ll = long long;
using pii = pair<int, int>;

 
int main(){
	int N;
	string S, T;
	cin >> N >> S >> T;
	rep(i, N){
		cout << S[i] << T[i];
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int A[50];

int fib(int n){
  if(n==0 || n==1){
    return A[n]=1;
  }
  if(A[n]!=-1){
    return A[n];
  }
  return A[n]=fib(n-1)+fib(n-2);
}

int main(){
  int n,i;
  for(i=0;i<50;i++){
    A[i]=-1;
  }

  scanf("%d",&n);
  printf("%d\n",fib(n));
  return 0;
}



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

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

    if (a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }

    return 0;
}

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

int main(){

    int n, m; cin >> n >> m;
    vector<bool> used(n+1, false);
    vector<int> e(m);
    for(int i = 0; i < m; i++){
        cin >> e[i];
    }

    reverse(e.begin(), e.end());
    for(int i = 0; i < m; i++){
        if(used[e[i]] == false){
            cout << e[i] << endl;
            used[e[i]] = true;
        }
    }

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


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

const ll maxs = 1e5+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

void pre(){

}

void solve(){ 
   ll n , k;
   cin >> n >> k;
   ll pre=0,suf=0;
   ll ans=0;
   for(ll i=0;i<n+1;i++){
       pre += i;
       suf += n-i;
       if(i+1 >= k){
           ans += suf-pre+1;
           ans %= mod;
       }
   }
   cout << ans << endl;
}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;   
    //cin>>T;
    while(T--){  
        solve();
    }
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;
#define ALL(x)			(x).begin(),(x).end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF				(int)2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)	((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define M_PI			3.14159265358979323846
typedef long long		ll;
typedef pair<ll, ll>	P;
typedef vector<ll>		VLL;
typedef vector<VLL>		VVLL;
typedef vector<VVLL>	VVVLL;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	string a, b;
	cin >> a >> b;
	int val = stoi(a + b);
	string ans = "No";
	REP(i, 1000) {
		if (i * i == val) {
			ans = "Yes";
		}
	}
	cout << ans << 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 repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc178/abc178_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint fact[1000010];
mint invfact[1000010];

mint comb(int n, int p) { 
  mint ret = fact[n] * invfact[p];
  ret = ret * invfact[n - p];
  return ret;
}

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  if (N == 1) {
    cout << 0 << endl;
    return 0;
  }

  // 階乗テーブルの初期化
  fact[0] = 1;
  invfact[0] = 1;
  repi(i, 1, N + 1) {
    fact[i] = fact[i - 1] * i;
    mint mi = i;
    invfact[i] = invfact[i - 1] * mi.pow(MOD - 2);
  }

  mint ans = 0;
  repi(i, 2, N + 1) {
    mint tmp = comb(N, i);
    tmp *= mint(2).pow(i) - 2;
    tmp *= mint(8).pow(N - i);
    ans += tmp;
  }

  cout << ans << endl;
}

Measured memory_bytes: 19276
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long A[] = new long[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
		}
		int countMinus = 0;
		for (int i = 0; i < N; i++) {
			if (A[i] < 0) {
				countMinus++;
			}
		}
		long sum = 0;
		long min = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			long abs = Math.abs(A[i]);
			if (abs < min) {
				min = abs;
			}
			sum +=abs;
		}
		if (countMinus%2==1) {
			sum -=min*2;
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 49724
fun main(args: Array<String>) {
    val s = readLine()!!
    var max=0
    var count=0
    s.forEach {
        if(it=='A'||it=='T'||it=='G'||it=='C'){
            count+=1
            if(max<count)max=count
        } else count=0
    }
    print(max)
}

Measured memory_bytes: 33792
mondai, kaitou = map(int, input().split())

# 問題ごとのクリア管理
clearNo = [0] * (mondai+1)
# 問題ごとのWrong
wrong = [0] * (mondai+1)
cleard = 0
pena = 0
# 解答数分繰り返す
kaitous = [input().split() for _ in range(kaitou)]
for i in kaitous:
    qNo = int(i[0])
    result = i[1]
    if clearNo[qNo] == 1:
        continue
    else:
        if result == 'WA':
            wrong[qNo] += 1
        else:
            clearNo[qNo] = 1
            cleard += 1
            pena += wrong[qNo]

print(str(cleard) + ' ' + str(pena))


Measured memory_bytes: 70700
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>

using namespace std;

int main(void)
{
    long long N, a[100001], i, sum[100010], max=0;

    cin >> N;

    for(i=0; i<=100009; i++){
        sum[i] = 0;
    }

    for(i=1; i<=N; i++){
        cin >> a[i];
    }

    for(i=1; i<=N; i++){
        if(a[i] > 0){
            sum[a[i]-1]++;
        }
        sum[a[i]]++;
        sum[a[i]+1]++;
    }

    for(i=0; i<=100000; i++){
        if(sum[i] > max){
            max = sum[i];
        }
    }

    cout << max << endl;

    return 0;
}

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

int n, q; 
ll score[200010];

vector<vector<ll>> g(200010);

void dfs(int i, int p) {
    for (ll x:g[i]) {
        if (x == p) continue;
        score[x] += score[i];
        dfs(x,i);
    }
}

int main() {
    cin >> n >> q;
    rep(i, n-1) {
       int a, b; cin >> a >> b;
       g[a-1].push_back(b-1);
       g[b-1].push_back(a-1);
    }
    rep(i,q) {
        int p, q; cin >> p >> q;
        score[p-1] += q;
    }
    dfs(0,0);
    rep(i,n) {
        cout << score[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 28312
def main(argv)
  n = gets.chomp.to_i
  a = gets.chomp.split(' ').map(&:to_i)
  
  s = a.map{|x| 1.0 / x.to_f}.reduce(:+)
  puts (1.0 / s).to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

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

const int mod = 1e9 + 7;

//繰り返し自乗法(modあり)
ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M);
}

int main() {
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  ll sum = n * (n + 1) / 2;
  for (ll i = k; i <= n +1; i++){
    if(i == 1) {
      ans += n + 1;
      ans %= mod;
    }else if(i == n+1){
      ans += 1;
      ans %= mod;
    }else {
      ll num1 = (i - 1) * i / 2;
      ll num2 = sum - ((n - i) * (n - i + 1) / 2) ;
      ll plus = num2 - num1 + 1;
      ans += plus;
      ans %= mod;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3588
n=int(input())
da=list(map(int,input().split()))
sum=[0 for i in range(2001)]
ans=0
da=sorted(da)
for i in range(n):
    for j in range(2001):
        if j > da[i]:
            ans+=sum[j]
    for j in range(i):
        sum[da[i]+da[j]]+=1
print(ans)

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

using namespace std;
const int INF=1e9+5;
const int MOD=1e9+7;
typedef long long ll;
//#define M_PI;

int main(){
	int T;
	cin>>T;
	double dd=2*M_PI*T;
	cout<<dd<<endl;
}

Measured memory_bytes: 3780
import sys
from pprint import pprint

def solve(n, tasks):
    tasks.sort()
    #pprint(tasks)
    spent = 0
    for limit, time in tasks:
        spent += time
        if spent > limit:
            return 'No'

    return 'Yes'

if __name__ == '__main__':

    tasks = []
    n = int(sys.stdin.readline().strip())
    for _ in range(n):
        a, b = map(int, sys.stdin.readline().strip().split(" "))
        tasks.append((b, a))

    print solve(n, tasks)

Measured memory_bytes: 33280
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <math.h> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int main(){
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    char x,y;
    cin >> x >> y;
    string res;

    if(x > y)
    {
        res = ">";
    }
    else if(x < y)
    {
        res = "<";
    }
    else
    {
        res = "=";
    }

    cout << res << endl;
    return 0;    

}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int t[10];
int main(){
  for(int i=0;i<10;i++)cin>>t[i];
  sort(t,t+10);
  for(int i=9;i>=7;i--)cout<<t[i]<<endl;
  
  return 0;
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

int main() {
	int n, k,sum=0;
	cin >> n >> k;
	vi v(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	sort(v.begin(),v.end(),greater<int>());
	for (int i = 0; i < k; i++) {
		sum += v[i];
	}
	cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
     
    using namespace std;
     
    typedef long long ll;
     
    int n1 = 0, n2 = 0, n = 0, s1[200], s2[200];
     
    void work(ll N) {
    	if(N == 1) return;
    	work(N >> 1);
    	s2[++n2] = ++n;
    	if(N & 1) s1[++n1] = ++n;
    }
     
    int main() {
    	ll N; scanf("%lld", &N); work(++N);
    	printf("%d\n", n << 1);
    	for(int i = 1; i <= n; i++) printf("%d ", i);
    	for(int i = n1; i >= 1; i--) printf("%d ", s1[i]);
    	for(int i = 1; i <= n2; i++) printf("%d ", s2[i]);
    	puts("");
    	return 0;
    }

Measured memory_bytes: 256
/*
asnasncsja
asncansca
ascnasncaks
sacnjsc
*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <cstring>
#include <string>
#include <bitset>
#include <stack>
#include <set>
#include <map>
#include <list>
using namespace std;
#define e exp(1.0)
typedef long long ll;
#define MAXN 100005
#define mod 998244353
#define INF 0x3f3f3f3f
#define fe(i,st,en) for(i = (st);i <= (en);++i)
#define fne(i,st,en) for(i = (st);i < (en);++i)
#define ri register int
#define db double
int p[25], a[25];
int gcd(int x, int y) {
	return y == 0 ? x : gcd(y, x%y);
}
int main() {
	p[0] = 1;
	for (int i = 1; i <= 20; ++i) p[i] = p[i - 1] << 1;
	int n, k;
	cin >> n >> k;
	double ans = 0;
	for (int i = 1; i <= n; ++i) {
		int t = i, c = 0;
		while (t < k) t *= 2, ++c;
		++a[c];
	}
	int u = -1;
	for (int i = 1; i <= 20; ++i) {
		if (a[i]) {
			a[i] += a[i - 1] * 2;
			u = i;
		}
	}
	if (u != -1) {
		int x = a[u], y = p[u];
		while (x % 2 == 0 && y % 2 == 0) x /= 2, y /= 2;
		printf("%.15lf\n", 1.0*x/((ll)y*n));
	}
	else {
		cout << 1.0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

int main() {
	int n, m = 0, i, j;
	long long int ans;
	scanf("%d", &n);
	char s[n][10];
	for (i = 0; i < n; i++) {
		scanf("%s", s[i]);
	}
	long long int a[5]; // MARCHの数
	for (i = 0; i < 5; i++) {
		a[i] = 0;
	}
	for (i = 0; i < n; i++) {
		if (s[i][0] == 'M') a[0]++;
		else if (s[i][0] == 'A') a[1]++;
		else if (s[i][0] == 'R') a[2]++;
		else if (s[i][0] == 'C') a[3]++;
		else if (s[i][0] == 'H') a[4]++;
	}
	ans = a[0]*a[1]*a[2] + a[0]*a[1]*a[3] + a[0]*a[1]*a[4] + a[0]*a[2]*a[3] + a[0]*a[2]*a[4] + a[0]*a[3]*a[4] + a[1]*a[2]*a[3] + a[1]*a[2]*a[4] + a[1]*a[3]*a[4] + a[2]*a[3]*a[4];
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define MOD 998244353

using namespace std;

typedef long long ll;

ll pow_mod(ll x,int k) {
  ll ans=1;
  while (k) {
  	if (k&1) ans=ans*x%MOD;
  	x=x*x%MOD;
  	k>>=1;
  }
  return ans;
} 

const int Maxn=20000000;

int facd[Maxn+5],facv[Maxn+5];

void pre(int n) {
  facd[0]=1;
  for(int i=1;i<=n;i++) facd[i]=(ll)facd[i-1]*i%MOD;
  facv[n]=pow_mod(facd[n],MOD-2);
  for(int i=n-1;i>=0;i--) facv[i]=(ll)facv[i+1]*(i+1)%MOD;
}

inline ll C(int n,int m) {
  return (n<m)?0:(ll)facd[n]*facv[m]%MOD*facv[n-m]%MOD;
}

int main() {
  int n,A,B;
  scanf("%d%d%d",&n,&A,&B);
  if (!A) {
  	puts("1");
  	return 0;
  }
  pre(2*n);
  int ans=0;
  for(int i=0;i<=A&&i+B<n;i++) {
  	int t=n-B-i;
    ans=(ans+(C(i+B-1,B-1)-C(i+B-1,B))*C(A-i+t-1,t-1))%MOD;
  }
  if (A+B==n) ans=(ans+C(A+B-1,B-1)-C(A+B-1,B))%MOD;
  printf("%d\n",(ans+MOD)%MOD);
  return 0;
}

Measured memory_bytes: 156544
#include <iomanip>
#include <string>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main() {
	long long int a, b;
	string s[100000];
	cin >> a >> b;
	for (int i = 0; i < a;i++) {
		cin >> s[i];
	}
	for (int i = 0; i < a; i++) {
		cout << s[i] << endl;
		cout << s[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
int main(void)
{
	char S[4];
	char A[4] = "SUN";
	char B[4] = "MON";
	char C[4] = "TUE";
	char D[4] = "WED";
	char E[4] = "THU";
	char F[4] = "FRI";
	char G[4] = "SAT";

	scanf("%s", &S);
	if (strcmp(S,A) == 0)
	{
		printf("7");
	}
	else if(strcmp(S, B) == 0)
	{
		printf("6");
	}
	else if (strcmp(S, C) == 0)
	{
		printf("5");
	}
	else if (strcmp(S, D) == 0)
	{
		printf("4");
	}
	else if (strcmp(S, E) == 0)
	{
		printf("3");
	}
	else if (strcmp(S, F) == 0)
	{
		printf("2");
	}
	else if (strcmp(S, G) == 0)
	{
		printf("1");
	}

	return 0;
}

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

int main(){
	int k; cin>>k;
	int cnt=0;
	for(int i=1; i<=k; i++){
		if(i%2==0){ //Even
			for(int j=i+1; j<=k; j++){
				if(j%2!=0) cnt++;
			}
		} else {
			for(int j=i+1; j<=k; j++){
				if(j%2==0) cnt++;
			}
		}
	}
	cout << cnt << endl;	
}

Measured memory_bytes: 256
N = int(input())
S = input()
new_S = ''
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

for s in range (len(S)):
    for i in range(26):
        if (S[s] == alphabet[i]):
            new_S += alphabet[i+N]
            break
print(new_S)

Measured memory_bytes: 3060
def to_number(n):
    res = 0
    for d in n:
        res = res*10 + d
    return res

if __name__ == "__main__":
    while True:
        n = input()
        if n == '0000':
            break
        cnt = 0
        used = set()
        while n != '6174':
            if n in used:
                cnt = 'NA'
                break
            used.add(n)
            n = list(map(int,list(n)))
            n.sort()
            a = to_number(n[::-1])
            b = to_number(n)
            a -= b
            n = str(a)
            while len(n) < 4:
                n = '0'+n
            cnt += 1
        print(cnt)



Measured memory_bytes: 5620
using System;
using System.Collections.Generic;
using System.Text;

namespace ac2
{
    class ac3
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int K = (A + B) / 2 ;
            int X = K /2 % 2;
            if(A%2==0&& B% 2 == 0){

                Console.WriteLine(K);
            }
            else if(A%2 == 1&&B%2  ==1){
                Console.WriteLine(K);

            }
            else { Console.Write("IMPOSSIBLE");
            }

        }
    }
}


Measured memory_bytes: 13140
# -*- coding: utf-8 -*-
import numpy as np

array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print(array[k-1])

Measured memory_bytes: 21552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
const ll mo = 1000000007;
auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };
const ll MAX = 510000;
const ll MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (ll i = 2; i < MAX; i++)
  {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(ll n, ll k)
{
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main()
{
ll n , k ;
cin >> n >> k ;
COMinit();
if(n<k+1)k=n-1;
ans=COM(2*n-1,n-1);
rep(i,n-k-1){
  ll an=COM(n,i+1);
  an=mod(an*COM(n-1,i));
  ans=mod(ans-an);
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 12160
d = [chr(i) for i in range(ord('a'), ord('z') + 1)]
ans = [10 ** 9] * 26
n = int(input())
for i in range(n):
  s = input()
  for j in range(26):
    ans[j] = min(ans[j], s.count(d[j]))
for i in range(26):
  print(d[i] * ans[i], end='')
print('')


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

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

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            String ans = s.charAt(1) == s.charAt(2) ? "Yes" : "No";
            if (ans.equals("Yes")) {
                if (s.charAt(0) == s.charAt(1) || s.charAt(3) == s.charAt(2)) ans = ans;
                else ans = "No";
            }
            out.println(ans);
        }

    }
}



Measured memory_bytes: 23764
N = int(input())


def factorize(n):
    i, factors = 2, []
    while i * i <= n:
        while n % i == 0:
            n //= i
            factors.append(i)
        i += 1
    if n > 1:
        factors.append(n)
    return factors


e = [0] * (N + 1)
for i in range(1, N + 1):
    for s in factorize(i):
        e[s] += 1


def f(n):
    cnt = 0
    for x in e:
        if x >= n - 1:
            cnt += 1
    return cnt


ans = f(75)
ans += f(25) * (f(3) - 1)
ans += f(15) * (f(5) - 1)
ans += f(5) * (f(5) - 1) * (f(3) - 2) // 2
print(ans)

Measured memory_bytes: 3064
#include <iostream>

int main() {
  int N, A, B; std::cin >> N >> A >> B;
  int q1 = 0, q2 = 0, q3 = 0;

  for (int i = 0; i < N; ++i) {
    int p; std::cin >> p;

    if (p <= A) ++q1;
    else if (p >= B+1) ++q3;
    else ++q2;
  }

//  std::cout << q1 << ", " << q2 << ", " << q3 << std::endl;
  std::cout << std::min(q1, std::min(q2, q3)) << std::endl;
}


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

int a[26];

int main()
{
    string s;
    cin >> s;
    rep(i, s.size()) {
        a[s[i] - 'a']++;
    }
    rep(i, 26) {
        if(a[i] == 0) {
            cout << (char) (i + 'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n;
    double ans = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        double x;
        string y;
        cin >> x >> y;
        if(y == "JPY"){
            ans += x;
        }else{
            ans += x * 380000.0;
        }
    }
    cout << fixed << setprecision(5) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define shosu(X) fixed << setprecision(X)
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;}

int main(){
  int n;
  int w[100];
  cin >> n;
  REP(i, n) cin >> w[i];
  int sum = 0;
  REP(i, n) sum += w[i];
  int tmpsum = 0;
  int ans = 1e9;
  REP(i, n-1){
    tmpsum += w[i];
    ans = min(ans, abs((sum - tmpsum) - tmpsum));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main(void){
    int n;cin>>n;
    vector<P>V(n);
    int x;
    rep(i,n){cin>>x;V[i]=make_pair(x,i);}
    sort(all(V),greater<P>());
    rep(i,n){
        if(V[0].S==i)cout<<V[1].F<<endl;
        else cout<<V[0].F<<endl;
    }
}

Measured memory_bytes: 4736