akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define clr(x, y) memset(x, y, sizeof(x))
#define fl(a, b) for(int i=a; i<b; i++)
using namespace std;
typedef long long ll;
const int maxn = 100000 + 5;
const int inf = INT_MAX;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int s = a*100 + 10*b + c;
	if(s%4==0) puts("YES");
	else puts("NO");
}

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

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> b(n);
    for(int i=0; i<n; i++){
        cin >> b[i];
    }

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


    vector<int> ans;

    for(int i=0; i<n; i++){
        int flag = 0;
        for(int j=n-i-1; j>=0; j--){
            if(b[j] == j+1){
                b.erase(b.begin() + j);
                ans.push_back(j+1);
                flag = 1;
                break;
            }
        }

        if(flag == 0){
            cout << -1 << endl;
            return 0;
        }
    }
    for(int i=0; i<n; i++){
        cout << ans[n-1-i] << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
"use strict";

const main = arg => {
    const input = arg.trim().split("\n");

    const [n, m] = input[0].split(" ").map(el => parseInt(el));
    const hs = input[1].split(" ").map(el => parseInt(el));
    hs.unshift(0) // dummy
    let tmp = {}
    for (let i = 2; i < input.length; i++) {
        let [a, b] = input[i].split(" ").map(el => parseInt(el))
        if (!tmp[a]) tmp[a] = {}
        tmp[a][b] = true
        if (!tmp[b]) tmp[b] = {}
        tmp[b][a] = true
    }
    const numIsolated = n - Object.keys(tmp).length
    let num = 0
    for(let i of Object.keys(tmp)){
        const baseHight = hs[i]
        let ret = true
        for(let otherKey of Object.keys(tmp[i])){
            if(baseHight <= hs[otherKey]){
                ret = false
                break
            }
        }
        if(ret){
            num++
        } 
    }
    console.log(num + numIsolated)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 108852
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 100005
#define fi(a, b, c, d) for(int a = b; i < c; i += d)
#define fl(a, b, c, d) for(ll a = b; i < c; i += d)
#define quit exit(0)

ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
set<string> V;
string S = "";
ll ans[MAX_INT];
std::vector<ll> numV;

void rec(string str, int len, int toReach) {
	if(len > toReach) {
		return;
	}
	// str += (str[str.size() - 1]);
	V.insert(str);
	if(str[str.size() - 1] == '0') {
		rec(str + (char)(str[str.size() - 1]), len + 1, toReach);
		rec(str + (char)(str[str.size() - 1] + 1), len + 1, toReach);
	}
	else if(str[str.size() - 1] == '9') {
		rec(str + (char)(str[str.size() - 1]), len + 1, toReach);
		rec(str + (char)(str[str.size() - 1] - 1), len + 1, toReach);
	}
	else {
		rec(str + (char)(str[str.size() - 1]), len + 1, toReach);
		rec(str + (char)(str[str.size() - 1] - 1), len + 1, toReach);
		rec(str + (char)(str[str.size() - 1] + 1), len + 1, toReach);
	}
} 

int main() {
	scanf("%lld", &N);
	for(int i = 1; i <= 9; i++) {
		ans[i] = i;
	}
	for(int i = 1; i <= 9; i++) {
		string st = "";
		st += i + '0';
		int toReach;
		if(i <= 3) {
			toReach = 10;
		}
		else {
			toReach = 9;
		}
		rec(st, 1, toReach);
	}
	// cout << V.size() << " \n";
	for(auto x: V) {
		stringstream ss(x);
		ll temp;
		ss >> temp;
		numV.push_back(temp);	
	}
	sort(all(numV));
	// for(auto y : numV) {
	// 	cout << y << "  ";
	// }
	cout << numV[N - 1] << " ";
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 13568
// https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_a
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    if (N % 2 == 0) {
        N--;
    }
    cout << N / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
import sys, math, collections, heapq, itertools
from bisect import bisect_left
  
def solve():
    file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
    INF = 10 ** 25
    mod = 7 + 10 ** 9
    N = int(file())
    A = [int(a) for a in file().split()]
    A.sort()
    ans = 0
    out = []
    if N == 2:
        ans = A[1] - A[0]
        out = [[A[1], A[0]]]
    else:
        plus = bisect_left(A, 0)
        if plus == 0:
            ans = A[0]
            for i in range(1, N-1):
                out.append([ans, A[i]])
                ans -= A[i]
            out.append([A[N-1], ans])
            ans = A[N-1] - ans
        elif plus < N:
            ans = A[0]
            for i in range(plus, N - 1):
                out.append([ans, A[i]])
                ans -= A[i]
            out.append([A[N-1], ans])
            ans = A[N-1] - ans
            for i in range(1, plus):
                out.append([ans, A[i]])
                ans -= A[i]
        else:
            ans = A[N-1]
            for i in range(N-1):
                out.append([ans, A[i]])
                ans -= A[i]

    print(ans)
    for k in out:
        print(" ".join(map(str, k)))


    return 0
  
if __name__ == "__main__":
    solve()

Measured memory_bytes: 22740
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;
typedef pair<int, char> ICpair;

int N;

string S;

int main() {
	ios_base::sync_with_stdio(false);
	cin >> N;
	cin >> S;
	int sum = 0;
	ffor (i, 1, N)
		if (S[i] == 'E')
			sum++;
	int ret = 1 << 20;
	FOR (l, N) {
		ret = min(ret, sum);
		if (S[l] == 'W')
			sum++;
		if (l < N - 1) {
			if (S[l + 1] == 'E')
				sum--;
		}
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 720
n = gets.split.map(&:to_i)
numbers = gets.split.map(&:to_i)
semi_numbers = {}
def set_numbers(semi_numbers, n)
  if semi_numbers[n]
    semi_numbers[n] += 1
  else
    semi_numbers[n] = 1
  end
end

numbers.each do |n|
  (-1..1).each do |j|
    set_numbers(semi_numbers, n - j)
  end
end

puts semi_numbers.sort{|a, b| a[1] <=> b[1]}[-1][-1]

Measured memory_bytes: 20504
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;

void fastIO() {
	std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
}

#define FOR(i,f,t) for(int i=f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=f; i>(int)t; i--)
#define FORE(i,c) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

template<typename T, typename U> inline void mnze(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void mxze(T &x, U y) { if(x < y) x = y; }

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(_i, (x)) cerr <<*_i <<", "; cerr <<"\n"; }}
#define debuga(x, sz) {{cerr <<#x <<" = "; FOR(_i, 0, sz) cerr << x[_i] <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

const int N=50;
ll K, a[N];

void simulate(int steps){
	while(steps--){
		int mni = 0;
		FOR(i,0,N) if(a[mni]>a[i]) mni=i;
		a[mni] += N;
		FOR(i,0,N) if(i!=mni) a[i]--;
	}
}

int main(){
	scan(K);
	ll q = K/N;
	FOR(i,0,N) a[i]=i+q;
	simulate(K%N);
	printf("%d\n", N);
	FOR(i,0,N) printf("%lld ",a[i]);
	printf("\n");
}

Measured memory_bytes: 256
import bisect
N = int(input())
L = sorted(list(map(int,input().split())))
lenl = len(L)
count = 0
for i in range(0,lenl-2):
    for j in range(i+1,lenl-1):
        count += bisect.bisect_left(L,L[i]+L[j])-j-1
print(count)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
main(){
        int n,ans=0,k=0;
        cin>>n;
        for(int q=1;q<=n;ans=k==8?ans+1:ans,q+=2,k=0)
                for(int w=1;w<=q;w++)
                        k=q%w==0?k+1:k;
        cout<<ans;
}

Measured memory_bytes: 256
def main():
    s = input()
    q = int(input())

    for _ in range(q):
        query = input().split()
        op, a, b = query[0:3]
        a, b = int(a), int(b)

        if op == "replace":
            p = query[3]
            s = s[:a] + p + s[b + 1:]
        elif op == "reverse":
            s = s[:a] + s[a:b + 1][::-1] + s[b + 1:]
        elif op == "print":
            print(s[a:b + 1])


if __name__ == "__main__":
    main()

Measured memory_bytes: 5616
#include <cstdio>
#include <cctype>
#include <queue>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define ll long long
#define reg register
#define rep(i, a, b) for (reg int i = (a), i##end = (b); i <= i##end; ++i)
#define dep(i, a, b) for (reg int i = (a), i##end = (b); i >= i##end; --i)

template <typename _typer> inline _typer read() {
    _typer init = 0;
    char ch = getchar(), k = 0;
    for ( ; !isdigit(ch); ch = getchar()) k = (ch == '-');
    for ( ; isdigit(ch); ch = getchar())
        init = (init << 3) + (init << 1) + (ch ^ 48);
    return k ? -init : init;
}
const ll N = 55, INF = 1e9;

/*******************************************************************************
 *
 *
 *
 ******************************************************************************/

int n, A[N];

priority_queue < double, vector < double > , greater < double > > Q;

int main() {
    cin >> n;
    rep (i, 1, n) cin >> A[i], Q.push(1.0 * A[i]);
    double a, b;
    while (Q.size() > 1) {
        a = Q.top(), Q.pop();
        b = Q.top(), Q.pop();
        Q.push((a + b) / 2);
    }
    cout << Q.top() << endl;
    return 0;
}



Measured memory_bytes: 256
from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
X = [int(x) for x in stdin.readline().rstrip().split()]
X.sort()
if N >= M:
    print('0')
else:
    r = []
    for i in range(M - 1):
        r.append(X[i + 1]-X[i])
    r.sort()
    if N != 1:
        print(sum(r[:-N+1]))
    else:
        print(sum(r))


Measured memory_bytes: 56744
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

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

    int n;
    while (cin >> n, n) {
        V p(n + 1), t(n + 1);   // 1-index!!
        p[0] = t[0] = 0;
        rep(i, n) cin >> p[i + 1] >> t[i + 1];

        const int inf = 1e9;
        VV dp(n + 1, V(4, inf));    // ?§?????????¢????????????????°????
        dp[0][0] = 0;
        rep(i, n) {
            rep(j, 4) {
                if (j + 1 <= 3 && t[i] + (j + 1) * abs(p[i] - p[i + 1]) <= t[i + 1]) {
                    dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + abs(p[i] - p[i + 1]));
                }
                if (j >= 1 && t[i] + (j + 1) * p[i] + 1 * p[i + 1] <= t[i + 1]) {
                    dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + p[i] + p[i + 1]);
                }
            }
        }

        // ???????????¶????????£???????????????????????????
        int d = inf;
        rep(j, 4) d = min(d, dp[n][j] + p[n]);
        if (d < inf) {
            cout << "OK " << d << endl;
        } else {
            rep(i, n + 1) {
                if (*min_element(all(dp[i])) == inf) {
                    cout << "NG " << i << endl;
                    break;
                }
            }
        }

    }
}

Measured memory_bytes: 3164
n = int(input())
si = []
s = ""

for i in range(n):
    s = input()
    si.append(s)

li = sorted(si)
li.append("S")
str_li = []
int_li = []
num = 1


for j in range(n):
    if li[j] == li[j+1]:
        num += 1
    else:
        str_li.append(li[j])
        int_li.append(num)
        num = 1
    t = li[j]

n_ma = max(int_li)

for j in range(len(int_li)):
    if int_li[j] == n_ma:
        print(str_li[j])

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

using namespace std;

typedef long long ll;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  	int n;
  	cin>>n;
  	int h[n],dp[n]={0};
  	for(int i=0;i<n;i++){
      	cin>>h[i];
    }  	
	for(int i=1;i<n;i++){
    	if(i-1>=0)
      		dp[i]=abs(h[i]-h[i-1])+dp[i-1];
      	if(i-2>=0)
      		dp[i]=min(dp[i],abs(h[i]-h[i-2])+dp[i-2]);
    }
  	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[100000];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    fill(a, a + n, 1);
    for (int i = 0; i < n - 1; ++i)
    {
        if (s[i] == 'R' && s[i + 1] == 'R')
        {
            a[i + 2] += a[i];
            a[i] = 0;
        }
    }
    for (int i = n - 1; i > 0; --i)
    {
        if (s[i] == 'L' && s[i - 1] == 'L')
        {
            a[i - 2] += a[i];
            a[i] = 0;
        }
    }
    for (int i = 0; i < n; ++i)
        cout << a[i] << ' ';
}


