akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define fi first
#define se second
#define U unsigned
#define P std::pair
#define Re register
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(Re int i = a;i <= b;++i)
#define ROF(i,a,b) for(Re int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 2e5 + 5;

LL a[MAXN];
int n;

int main(){
    scanf("%d",&n);
    FOR(i,1,n) scanf("%lld",a+i);
    LL ans = 0ll,s1 = 0,s2 = 0;
    int r = 1;s1 += a[1],s2 ^= a[1];
    FOR(l,1,n){
        //s1 += a[l],s2 ^= a[l];
        while(s1 == s2 && r <= n) r++,s1 += a[r],s2 ^= a[r];
        ans += r-l;
        s1 -= a[l];s2 ^= a[l];
        //DEBUG(l);DEBUG(r);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1792
function main(input) {
    var s = input.split('\n')[1];

    var result = [s[0]];
    for (var i = 1; i < s.length; i++)
        if (s[i - 1] !== s[i]) result.push(s[i]);

    console.log(result.length);
}

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

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

a = []
n = 10
while True:
  a.append(n)
  n *= 5
  if n > 10**18:
    break
num = len(a)
numsum = 0
ans = 0
if N % 2 == 1:
  print(0)
else:
  for i, one in enumerate(reversed(a)):
    sho = N // one
    tmp = sho - numsum
    ans += (num - i) * tmp
    numsum += tmp
  print(ans)

Measured memory_bytes: 3064
fn input_vec<T: std::str::FromStr>()->Vec<T>{
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn input<T: std::str::FromStr>()->T{
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	s.trim().parse().ok().unwrap()
}

fn main() {
	let n = input::<i64>();
	let input2 = input_vec::<i64>();
	let mut flag = 0;
	for i in 0..n{
		if i % 2 ==0{
			if input2[i as usize]%2!=0{
				flag+=1;
			}
		}
	}
	println!("{}",flag);

    
}


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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(ll i=0; i<(n); i++)
#define REPj(n) for(ll j=0; j<(n); j++)
#define REPinit(i,a,n) for(ll i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(ll j=(a); j<(n); j++)

//algorithm
#define SORT(c) sort((c).begin(),(c).end())
#define CONTAINER_ALL(a) a.begin(),a.end()

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


int ai[1000001];

int fn(int n) {
    if (n % 2 == 0) return (int)(n / 2);
    else return (3 * n + 1);
}

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

    int s;
    cin >> s;

    ai[s] = 1;
    int idx = 1;
    while (true) {
        s = fn(s);
        idx++;
        if (ai[s] == 1) {
            cout << idx << endl;
            break;
        }
        else {
            ai[s] = 1;
        }
    }

    return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> array(n);
  for(int i =0; i< n ; ++i) cin >> array[i];

  std::vector<size_t> indices(array.size());
  std::iota(indices.begin(), indices.end(), 0);
  std::sort(indices.begin(), indices.end(), [&array](size_t i1, size_t i2) {
    return array[i1] < array[i2];
  });

  for (auto v : indices)
     std::cout << v+1 << " ";
  std::cout << std::endl;
}

Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
ll BASE_NUM = 1000000007;

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

int main()
{
    // 整数の入力

    ll K;
    cin >>  K;
    ll total = 0;
    for(int a = 1; a <= K;a++){
        for(int b=1 ; b<= K;b++){
            for(int c = 1; c<=K;c++){
                total += gcd(gcd(a,b),c);
            }
        }
    }
    cout << total << endl;
   return 0;
}

Measured memory_bytes: 3624
def q3():
    N, K, Q = (int(i) for i in input().split())

    ans = [K-Q]*N
    for i in range(Q):
        a = int(input())
        ans[a-1] += 1

    for i in range(N):
        print('Yes' if ans[i] > 0 else 'No')


if __name__ == '__main__':
    q3()


Measured memory_bytes: 6580
n,l = map(int,input().split())
a = list(map(int,input().split()))
for N in range(n - 1):
    a[N] = a[N] + a[N + 1]
if max(a) >= l:
    print('Possible')
    ind = a.index(max(a)) + 1
    for  i in range(ind - 1):
        print(i + 1)
    for i in range(n - ind):
        print(n - i - 1)
else:
    print('Impossible')

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

typedef struct pp{
    int num;
    struct pp *right, *left, *parent;
}PO;
PO *root, *nothing;
int n,input;
char command[7];

void ins(int n)
{
    PO *x = root;
    PO *y = nothing;
    PO *v;//what i want to put as x;
    v = (PO *)malloc(sizeof(PO));
    v->num = n;
    v->left = nothing;
    v->right = nothing;
    while(1)
    {
        if(x == nothing) break;
        y = x;
        if(v->num < x->num) x = x->left;
        else x = x->right;
    }
    v->parent = y;
    if(y == nothing) root = v;
    else
    {
        if(v->num < y->num) y->left = v;
        else y->right = v;
    }
}

void ino(PO *r)
{
    if(r == nothing) return;
    ino(r->left);
    printf(" %d", r->num);
    ino(r->right);
}

void pre(PO *r)
{
    if(r == nothing) return;
    printf(" %d", r->num);
    pre(r->left);
    pre(r->right);
}

int main()
{
    scanf("%d", &n);
    for(int i=0; i<n; i++)
    {
        scanf("%s", command);
        if(command[0] == 'i')
        {
            scanf("%d", &input);
            ins(input);
        }
        else if(command[0] == 'p')
        {
            ino(root);
            printf("\n");
            pre(root);
            printf("\n");
        }
    }
    return 0;
}


Measured memory_bytes: 25144
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
ll a[100010];
int main(){
	int n,x,sum=0,max=-1;cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x;
		a[x]++;
		a[x-1]++;
		a[x+1]++;
	}
	for(int i=1;i<=100010;i++){
		sum=a[i];
		if(max<sum)max=sum;
		sum=0;
	}
	cout<<max;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,x;
set<int>s;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&x);
        s.insert(x);
    }
    if(s.size()==n){
        puts("YES");
    }
    else{
        puts("NO");
    }
    return 0;
}

