akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    h = II()
    ans = 0
    while h:
        h = h >> 1
        ans += 1
    print(2 ** ans - 1)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 39024
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

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

const ll mod = 1e9 + 7;

vector<string> g;


int main() {
    
    
    string s;
    cin >> s;
    
    reverse(s.begin(), s.end());
    vector<ll> m(2019);
    
    ll cur = 1;
    ll prev = 0;
    m[0]++;
    for (int i = 0; i < s.size(); ++i)
    {
        ll num = s[i] - '0';
        m[(cur * num + prev) % 2019]++;
        prev = (cur * num + prev) % 2019;
        cur *= 10;
        cur %= 2019;
    }
    
    ll ret = 0;
    for (int i = 0; i < 2019; ++i)
    {
        if (m[i] != 0)
        {
            ret += (m[i] * (m[i] - 1)) / 2;
        }
    }

    cout << ret << endl;
    
    return 0;
}

Measured memory_bytes: 3716
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



signed main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) << " " << max(0ll, a + b - n);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};

int main()
{
    int n;
    cin >> n;
    int w[n];
    REP(i, n) cin >> w[i];
    int s = 0, m = 100;
    REP(i, n){
        s += w[i];
        int s1 = 0;
        FORR(j, n-1, i+1){
            s1 += w[j];
        }
        m = min(abs(s - s1), m);
    }
    cout << m << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define lint long long

using namespace std;

int main() {
	string s,based;
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'B') {
			if (based.length() == 0)
				continue;
			else
				based.pop_back();
		} else {
			based.push_back(s[i]);
		}
	}
	cout << based << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s; cin >> s;
    cout << vector<string>{"No", "Yes"}[s.substr(0, 4) == "YAKI"] << endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;
#define int ll
using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<int, int> pii;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define asd(n) rep(i, 0, n)
#define jkl(n) rep(j, 0, n)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

namespace IO {

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> a);

    template<class A>
    ostream &operator<<(ostream &out, vector<A> a);

    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
        return out;
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve() {
    string s;
    cin >> s;
    put(s + (s.back() =='s'?"e":"") + "s");
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(30);
//    freopen("input.txt", "r", stdin);
    int q = 1;
//    cin >> q;

    while (q--) solve();
}


Measured memory_bytes: 3080
def convertRoman(str)
  romanHash = Hash.new()
  romanHash["I"] = 1
  romanHash["V"] = 5
  romanHash["X"] = 10
  romanHash["L"] = 50
  romanHash["C"] = 100
  romanHash["D"] = 500
  romanHash["M"] = 1000
  pre = 0
  num = 0
  (str.length - 1).downto(0) do |i|
    n = romanHash[str[i].upcase]
    return -1 unless n
    if n >= pre
      num += n
      pre = n
    else
      num -= n
    end
  end
  return num
end

if __FILE__ == $0
  while line = gets
    puts convertRoman(line.rstrip)
  end
end

Measured memory_bytes: 6108
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
const long double EPS = 1e-6, PI = acos((long double)-1);

//ここから編集

bool visited[1010][1010];

int dxy[5] = {-1,0,1,0,-1};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(4);
  
  int H, W; cin >> H >> W;
  int sy,sx,gy,gx;
  cin >> sy >> sx >> gy >> gx;
  vector<string> f;
  REP(i,H){
    string s; cin >> s;
    f.push_back(s);
  }

  sy--; sx--;
  gy--;gx--;
  vector<vector<int>> dist(H, vector<int>(W, INT_MAX));
  dist[sy][sx] = 0;
  priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;
  q.push({0,sy*W + sx});

  while(q.size()){
    auto v = q.top();
    q.pop();


    int y = v.second/W, x = v.second%W;
    if(dist[y][x] < v.first) continue;
    for(int i=0; i<4; i++){
      int ny = y + dxy[i], nx = x + dxy[i+1];
      if(ny >= 0 && ny < H && nx >= 0 && nx < W && f[ny][nx] == '.'){
        if(dist[ny][nx] > dist[y][x]){
          dist[ny][nx] = dist[y][x];
          q.push({dist[ny][nx],ny*W + nx});
        }
      }
    }
    for(int i=-2; i<=2; i++){
      for(int j=-2; j<=2; j++){
        int ny = y+i, nx = x+j;
        if(ny >= 0 && ny < H && nx >= 0 && nx < W && f[ny][nx] == '.'){
          if(dist[ny][nx] > dist[y][x] + 1){
            dist[ny][nx] = dist[y][x] + 1;
            q.push({dist[ny][nx], ny*W + nx});
          }
        }
      }
    }
  }
  int ans = dist[gy][gx];
  if(ans == INT_MAX){
    ans = -1;
  }
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 8368
import sys