Measured memory_bytes: 1104
#include <iostream>
#include <vector>

using namespace std;
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m, c;
  int ans = 0;
  cin >> n >> m >> c;
  vector<int> b(m);
  for (int i = 0; i < m; i++)  {
    cin >> b[i];
  }

  for (int i = 0; i < n; i++) {
    int score = 0;
    int a;
    for (int j = 0; j < m; j++) {
      cin >> a;
      score += a * b[j];
    }
    if (score + c > 0) {ans++;}
  }


  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <queue>
#include <iostream>
using namespace std;
int H, W;

int main () {
  const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1}; 
  while(cin >> W >> H && W != 0 && H != 0) {
    int srcy, srcx;
    int G[W][H];
    int D[W][H];
    for (int i = 0; i < H; i++) {
      for (int k = 0; k < W; k++) {
        D[k][i] = -1;
        char input;
        cin >> input;
        if (input == '.') {
          G[k][i] = 0;
        } else if (input == '#') {
          G[k][i] = 1;
        } else {
          G[k][i] = 0;
          srcx = k;
          srcy = i;
        }
      }
    }
    // for (int i = 0; i < H; i++) {
    //   for (int k = 0; k < W; k++) {
    //     cout << G[k][i] << " ";
    //   }
    //   cout << endl;
    // }
    // for (int i = 0; i < H; i++) {
    //   for (int k = 0; k < W; k++) {
    //     cout << D[k][i] << " ";
    //   }
    //   cout << endl;
    // }
    
    queue<pair<int, int> > Q; // 整数を管理するキューの定義
    pair<int, int> src = make_pair(srcx, srcy);
    Q.push(src);
    D[srcx][srcy] = 0; // 出発点
    // cerr << "src " << srcx << ", " << srcy  << endl;
    while (! Q.empty()) {
      pair<int, int> cur = Q.front(); // 先頭要素を取り出す
      Q.pop();
      int x = cur.first;
      int y = cur.second;
      // cerr << "src " << x << ", " << y  << endl;
      for (int i = 0; i < 4; i++) {
        int dstx = x+dx[i];
        int dsty = y+dy[i];
        // cerr << "visiting " << dstx << ", " << dsty << ", " << G[dstx][dsty] << ", " <<  D[dstx][dsty]  << endl;
        if (
          (dstx >= 0 && dstx <= W - 1)
          && (dsty >= 0 && dsty <= H - 1)
          && G[dstx][dsty] == 0
          && D[dstx][dsty] == -1
        ) { // cur から dst に辺があり，dst が未訪問なら
          D[dstx][dsty] = D[x][y]+1; //
          Q.push(make_pair(dstx, dsty));
        }
      }
    }
    // for (int i = 0; i < H; i++) {
    //   for (int k = 0; k < W; k++) {
    //     cout << D[k][i] << " ";
    //   }
    //   cout << endl;
    // }
    int r = 0;
    for (int i = 0; i < W; i++) {
      for (int k = 0; k < H; k++) {
        if (D[i][k] != -1) {
          r++;
        }
      }
    }
    cout << r << endl;
  }
}