Measured memory_bytes: 9600
n = int(input())
now = [i+1 for i in range(9)]
ans = now[:]
for k in range(11):
  last = now
  now = []
  for x in last:
    y = x % 10
    if y == 0:
      now.append(x*10+y)
      now.append(x*10+y+1)
      ans.append(x*10+y)
      ans.append(x*10+y+1)
    elif y == 9:
      now.append(x*10+y-1)
      now.append(x*10+y)
      ans.append(x*10+y-1)
      ans.append(x*10+y)
    else:
      now.append(x*10+y-1)
      now.append(x*10+y)
      now.append(x*10+y+1)
      ans.append(x*10+y-1)
      ans.append(x*10+y)
      ans.append(x*10+y+1)
print(ans[n-1])
#print(ans)

Measured memory_bytes: 147320
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;

typedef long long ll;
#define READ(a) int a; cin >> a;
#define READARR(a, n) int a[(n) + 1]; FOR(i, 1, (n)) {cin >> a[i];}
#define READMAT(a, n, m) int a[n + 1][m + 1]; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
#define pb(x) push_back(x)
#define vi vector <int>
#define pi pair <int, int>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	READ(n);
	READARR(a, n);
	sort(a + 1, a + n + 1);
	cout << a[n/2 + 1] - a[n/2];
}

Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, s: "List[int]"):
    mx = 10000
    dp = [False] * (mx + 1)
    dp[0] = True
    for v in s:
        for i in range(mx, -1, -1):
            if dp[i] and i + v <= mx:
                dp[i + v] = True
    ret = 0
    for i in range(mx, -1, -1):
        if dp[i] and i % 10 > 0:
            ret = i
            break
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include<iomanip>
typedef long long ll;
using namespace std;

double t[105], v[105], sum[105];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> t[i+1];
        sum[i+1] = sum[i] + t[i+1];
    }
    for (int i = 0; i < n; i++) {
        cin >> v[i+1];
    }

    double ans=0, p=0;
    int f = 0;

    for (double i = 0.5; i <= sum[n]; i+=0.5) {
        if (i > sum[f]) f++;
        double now = v[f];
        for (int j = 0; j <= n+1; j++) {
            double c = now;
            if (j < f) {
                c = v[j] + i - sum[j];
            } else if (j > f) {
                c = v[j] + sum[j-1] - i;
            }
            now = min(now, c);
        }
        ans += (p+now)/4.0;
        p = now;
    }

    cout << fixed << setprecision(9) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include<vector>
#include<cmath>

using namespace std;
typedef pair<int, int> P;
const int INF = 100000000;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };



int main()
{
	int i,j,k,l,m,n,sum,flag,N,M,X,H, W;
	k = 0;
	sum = 0;
	cin >> N>>X;
	vector<int>A(N);
	for (i = 0; i<N; i++) {
		cin >> A[i];
		sum += A[i];
	}
	sort(A.begin(), A.end());
	cout << N + (X - sum) / A[0] << endl;


	flag = 0;
	
	return 0;
}



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

