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

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		String string;
		int n, old;
		
		while(!(string = reader.readLine()).equals("0")){
			n = Integer.parseInt(string);
			
			int[] age = new int[7];
			for(int i = 0; i < n; i++){
				old = Integer.parseInt(reader.readLine());
				if(old < 10) age[0]++;
				if(10 <= old && old < 20) age[1]++;
				if(20 <= old && old < 30) age[2]++;
				if(30 <= old && old < 40) age[3]++;
				if(40 <= old && old < 50) age[4]++;
				if(50 <= old && old < 60) age[5]++;
				if(60 <= old) age[6]++;
			}
			for(int var : age)System.out.println(var);
		}
		reader.close();
	}
}

Measured memory_bytes: 62172
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
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 gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

    string s;
    cin >> s;

    //vector<int>n((int)s.size()-2);
    cout<< s[0]<<(int)s.size()-2<<s[(int)s.size()-1]<<endl;
 
}


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

int main(){
	int n, a, s = 0, t = 0;
	cin>> n;
	vector<int> v;
	for( int i= 0; i< n; ++i ){
		cin >> a;
		v.push_back(a);
	}

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

	for( int i = 0;i<n;++i){
		if( i%2)
			s+=v[i];
		else
			t+=v[i];
	}

	cout << abs(s-t) << endl;
	return 0;
}

Measured memory_bytes: 256
import Control.Monad

main = do
    (n : abc) <- fmap read <$> words <$> getLine
    ls <- forM [1..n] $ \i -> read <$> getLine
    putStrLn $ show $ solve n abc ls

solve :: Int -> [Int] -> [Int] -> Int
solve n abc ls = doit 0 abc ls []
  where
    doit s []       ls  m = 0
    doit 0 (a : bc) []  m = 1000 * 1000
    doit s (a : bc) []  m = abs (s - a) - 10 + doit 0 bc m []
    doit s abc (l : lt) m = min (10 + doit (s + l) abc lt m) (doit s abc lt (l : m))


Measured memory_bytes: 1020
#include <string>
#include <iostream>
#include <vector>
#include <sstream>
#include <istream>

int main()
{
    int n;
    std::vector<char> s;
    std::cin >> n;
   
    std::string b;
    std::cin.ignore();
    std::getline(std::cin, b);

    std::stringstream ss(b);
    std::string buf;
    
    while (std::getline(ss, buf, ' ')) {
        s.push_back(buf[0]);
    }

    bool flags[4] = {};
    for (auto a : s) {
        if (a == 'P')flags[0] = true;
        else if (a == 'W')flags[1] = true;
        else if (a == 'G')flags[2] = true;
        else if(a=='Y')flags[3] = true;
    }

    int c = 0;
    for (int i = 0; i < 4; i++) {
        if (flags[i])c++;
    }

    if (c == 3)std::cout << "Three"<<std::endl;
    else std::cout << "Four" << std::endl;


    return 0;
}



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

using namespace std;

typedef long long ll;

const int N = 100100;

map<int, int> pos;
map<int, ll> cnt;

ll ans[N];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    set<int, greater<int>> kek;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        kek.insert(a[i]);
        ++cnt[a[i]];
        if (!pos.count(a[i])) {
            pos[a[i]] = i + 1;
        }
    }
    int ind = n;
    for (auto i = kek.begin(); i != kek.end(); ++i) {
        ind = min(ind, pos[*i]);
        int next = 0;
        auto j = i;
        ++j;
        if (j != kek.end()) {
            next = *j;
        }
        ans[ind] += cnt[*i] * (*i - next);
        cnt[next] += cnt[*i];
    }
    for (int i = 1; i <= n; ++i) {
        cout << ans[i] << '\n';
    }
    return 0;
}

Measured memory_bytes: 17792
import math
a,b,h,m = map(int,input().split())
#長身
q = (m/60)*360
#単身
s = (h/12)*360+m*0.5
#print(s,q)
w = min(abs(s-q),abs(360-(s-q)))
z = a**2+b**2-2*a*b*math.cos(math.radians(w))
#print(z)
print(z**0.5)

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

int main() {
  string s;
  int i,j,lens;
  int cnt;
  cin >> s;
  lens = s.size();
  for(i=0;i<lens;i=i+2) {
    cout << s[i];
  }
  cout << endl;
  return(0);
}

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