def input():
    return sys.stdin.readline()[:-1]


N = int(input())
BA = []
for _ in range(N):
    a, b = map(int, input().split())
    BA.append([b, a])
BA.sort()

sum_time = 0
for i in range(N):
    sum_time += BA[i][1]
    if sum_time > BA[i][0]:
        print('No')
        exit(0)
print('Yes')


Measured memory_bytes: 35612
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var w = Console.ReadLine();

			var dictionary = new Dictionary<char, int>();

			foreach(var c in w)
			{
				if(dictionary.ContainsKey(c))
				{
					dictionary[c]++;
				}
				else
				{
					dictionary.Add(c, 1);
				}
			}

			if(dictionary.Values.Any(value => value % 2 != 0))
			{
				Console.WriteLine("No");
			}
			else
			{
				Console.WriteLine("Yes");
			}
		}
	}
}


Measured memory_bytes: 13276
import sys
import itertools
import math

readline = sys.stdin.readline
sqrt = math.sqrt

def distance(a, b):
    return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2)


def main():
    N = int(input())
    G = []
    for _ in range(N):
        G.append(list(map(int, readline().split())))
    
    permN = itertools.permutations(range(N))
    d = []
    for p in permN:
        tmp = 0
        for i in range(len(p)-1):
            a = p[i]; b = p[i+1]
            tmp += distance(G[a], G[b])
        d.append(tmp)
    ans = sum(d)/len(d)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 4528
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int N,K,R,S,P;
    int ans=0;
    string T;
    cin >>N>>K>>R>>S>>P>>T;
    vector<char>vec(N);
    REP(i,N){
        vec[i]=T[i];
    }
    for(int i=0;i<K;i++){
        char before;
        for(int j=0;K*j+i<=N-1;j++){
            char a = vec[K*j+i];
            if(j!=0 && before ==a){
                before='z';
                continue;
            }
            if(a =='r'){
                ans+=P;
                before='r';
            }
            if(a=='s'){
                ans+=R;
                before='s';
            }
            if(a=='p'){
                ans+=S;
                before='p';
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <stack>

int dots_num(std::string s); 
int value_num(char c); 
void inner_loop(std::stack<std::pair<int, int> > &st); 
void dfs(int n); 


int main(void) {
    int n;
    while (1) {
        std::cin >> n;
        if (n == 0) {
            break;
        }
        dfs(n);
    }
    return 0;
}

int dots_num(std::string s) {
    int num = 0;
    int loop = 0;
    while (s[loop] == '.') {
        ++num; 
        ++loop;
    }
    return num;
}

int value_num(char c) {
    int ret;
    if (c == '+') {
        ret = -1; 
    } else if (c == '*') {
        ret = -2;
    } else {
        ret = (int) c - 48;
    }
    return ret;
}

void inner_loop(std::stack<std::pair<int, int> > &st) {
    int start_dots;
    int enzan[2] = {0, 1};
    start_dots = st.top().first;
    std::pair<int, int> p;

    while (1) {
        if (start_dots > st.top().first) {
            break;
        }
        enzan[0] += st.top().second;
        enzan[1] *= st.top().second;
        st.pop();
    }
    if (st.top().second == -1) {
        p = std::make_pair(st.top().first, enzan[0]);
        st.pop();
        st.push(p);
    } else if(st.top().second == -2) {
        p = std::make_pair(st.top().first, enzan[1]);
        st.pop();
        st.push(p);
    }
    return;
}

void dfs(int n) {
    std::string s;
    std::stack<std::pair<int, int> > st;
    st.push(std::make_pair(0, 0));
    int dots;
    int value;

    for (int i = 0; i < n; i++) {
        std::cin >> s;
        dots = dots_num(s);
        value = value_num(s[dots]);

        while (1) {
            if (st.top().first <= dots) {
                break; 
            }
            inner_loop(st); 
        }
        st.push(std::make_pair(dots, value));
    }

    while (1) {
        if (st.top().first == 0) {
            break; 
        }
        inner_loop(st); 
    }
    std::cout << st.top().second << std::endl;
    return;
}

Measured memory_bytes: 3156
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
using namespace std;

int s[100007];
int t[100007];

int memo_s[100007];
int memo_t[100007];

signed main()
{
	string S;
	cin >> S;
	for (int i = 0; i < S.length(); i++)
	{
		s[i] = (S.at(i) == 'A') ? 1 : 2;
	}
	string T;
	cin >> T;
	for (int i = 0; i < T.length(); i++)
	{
		t[i] = (T.at(i) == 'A') ? 1 : 2;
	}

	memo_s[0] = 0;
	for (int i = 1; i <= S.length(); i++)
	{
		memo_s[i] = memo_s[i - 1] + s[i - 1];
	}
	memo_t[0] = 0;
	for (int i = 1; i <= T.length(); i++)
	{
		memo_t[i] = memo_t[i - 1] + t[i - 1];
	}

	int q;
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		int n = memo_s[b] - memo_s[a - 1];
		int m = memo_t[d] - memo_t[c - 1];
		if ((n % 3) == (m % 3))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const int INF = 1e9;

int main(void){

	int A, B; cin >> A >> B;
	REP(i,1200){
		int C = (int)(i*0.08);
		int D = (int)(i*0.1);
		if(A == C and D == B){
			cout << i << endl;
			return 0;
		}

	}


	cout << -1 << endl;
	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int INF=1e9;
int main(){
	int N;cin>>N;
	long A[N+1],B[N];long sum=0;
	rep(i,0,N+1) cin>>A[i];
	rep(i,0,N) cin>>B[i];
	rep(i,0,N){
        if(A[i]+A[i+1]<B[i]){
            sum+=A[i]+A[i+1];
            A[i+1]=0;
        }else if(A[i]<B[i]){
            sum+=B[i];
            A[i+1]=A[i]+A[i+1]-B[i];
        }else{
            sum+=B[i];
        }
	}cout<<sum<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(x,a) for(auto& (x):(a))
#define ALL(obj) (obj).begin(),(obj).end()
#define Yes(n) cout<<((n)?"Yes":"No")<<endl;
using namespace std;
using ll=long long;
const int INF=1e9;
const ll LINF=1e18;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

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

  float a[5];
  REP(i,5) cin>>a[i];

  int lasti=0;
  float lastn=(int)a[0]%10;
  REP(i,4) if(lastn > (int)a[i+1]%10 and (int)a[i+1]%10!=0){
    lasti=i+1;
    lastn=(int)a[i+1]%10;
  }

  int ans=0;
  REP(i,5){
    if(i==lasti) continue;
    else ans+=(ceil(a[i]/10)*10);
  }
  ans+=a[lasti];

  cout<<ans<<endl;;
  return 0;
}

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

int main()
{
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    cout<<x2+y1-y2<<" "<<y2-x1+x2<<" "<<x1+y1-y2<<" "<<y1-x1+x2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define float long double
#define PB push_back
#define MP make_pair
#define ss second
#define ff first
#define PI 3.14159265
#define fastrack ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int M = 2007, mod = 998244353;

signed main(){
    fastrack;
    int n;
    cin >> n;
    map <string, bool> mp;
    int ans = 0;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        if(mp[s] == 0){
            ans++;
            mp[s] = 1;
        }
    }
    cout << ans << "\n";
    return 0;
}


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

const int mod = 1000000007;
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, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  
  mint ans = 3;
  vector<ll> B(3);
  B.at(0)=1;
  B.at(1)=0;
  B.at(2)=0;

  FOR(i,1,N){
    ll cnt = 0;
    ll flag=0;
    REP(j,3){
      if(A.at(i)==B.at(j)){
        if(flag==0){
          B.at(j)++;
          flag=1;
        }
        cnt++;
      }
    }
    ans*=cnt;
  }
  if(A[0]!=0){
    cout << 0 << endl;
  }else{
    cout << ans << endl;
  }
}

Measured memory_bytes: 4032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 
	ll ans[100010];
int main() {
	bool ch[100010];
	for(ll i=2;i<=100000;i++){
		ch[i]=false;
		bool so=true;
		for(ll j=2;j<=sqrt(i);j++){
			if(i%j==0){
				so=false;
			}
		}
		if(so){
			ch[i]=true;
		}
	}
//	cout << ch[4]<<endl;
	for(ll i=1;i<100010;i++){
		if(ch[i]&&ch[(i+1)/2]){
			ans[i]=1+ans[i-1];
		}
		else{
			ans[i]=ans[i-1];
		}
	}
//	cout << ans[3]<<endl;
	ll q;
	cin>>q;
	for(ll i=0;i<q;i++){
		ll x,y;
		cin>>x>>y;
		cout << ans[y]-ans[x-1]<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,c=1,mx;
    cin>>n;
 for (int i=0;i<n;i++ )
 {
     cin>>a;
     if(i==0){mx=a;}
     else {
    if(a<mx){c++;mx=a;}
     }
 }
    cout<<c<<endl;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */
int main(){
    double a, b; cin >> a >>b;
    double m = max(12.5*a, 10*b);
    double M = min(12.5*(a+1), 10*(b+1));
    if(ceil(m) < M) out(ceil(m));
    else out(-1);
}

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

using namespace std;

int main() {
    int x,y;
    cin>>x;
    if(x%2==1){
        y=x/2+1;
        cout<<y;
    }
    else {
        y=x/2;
        cout<<y;
    }
   return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn._

object Main extends App {
  val n = readInt()

  require(2 <= n && n <= 10)

  var i = 0
  var j = 0.0
  while (i < n) {
    val Seq(x, u) = readLine().split(" ").toSeq
    u match {
      case "JPY" => j = j + x.toDouble
      case "BTC" => j = j + x.toDouble * 380000.0
    }
    i = i + 1
  }
  println(j)
}


Measured memory_bytes: 54812
#include <stdio.h>

int main(void)
{
	int r=0, c=0;
	int i,j;
	int a[101][101];
	int rsum=0;
	int csum=0;
	int nsum=0;

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

	for(i=0;i<r;i++){
		for(j=0;j<c;j++){
		rsum += a[i][j];
		printf("%d",a[i][j]);
		if(j!=c){
			putchar(' ');
			}
		}
		printf("%d\n",rsum);
		rsum=0;
		}

	for(i=0;i<c;i++){
		for(j=0;j<r;j++){
		csum += a[j][i];
		}
		printf("%d ",csum);
		csum=0;
		}
		printf("%d\n",nsum);

	return 0;
}

Measured memory_bytes: 644
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;

#define MAXN 5000
#define INF 0x7f7f7f7f

int dis[4 + 5][2] = {{}, {1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int s[MAXN + 5][MAXN + 5];
char c[MAXN + 5][MAXN + 5];
bool vis[MAXN + 5][MAXN + 5];

void scan(int &x) {
    x = 0;

    char c = getchar();
    int f = 1;

    while ('0' > c || c > '9') {
        if (c == '-') {
            f = -1;
        }

        c = getchar();
    }

    while ('0' <= c && c <= '9') {
        x = x * 10 - '0' + c;

        c = getchar();
    }

    x *= f;

    return;
}

void print(int x) {
    if (x < 0) {
        putchar('-');
        print(0 - x);

        return;
    }

    if (x >= 10) {
        print(x / 10);
    }

    putchar(x % 10 + '0');

    return;
}

struct node {
	int x, y, n;
	node (){}
	
	node (int a, int b, int c) {
		x = a;
		y = b;
		n = c;
	}
};
bool operator < (const node a, const node b) {
	if (a.n < b.n) {
		return 1;
	}
	else {
		return 0;
	}
}
bool operator > (const node a, const node b) {
	if (a.n > b.n) {
		return 1;
	}
	else {
		return 0;
	}
}

int main (){
	int n, m;
	int xa, ya;
	int xb, yb;
	priority_queue <node, vector <node>, greater <node> > q;
	
	scan (n);
	scan (m);
	scan (xa);
	scan (ya);
	scan (xb);
	scan (yb);
	for (int i = 1; i <= n; i ++) {
		scanf ("%s", c[i] + 1);
	}
	for (int i = 1; i <= n; i ++) {
		for (int j = 1; j <= m; j ++) {
			s[i][j] = INF;
		}
	}
	q.push (node (xa, ya, 0));
	s[xa][ya] = 0;
	vis[xa][yb] = 1;
	while (!q.empty ()) {
		node a = q.top ();
		
		q.pop ();
		vis[a.x][a.y] = 1;
		for (int i = 1; i <= 4; i ++) {
			int x, y;
			
			x = a.x + dis[i][0];
			y = a.y + dis[i][1];
			if (x > 0 && x <= n && y > 0 && y <= m && c[x][y] != '#' && s[x][y] > s[a.x][a.y]) {
				s[x][y] = s[a.x][a.y];
				if (!vis[x][y]) {
					q.push (node (x, y, s[x][y]));
				}
			}
		}
		for (int i = max (a.x - 2, 1); i <= a.x + 2; i++) {
			if (i > n) {
				break;
			}
			for (int j = max (a.y - 2, 1); j <= a.y + 2; j ++) {
				if (j > m) {
					break;
				}
				if (c[i][j] != '#' && s[i][j] > s[a.x][a.y] + 1) {
					s[i][j] = s[a.x][a.y] + 1;
					if (!vis[i][j]) {
						q.push (node (i, j, s[i][j]));
					}
				}
			}
		}
	}
	if (s[xb][yb] >= INF) {
		print (-1);
	}
	else {
		print (s[xb][yb]);
	}
	
	return 0;
}



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

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

    int N, M; cin >> N >> M;
    vector<int> X(M);
    for (int i = 0; i < M; i++) cin >> X[i];
    sort(X.begin(), X.end());

    vector<int> d(M-1);
    for (int i = 0; i < M-1; i++) d[i] = X[i+1] - X[i];
    sort(d.begin(), d.end(), greater<int>());

    int ans = 0;
    for (int i = N-1; i < M-1; i++) ans += d[i];
    cout << ans << "\n";
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoders {
	class Program {
		static void Main(string[] args) {

		
			var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			var H = (int)inputArray[0];
			var W = (int)inputArray[1];

			var map = new bool[H, W];

			for (int h = 0; h < H; h++) {
				var inp = retreiveStringArray()[0];
				for (int w = 0; w < W; w++) {
					map[h, w] = inp[w] == '.';
				}

			}


			var flip = new int[H, W];
			flip[0, 0] = 0;
			for (int h = 0; h < H; h++) {
				for (int w = 0; w < W; w++) {
					if (h==0 && w==0) {
						continue;
					}

					var hRoot = int.MaxValue;
					if (h>0) {
						var plus = map[h - 1, w] == map[h, w] ? 0 : 1;
						hRoot = flip[h - 1, w] + plus;
					}
					var wRoot = int.MaxValue;
					if (w > 0) {
						var plus = map[h, w-1] == map[h, w] ? 0 : 1;
						wRoot = flip[h , w-1] + plus;
					}
					flip[h, w] = Math.Min(hRoot, wRoot);
				}

			}


			//答えの出力
			var ans = (flip[H-1, W-1]+1)/2;

			if (!map[0,0] && !map[H-1,W-1]) {
				ans++;
			}

			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}


Measured memory_bytes: 28284
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;

int main()
{
	int a,b,c,count=0;
	cin >> a >> b >> c;
	for(int i = a; i <= b; i++){
		if(c%i == 0)
			count++;
	}
	cout << count << "\n";
	return 0;
}

Measured memory_bytes: 3096
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * 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;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            in.next();
            for (int i = 0; i < n; i++) {
                String s = in.next();
                out.printf("%s\n%s\n", s, s);
            }
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 21840
#include <stdio.h>
#include <stdlib.h>

int GCD(int ,int);

int main(void){

  	int N,M;
	long long int G,i,n,m;
	char *S,*T;
  
	scanf("%d %d",&N,&M);
	S = (char *)malloc((N+1)*sizeof(char));
	T = (char *)malloc((M+1)*sizeof(char));
	scanf("%s",S);
	scanf("%s",T);

	G = GCD(N,M);
  	n = N/G;
  	m = M/G;

	for(i=0;i<G;i++){
    	if(S[i*n] != T[i*m]){
 			printf("-1\n");       	
			free(S);
			free(T);
			return 0;
        }
    }
  
	printf("%lld\n",(long long int)(N/G*M));

	free(S);
	free(T);
	return 0;
}


int GCD(int a,int b){
	
	int tmp,r;
	
	if(a<b){
		tmp = a;
		a = b;
		b = tmp;
	}
	
	r = a % b;
	
	while(r != 0){
		a = b;
		b = r;
		r = a % b;
	}
  	return b;

}


Measured memory_bytes: 356
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX*/

using namespace std;

using ll = long long;

#define mp make_pair

const int p = 786433;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);

    int h, w;
    cin>>h>>w;
    vector<string> s(h);
    for (int i = 0; i<h; i++) cin>>s[i];

    vector<vector<int>> dp(h, vector<int>(w, 10000));
    if (s[0][0]=='#') dp[0][0] = 1; else dp[0][0] = 0;
    for (int r = 0; r<h; r++)
        for (int c = 0; c<w; c++) if (r+c)
            {
                if (r>0) dp[r][c] = min(dp[r][c], dp[r-1][c] + (s[r-1][c]!=s[r][c]));
                if (c>0) dp[r][c] = min(dp[r][c], dp[r][c-1] + (s[r][c-1]!=s[r][c]));
            }
    if (s[h-1][w-1]=='#') dp[h-1][w-1]++;
    cout<<dp[h-1][w-1]/2;

}




Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
inline int read()
{
	int res, ok = 1;
	char ch;
	for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
	if (ch == '-')
	ok = -1;
	res = ch - '0';
	for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
	res = res * 10 + ch - '0';
	return res * ok;
}
long long mod = 1e9 + 7;
int n, m, k;
long long qp2[1000005], qp3[1000005], f[1000005], rev[1000005], fac[1000005], ans, last;
inline long long C (int x, int y)
{
	long long num = f[y];
	num = num * fac[x] % mod;
	num = num * fac[y - x] % mod;
	return num;
}
int main()
{
	n = read();
	m = read();
	k = read();
	qp2[0] = 1;
	qp3[0] = 1;
	f[0] = 1;
	rev[0] = rev[1] = 1;
	fac[0] = fac[1] = 1;
	for (int i = 1; i <= n + m + k; i++)
	{
		qp2[i] = qp2[i - 1] * 2 % mod;
		qp3[i] = qp3[i - 1] * 3 % mod;
		f[i] = f[i - 1] * i % mod;
		if (i >= 2)
		{
			rev[i] = mod - (mod / i) * rev[mod % i] % mod;
			fac[i] = fac[i - 1] * rev[i] % mod;
		}
	}
	if (m > k)
	swap (m, k);
	for (int i = 0; i <= m; i++)
	ans = (ans + qp2[i] * C (i, i + n - 1) % mod * qp3[m + k - i] % mod) % mod;
	last = qp2[m];
	for (int i = m + 1; i <= m + k; i++)
	{
		last <<= 1;
		last -= C (m, i - 1);
		last %= mod;
		if (i > k)
		last -= C (i - k - 1, i - 1);
		last %= mod;
		if (last < 0)
		last += mod;
		if (last >= mod)
		last -= mod;
		ans = (ans + last * C (i, i + n - 1) % mod * qp3[m + k - i] % mod) % mod;
	}
	printf ("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 39168
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a < 10 && b < 10) {
    cout << a * b << endl;
  } else {
    cout << -1 << endl;
  }
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
   ll a,b,x;cin >>a>>b>>x;
   ll ans=a?(b/x)-(a-1)/x:(b/x)+1;
   cout <<ans<<endl;
    return 0;
}



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

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

using namespace std;

const int MAX_N=1e2;

int N,L;
string S[MAX_N];

int main(){
	cin>>N>>L;
	REP(i,N){
		cin>>S[i];
	}
	sort(S,S+N);
	string res="";
	REP(i,N){
		res+=S[i];
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(3 * n);
    rep(i, 3 * n) cin >> a[i];
    sort(all(a));
    ll ans = 0;
    rep(i, n) {
        ans += a[n + 2 * i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const long long  mod = 1000000007;



int main(){
  ll n;
  cin >> n;
  vector<ll> a(5);
  rep(i,5) cin >> a[i];

  ll mn = 1e16;
  rep(i,5) mn = min(mn,a[i]);

  if(n <= mn){
    cout << 5 << endl;
    return 0;
  }

  ll cnt;
  if(n%mn == 0)  cnt = n/mn;
  else  cnt = n/mn+1;
  
  ll ans = 4 + cnt;
  cout << ans << endl;

  
}


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

int main() {
    int h, w, cnt = 0;
    char a[10][10];
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            a[i][j] = 0;
            cin >> a[i][j];
            if (a[i][j] == '#') cnt++;
        }
    }

    if (cnt == h + w - 1) cout << "Possible" << endl;
    else cout << "Impossible" << endl;

    return 0;
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const D = parseInt(arg[0].split(" ")[0]);
    const N = parseInt(arg[0].split(" ")[1]);
    
    let temp = [...Array(D * 2)].fill(0);
    let answer = parseInt(N + String(temp.join("")));
    let plus  = parseInt(1 + String(temp.join("")));
    
    console.log(N !== 100 ? answer : answer + plus);

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i) >> b.at(i) >> c.at(i);
    }
    //dpテーブル
    long long dp[6][n + 10];

    dp[0][0] = a.at(0);
    dp[2][0] = b.at(0);
    dp[4][0] = c.at(0);

    for (int i = 1; i < n; i++)
    {
        dp[0][i] = a.at(i) + dp[2][i - 1];
        dp[1][i] = a.at(i) + dp[4][i - 1];
        dp[2][i] = b.at(i) + dp[0][i - 1];
        dp[3][i] = b.at(i) + dp[4][i - 1];
        dp[4][i] = c.at(i) + dp[0][i - 1];
        dp[5][i] = c.at(i) + dp[2][i - 1];

        //まとめ
        dp[0][i] = max(dp[0][i], dp[1][i]);
        dp[2][i] = max(dp[2][i], dp[3][i]);
        dp[4][i] = max(dp[4][i], dp[5][i]);
    }

    cout << max(dp[0][n - 1], max(dp[2][n - 1], dp[4][n - 1]));
}


Measured memory_bytes: 6144
<?php
$n = int();
for($i = 0; $i < $n; $i++){
    @$map[str()]++;
}
$max = max($map);
foreach($map as $key => $value){
    if($value == $max){
        $ans[] = $key;
    }
}
sort($ans);
echo implode("\n", $ans), "\n";

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}
/**
 * 座圧対象の配列を渡すと以下の値を返す
 * ・圧縮された配列
 * ・復元用のMap
 * ・圧縮用のMap
 **/
function atsu($array){
    $a = array_flip($array);
    $fuku = array_flip($a);
    sort($fuku);
    $atsu = array_flip($fuku);
    foreach($array as $i => $val)$array[$i] = $atsu[$val];
    return [$array, $fuku, $atsu];
}
//配列の最大公約数
function gcdAll($array){
    $gcd = $array[0];
    for($i = 1; $i < count($array); $i++){
        $gcd = gcd($gcd, $array[$i]);
    }
    return $gcd;
}

//最大公約数
function gcd($m, $n){
    if(!$n)return $m;
    return gcd($n, $m % $n);
}

//配列の最小公倍数
function lcmAll($array){
    $lcm = $array[0];
    for($i = 1; $i < count($array); $i++){
        $lcm = lcm($lcm, $array[$i]);
    }
    return $lcm;
}

//最小公倍数
function lcm($a, $b) {
    return $a / gcd($a, $b) * $b;
}
//ビットカウント-1の数を数える
function popcount($x){
    $con = 0;
    while ($x) {
        $x &= $x-1;
        ++$con;
    }
    return $con;
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        boolean array[] = new boolean[26];
        for(int i = 0;i < str.length();i++)
            array[str.charAt(i) - 'a'] = true;
        for(int i = 0;i < 26;i++){
            if(!array[i]){
                System.out.println((char)(i + 97));
                return;
            }
        }
        System.out.println("None");
    }
}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
#define rgi register int
#define ll long long
class fastin{
	private: int _ch,_f;
	public: template<typename _Tp> inline fastin& operator>>(_Tp&_x){
		_x=0; while(!isdigit(_ch)) _f|=(_ch==45),_ch=getchar();
		while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),_ch=getchar();
		_f&&(_x=-_x,_f=0); return *this;}
	fastin() {_ch=_f=0;}
}fin;
class fastout{
	private: int _num[32],_head;
	public: int SUF; template<typename _Tp> inline fastout& operator<<(_Tp _x){
		_Tp _k; if(_x==0) {putchar('0'),putchar(SUF);return *this;} if(_x<0) putchar('-'),_x=-_x;
		while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
		while(_head>0) putchar(_num[_head]),--_head; putchar(SUF); return *this;}
	fastout() {_head=0,SUF=' ';}
}fout;
// ----------------------------
// #define int ll
using namespace std;
const int maxn=200004;
const int mod=998244353,inf=1000000007;


int n,cnt;
int book[maxn];
char out[maxn];
void dfs(int now,int pre)
{
	if(now==n) {cout<<out<<endl; return;}
	for(int i=0;i<=cnt;++i)
	{
		if(book[i]==0) ++cnt;
		++book[i];
		out[now]=i+'a';
		dfs(now+1,i);
		--book[i];
		if(book[i]==0) --cnt;
	}
}
signed main()
{
	cin>>n;
	out[n]='\0';
	dfs(0,0);
	return 0;
}
// ----------------------------
// by imzzy


Measured memory_bytes: 1536
def f(n,ais):
	ma,mi = max(ais), min(ais)
	res = []
	if ma + mi > 0:
		j = [j for j in range(len(ais)) if ais[j] == ma][0]
		for i in range(len(ais)):
			if ais[i] != ma:
				ais[i] += ais[j]
				res.append([j+1,i+1])

		for i in range(1,len(ais)):
			if ais[i-1] > ais[i]:
				ais[i] += ais[i-1]
				res.append([i-1+1, i+1])
	else:
		j = [j for j in range(len(ais)) if ais[j] == mi][0]
		for i in range(len(ais)):
			if ais[i] != mi:
				ais[i] += ais[j]
				res.append([j+1, i+1])
		for i in range(len(ais)-1, 0, -1):
			if not(ais[i - 1] <= ais[i ]):
				ais[i-1] += ais[i]
				res.append([i+1, i-1+1])
	print len(res)
	for u,v in res:
		print u,v
f(int(raw_input()),map(int, raw_input().split()))


Measured memory_bytes: 84712