Measured memory_bytes: 3068
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int counter[n];
    for(int i=0;i<n;i++) counter[i] = 0;
    for(int i=0;i<n-1;i++){
        int a;
        cin >> a;
        counter[a-1]++;
    }
    for(int i=0;i<n;i++) cout << counter[i] << endl;
}

Measured memory_bytes: 4388
#pragma region Template
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RNG(i, a, b) for(int i = a; i < b; i++)
#define RBF(i, v) for(auto& i : v)
#define ALL(x) x.begin(), x.end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }
#pragma endregion

signed main()
{	
	int k, n;
	cin >> k >> n;
	V<int> a(n);
	RBF(ai, a) cin >> ai;
	a.emplace_back(k + a[0]);

	int maxd = 0;
	REP(i, n) {
		maxd = max(maxd, a[i + 1] - a[i]);
	}

	col(k - maxd);
	return 0;
}


Measured memory_bytes: 4764
#include<iostream>
#include<vector>
#include<iomanip>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<double> A(N);
	double sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		sum += 1 / A[i];
	}
	cout << setprecision(10) <<  1 / sum << endl;
	return 0;
}

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

#define N_MAX 200000 
int num[N_MAX]={0};

int main(){
  int N,K,A;
  cin >> N >> K;
  for(int i=0;i<N;i++){
    cin >> A;
    num[A-1]++;
  }
  vector<int> kind;
  for(int i=0;i<N_MAX;i++){
    if(num[i]>0)kind.push_back(num[i]);
  }
  sort(kind.begin(),kind.end());
  int cnt=0;
  for(int i=0;K+i<kind.size();i++){
    cnt+=kind[i];
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 2168
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
  int A[3];
  scanf("%d %d %d", &A[0], &A[1], &A[2]);
  
  sort(A, A+3);
  int cost = 0;
  printf("%d\n", A[2] - A[0]);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
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; }





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	ll k;cin >> k;
	ll n = s.size();
	rep(i,min(k,n)){
		if(s.at(i) != '1'){
			cout << s.at(i) << endl;
			return 0;
		}
	}
	cout << s.at(k - 1) << endl;
}