int main(void) {
  int K, A, B;
  cin >> K >> A >> B;
  for (int i = A; i <= B; i++) {
    if (i % K == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
 
class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
    int N;
    string S;
    void solve()
    {
        S = cin.next;
        N = S.Length;
        var A = new int[26];
        var B = new int[N];
        for (int i = 0; i < N; i++)
        {
            B[i] = alfa.IndexOf(S[i]);
            A[B[i]]++;
        }
        long ans = 1;
        ans += (long)N * (N - 1) / 2;
        for (int i = 0; i < 26; i++)
        {
            if(A[i] > 1)
            {
                ans -= (long)A[i] * (A[i] - 1) / 2;
            }
        }
        WriteLine(ans);
 
    }
 
}
 
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13404
h,w=map(int,input().split())
board=[list(map(str,input().split())) for _ in range(h)]
pos="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(h):
  for j in range(w):
    if board[i][j]=="snuke":
      print(pos[j]+str(i+1))
      exit()

Measured memory_bytes: 3060
import sys
from io import StringIO
import unittest
# import numpy as np

def resolve():
    # s = input()
    n = int(input())
    a = list(map(int, input().split()))
    # l = [list(map(int, input().split())) for _ in range(n)]

    thr = 10 ** 18
    a.sort(reverse=True)
    ans = 1

    if 0 in a:
        ans = 0
    else:
        for a_i in a:
            ans *= a_i

            if ans > thr:
                ans = -1
                break

    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2
1000000000 1000000000"""
        output = """1000000000000000000"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3
101 9901 999999000001"""
        output = """-1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0"""
        output = """0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 88080
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const ll mod = 1e9+7;
 
ll Pow(ll x, ll n){
  if(n == 0) return 1;
  if(n % 2 == 0) return Pow(x*x % mod, n/2);
  else return x * Pow(x,n-1) % mod;
}
 
int main(){
  ll n, c;
  cin >> n >> c;
  ll a[n], b[n];
  map<int,int> m;
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  vector<vector<ll>> sum(401,vector<ll>(401,0));
  rep(i,401) {
    rep(j,400) {
      sum[i][j+1] = (sum[i][j] + Pow(j+1,i)) % mod; 
    }
  }
  vector<vector<ll>> dp(n+1,vector<ll>(c+1,0));
  dp[0][0] = 1;
  rep(i,n) { 
    rep(j,c+1) {
      rep(k,j+1) (dp[i+1][j] += (sum[j-k][b[i]]-sum[j-k][a[i]-1])*dp[i][k] % mod) %= mod; 
    }
  }
  cout << (dp[n][c] + mod) % mod << endl;
  return 0;
}

Measured memory_bytes: 2816
import numpy as np

def solve(stdin):
    n = stdin[0]
    dp = np.zeros(n+1,dtype=np.int64)
    for i in range(1,n+1):
        for j in range(i,n+1,i):
            dp[j]+=1
    dp*=np.arange(n+1)
    return dp.sum()

def main():
    stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=' ')
    print(solve(stdin))

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()

if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()

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

int main(){
  string str;
  cin>>str;
  for(int i=0;i<4;i++)cout<<str[i];
  cout<<" ";
  for(int i=4;i<str.size();i++)cout<<str[i];
  cout<<endl;
  return 0;
}


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

using namespace std;

int main() {
  int n; cin >> n;
  string S; cin >> S;
  if (n % 2 == 0 && S.substr(0,n/2) == S.substr(n/2)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
As = [int(input()) for i in range(n)]
dp  = [0] * n #どこまで伸ばせたか
mx = 0
prev = 0
for i,a in enumerate(As):
    if a == 0:continue
    # prev + 1より大きくなることはありえない
    if prev + 1 < a:
        print(-1)
        exit()
    if i - a < mx: #遡ってしまったら
        print(-1)
        exit()
    else:
        dp[i-a] = a
        mx = i-a
    prev = a
print(sum(dp))    

Measured memory_bytes: 18640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string A;
  cin >> A;
  
  if(A[0]==A[1] || A[1]==A[2] || A[2]==A[3]){
    cout << "Bad" << endl;
  }
  else if(A[0]==A[1]==A[2] ||A[1]==A[2]==A[3]){
    cout << "Bad" << endl;
  }
  else{
    cout << "Good"<< endl;
  }
}

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

T, A = list(map(int , input().split()))

H = list(map(int , input().split()))

Tlist =[]

for n in range(N):
	Tlist.append(T - H[n]*0.006)

t = Tlist[0]
m = 0

for n in range(N):
	if abs(t-A) > abs(Tlist[n]-A):
		t = Tlist[n]
		m = n

M = m + 1
print(M)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            string[] input = Console.ReadLine().Split(' ');
            int[] A = new int[m];
            int sum = 0;
            
            for(int i = 0; i < m; i++)
            {
                A[i] = int.Parse(input[i]);
                sum += A[i];
            }
            if (n < sum) Console.WriteLine("-1");
            else Console.WriteLine(n - sum);

        }
    }
}