using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    double d = (double)a/(double)b;
    cout << fixed;
    cout << a/b << " ";
    cout << a%b << " ";
    cout << setprecision(8) << d;

    return 0;
}


Measured memory_bytes: 3288
import sys
input = sys.stdin.readline
N, W = map(int, input().split())
A = [tuple(map(int, input().split())) for _ in [0]*N]
w0 = A[0][0]
A = [(w-w0, v) for w, v in A]

dp = [[0]*(3*N) for _ in [0]*(N+1)]
ans = 0
sumw = 0
for k, (w, v) in enumerate(A):
    for i in range(k, -1, -1):
        for j in range(sumw, -1, -1):
            if 0 <= i < N and 0 <= j+w < 3*N and (i+1)*w0+j+w <= W:
                dp[i+1][j+w] = max(dp[i][j]+v, dp[i+1][j+w])
    sumw += w

for d in dp:
    ans = max(ans, *d)
print(ans)


Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
int n,m,cnt = 0, k[11],p[11],s[11][11],sw[11];
int target;
void dfs(int num, int now){
    if(num > n){
        if(now == target) cnt++;
        return ;
    }
    for(int i = 0; i <= 1; i++) {
        dfs(num + 1, now ^ (i * sw[num]));
    }
}
int main(){
    cin >> n >> m;
    for(int i = 1; i <= m; i++){
        cin >> k[i];
        for(int j = 0; j < k[i]; j++){
            cin >> s[i][j];
            sw[s[i][j]] |= 1 << i;
        }
    }
    for(int i = 1; i <= m; i++) {
        cin >> p[i];
        target |= p[i] << i;
    } 
    dfs(1,0);
    cout << cnt << endl;
}


Measured memory_bytes: 256
N = input()
dp = [[0] * 2 for _ in range(len(N) + 1)]
dp[0][1] = 1

for i in range(len(N)):
    n = int(N[i])
    dp[i + 1][0] = min(dp[i][0] + n, dp[i][1] + 10 - n)
    dp[i + 1][1] = min(dp[i][0] + n + 1, dp[i][1] + 10 - (n + 1))

print(dp[-1][0])


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

#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()

using pii = pair<int, int>;

double kyori(pii x, pii y) {
  return sqrt(pow(x.first - y.first, 2) + pow(x.second - y.second, 2));
}

inline void Main() {
  // code
  int n,h[(int)1e5];
  cin>>n;
  rep(i,n)cin>>h[i];

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

  cout << "Yes" << endl;
  return;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    int n;
    while(cin >> n){
        if(n == 0)return 0;
        vector<int> vec;
        for(int i = 0;i < n;i++){
            int b;cin >> b;
            vec.push_back(b);
        }
        sort(vec.begin(), vec.end());
        int ans = 1e9;
        for(int i = 0;i < n-1;i++){
            ans = min(ans, vec.at(i+1)-vec.at(i));
        }
        cout<<ans<<endl;
    }
}



Measured memory_bytes: 3108
#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()

int main(void)
{
    int n, m, sum=0;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        sum += a[i];
    }
    sort(all(a),greater<int>());
    if(a[m-1]*4*m >= sum) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(2e5) + 5;