Measured memory_bytes: 256
from collections import deque

n = int(input())
uni = list(range(n))
cityx = [None] * n
cityy = [None] * n
for i in range(n):
    x, y = map(int, input().split())
    cityx[i] = (x, i)
    cityy[i] = (y, i)

cityx.sort()
cityy.sort()
dcx, dcy = [], []
for i in range(n - 1):
    dcx.append((cityx[i+1][0] - cityx[i][0], (cityx[i][1], cityx[i+1][1])))
    dcy.append((cityy[i+1][0] - cityy[i][0], (cityy[i][1], cityy[i+1][1])))

dqx = deque(sorted(dcx))
dqy = deque(sorted(dcy))

def root(a):
    if(a == uni[a]):
        return a
    uni[a] = root(uni[a])
    return uni[a]

def connect(a, b):
    a = root(a)
    b = root(b)
    uni[b] = a

ans = 0
while dqx or dqy:
    if(dqx and (not dqy or dqx[0] < dqy[0])):
        d, (i, j) = dqx.popleft()
    else:
        d, (i, j) = dqy.popleft()
    if(root(i) != root(j)):
        ans += d
        connect(i, j)

print(ans)


Measured memory_bytes: 66836
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;

vector<long long> get_array(int n) {
  int root_n = (int)sqrt(n);
  vector<long long> array(root_n, 1);
  for (int i = n / root_n - 1; i >= 1; i--) {
    int add = n / i - n / (i + 1);
    if (add != 0) {
      array.push_back((long long)add);
    }
  }
  return array;
}
const long long MOD = 1000000007;

int main() {
  int max, length;
  cin >> max >> length;

  vector<long long> array = get_array(max);
  int size = array.size();

  int dp[length][size] = {};
  for (int i = 0; i < size; i++) {
    dp[0][i] = array[i];
  }

  for (int current = 1; current < length; current++) {
    int pre = current - 1;
    long long sum_pre = 0;
    for (int i = 0; i < size; i++) {
      sum_pre += dp[pre][i];
    }
    for (int i = 0; i < size; i++) {
      dp[current][i] = (int)(((sum_pre % MOD) * array[i]) % MOD);
      sum_pre -= dp[current - 1][size - 1 - i];
    }
  }
  long long ans = 0;
  for (int i = 0; i < size; i++) {
    ans = (ans + dp[length - 1][i]) % MOD;
  }
  cout << ans % MOD << endl;

  return 0;
}


Measured memory_bytes: 25480
N = int(input())
As = list(map(int, input().split()))

Asum = sum(As)
sum_eve = 0 #偶数
sum_odd = 0 #奇数

for i,a in enumerate(As+[As[0]]):
    if i % 2 == 0:
        sum_eve += a
    if i % 2 == 1:
        sum_odd += a 
# print(sum_eve)   
# print(sum_odd)
ans = [0] * N
ans[0] = sum_eve-Asum//2
ans[1] = sum_odd-Asum//2

n = N//2
for i in range(2,N):
    i_d = i-2  #消す
    i_a = (i+2*n)%N ##加える 
    # print(i)
    ans[i] = ans[i-2] - As[i_d] + As[i_a]