Measured memory_bytes: 19332
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

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

i64 n,m;
cin >> n >> m;
cout << (n == m ? "Yes" : "No") << endl;
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int N = input();
    vector< int > L(N);
    cin >> L;

    whole(sort, L);

    cout << (accumulate(L.begin(), L.end() - 1, 0ll) > L.back() ? "Yes" : "No") << endl; 
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 256
n, m = map(int,input().split())
ll, rr = 0, 100000 
for i in range(m):
    l, r = map(int,input().split())
    if ll < l:
        ll = l
    if r < rr:
        rr = r
s = rr -ll
if s < 0:
    s = 0
else:
    s += 1
print(s)

Measured memory_bytes: 3060
X = int(input())

max_val = 0

if X == 1:
    max_val = 1

for b in range(2,X):
    p = 2
    while(True):
        val = b ** p
        if val > X:
            break
        if val >= max_val:
            max_val = val
        p += 1

print(max_val)

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

int main() {
    ll N;
    cin >>N;
    map<ll,int> mp;
    for(int i=0;i<N;i++){
        ll A;
        cin >> A;
        mp[A]++;
        if(mp[A] ==3){
            mp[A] =1;
        }
    }
    ll secondNum =0;
    for(auto itr=mp.begin();itr != mp.end();++itr){
        if(itr->second ==2){
            secondNum++;
        }
    }
    ll ans = mp.size();
    if(secondNum%2==1){
        ans--;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6528
#!/usr/bin/env python3

d = int(input())
c = list(map(int, input().split()))
s = [[0 for _ in range(26)] for _ in range(d)]
for i in range(d):
    s[i] = list(map(int, input().split()))

def maxcontest(s):
    ans = -1
    for i in range(26):
        if ans <= s[i]:
            ans = s[i]
            num = i 
    return num+1

for i in range(d):
    print(maxcontest(s[i]))


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

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

  if(b%a==0)cout << a+b <<endl;
  else cout <<b-a << endl;

}


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

using namespace std;

#define endl            "\n"
#define sz(x)          (int) (x.size())
#define all(v)          v.begin(), v.end()
#define isOdd(n)       (n&1)
#define pow(n, m)      (ll)powl(n, m)
#define clr(x, val)     memset(x, val, sizeof(x))

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;



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

    string s; cin >> s;
    int n = s.size();
    int c = 0;
    for(int i = 0; i < n; i++){
        c += ((s[i] - '0') * 10%9) % 9;
        c %= 9;
    }
    cout << (!c ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 3740
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define mod 1000000007;
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long double a,b;
    cin>>a>>b;
    long double c=a*b;
    ll d=floor(c);
    cout<<d;
    

    return 0;
}

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

long long n, x;
long long all[51], p[51];

long long calc(long long level, long long k) {
  if (level == 0 || k == 0) {
    return k;
  }
  if (k == all[level-1] * 2 + 3) {
    return p[level-1] * 2 + 1;
  } else if (k > all[level-1] + 2) {
    return p[level-1] + calc(level-1, k - all[level-1] - 2) + 1;
  } else if (k == all[level-1] + 2) {
    return p[level-1] + 1;
  } else {
    return calc(level-1, k-1);
  }
}
int main() {
  cin>>n>>x;
  all[0] = 1;
  p[0] = 1;
  for (int i=1; i<n; i++) {
    all[i] = all[i-1] * 2 + 3;
    p[i] = p[i-1] * 2 + 1;
  }
  cout<<calc(n, x)<<endl;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    N=int(input())
    Ms=set()
    As=set()
    Rs=set()
    Cs=set()
    Hs=set()
    for i in range(N):
        name=input()
        if name[0]=="A":
            As.add(name)
        elif name[0]=="M":
            Ms.add(name)
        elif name[0]=="R":
            Rs.add(name)
        elif name[0]=="C":
            Cs.add(name)
        elif name[0]=="H":
            Hs.add(name)
    NAMES=[Ms.__len__(),As.__len__(),Rs.__len__(),Cs.__len__(),Hs.__len__()]
    zeros=NAMES.count(0)
    if zeros>=3:
        print(0)
    else:
        from itertools import combinations
        ans=0
        for comb in combinations(NAMES,3):
            if 0 in comb:
                continue
            else:
                temp=1
                for c in comb:
                    temp*=c
                ans+=temp
        print(ans)



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

typedef long long ll;

ll N;
vector<ll> A, B;

ll solve() {
  if (N % 2 == 1) {
    return B[N / 2] - A[N / 2] + 1;
  } else {
    return (B[N / 2 - 1] + B[N / 2]) - (A[N / 2 - 1] + A[N / 2]) + 1;
  }
}
int main() {
  cin >> N;
  A.resize(N);
  B.resize(N);
  for (ll i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
  }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 6408
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll j,mx[263005][2],mx2[263005][2],ans[263005],n,i,a[263005];
void update(ll a,ll b,ll c)
{
	if(mx[a][1]==c||mx2[a][1]==c)return;
	if(mx[a][0]<b)
	{
		mx2[a][0]=mx[a][0];
		mx2[a][1]=mx[a][1];
		mx[a][0]=b;
		mx[a][1]=c;
	}
	else if(mx2[a][0]<b)
	{
		mx2[a][0]=b;
		mx2[a][1]=c;
	}
}
int main()
{
	cin>>n;
	for(i=0;i<(1<<n);i++)cin>>a[i];
	memset(mx,-1,sizeof(mx));
	memset(mx2,-1,sizeof(mx2));
	ans[1]=a[0]+a[1];
	cout<<ans[1]<<endl;
	update(0,a[0],0);
	update(1,a[0],0);
	update(1,a[1],1);
	for(i=2;i<(1<<n);i++)
	{
		ans[i]=ans[i-1];
		update(i,a[i],i);
		for(j=0;j<n;j++)
		{
			if((1<<j)&i)
			{
				update(i,mx[i-(1<<j)][0],mx[i-(1<<j)][1]);
				update(i,mx2[i-(1<<j)][0],mx2[i-(1<<j)][1]);
			}
		}
		ans[i]=max(ans[i],mx[i][0]+mx2[i][0]);
		cout<<ans[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 15360
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>

template<typename T> bool chmax(T &a,T b){
    if(a<b){
        a=b;
        return true;
    }
    return false;
}

template<typename T> bool chmin(T &a,T b){
    if(a>b){
        a=b;
        return true;
    }
    return false;
}

using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=2147483647;
const ll LLMAX=9223372036854775807;

ll modadd(ll a,ll b,ll mod=MOD){
    return (a%mod+b%mod)%mod;
}

ll modsub(ll a,ll b,ll mod=MOD){
    a%=mod;
    b%=mod;
    if(a>=b) return a-b;
    else return mod-b+a;
}

ll modmul(ll a,ll b,ll mod=MOD){
    return ((a%mod)*(b%mod))%mod;
}

ll modpow(ll a, ll n,ll mod=MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll moddiv(ll a,ll b,ll mod=MOD) {
    return modmul(a, modpow(b, mod-2));
}



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N;
    cin>>N;
    
    vll count(1000,0);
    for(ll i=2;i<=N;i++){
        ll val=i;
        for(ll j=2;j<=sqrt(i);j++){
            while(val%j==0){
                count[j]++;
                val/=j;
            }
            if(val==1)break;
        }
        if(val!=1)count[val]++;
    }
    
    ll ans=1;
    for(ll j=2;j<1000;j++){
        ans=modmul(ans,count[j]+1);
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
       int A,B,C,D;
        while(~scanf("%d %d %d %d",&A,&B,&C,&D))
       {
                  int min1,min2,min;
                  min1=(A<B)? A:B;
                  min2=(C<D)? C:D;
                  min=min1+min2;
                   printf("%d\n",min);
       }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
#define Y printf("YES\n")
#define N printf("NO\n")
#define mp make_pair
#define pb push_back
#define tp make_tuple
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define pr(a) printf("%lld\n",a)
using namespace std;

int main()
{

    ll n,i,j,k;

    cin>>n;

    ll a[n+5],b[n+5];

    for(i=0;i<n;i++){

        cin>>a[i];
    }

    b[0]=a[0];

    for(i=1;i<n;i++){

        b[i]=a[i] ^ b[i-1];
    }

    k=b[n-1];

    for(i=0;i<n;i++){

        cout<<(k^a[i])<<" ";
    }

    cout<<endl;



}



Measured memory_bytes: 6684
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  ull n;cin >> n;
  string s;cin >> s;
  map<char,int> m;
  ull ans = 0;

  ull a=0,b=0,c=0;
  for(ull i = 0;i < sz(s) ;i++)
  {
    m[s[i]]++;
    // if(s[i] == 'R') a++;
    // else if(s[i] == 'G') b++;
    // else c++;
  }
  a = m['R'];
  b = m['G'];
  c = m['B'];

  ans = a * b * c;

  ull dis = 0;
  for(ull i = 0;i < n;i++)
  {
    for(ull j = i + 1;j < n; j++)
    {
      ull k = (j - i) + j;
      if(k >= n) break;
      if(s[i] != s[j] && s[j] != s[k] && s[k] != s[i])
        dis++;
    }
  }

  cout << (ull)(ans - dis) << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(s...) fprintf(stderr, s)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }

int N;
LL A[100111], L;

int main() {
    scanf("%d%lld", &N, &L);

    REP (i, N) scanf("%lld", A+i);

    int p = -1;
    REP (i, N-1) if (A[i] + A[i+1] >= L) p = i;

    if (p == -1) {
	puts("Impossible");
    } else {
	puts("Possible");
	REP (i, p) printf("%d\n", i+1);
	for (int i=N-2; i>=p; i--) printf("%d\n", i+1);
    }


    return 0;
}




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

template<Int MOD = 1000000007>
struct Mod{
  Int prev=0;
  vector<Int> fact,inv,finv;
  Mod(){}
  Mod(Int n){init(n);}
  
  Int pow(Int x,Int n){
    Int res=1;
    while(n){
      if(n&1) (res*=x)%=MOD;
      (x*=x)%=MOD;
      n>>=1;
    }
    return res;
  }
  
  Int inverse(Int a){
    return pow(a,MOD-2);
  }
  
  void init(Int n){
    if(prev>=n) return;
    prev=n;
    fact=inv=finv=vector<Int>(n);
    
    fact[0]=1;
    for(Int i=1;i<n;i++)
      fact[i]=(fact[i-1]*i)%MOD;
    
    inv[1]=1;
    for(Int i=2;i<n;i++)
      inv[i]=inv[MOD%i]*(MOD-MOD/i)%MOD;
    
    finv[0]=1;
    for(Int i=1;i<n;i++)
      finv[i]=finv[i-1]*inv[i]%MOD;
  }
  
  Int comb(Int n,Int k){
    Int res=1;
    for(Int i=0;i<k;i++){
      res*=(n-i)%MOD;
      res%=MOD;
      res*=inverse(i+1);
      res%=MOD;
    }
    return res;
  }
  
  //only for prime MOD
  Int C(Int n,Int k){
    if(k<0||k>n) return 0;
    return fact[n]*finv[k]%MOD*finv[n-k]%MOD;
  }

  Int H(Int n,Int k){
    return C(n+k-1,n);
  }

  Int S(Int n,Int k){
    Int res=0;
    for(Int i=1;i<=k;i++){
      Int tmp=C(k,i)*pow(i,n)%MOD;
      if((k-i)&1) res+=MOD-tmp;
      else res+=tmp;
      res%=MOD;
    }
    res=res*finv[k]%MOD;
    return res;
  }
  
  Int B(Int n,Int k){
    Int res=0;
    for(Int j=1;j<=k;j++){
      res+=S(n,j);
      res%=MOD;
    }
    return res;
  }
  
  Int montmort(Int n){
    Int res=0,rinv=1;
    for(Int k=2;k<=n;k++){
      rinv=rinv*inverse(k)%MOD;
      if(k%2) res+MOD-rinv;
      else res+=rinv;
      res%=MOD;
    }
    for(Int i=1;i<=n;i++) res=res*i%MOD;
    return res;
  }
  
  // calculate P(t) from given points in [0,N]
  Int LagrangePolynomial(vector<Int> &y,Int t){
    Int n=y.size()-1;
    init(n+1);
    Int num=1;
    for(Int i=0;i<=n;i++)
      num=num*((t-i)%MOD)%MOD;
    Int res=0;
    for(Int i=0;i<=n;i++){
      Int tmp=(y[i]*num%MOD)*inverse((t-i)%MOD)%MOD;
      tmp=tmp*finv[i]%MOD;
      tmp=tmp*finv[n-i]%MOD;
      if((n-i)&1) tmp=MOD-tmp;
      res=(res+tmp)%MOD;
    }
    return res;
  }
};

//INSERT ABOVE HERE
signed main(){
  const Int MOD = 1e9+7;
  Mod<MOD> mod(2e5);
  Int n,k;
  cin>>n>>k;
  cout<<mod.S(n,k)<<endl;
  return 0;
}



Measured memory_bytes: 7468
from collections import deque
def main():
    X = input()
    stack = deque([])
    for i in range(len(X)):
        if X[i] == "S":
            stack.append(X[i])
        else:
            if len(stack) != 0:
                tmp = stack.pop()
                if tmp == "T":
                    stack.append(tmp)
                    stack.append(X[i])
            else:
                stack.append(X[i])
    print(len(stack))
if __name__ == '__main__':
    main()

Measured memory_bytes: 5080
package main

import "fmt"

func main() {
	var (
		input []int
		count int
	)

	input = make([]int, 3)

	for i := 0; i < len(input); i++ {
		fmt.Scan(&input[i])
	}

	for i := 0; i < len(input)-1; i++ {
		for j := i+1; j < len(input); j++ {
			if input[i] == input[j] {
				count++
			}
		}
	}

	if count == 1 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
using namespace std;
int fastin(){
	register int i; register char ch;
	while (ch = getchar(), ch < '0' || ch > '9');
	i = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9') i = i * 10 + ch - '0';
	return i;
}
int a[100008];
int main(){
	register int n, i, val, cnt, ans;
	n = fastin();
	if (n == 0) {
		puts("0");
		return 0;
	}
	for (i = 1; i <= n; ++i) a[i] = fastin();
	sort(a + 1, a + n + 1);
	val = a[1], cnt = 1, ans = 0;
	for (i = 2; i <= n; ++i) {
		if (a[i] != val) {
			if (val > cnt) ans += cnt;
			else ans += cnt - val; 
			val = a[i], cnt = 1;
		}
		else ++cnt;
	}
	if (val > cnt) ans += cnt;
	else ans += cnt - val; 
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    int a[50]={0};
    for(int i=0;i<m;i++){
        int tmp1,tmp2;
        scanf("%d%d",&tmp1,&tmp2);
        a[tmp1-1]++;
        a[tmp2-1]++;
    }
    for(int i=0;i<n;i++){
        printf("%d\n",a[i]);
    }
  
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n; cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v[i];
  int a = 1, ans = 0;
  rep(i, n){
    if(v[i] == a) a++;
    else ans++;
  }
  if(ans == n)cout << "-1" << endl;
  else cout << ans << endl;
  system("pause");
}

Measured memory_bytes: 1272
N = int(input())
A = list(map(int, input().split()))
B = set()
C = set()
for a in A:
    if a in B:
        C.add(a)
    else:
        B.add(a)
M = max(B)
bool = [1]*(M+1)
for c in C:
    bool[c] = 0
for b in B:
    for i in range(b*2, M+1, b):
        bool[i] = 0
ans = 0
for a in A:
    if bool[a] == 1:
        ans += 1
print(ans)


Measured memory_bytes: 34036
n = int(input())
a = list(map(int, input().split()))
even = [i for i in a if i%2 ==0]
count = 0 
for i in even:
  if i%3 == 0 or i%5 ==0:
    count += 1
print('APPROVED' if count == len(even) else 'DENIED')

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout << endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
struct edge { int to, cost; };
using P = pair<int, int>;
using PP=pair<P, int>;
const int mod = 1e9 + 7, inf = 1e16;

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			if (mod <= ans * x) ans = ans * x % mod;
			else ans *= x;
		}
		if (mod <= x * x) x = x * x % mod;
		else x *= x;
		n >>= 1;
	}
	return ans;
}

int fact_memo[114514];
int fact(int n) {
	int ans = 1;
	if (fact_memo[n]) return fact_memo[n];
	rep(i, n) {
		ans *= (i + 1);
		if (mod <= ans) ans %= mod;
		fact_memo[i + 1] = ans;
	}
	return (ans + mod) % mod;
}

int comb(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod * modpow(fact(r), mod - 2) + mod) % mod;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod + mod) % mod;
}

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

int lcm(int a, int b) {
	return a * b / gcd(a, b);
}

bool pri(int p) {
	for (int i = 2; i * i <= p; i++) if (p % i == 0) return false;
	return p > 1;
}

map<int, int>factring(int n) {
	map<int, int>ans;
	for (int i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			n /= i;
			ans[i]++;
		}
	}
	if (n != 1) ans[n]++;
	return ans;
}

P operator+(const P& a, const P& b) {
	return P(a.first + b.first, a.second + b.second);
}
P operator-(const P& a, const P& b) {
	return P(a.first - b.first, a.second - b.second);
}

int n, m, ans = 1;
map<int, int>mp;
signed main() {
	scanf("%lld %lld", &n, &m);
	mp = factring(m);
	for (P p : mp) {
		ans *= comb(p.second + n - 1, p.second);
		ans %= mod;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	 int n;
	 cin>>n;
	 bool found = false;int val;int ans;
	 for(int i =1;i<=n;i++)
	 {
          val = floor(i*1.08);
          if(val == n)
          {
          	ans = i;
          	found = true;break;
          }
	 }

	 if(!found)
	 	cout<<":("<<endl;
	 else
	 	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif
  
  int a, b; cin >> a >> b;
  cout << (a * b) << endl;

  return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    ll k;
    cin >> k;
    ll n = 50;
    vector<ll> ans(n, n - 1 + k / n);
    k %= n;
    for (int i = 0; i < k; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j)
                ans[j] += n;
            else
                ans[j] -= 1;
        }
    }
    cout << n << endl;
    cout << ans << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) {
  ll t;
  while (b != 0) {
    t = a%b; a = b; b = t;
  }
  return a;
}

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

  ll x = min(a, b);

  vector<ll> d;
  for (ll i = 1; i*i <= x; ++i) {
    if (x%i == 0) {
      if (a % i == 0 && b % i == 0) d.push_back(i);

      if (i*i != x) {
        ll j = x / i;
        if (a % j == 0 && b % j == 0) d.push_back(j);
      }
    }
  }
  sort(d.begin(), d.end());
  
  ll ans = 0;
  for (ll i = d.size()-1; i >= 0; --i) {
    bool so = true;
    for (ll j = i-1; j >= 0; --j) {
      if (gcd(d[i], d[j]) != 1) so = false;
    }

    if (so) ++ans;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
n, m = map(int, input().split())
sa = set()
sb = set()
for i in range(m):
  a, b = map(int, input().split())
  if a == 1:
    sa.add(b)
  if b == n:
    sb.add(a)

if len(sa&sb) == 0:
  print("IMPOSSIBLE")
else:
  print("POSSIBLE")  

Measured memory_bytes: 18892
using System;

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

            string read = Console.ReadLine();
            var temp = read.Split(' ');
            int a = int.Parse(temp[0]), b = int.Parse(temp[1]);
            string msg;

            if(a>b)
            {
                msg = "a > b";
            }
            else if(a<b)
            {
                msg = "a < b";
            }
            else
            {
                msg = "a == b";
            }

            Console.WriteLine(msg);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 8956
// Last Change: 05/02/2020 21:25:12.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  ll X;
  cin >> X;
  ll money = 100;

  ll cnt = 0;
  while (money < X) {
    money += money / 100;
    ++cnt;
  }

  cout << cnt << endl;
}


Measured memory_bytes: 3184
#include<stdio.h>
int main(){
  int n,i;
  int a[101];
  scanf("%d",&n);
  for(i=n-1;i>=0;i--){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    if(i == n-1){
        printf("%d\n",a[i]);
    }
    else{
        printf("%d ",a[i]);
    }
  }
  return 0;
}

Measured memory_bytes: 2584
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String b = sc.next();
		
		if(b.equals("A")) {
			System.out.println("T");
		}
		if(b.equals("C")) {
			System.out.println("G");
		}
		if(b.equals("G")) {
			System.out.println("C");
		}
		if(b.equals("T")) {
			System.out.println("A");
		}
	}

}