constexpr double EPS = 1e-8;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i=0;i<n;i++){
        cin >> p[i];
    }
    bool ok = false;
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            swap(p[i],p[j]);
            bool sorted = true;
            for(int k=0;k<n-1;k++){
                sorted &= p[k] < p[k+1];
            }
            ok |= sorted;
            swap(p[i],p[j]);
        }
    }
    cout << (ok ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = 1e+9 + 7;

//マクロ
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#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 INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main()
{
  ll l, r;
  cin >> l >> r;
  r = min(r, l + 4038);
  int ans = 2018;
  for (ll i = l; i <= r; i++)
  {
    for (ll j = i + 1; j <= r; j++)
    {
      int x = i * j % 2019;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
  return 0;
}

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

int ans,sum;

void dfs( int i, int s, int n ) {
  
  if ( s == sum && n== 0 ) {
    ans++;
    return;
  }

  if ( i == 10 || n == 0 ) return;


  dfs(i+1,s+i,n-1);
  dfs(i+1,s,n);
}

int main() {
  int n;
  while ( cin >> n >> sum, n || sum ) {
    ans = 0;
    dfs(0,0,n);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

int main()
{
    int n, r;

    cin >> n >> r;

    if (n >= 10){
    	cout << r << " ";
    }
    else{
    	cout << r + 100*(10 - n);
    }
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

template<typename T>
T gcd(T n, T m){

    if(m > n)  swap(n, m);

    if(m == 0) return n;

    T r = n % m;
    if(r == 0) return m;
    else       return gcd(m, r);
}

template<typename U>
U lcm(U n, U m){
    return n / gcd(n, m) * m;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll a, b, c, d; cin >> a >> b >> c >> d;

    ll nl, ns;

    nl = b   - (    b / c +     b / d -     b / lcm(c, d));
    ns = a-1 - ((a-1) / c + (a-1) / d - (a-1) / lcm(c, d));

    // cout << nl << endl;
    // cout << ns << endl;

    cout << nl - ns << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Globalization;
using System.IO;
using System.Text;
using static Scanner;
using static System.Math;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Solve();
        Console.Out.Flush();
    }
    static void Solve() {
        Console.WriteLine((int) Ceiling(ScanDouble() / ScanDouble()) * ScanInt());
    }
}

public static class Scanner
{
    static readonly Stream stdin = Console.OpenStandardInput();
    static readonly byte[] buffer = new byte[1024];
    static int length, p;
    static bool isEof;
    private static byte StdIn() {
        if (isEof) return 0;
        if (p < length) return buffer[p++];
        p = 0;
        if ((length = stdin.Read(buffer, 0, 1024)) > 0) return buffer[p++];
        isEof = true;
        return 0;
    }
    public static char GetChar() {
        var by = StdIn();
        while ((by < '!' || '~' < by) && !isEof) by = StdIn();
        return (char) by;
    }
    public static string Scan() {
        var sb = new StringBuilder();
        for (var ch = GetChar(); '!' <= ch && ch <= '~'; ch = (char) StdIn()) {
            sb.Append(ch);
        }
        return sb.ToString();
    }
    public static int ScanInt() {
        var temp = 0;
        for (var ch = GetChar(); '0' <= ch && ch <= '9'; ch = (char) StdIn()) {
            temp = temp * 10 + ch - '0';
        }
        return temp;
    }
    public static double ScanDouble() => double.Parse(Scan(), CultureInfo.InvariantCulture);
}

Measured memory_bytes: 23820
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

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

        public void Solve(ConsoleInput cin)
        {
            double[] A = cin.ReadDoubleArray(4);
            double W = A[0];
            double H = A[1];
            double x = A[2];
            double y = A[3];
            int flag = 0;
            if ((x == W/2) && (y == H/2))
            {
                flag = 1;
            }
            double answer = W * H / 2;
            Console.WriteLine($"{answer:F9}".ToString()+ ' ' + flag.ToString());
            
            
        }

    }

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

Measured memory_bytes: 11348
//#pragma GCC optimize(2)
// Happy TLE and WA every day!
// by: zxb the vegetable chicken
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            4557430888798830399
#define pb              push_back
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
#define read            ZXBs_fast_input
#define write           ZXBs_fast_output
//#define usingFiles
using namespace std;

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

inline bool read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool write(int x){
	if(x >= 10) write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	int n;
	string a, b, c;
	cin >> n >> a >> b >> c;
	int cnt = 0;
	rep(i, n){
		if(a[i] == b[i] && b[i] == c[i]);
		else if(a[i] == b[i] || b[i] == c[i] || c[i] == a[i]){
			cnt++;
		} else {
			cnt += 2;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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 bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> a(3);
    int k, sum;
    cin >> a[0] >> a[1] >> a[2] >> k;
    sort(a.begin(), a.end());
    rep(i, k) {
      a[2] *= 2;
    }
    sum = a[0] + a[1] + a[2];
    cout << sum << '\n';

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main{
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] stringArray = br.readLine().split("\\s");

        Deque<Integer> que = new ArrayDeque<>();
        int a = 0;
        int b = 0;
        for (int i = 0; i < stringArray.length; i++) {
            switch (stringArray[i]) {
            case "+":
                a = que.pollFirst();
                b = que.pollFirst();
                que.addFirst(b + a);
                break;
            case "-":
                a = que.pollFirst();
                b = que.pollFirst();
                que.addFirst(b - a);
                break;
            case "/":
                a = que.pollFirst();
                b = que.pollFirst();
                que.addFirst(b / a);
                break;
            case "*":
                a = que.pollFirst();
                b = que.pollFirst();
                que.addFirst(b * a);
                break;
            default:
                que.addFirst(Integer.parseInt(stringArray[i]));
            }
        }
        System.out.println(que.pop());
    }
}



Measured memory_bytes: 24344
import math
N, D= map(int, input().split())

X = [[[] * x for x in range(D)] * y for y in range(N)]
for i in range(N):
  X[i] = list(map(int, input().split()))
Cnt = 0
for i in range(N):
  for j in range(i+1,N):
    Dst = 0.0
    for k in range(D):
#      print (i, j, k ,X[i][k], X[j][k])
      Dst += (X[i][k] - X[j][k]) ** 2
    Dst = math.sqrt(Dst)
#    print (Dst , " is ", Dst.is_integer)
    if Dst % 1 == 0:
      Cnt += 1
print (Cnt)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int T = sc.nextInt();
        
        int minCost = 1001; 
        for(int i = 0; i < N; i++){
            int ci = sc.nextInt();  int ti = sc.nextInt();
            if(ti <= T && ci < minCost) minCost = ci;
        }
        System.out.println(minCost != 1001 ? minCost : "TLE");
    }
}


Measured memory_bytes: 21844
import math

def input_num():
	ls = input().strip().split(" ")
	return [int(e) for e in ls]

a,b,c,k = input_num()

b_n, c_n = 0,0
a_n = min(k,a)
k -= a_n
if k > 0:
	b_n = min(k,b)
	k -= b_n
	if k > 0:
		c_n = k
print(a_n-c_n)

Measured memory_bytes: 9132
#include<bits/stdc++.h>
#include<set>
using namespace std;
int n,m;
long long num;
int Max;
int Maxn=30;
int main()
{
    cin>>num;
    for(int i=sqrt(num);i>=1;i--)
    {
        if(num%i==0)
        {
            int ans1=0;
            int ans2=0;
            int x=num/i;
            int y=i;
            while(x)
            {
                x/=10;
                ans1++;
            }
            while(y)
            {
                y/=10;
                ans2++;
            }
            Max=max(ans1,ans2);
            Maxn=min(Max,Maxn);
        }
    }
    cout<<Maxn<<endl;
    return 0;
}

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

int main(){
	int N, First=0, Second=0;
	cin>>N;

	vector<int> A(N);
	for(int i=0;i<N;i++){
		cin>>A.at(i);
		if(A.at(i)>Second){
			if(A.at(i)>First){
				First = A.at(i);
			}else{
				Second = A.at(i);
			}
		}
	}

	for(int i=0;i<N;i++){
		if(A.at(i)==First){
			cout<<Second<<endl;
		}else{
			cout<<First<<endl;
		}
	}
}


Measured memory_bytes: 2432
#include<iostream>
#include<algorithm>
using namespace std;
int a[100010];
int main(){
	int n,i,j,x,y;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a,a+n);
	x=n/2-1;
	y=n/2;
	if(a[x]==a[y])
		cout << 0 << endl;
	else
		cout << a[y]-a[x] << endl;
	return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main() {

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




    return 0;
}






Measured memory_bytes: 3624
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k-1])

Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int sum(int start,int length){
    return (start+start+length-1)*length/2;
}



int main() {
    for (; ;) {
        int N;
        cin >>N;
        if (N==0) {
            break;
        }
        int ans=0;
        for (int i=1; i<N; i++) {
            for (int j=2; i+j-1<N; j++) {
                if (sum(i,j)==N) {
                    ans++;
                }
            }
        }
        cout << ans <<endl;
    }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int64_t f(int64_t x,int64_t y){
if(y==0)
  return 1;
  else if(y%2==0)
    return (f(x,y/2)*f(x,y/2))%mod;
  else
    return (x*((f(x,y/2)*f(x,y/2))%mod))%mod;
}
int main(){
  int64_t B,W;
  cin>>B>>W;
  int64_t a=500000004;
  vector<int64_t>b(B+W,0);
  vector<int64_t>w(B+W,0);
  b.at(B)=f(a,B);
  for(int i=B+1;i<B+W;i++)
    b.at(i)=(((((a*b.at(i-1))%mod)*(i-1))%mod)*f(i-B,mod-2))%mod;
   w.at(W)=f(a,W);
  for(int i=W+1;i<B+W;i++)
    w.at(i)=(((((a*w.at(i-1))%mod)*(i-1))%mod)*f(i-W,mod-2))%mod;
  int64_t b1,w1;b1=0;w1=0;
  for(int i=1;i<=B+W;i++){
  b1=(b1+b.at(i-1))%mod;w1=(w1+w.at(i-1))%mod;
    int64_t ans=(a*(1-b1-w1)+w1)%mod;
    ans=(ans+mod)%mod;
    cout<<ans<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 6248
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
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;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AFiftyFifty solver = new AFiftyFifty();
        solver.solve(1, in, out);
        out.close();
    }

    static class AFiftyFifty {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            int[] hash = new int[26];
            int count = 0;
            for (int i = 0; i < s.length(); i++) {
                int c = s.charAt(i) - 'A';
                hash[c]++;
                if (hash[c] == 2)
                    count++;
            }
            if (count == 2)
                out.println("Yes");
            else
                out.println("No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 21460
/*
Original problem: https://atcoder.jp/contests/dp/tasks/dp_j
Author: sammochen
*/

#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;

#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)

#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef vector<ll> VLL;
typedef vector<int> VI;

namespace SOLVE {
	const int nax = 305;
	double E[nax][nax][nax] = {0};
	double P[nax][nax][nax] = {0};

	void main() {
		int n, temp;
		int count[4] = {0};
		cin >> n;

		REP(i, 0, n) {
			cin >> temp;
			count[temp]++;
		}

		P[count[1]][count[2]][count[3]] = 1; // the probability moves to get to this state
		E[count[1]][count[2]][count[3]] = 0; // the expected value - a little redundant

		RREP(f3, n, 0) {
			RREP(f2, n, 0) {
				RREP(f1, n, 0) {
					if (f1 + f2 + f3 == 0) {
						// no more transitions - complete
						break;
					}

					// there is a probability that nothing happens: Pwaste
					// i want to find the p-bility and ev that nothing happens

					// p[waste] + p[waste]^2 + p[waste]^3 ... = S
					// S / p[waste] = S + 1
					// S = (1 - p[waste]) / p[waste]

					// E[waste] = 1 / S + 1

					double useful = f1 + f2 + f3;
					double Pwaste = 1 - (useful / n);
					double Ewaste = Pwaste / (1 - Pwaste) + 1;

					// the expected value of a state has to include the transition to itself
					E[f1][f2][f3] += Ewaste * P[f1][f2][f3];

					// now that we have considered the self-transitions, we consider useful instead of n
					if (f1 != 0) {
						E[f1 - 1][f2][f3] += E[f1][f2][f3] * (f1 / useful);
						P[f1 - 1][f2][f3] += P[f1][f2][f3] * (f1 / useful);
					}
					if (f2 != 0) {
						E[f1 + 1][f2 - 1][f3] += E[f1][f2][f3] * (f2 / useful);
						P[f1 + 1][f2 - 1][f3] += P[f1][f2][f3] * (f2 / useful);
					}
					if (f3 != 0) {
						E[f1][f2 + 1][f3 - 1] += E[f1][f2][f3] * (f3 / useful);
						P[f1][f2 + 1][f3 - 1] += P[f1][f2][f3] * (f3 / useful);
					}

				}
			}
		}
		cout << setprecision(20) << E[0][0][0] << endl;
	}
}


signed main() {
	int t;
	t = 1;
	// cin >> t;
	while (t--) {
		SOLVE::main();
	}

	return 0;
}

Measured memory_bytes: 442624
import sys
from collections import deque
nq = int(input())
lines = sys.stdin.readlines()
deq = deque()
for i in range(nq):
    query, *arg = lines[i].split()
    if query == '0':    # push 0or1 x
        deq.appendleft(arg[1]) if arg[0] == '0' else deq.append(arg[1])
    elif query == '1':  # randaccess p
        print(deq[int(arg[0])])
    elif query == '2':    # pop 0or1
        deq.popleft() if arg[0] == '0' else deq.pop()
    else:
        raise AssertionError


Measured memory_bytes: 63124
#include <stdio.h>
#include <iostream>

using namespace std;

#define MAX 200000
#define SENTINEL 2000000000

typedef long long llong;


llong MergeReverseCount (int *input, int left, int mid, int right) {
	int L[MAX / 2 + 2], R[MAX / 2 + 2];
	llong cnt = 0;
	int n1 = mid - left;
	int n2 = right - mid;

	for (int i = 0; i < n1; i++) {
		L[i] = input[left + i];
	}
	for (int i = 0; i < n2; i++) {
		R[i] = input[mid + i];
	}

	L[n1] = R[n2] = SENTINEL;

	for (int k = left, i = 0,j = 0; k < right; k++) {
		if (L[i] <= R[j]) {
			input[k] = L[i++];
		}
		else {
			input[k] = R[j++];
			cnt += n1 - i;
		}

	}


	return cnt;
}

llong MergeSortReverseCount (int *input, int left, int right) {
	if (left + 1 < right) {
		int mid = (left + right) / 2;
		llong v1, v2, v3;

		v1 = MergeSortReverseCount (input, left, mid);
		v2 = MergeSortReverseCount (input, mid, right);
		v3 = MergeReverseCount(input, left, mid, right);
		
	return v1 + v2 + v3;
	}
	
	return 0;
}


int main() {

	int *input, n;

	scanf("%d", &n);
	input = new int[n];

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

	llong ans = MergeSortReverseCount(input, 0, n);
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4768
#include <iostream>
#include <queue>
#include <map>
#include <string>
#include <stdio.h>

using namespace std;

map<string, int> ans;

void bfs()
{
    int dx[4] = {-1, 4, 1, -4};
    string sunxu = "01234567";
    queue<string> que;
    que.push(sunxu);
    ans[sunxu] = 0;
    ans.clear();

    while(que.size())
    {
        sunxu = que.front();
        que.pop();

        int x;
        for (int i = 0; i < 8; i++)
        {
            if (sunxu[i] == '0')
                x = i;
        }
        for (int i = 0; i < 4; i++)
        {
            int nx = x + dx[i];
            if ((x == 4 && i == 0) || (x == 3 && i == 2))
                continue;
            if (nx >= 0 && nx < 8)
            {
                string s = sunxu;
                swap(s[nx], s[x]);
                if (ans[s] == 0  && s != "01234567")
                {
                    que.push(s);
                    ans[s] = ans[sunxu] + 1; 
                }
            }

        }
    }
}

int main()
{
    bfs();

    int num;
    string sunxu;

    while(~scanf("%d", &num))
    {
        sunxu.clear();
        sunxu += num + '0';
        for (int i = 1; i < 8; i++)
        {
            scanf("%d", &num);
            sunxu += num + '0';
        }

        printf("%d\n", ans[sunxu]);
    }
}

Measured memory_bytes: 5516
#include<bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(i=0;i<n;i++)
#define test(a) cout << "*" << a << endl;
int main(){
  int i;
  string S,T;
  bool exist = false;
  
  cin  >> S >> T ;
  rep0(i,S.size()){
    if(S[i] != T[i]){
      break;
    }
    else{
      if(i==S.size()-1)
        exist = true;
    }
  }
  if(exist)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
    
      
    
  
  
}

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

int main(){
  int a, b;
  cin >> a >> b;
  if(a==1 && b>1){
    cout << "Alice" << endl;
  }else if(b==1 && a>1){
    cout << "Bob" << endl;
  }else if(a>b){
    cout << "Alice" << endl;
  }else if(a<b){
    cout << "Bob" << endl;
  }else if(a==b){
    cout << "Draw" << endl;
  }
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- 整数の入力
    a <- readLn
    -- 出力
    putStrLn $ show $ 800 * a - 200 * (a `div` 15)


Measured memory_bytes: 508
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
struct P {
double first;
int second;
};
class great {
public:
    bool operator()(const P& a, const P& b) {
        return a.first<b.first;
    }
};
P team1[8], team2[8], team3[8];
P amari[18];
int main() {
    for (int i=0; i<8; i++)
        scanf("%d%lf",&team1[i].second,&team1[i].first);
    for (int i=0; i<8; i++)
        scanf("%d%lf",&team2[i].second,&team2[i].first);
    for (int i=0; i<8; i++)
        scanf("%d%lf",&team3[i].second,&team3[i].first);
    sort(team1, team1+8, great());
    sort(team2, team2+8, great());
    sort(team3, team3+8, great());
    for (int i=2; i<8; i++) amari[i-2]=team1[i];
    for (int i=2; i<8; i++) amari[i+4]=team2[i];
    for (int i=2; i<8; i++) amari[i+10]=team3[i];
    sort(amari, amari+18, great());
    printf("%d %.2lf\n%d %.2lf\n",team1[0].second,team1[0].first,
                                  team1[1].second,team1[1].first);
    printf("%d %.2lf\n%d %.2lf\n",team2[0].second,team2[0].first,
                                  team2[1].second,team2[1].first);
    printf("%d %.2lf\n%d %.2lf\n",team3[0].second,team3[0].first,
                                  team3[1].second,team3[1].first);
    printf("%d %.2lf\n%d %.2lf\n",amari[0].second,amari[0].first,
                                  amari[1].second,amari[1].first);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool prime(ll n) {
  if (n == 1) {
    return false;
  } else {
    for (ll i = 2; i <= (ll)pow(n, 0.5); i++) {
      if (n%i == 0) return false;
    }
  }
  return true;
}
ll RepeatSquaring(ll n, ll p, ll m) {
  if (p == 0) return 1;
  if (p%2 == 0) {
    ll t = RepeatSquaring(n, p/2, m);
    return (t*t)%m;
  }
  return (n*RepeatSquaring(n, p-1, m))%m;
}

int main() {
  ll n, m;
  cin >> n >> m;
  vector <pair <ll, ll>> v(m);
  rep(i, m) {
    ll a, b;
    cin >> a >> b;
    v.at(i) = make_pair(b, a);
  }
  sort(v.begin(), v.end());
  ll ans = 0, l = 0;
  rep(i, m) {
    if (l <= v.at(i).second) {
      ans++;
      l = v.at(i).first;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a;
    cin>>n;
    a=n%10;
    if(a==2||a==4||a==5||a==7||a==9){
        cout<<"hon"<<endl;
    }
    else if(a==0||a==1||a==6||a==8){
        cout<<"pon"<<endl;
    }
    else
    {
        cout<<"bon"<<endl;
    }

    return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;
const int MOD = 1e9 + 7;

int main()
{
    string s, t;
    cin >> s >> t;

    sort(all(s));
    sort(all(t));
    reverse(all(t));

    cout << ((s < t) ? "Yes" : "No") << endl;
    return (0);
}


Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include<string>
#include<utility>
#include<iterator>
#include<regex>
#include<math.h>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(lli i=0;i<j;i++)
#define rep1(i,j) for(lli i=1;i<=j;i++)
#define rep0d(i,j) for(lli i=j-1;i>=0;i--)
#define MAX 1000000007
typedef struct tree Tree;

using namespace std;

bool cmpf(pair<lli, lli> left, pair<lli, lli> right) {
	return left.first < right.first;
}
bool cmp(pair<lli, lli> left, pair<lli, lli> right) {
	if (left.first != right.first)return left.first < right.first;
	else return left.second < right.second;
}
int main() {
	lli num,n,k;
	cin >> n >> k;
	cout << 1 + (n -2) / (k - 1);

}


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

using namespace std;

int main()
  
{
  
  int n;
  
  cin>>n;
  
  if(n%1000)
  {
    
    cout<<1000-n%1000;
    
  }
  
  else
    
    cout<<0;
  
  
  return 0;
  
}

Measured memory_bytes: 3620
#include<iostream>
#include<stdio.h>
#define max 500000
#define sen 2000000000
using namespace std;

int a[max+1];
int l[max/2+2],r[max/2+2];
int cnt;

void merge(int a[],int n,int left,int mid,int right)
{
	int n1=mid-left;
	int n2=right-mid;
	for(int i=0;i<n1;i++) l[i]=a[left+i];
	for(int i=0;i<n2;i++) r[i]=a[mid+i];
	l[n1]=r[n2]=sen;
	int i=0,j=0;
	for(int k=left;k<right;k++)
	{
		cnt++;
		if(l[i]<=r[j])
		{
			a[k]=l[i++];
		}
		else{
			a[k]=r[j++];
		}
	}
}

void mergesort(int a[],int n,int left,int right)
{
	if(left+1<right)
	{
		int mid=(left+right)/2;
		mergesort(a,n,left,mid);
		mergesort(a,n,mid,right);
		merge(a,n,left,mid,right);
	}
}

int main()
{
	int n,i;
	cnt=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%d",&a[i]);
	mergesort(a,n,0,n);
	
	for(i=0;i<n;i++)
	{
		if(i) printf(" ");
		printf("%d",a[i]);
	}
	printf("\n");
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 7072
// Linear Approximation

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(){
	int N;
	cin >> N;
	int A[N];
	for (int i = 0; i < N; ++i){
		cin >> A[i];
		A[i] -= i+1;
	}

	sort(A, A+N);

	long b; // median

	if (N % 2){
		b = A[N/2];
	}else{
		b = (A[N/2-1] + A[N/2])/2;
	}

	long ans = 0;

	for (int i = 0; i < N; ++i)
		ans += abs(A[i] - b);

	cout << ans;

	return 0;
}

Measured memory_bytes: 1024