ans = [2*a for a in ans]

print(*ans)

Measured memory_bytes: 14916
#include<iostream>
#include<cstring>
using namespace std;
char op,t1[500],t2[500],isI;
int findm(char *t,int s,int e){
	int d=0;
	for(int i=s;i<e;i++){
		if(t[i]=='(')d++;
		if(t[i]==')')d--;
		if(d==1&&t[i]==',')return i;
	}
}
void calc(int s1,int e1,int s2,int e2){
	int f1=s1<e1,f2=s2<e2,m1=e1-1,m2=e2-1;
	if(f1)m1=findm(t1,s1,e1);
	if(f2)m2=findm(t2,s2,e2);
	if(isI&&f1&&f2||!isI&&(f1||f2)){
		cout<<"(";calc(s1+1,m1,s2+1,m2);
		cout<<",";calc(m1+1,e1-1,m2+1,e2-1);
		cout<<")";
	}
}
int main(){
	while(cin>>op>>t1>>t2)isI=op=='i',calc(0,strlen(t1),0,strlen(t2)),cout<<endl;
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int isleapyear(int year);
int nday(int y, int m); 

int main() {
	int i, j, leapyear_count = 0;
	int y1, m1, d1, y2, m2, d2;

	while(1) {
		int day = 0;
		scanf("%d %d %d %d %d %d", &y1, &m1, &d1, &y2, &m2, &d2);
		if(y1 < 0 || y2 < 0 || m1 < 0 || m2 < 0 || d1 < 0 || d2 < 0) {
			break;
		}
		for(i = y1; i <= y2; ++i) {
			// 期首年と期末年が同じとき
			if(y1 == y2) {
				for(j = m1; j < m2; ++j) {
					day += nday(i, j);
				}
				day = day + d2 - d1;
			}
			else {
				if(i == y1) {
					for(j = m1; j <= 12; ++j) {
						day += nday(i, j);
					}
					day = day - d1;
				}
				else if(i == y2) {
					for(j = 1; j < m2; ++j) {
						day += nday(i, j);
					}
					day = day + d2;
				}
				else {
					for(j = 1; j <= 12; ++j) {
						day += nday(i, j);
					}
				}
			}
		}
		printf("%d\n", day);
	}
	return 0;
}
/* うるう年かどうか判定する関数 うるう年ならば1、そうでなければ0を返す */
int isleapyear(int year) {
	int result;
	if (year % 4 == 0) {
		if (year % 100 == 0) {
			if (year % 400 == 0) {
				result = 1;
			} else {
				result = 0;
			}
		} else {
			result = 1;
		}
	} else {
		result = 0;
	}

	return result;
}

/* y年m月の日数を返す関数 */
int nday(int y, int m) {
	int result;
	if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
		result = 31;
	else if(m == 2 && isleapyear(y))
		result = 29;
	else if(m == 2)
		result = 28;
	else
		result = 30;
	return result;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
	char s[10001];
	while(scanf("%s",s)!=EOF)
	{
		int len=strlen(s);
		int flag1=0,flag2=0,flag3=0,flag4=0;
		for(int i=0;i<len;i++)
		{
			if(s[i]=='N') flag1=1;
			if(s[i]=='W') flag2=1;
			if(s[i]=='S') flag3=1;
			if(s[i]=='E') flag4=1;
		}
		if((flag1==1&&flag2==1&&flag3==1&&flag4==1)||(flag1==1&&flag3==1&&flag2==0&&flag4==0)||(flag2==1&&flag4==1&&flag1==0&&flag3==0))
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  cin>>s;
  int ans=0,l;
  for(int i=0;i<s.size()/2;i++){
    if(s[i]!=s[s.size()-i-1]) ans++;
  }
  cout<<ans<<endl;
}

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

int main() {

    string S;
    cin >> S;

    if (S[0] == S[1] && S[2] == S[3]) {
        if (S[0] != S[2]) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
        return 0;
    }
    if (S[0] == S[2] && S[1] == S[3]) {
        if (S[0] != S[1]) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
        return 0;
    }
    if (S[0] == S[3] && S[1] == S[2]) {
        if (S[0] != S[1]) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
        return 0;
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

typedef long long ll;

int main()
{
    int N,M;
    cin >> N >> M;
    priority_queue<double> pque;
    for(int i=0; i<N; i++){
        double tmp;
        cin >> tmp;
        pque.push(tmp);
    }
    for(int i=0; i<M; i++){
        double tmp=pque.top(); pque.pop();
        tmp/=2.0;
        pque.push(tmp);
    }
    ll ans=0;
    for(int i=0; i<N; i++){
        ll tmp=(ll)pque.top(); pque.pop();
        ans+=tmp;
    }


    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1400
import java.util.*;

public class Main{
	public static void main(String[] args){
		// 標準入力
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int k = sc.nextInt();
		
		String s = "";

		if(b - a > k){
			s = ":(";
		}else if(c - a > k){
			s = ":(";
		}else if(d - a > k){
			s = ":(";
		}else if(e - a > k){
			s = ":(";
		}else if(c - b > k){
			s = ":(";
		}else if(d - b > k){
			s = ":(";
		}else if(e - b > k){
			s = ":(";
		}else if(d - c > k){
			s = ":(";
		}else if(e - c > k){
			s = ":(";
		}else if(e - d > k){
			s = ":(";
		}else{
			s = "Yay!";
		}

		System.out.println(s);
		sc.close();
	}
}


Measured memory_bytes: 23760
/**
 *    author: gxfireball       
**/
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
using namespace std;

void solve(){
    ll n,k;
    cin >> n >>k;
    vector<ll> temp(n,0);
    for(ll i=0; i<k; ++i){
		ll d;
		cin >> d;
		for(ll j=0; j<d; ++j){
			ll tt;
			cin>>tt;
			tt--;
			temp[tt] = 1;
		}
	}
	ll cnt=0;
	for(ll i=0; i<n; ++i){
		if(temp[i] == 0) cnt++;
	}
	cout << cnt ;
}

int main(){
    fastio;
    int t;
    t = 1;
    //cin>>t;
    while(t--){
    	solve();
    }
    return 0;
}



Measured memory_bytes: 3624
#include <stdio.h>

int a, b, c;

int main(){
	scanf("%d %d %d", &a, &b, &c);
	if (a <= b && b <= c){
		printf("%d %d %d\n", a, b, c);}
	else if (a <= b && b >= c && a >= c){
		printf ("%d %d %d\n", c, a, b);}
	else if (a >= b && b >= c){
		printf ("%d %d %d\n", c, b, a);}
	else if (a >= b && b <= c && a >= c){
		printf ("%d %d %d\n", b, c, a);}
	else if (a >= b && b <= c && c >= a){
		printf ("%d %d %d\n", b, a, c);}
	else if (a <= b && b >= c && a < c){
		printf ("%d %d %d\n",a ,c ,b );}
	return 0;
}


Measured memory_bytes: 2088
N, M, C = (int(x) for x in input().split())
B = [int(x) for x in input().split()]
A = []
for _ in range(N):
    A.append([int(x) for x in input().split()])
ans, s = 0, 0
for Ai in A:
    for i in range(M):
        s += Ai[i] * B[i]
    if s + C > 0: ans += 1
    s = 0
print(ans)

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int a,b,k;

signed main() {
    cin >> a >> b >> k;
    cout << max(0LL, a-k) << " " << max(0LL,min(b,b-(k-a))) << endl;
}


Measured memory_bytes: 384
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(S: str, T: str):
    n = len(S)
    m_in = {}
    m_out = {}
    for i in range(n):
        if (S[i] in m_in and m_in[S[i]] != T[i]) or (T[i] in m_out and m_out[T[i]] != S[i]):
            ret = NO
            print(ret)
            return
        else:
            m_in[S[i]] = T[i]
            m_out[T[i]] = S[i]
    print(YES)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3828
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int n,r=0,b=0;string s;
	cin>>n;cin>>s;
	rep(i,n){
		if(s[i]=='R') r++;else b++;
	}
	if(r>b) cout<<"Yes"<<endl;else cout<<"No"<<endl;
}


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

int main(){
  long long h, w; cin >> h >> w;
  vector<string> s(h);
  for(int i = 0; i < h; i++){
    cin >> s.at(i);
  }
  vector<vector<long long>> a(h), b(w);
  for(int i = 0; i < h; i++){
    long long tmp = 0;
    for(int j = 0; j < w; j++){
      if(s.at(i).at(j) == '.'){
        tmp++;
        if(j == w - 1){
          for(int k = 0; k < tmp; k++) a.at(i).push_back(tmp);
          tmp = 0;
        }
      }else{
        for(int k = 0; k < tmp; k++) a.at(i).push_back(tmp);
        a.at(i).push_back(0);
        tmp = 0;
      }
    }
  }
  for(int i = 0; i < w; i++){
    long long tmp = 0;
    for(int j = 0; j < h; j++){
      if(s.at(j).at(i) == '.'){
        tmp++;
        if(j == h - 1){
          for(int k = 0; k < tmp; k++) b.at(i).push_back(tmp);
          tmp = 0;
        }
      }else{
        for(int k = 0; k < tmp; k++) b.at(i).push_back(tmp);
        b.at(i).push_back(0);
        tmp = 0;
      }
    }
  }
  long long out = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      long long tmp = a.at(i).at(j) + b.at(j).at(i) - 1;
      if(tmp > out) out = tmp;
    }
  }
  cout << out;
}


Measured memory_bytes: 68480
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(void)
{
	int N, f,i;
	cin >> N;
	f = 0;
	i = N;
	while (i != 0)
	{
		f += i % 10;
		i /= 10;
	}
	if (N%f == 0)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	int a, b, c,ans;
	cin >> a >> b >> c;
	if (a == b &&b== c){ ans = 1; }
	else if (a == b || b == c || c == a){ ans = 2; }
	else{ ans = 3; }
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include "stdio.h"

int main()
{
	//??\?????????????????°??????????????????????¬???????????????????????????????????????????????????????????????????????????¨?????????

	//??¶??????????????°???????´?
	int player[110] = { 0 };
	//??????????????¶?????????????????????(?????????????????????????????????-1???????????¨?????????
	int winner[110] = { 0 };
	//??§?????????????´?
	int discount[110] = { 0 };
	//?????¶?????????????\¨??????????????°
	int ticket[110][110] = { 0 };
	//???????????????????????§????????????????????????????????????
	long int money[110] = { 0 };

	//??????????????°??????
	int i = 0, j = 0;
	

	//0 0 0?????\???????????????????¢???????????????§????°????????¶?????????????
	while (1) {
		//????????????????????????????????????????¢????
		//??????????????°??????????????????????????§??????
		scanf("%d %d %d", &player[i],&winner[i],&discount[i]);

		//0 0 0?????\???????????????????????????
		if ((player[i] == 0) && (winner[i] == 0) && (discount[i] == 0)) 
			break;

		//????????????????????°??????????\¨??°????????????????????????????????????????¨????????????????
		for (j = 0; j < player[i]; j++) {
			scanf("%d", &ticket[i][j]);
			money[i] += 100 * ticket[i][j];
		}

		//?????????????????§?????????
		//100??§?????£????°???°?????????????????????????????¨?????¬?????£????????????????????????100????????°???????????????????????£???
		money[i] -= (money[i] / 100) * discount[i];

		//??§????????????????????????????????????????????????????¨??????????money?????\??????
		//????????????????\¨??????????????°??§?????§????????????????????????????????£????????????????????????????????????????????§?????????
		//??????????°???°?????????????????§???????????????????????§???????????¨?????§??´??°???????????¨????????????????????????
		//int????????£??\?????????????????????????????????????????????????????????????????§??§?????????
		//???????????????????????????????\¨???????????????????????°???0?????????????????????????????????????????¶??????0????????????
		if (ticket[i][winner[i] - 1] == 0)
			money[i] = 0;
		else
			money[i] = money[i] / ticket[i][winner[i] - 1];

		//??????????????°?????????????????????????????????????????????
		i++;
	}

	//??????????????????????????§i-1??????????????????????????????????????????????????§???????????????
	//i-1???????????§??????????????????????????¨????????????
	for (j = 0; j < i; j++)
		printf("%d\n", money[j]);

    return 0;
}

Measured memory_bytes: 656
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    int n,b,i,j;
    scanf("%d%d",&n,&b);
    char s[n+1][b+1];
    for(i=0; i<n; i++)
    {
        scanf("%s",s[i]);
    }
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            if(strcmp(s[i],s[j])>0)
            {
                char tem[b+1];
                strcpy(tem,s[i]);
                strcpy(s[i],s[j]);
                strcpy(s[j],tem);
            }
        }
    }
    for(i=0; i<n; i++)
    {
        printf("%s",s[i]);
    }
    printf( "\n" ) ;
}