Measured memory_bytes: 21076
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-9;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
const int mn = 40000;
int n;
ld a[mn], b[mn], c[mn];
typedef pair<ld, int> speP;
vector<speP> lx,ly;
int dx[mn + 1], dy[mn + 1];

int bit[mn + 3];
void init() {
	rep(i, n + 3) {
		bit[i] = 0;
	}
}
void add(int a) {
	for (int i = a; i <= n + 2; i += i & -i)bit[i]++;
}
int sum(int a) {
	int res = 0;
	for (int i = a; i > 0; i -= i & -i)res += bit[i];
	return res;
}
int main(){
	cout << fixed << setprecision(10);
	cin >> n;
	ll key = (ll)(n - 1)*n / 2;
	key = (key + 1) / 2;
	rep(i, n) {
		cin >> a[i] >> b[i] >> c[i];
	}
	rep(i, n) {
		lx.push_back({ -a[i]/b[i],i });
		ly.push_back({ -b[i] / a[i],i });
	}
	sort(lx.begin(), lx.end());
	sort(ly.begin(), ly.end());
	rep(i, n) {
		dx[lx[i].second] = i+1;
		dy[ly[i].second] = i + 1;
	}
	ld le = -mod, ri = mod;
	while (ri - le > eps) {
		ld mid = (le + ri) / 2.0;
		vector<speP> v;
		rep(i, n) {
			v.push_back({ (c[i] - a[i] * mid) / b[i], i });
		}
		sort(v.begin(), v.end());
		ll cnt = 0;
		init();
		rep(i, n) {
			int id = dx[v[i].second];
			cnt += sum(id);
			add(id);
		}
		//cout << mid<<" "<<cnt << endl;
		if (cnt < key)le = mid;
		else ri = mid;
	}
	cout << le << " ";
	le = -mod, ri = mod;
	while (ri - le > eps) {
		ld mid = (le + ri) / 2.0;
		vector<speP> v;
		rep(i, n) {
			v.push_back({ (c[i] - b[i] * mid) / a[i],i });
		}
		sort(v.begin(), v.end());
		ll cnt = 0;
		init();
		rep(i, n) {
			int id = dy[v[i].second];
			cnt += sum(id);
			add(id);
		}
		if (cnt < key)le = mid;
		else ri = mid;
	}
	cout << le << endl;
	//stop
	return 0;
}