Measured memory_bytes: 1732
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    while (cin >> N) {
        vll a(N*3);
        rep(i, N*3)cin >> a[i];
        sort(all(a), greater<int>());
        ll ans = 0;
        for (int i = 1; i < 2 * N; i += 2) {
            ans += a[i];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 2560
#include <iostream>
#include <stdio.h>
using namespace std;

void Calc();

int main(){
    int n;
    cin >> n;
    
    for(int i=0; i<n; i++){
        Calc();
    }
    
    return 0;
}

void Calc(){
    int score = 0;
    int outCount = 0;
    string event;
    int runners[3]={};
    
    while(1){
        cin >> event;
        
        if(event == "HIT"){
            if(runners[2] == 1){
                score++;
            }
            
            for(int i=2; i>0; i--){
                runners[i] = runners[i-1];
            }
            runners[0] = 1;
        }
        
        else if(event == "HOMERUN"){
            score++;
            for(int i=0; i<3; i++){
                score += runners[i];
                runners[i] = 0;
            }

        }
        
        else{
            outCount++;
        }
        
        if(outCount == 3){
            cout << score << "\n";
            break;
        }
        
    }
    return;
}

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

namespace oasobi
{
    static class MainClass
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var list = new List<string>();

            for(int i = 0; i < n; ++i)
            {
                list.Add(Console.ReadLine());
            }

            var rist = list.Distinct();
            int rl = rist.Count();
            Console.WriteLine(rl);
        }
    }
}