Measured memory_bytes: 10144
#include <stdio.h>

int main(){
  int i,n;
  double x1,y1,x2,y2,x3,y3,x4,y4,sl1,sl2;
  scanf("%d",&n);
  for (i=0;i<n;i++){
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
    sl1=(y2-y1)/(x2-x1);
    sl2=(y4-y3)/(x4-x3);
    if (sl1==sl2){
      puts("YES");
    }else{
      puts("NO");
    }
  }
  return 0;
}

Measured memory_bytes: 620
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
// #include <numeric>
#include <complex>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
typedef long long int ll;
#define iceil(x,y) (x+y-1)/y
#define min(x,y)(x<y?x:y)

using namespace std;
typedef pair<int, int> P;

int main() {
	FAST;

	int a, b;
	cin >> a >> b;

	int res = (a<=b? a:a-1);
	cout << res;

	return 0;
}

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

char buffer[512];

int parse(int i) {
  if (buffer[i] == 'm') {
    int next1 = parse(i+1);
    if (buffer[next1] == 'e') {
      int next2 = parse(next1+1);
      if (buffer[next2] == 'w') { return next2+1; }
    }
  }
  return i;
}

int main() {
  while (fgets(buffer, sizeof(buffer), stdin)) {
    int ret = parse(0);
    if (buffer[ret] == '\0' || buffer[ret] == '\n') {
      puts("Cat");
    } else {
      puts("Rabbit");
    }
  }
}

Measured memory_bytes: 0
// header {{{
            #include <bits/stdc++.h>
            using namespace std;
                         
            void solve() {
                int s, e, a;
                cin >> s;
                cin >> e;
                cin >> a;
                int res = 0;
                if (a == 1) res = e - s + 1;
                else res = e/a - s/a + (s % a == 0 ? 1 : 0);
            	cout << res << "\n" << endl;
                // cout << ans << "\n";
            }
             
            signed main() {
                
                solve();
             
                return 0;
            }


Measured memory_bytes: 3580
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <algorithm>
#include <stdio.h>
#include <cassert>
#include <set>
#include <map>
#include <bitset>
#include <unordered_set>
#include <string>
#include <cstring>
#include <cmath>
#include <numeric>
#define all(container)         (container).begin(), (container).end()
#define rall(container)        (container).rbegin(), (container).rend()
#define sz(container)          (int) container.size()
#define mp                     make_pair
#define fi                     first
#define se                     second

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector< vector< int > > vvi;
typedef vector<bool> vb;
typedef vector<long long> vll;

#ifdef LOCAL_DEFINE
    #include "DEBUG.hpp"
#else
    #define debug(...) 0
#endif

void read(int &a) {scanf("%d", &a);}
void read(ll &a) {scanf("%lld", &a);}
void read(char* a, string& s) {scanf("%s", a); s = string(a);}
void read(float &a) {scanf("%f", &a);}
void read(double &a) {scanf("%lf", &a);}

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
vi teleport, seq, visited;