Measured memory_bytes: 47964
/**
 * @author: pr4shan7 (प्रशांत)
 */
// #define _DEBUG

#ifndef _DEBUG
#define NDEBUG
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pb_set;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define ln '\n'
#define x first
#define y second
#define cai static_cast<int>
#define cal static_cast<long long>
const int N = 1e5 + 5;
const int INF = 1e9;
const int MV = 1e9 + 7;

int32_t main() {
	ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

#ifdef _DEBUG
	ifstream cin("input.txt");
	ofstream cout("output.txt");
#endif

	ll h; cin >> h;
	ll height = cal(log2(h));
	// ll last = 2 << h;
	// cout << height << ln;
	cout << (2LL << height) - 1 << ln;

	return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> P;
const LL MOD = 1000000007LL;
int p[100000];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> p[i], p[i]--;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (i != p[i]) continue;
		if (i + 1 < N) swap(p[i], p[i + 1]);
		else swap(p[i], p[i - 1]);
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define reg register
typedef long long ll;
#define MOD 998244353
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
static char buf[100000],*p1=buf,*p2=buf;
inline int read(void){
	reg char ch=getchar();
	reg int res=0;
	while(ch<'0'||'9'<ch)ch=getchar();
	while('0'<=ch&&ch<='9')res=10*res+ch-'0',ch=getchar();
	return res;
}

const int MAXC=3000+5;
const int MAXD=3000+5;

int a,b,c,d;
int f[MAXC][MAXD];

int main(void){
	a=read(),b=read(),c=read(),d=read();
	f[a][b]=1;
	for(reg int i=a;i<=c;++i)
		for(reg int j=b;j<=d;++j)
			if(i!=a||j!=b)
				f[i][j]=((1ll*f[i-1][j]*j%MOD+1ll*f[i][j-1]*i%MOD)%MOD-1ll*f[i-1][j-1]*(i-1)%MOD*(j-1)%MOD+MOD)%MOD;
	printf("%d\n",f[c][d]);
	return 0;
}

Measured memory_bytes: 38776
main = do
 [h,w] <- map (read::String->Int) .words <$> getLine
 if h == 1 || w == 1 then print 1
 else if h < w then print $  h * (w `div` 2) + ceiling((fromIntegral h)/2) * (w `mod` 2)
 else print $  w * (h `div` 2) + ceiling((fromIntegral w)/2) * (h `mod` 2)

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

int main(){
	string s = "";
	int n;
	cin >> n;
	while(n) {
		if(n%(-2)) {
			s+= '1';
			n -= 1;
		}
		else s+= '0';
		n /= -2;
	}
	if(s == "") {
		cout << "0";
	} else {
		for(int i =s.size() - 1; i>=0; i--){
			cout << s[i];
		}
	}
}



Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <tuple> 

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
	string s;
	cin >> s;
	cout << s.substr(0, s.size() - 8) << endl;
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")

//#pragma comment(linker,"/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//order_of_key(k): Number of items strictly smaller than k .
//find_by_order(k): K-th element in a set (counting from zero).
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define full(x,n) x,x+n+1
#define full(x) x.begin(),x.end()
#define finish return 0

#define putb push_back
#define f first
#define s second

//logx(a^n)=loga(a^n)/logx(a)
//logx(a*b)=logx(a)+logx(b)
//logx(y)=log(y)/log(x)

#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define putf push_front
#define gainb pop_back

#define gainf pop_front
#define len(x) (int)x.size()

// 1/b%mod=b^(m-2)%mod
// (a>>x)&1==0
// a^b=(a+b)-2(a&b)

typedef double db;
typedef long long ll;

const int ary=1e5+5;
const int mod=1e9+7;
const ll inf=1e18;

using namespace std;
using namespace __gnu_pbds;
int a,b;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>a>>b;
	if(a==b){
		cout<<"Yes";
		return 0;
	}
	cout<<"No";
}

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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