void solve() {
    int n; read(n);
    ll k; read(k);
    teleport.resize(n + 1);
    for (int i = 1; i <= n; i++)
        read(teleport[i]);
    visited.resize(n + 1, -1);
    visited[1] = 0;
    seq.push_back(1);
    int curr = teleport[1];
    while (visited[curr] == -1) {
        seq.push_back(curr);
        visited[curr] = sz(seq) - 1;
        curr = teleport[curr];
    }
    int cycle_start = visited[curr];
    debug(cycle_start, seq);
    if (k <= cycle_start) 
        printf("%d\n", seq[k]);
    else {
        k -= cycle_start;
        int ans = seq[cycle_start + k % (ll)(sz(seq) - cycle_start)];
        printf("%d\n", ans);
    }
}

int main(void) {
    int T = 1;
    while (T--)
        solve();
    return 0;
}

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<string> vec(H);
  for(int i = 0; i < H; i++) {
    cin >> vec.at(i);
  }
  for(int i = 0; i < W + 2; i++) {
    cout << '#';
  }
  cout << endl;
  for(int i = 0; i < H; i++) {
    cout << '#' << vec.at(i) << '#' << endl;
  }
  for(int i = 0; i < W + 2; i++) {
    cout << '#';
  }
  cout << endl;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,h,hp,a=0,m=0;
    cin>>n>>hp;
    for(ll i=1;i<n;i++){
        cin>>h;
        if(hp>=h) a++;
        if(hp<h||i==n-1){
            m=max(m,a);
            a=0;
        }
        hp=h;
    }
    cout<<m<<endl;
    return 0;
}

Measured memory_bytes: 256