const int INF = 0x3f3f3f3f;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
 
//int in() { int x; scanf("%d", &x); return x; }
//ll lin() { ll x; scanf("%lld", &x); return x; }
//void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

int main(void){

    ll a,b,k;
    cin >> a >> b >> k;
    
    if(k > a){
        cout << 0 << " " << (((b - (k - a)) > 0) ?  (b - (k - a)) : 0);
    } else {
        cout << a-k << " " << b;
    }
    return 0;
}


Measured memory_bytes: 256
# frozen_string_literal: true
require 'thread'

@h, @w, @k = gets.split.map(&:to_i)
@s = @h.times.map { gets.chomp }

def left(x, y)
  if y.zero? || @s[x][y - 1] != '.'
    [x, y]
  else
    [x, y - 1]
  end
end

def right(x, y)
  if y == @w - 1 || @s[x][y + 1] != '.'
    [x, y]
  else
    [x, y + 1]
  end
end

def up(x, y)
  if x.zero? || @s[x - 1][y] != '.'
    [x, y]
  else
    [x - 1, y]
  end
end

def down(x, y)
  if x == @h - 1 || @s[x + 1][y] != '.'
    [x, y]
  else
    [x + 1, y]
  end
end

def nextp(x, y)
  if y == @w - 1
    if x == @h - 1
      nil
    else
      [x + 1, 0]
    end
  else
    [x, y + 1]
  end
end

starts = []
goals = []
0.upto(@h - 1) do |i|
  0.upto(@w - 1) do |j|
    if @s[i][j] == '.'
      starts.push [i, j]
      goals.push [i, j]
    end
  end
end
max = 0

def maze(start, goal)
  return 0 if @s[start[0]][start[1]] == '#'

  q = Queue.new
  c = Array.new(@h) { Array.new(@w) { -1 } }
  c[start[0]][start[1]] = 0

  max = 0
  q.push start
  loop do
    break if q.empty?

    p = q.pop
    x = p[0]
    y = p[1]
    count = c[x][y]
    max = count if max < count

    [left(x, y), right(x, y), up(x, y), down(x, y)].each do |np|
      xx = np[0]
      yy = np[1]
      if c[xx][yy].negative?
        q.push [xx, yy]
        c[xx][yy] = count + 1
      end
    end
  end
  max
end

starts.each do |start|
  d = maze(start, start)
  max = d if max < d
end

puts max


Measured memory_bytes: 2172