akhauriyash/Code-Regression huggingface dataset:
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <vector>
#include <list>
using namespace std;
#include <stdio.h>
#include <map> 
#include <algorithm>
#include <functional>
#include <algorithm>
#include <functional>
#include <array>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>


std::vector<int> len;

int main()
{
	long int N;
	std::string S;
	cin >> N;

	std::vector< std::vector<int> > tmp;


	len.resize(N);
	tmp.resize(N);
	for (int i = 0; i < N; ++i) {
		cin >> len[i];
		tmp[i].resize(N);
	}
	std::sort(len.begin(), len.end());

	for (int i = 0; i < N; ++i) {
		const int &ii = len[i];

		for (int j = i + 1; j < N; ++j) {
			const int &jj = len[j];
			tmp[i][j] = tmp[j][i] = ii + jj;
		}
	}

	int c = 0;
	for (int i = 0; i < N; ++i) {
		const int &ii = len[i];
		for (int j = i + 1; j < N; ++j) {
			const int &jj = len[j];

			for (int k = j + 1; k < N; ++k) {
				const int &kk = len[k];

				if (tmp[i][j] <= kk) break;

				if (tmp[j][k] <= ii) continue;
				if (tmp[i][k] <= jj) continue;

				++c;
			}
		}
	}


	printf("%d", c);
	printf("\n");

	return 0;
}




Measured memory_bytes: 18048
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

int main() {

    int H, W;
    cin >> H >> W;

    vector<vector<int>> a(H + 1, vector<int>(W, 0));
    for (int i = 0; i < H; i++)for (int j = 0; j < W; j++)cin >> a[i][j];

    vector<pair<int, int>> from, to;
    for (int i = 0; i < H; i++) {
        if (i % 2 == 0) {
            for (int j = 0; j < W; j++) {
                if (j != W - 1) {
                    if (a[i][j] % 2 == 1) {
                        from.push_back(make_pair(i, j));
                        to.push_back(make_pair(i, j + 1));
                        a[i][j + 1]++;
                    }
                } else {
                    if (a[i][j] % 2 == 1) {
                        from.push_back(make_pair(i, j));
                        to.push_back(make_pair(i + 1, j));
                        a[i + 1][j]++;
                    }
                }
            }
        }
        if (i % 2 == 1) {
            for (int j = W - 1; j >= 0; j--) {
                if (j != 0) {
                    if (a[i][j] % 2 == 1) {
                        from.push_back(make_pair(i, j));
                        to.push_back(make_pair(i, j - 1));
                        a[i][j - 1]++;
                    }
                } else {
                    if (a[i][j] % 2 == 1) {
                        from.push_back(make_pair(i, j));
                        to.push_back(make_pair(i + 1, j));
                        a[i + 1][j]++;
                    }
                }
            }
        }
    }

    if (to.size() > 0) {
        if (to.back().first == H) {
            from.pop_back();
            to.pop_back();
        }
    }

    cout << from.size() << endl;
    for (int i = 0; i < from.size(); i++) {
        cout << from[i].first + 1 << " " << from[i].second + 1 << " " << to[i].first + 1 << " " << to[i].second + 1 << endl;
    }

}


























































Measured memory_bytes: 5144
import numpy as np
N = int(input())

def factorization(n):
    if n == 1:
        return []

    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

Arr = factorization(N)

comp = []

for i in range(40):
    comp.append((i + 1) * (i + 2) / 2)

cn = np.array(comp)

Sum = 0

for arr in Arr:
    Sum += np.count_nonzero(arr[1] >= cn)
    
print(Sum)

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

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

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int UI;

using namespace std;

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

    string s;
    cin >> s;

    for (UI i = 0; i < s.size(); i += 2)
    {
        cout << s[i];
    }

    cout << endl;

    return 0;
}

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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 2010;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}


// Main Code

ll warr[N][N];
ll barr[N][N];

ll getW(int x, int y, int x2, int y2)
{
	if(x2 < x || y2 < y)return 0;
	ll temp = warr[x2][y2] - warr[x2][y-1] - warr[x-1][y2];
	temp += warr[x-1][y-1];
	return temp;
}
ll getB(int x, int y, int x2, int y2)
{
	if(x2 < x || y2 < y)return 0;
	ll temp = barr[x2][y2] - barr[x2][y-1] - barr[x-1][y2];
	temp += barr[x-1][y-1];
	return temp;
}

int main()
{
	int n, k;
	cin>>n>>k;
	ll k2 = 2*k;
	rep(i, 0, n)
	{
		int x, y;
		char ch;
		cin>>x>>y>>ch;
		x %= k2;
		y %= k2;
		x++, y++;
		if(ch == 'W')
			warr[x][y]++;
		else 
			barr[x][y]++;
	}
	repn(i, 1, k2)
	{
		repn(j, 1, k2)
		{
			warr[i][j] += warr[i-1][j] + warr[i][j-1] - warr[i-1][j-1];
			barr[i][j] += barr[i-1][j] + barr[i][j-1] - barr[i-1][j-1];
		}
	}
	ll ans = 0;

	repn(i, 1, k)
	{
		repn(j, 1, k)
		{
			ll tans = 0;
			tans += getW(i, j, i+k-1, j+k-1);
			tans += getW(1, 1, i-1, j-1);
			tans += getW(i+k, j+k, k2, k2);
			tans += getW(i+k, 1, k2, j-1);
			tans += getW(1, j+k, i-1, k2);
			tans += getB(i, 1, i+k-1, j-1);
			tans += getB(i+k, j, k2, j+k-1);
			tans += getB(1, j, i-1, j+k-1);
			tans += getB(i, j+k, i+k-1, k2);

			ans = max(ans, tans);
			tans = 0;
			tans += getB(i, j, i+k-1, j+k-1);
			tans += getB(1, 1, i-1, j-1);
			tans += getB(i+k, j+k, k2, k2);
			tans += getB(i+k, 1, k2, j-1);
			tans += getB(1, j+k, i-1, k2);
			tans += getW(i, 1, i+k-1, j-1);
			tans += getW(i+k, j, k2, j+k-1);
			tans += getW(1, j, i-1, j+k-1);
			tans += getW(i, j+k, i+k-1, k2);
			ans = max(ans, tans);
		}
	}
	cout<<ans<<endl;
}


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

const int SIZE = 510000;
int n[SIZE];
int x[SIZE];

void input() {
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		n[s.length() - 1 - i] = s[i] - '0';
	}
}

bool check(int k) {
	int i;
	
	for (i = 0; i < SIZE; i++) x[i] = 0;
	for (i = 0; i < SIZE; i++) x[i] = n[i] * 9;
	x[0] += 9 * k;
	
	for (i = 0; i + 1 < SIZE; i++) {
		x[i + 1] += x[i] / 10;
		x[i] %= 10;
	}
	
	int digit_sum = 0;
	for (i = 0; i < SIZE; i++) {
		digit_sum += x[i];
	}
	return (digit_sum <= 9 * k);
}

int main() {
	input();
	
	int st = 0, ed = SIZE, mid;	//xxxooo, (st, ed]
	while (ed - st >= 2) {
		mid = (st + ed) / 2;
		if (check(mid)) ed = mid;
		else st = mid;
	}
	cout << ed << endl;
	
	return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
int V[30], C[30];

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

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> V[i];
    }

    for(int i=0;i<N;++i){
        std::cin >> C[i];
    }

    int res = 0;

    for(int i=0;i<N;++i){
        int x = V[i] - C[i];

        if(x > 0){
            res += x;
        }
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - 1e8;
const ll INFLL = numeric_limits<ll>::max() - 1e17;

signed main() {
    int N;
    cin >> N;
    vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>>(2, vector<ll>(3, -INFLL)));
    dp[0][1][0] = 0;
    for (int i = 0; i < N; i++) {
        ll A;
        cin >> A;
        for (int j = 0; j < 3; j++) {
            dp[i + 1][0][j] = max(dp[i + 1][0][j], dp[i][1][j] + A);
            dp[i + 1][1][j] = max(dp[i + 1][1][j], dp[i][0][j]);
            if (j + 1 < 3) dp[i + 1][1][j + 1] = max(dp[i + 1][1][j + 1], dp[i][1][j]);
        }
    }
    if (N % 2 == 0) cout << max(dp[N][1][0], dp[N][0][1]) << endl;
    else cout << max(dp[N][0][2], dp[N][1][1]) << endl;
}


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

int main() {
  int N, T, A;
  cin >> N >> T >> A;
  vector<int> H(N);
  for (int i = 0; i < N; ++i) {
    cin >> H.at(i);
  }
  int ans;
  double min_abs = 1000000;
  for (int i = 0; i < N; ++i) {
    double temperature = T - H.at(i) * 0.006;
    if (abs(A - temperature) < min_abs) {
      min_abs = abs(A - temperature);
      ans = i + 1;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#define MOD 1000000007
#define ll long long int
using namespace std;
ll ind[100005];
ll fact[100005];
ll modPow(ll base, ll exp, ll mod) {
	ll ans = 1L;
	while (exp != 0) {
		if (exp % 2 != 0)
			ans = ans * base % mod;
		exp >>= 1;
		base %= mod;
		base = base * base % mod;
	}

	return ans;
}

ll nck(int n, int k) {
	if (n < k) {
		return 0;
	}
	ll ans = 1;
	return fact[n] * modPow(fact[k], MOD - 2, MOD) % MOD*modPow(fact[n - k], MOD - 2, MOD) % MOD;
}

int main() {
	int N;
	scanf("%d", &N);
	string str = "";
	int start, end;
	for (int i = 0; i < N+1; i++) {
		int t;
		scanf("%d", &t);
		if (ind[t-1] != 0) {
			start = ind[t-1];
			end = i+1;
			break;
		}
		ind[t-1] = i+1;
	}
	fact[0] = 1;
	for (int i = 1; i <= N + 1; i++) {
		fact[i] = fact[i - 1] * i % MOD;
	}
	int use = start-end+N;
	for (int i = 1; i <= N + 1; i++) {
		ll ans = (nck(N + 1, i)-nck(use, i-1)+MOD)%MOD;
		printf("%d\n", ans);
	}
	
	return 0;
}

Measured memory_bytes: 2816
def main():
    n = int(input())
    s = input()

    ls = [s[0]]

    index = 1

    while(n -1 >= index):
        if ls[len(ls)-1] != s[index]:
            ls.append(s[index])
        index += 1

    print(len(ls))

if __name__ == '__main__':
    main()

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

const int INF = 1e9;

int main() {
  int N, H;
  cin >> N >> H;

  vector<int> a(N), b(N);
  int ma = 0;
  for ( int i = 0; i < N; i++ ) {
    cin >> a[i] >> b[i];
    ma = max(ma, a[i]);    
  }
  
  sort(b.begin(), b.end(), greater<int>());
  int ans = (H-1)/ma+1;  
  int sum = 0;
  for ( int i = 0; i < N; i++ ) {
    sum += b[i];
    if ( H-sum > 0 ) ans = min(ans, (H-sum-1)/ma+1+i+1);    	      
    else ans = ans = min(ans, i+1);
  }

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


Measured memory_bytes: 1024
D, G = map(int, input().split())
qu = [0] * D
bonus = [0] * D
for i in range(D):
  a, b = map(int, input().split()) 
  qu[i] = a
  bonus[i] = b
  
ans = 10 ** 5  
for i in range(2 ** D):
  score = 0
  nn = 0
  yet = [0] * D
  for j in range(D):#j の 問い をコンプリートする
    if (i >> j) & 1:
      score += 100 * (j + 1) * qu[j] + bonus[j]
      nn += qu[j]
      yet[j] = 1
  if score >= G:
    ans = min(ans, nn)
  else:
    #print(i, score, nn)
    con = 0
    for k in range(1, D + 1):
      if con == 0:
        if yet[D - k] == 0:
          now = 100 * (D - k + 1) * (qu[D - k] - 1)
          if now + score >= G:
            subt = G - score
            nn += int((subt - 1) / (100 * (D - k + 1))) + 1
            ans = min(ans, nn) 
            con = 1
          else:
            score += now
            nn += qu[D - k] - 1
  #print(ans)    
print(ans)    
    
    
  
  
  


Measured memory_bytes: 9264
import java.util.Scanner;

public class Main {

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a, b, c, x, y;
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        x = sc.nextInt();
        y = sc.nextInt();
        long common = Math.min(x, y);
        long to = Math.min(a + b, 2 * c);
        long ans = to * common;
        x -= common;
        y -= common;
        ans += Math.min(x * a, x * 2 * c);
        ans += Math.min(y * b, y * 2 * c);
        System.out.print(ans);
    }
}


Measured memory_bytes: 23252
<?php

$n = trim(fgets(STDIN));

$o = 0;
for($i=0; $i<$n; $i++){
  $xu = explode(' ', trim(fgets(STDIN)));
  $x = $xu[0];
  $u = $xu[1];
  if ($u == 'JPY'){
    $o += $x;
  } else {
    $o += $x*380000;
  }
}

echo $o;
  
?>

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

int main () {
  string s;
  cin >> s;
  string ans = "No";
  if (s[2] == s[3] && s[4] == s[5]) ans = "Yes";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i< (int) n; i++)
 
 
int main () {
    int N;

    cin >> N;

    cout << "ABC"  << N << endl;
}

    


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
typedef pair<int, int> pii;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define ALL(container) container.begin(), container.end()
#define X first
#define Y second
pii operator+(const pii &s, const pii &t){ return pii(s.first+t.first, s.second+t.second);}
pii operator-(const pii &s, const pii &t){ return pii(s.first-t.first, s.second-t.second);}


pii d[7] = {pii(0, -1),pii(1, -1),pii(1, 0),pii(0, 1),pii(-1, 1),pii(-1, 0),pii(0, 0)};

vector<vector<pii>> Body[9];
vector<vector<pii>> g[9];

inline int abs(const pii &d){
	return ((d.X < 0) ^ (d.Y < 0)) ? max(abs(d.X), abs(d.Y)) : abs(d.X) + abs(d.Y);
}

inline int abs(const pii &p1, const pii &p2){
	return abs(p1 - p2);
}

void enumerateState(vector<pii> &p){
	Body[p.size()].push_back(p);
	if(p.size() == 8) return;
	const pii b = p.back();
	p.emplace_back();
	REP(i, 6){
		const pii q = b + d[i];
		p.back() = q;
		int f = 1;
		RREP(j, (int)p.size()-2) if(abs(p[j], q) <= 1) f = 0;
		if(f) enumerateState(p);
	}
	p.pop_back();
}

void makeGraph(){
	REPS(k, 8){
		const int n = Body[k].size();
		g[k].resize(n);
		REP(i, n)REP(j, i)REP(l, 7){
			int f = 1, prev = l != 6;
			for(int q=1;q<k&&f;q++){
				const int dist = abs(Body[k][j][q], Body[k][i][q] - d[l]);
				if(dist > 1 || (dist == 1 && prev)) f = 0;
				prev = dist;
			}
			if(f){
				g[k][i].emplace_back(j, l);
				g[k][j].emplace_back(i, l==6 ? l : (l+3)%6);
			}
		}
	}
}

struct State{
	pii pos;
	int id, cost;
	State(pii pos=pii(0, 0), int id=0, int cost=0):pos(pos), id(id), cost(cost){}
};

int n, m, visited[60][60][4100], Rock[60][60];
pii goal;

int main(){
	ios::sync_with_stdio(false);
	vector<pii> p(1, pii(0, 0));
	enumerateState(p);
	makeGraph();
	while(cin >> n, n){
		vector<pii> body(n);
		REP(i, n) cin >> body[i].X >> body[i].Y;
		pii pos = pii(30, 30);
		memset(Rock, 0, sizeof(Rock));
		memset(visited, 0, sizeof(visited));
		cin >> m;
		REP(i, m){
			pii t;
			cin >> t.X >> t.Y; t = t - body[0] + pos;
			if(abs(t, pos) > 25) continue;
			Rock[t.X][t.Y] = 1;
		}
		cin >> goal.X >> goal.Y; goal = goal - body[0] + pos;
		RREP(i, n) body[i] = body[i] - body[0];
		int state = find(ALL(Body[n]), body) - Body[n].begin();
		
		visited[pos.X][pos.Y][state] = 1;
		queue<State> que;
		que.emplace(pos, state, 0);
		int ans = 20;
		while(!que.empty()){
			State s = que.front();que.pop();
			if(s.pos == goal){
				ans = s.cost;
				break;
			}
			FOR(it, g[n][s.id]){
				State t(s.pos + d[it->second], it->first, s.cost+1);
				if(t.cost + abs(t.pos, goal) >= 20 || visited[t.pos.X][t.pos.Y][t.id]) continue;
				visited[t.pos.X][t.pos.Y][t.id] = 1;
				int f = 1;
				REP(i, n) if(Rock[t.pos.X+Body[n][t.id][i].X][t.pos.Y+Body[n][t.id][i].Y]) f = 0;
				if(f) que.push(t);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 61164
#include <bits/stdc++.h>
using namespace std;
#define ll long long
template <typename T>
bool PN(T x){ if (x <= 1) return false; if (x == 2) return true; for (int i = 2; i < sqrt(x) + 1; i++) if (x % i == 0) return false; return true;}
const ll MOD = 1e9+7;
long long Comb(int n, int i){long long ans = 1; if(i == 0 || i == n) return 1; else {for(int j = 1; j <= i; ++j){
      ans *=(n+1-j);
      ans /= j;
      ans %= MOD;} }return ans;}

void solve()
{
  int n; cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    int q; cin >> q;
    while(q--){
        int k; cin >> k;
        int left = 0;
        int right = n;
        int flag = 0;
        int middle = (left+right)/2;
        while(left < right){
            if(a[middle] == k) {
                cout << 1 <<endl;
                flag = 1;
                break;
            } else if(a[middle] > k){
                right = middle-1;
            } else {
                left = middle + 1;
            }
            middle = (left + right)/2;
            if(a[middle] == k) {
                cout << 1 << endl;
                flag = 1;
                break;
            }
        }
        if(!flag) cout << 0 << endl;
    }
}

int main()
{
  solve();
  return 0;
}



Measured memory_bytes: 3476
import math
from functools import reduce

def gcd(*n):
    return reduce(math.gcd, n)

k = int(input())

ans = 0
l = []
for a in range(1, k+1):
    for b in range(1, k+1):
        l.append(math.gcd(a, b))

for li in l :
    for c in range(1, k+1):
        ans += math.gcd(li, c)

print(ans)

Measured memory_bytes: 70428
#include<bits/stdc++.h>
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

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;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
Vi accum(Vi v){Vi ret((v).size());ret[0]=v[0];REP(i,1,(v).size()) ret[i]=ret[i-1]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

struct good{int weight,value;};
struct napsak{
    int N,W;
    vector<good> goods;
    VVi dp;
    napsak(int n,int w){
        init(n,w);
    }
    void init(int n,int w){
        N=n; W=w;
        dp.resize(N+1);
        REP(i,0,N+1) dp[i].resize(W+1);
        REP(i,0,N+1) REP(j,0,W+1) dp[i][j]=INF;
    }
    void add_goods(int w,int v){
        good g;
        g.weight=w,g.value=v;
        goods.pb(g);
    }
    int solve(){
        REP(i,0,N+1) REP(j,0,W+1) dp[i][j]=0;
        N=goods.size();
        REP(i,0,N){
            REP(j,0,W+1){
                chmax(dp[i+1][j],dp[i][j]);
                if(j+goods[i].weight<=W){
                    chmax(dp[i+1][j+goods[i].weight],dp[i][j]+goods[i].value);
                }
            }
        }
        return dp[N][W];
    }
};

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
    int n,t;
    cin>>n>>t;
    Vi a(n),b(n);
    REP(i,0,n) cin>>a[i]>>b[i];
    VPii p(n);
    REP(i,0,n) p[i]=mp(a[i],b[i]);
    sort(ALL(p));

    napsak NS(n,t-1);
    REP(i,0,n){
        NS.add_goods(p[i].first,p[i].second);
    }
    NS.solve();

    int ans=0;
    REP(i,0,n-1){
        chmax(ans,NS.dp[i+1][t-1]+p[i+1].second);
    }
    cout<<ans<<endl;
    return 0;
}



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

int main() {
	char str[4];

	cin >> str;
	if (str[2] != '\0') {
		char ren[4];
		ren[3] = '\0';
		for (int i = 0; i < 3; i++) {
			ren[i] = str[2 - i];
		}
		cout << ren << endl;
		return 0;
	}
	cout << str << endl;
	return 0;
}

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

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
string S,T;

ll alpha[30];

int main() {
    std::cin >> S;
    std::cin >> T;
    Fill(alpha,-1);
    for (int i = 0; i < S.length(); i++) {
        if(alpha[S[i]-'a'] == -1){
            alpha[S[i]-'a'] = T[i]-'a';
        }else{
            if(alpha[S[i]-'a'] == T[i]-'a'){
                continue;
            }else{
                std::cout << "No" << std::endl;
                return 0;
            }
        }
    }
    Fill(alpha,-1);
    for (int i = 0; i < T.length(); i++) {
        if(alpha[T[i]-'a'] == -1){
            alpha[T[i]-'a'] = S[i]-'a';
        }else{
            if(alpha[T[i]-'a'] == S[i]-'a'){
                continue;
            }else{
                std::cout << "No" << std::endl;
                return 0;
            }
        }
    }
    std::cout << "Yes" << std::endl;
    return 0;
}


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

int main(void){
  int n,k,c;
  double ans;
  
  cin >> n >> k;
  ans = 0; c = 1;
  while (n*c<k){
    c*=2;
  }
  for (int i=n;i>=1; i--){
    if (i*c<k) c*=2;
    ans += 1.0/n/c;
  }
  cout << setprecision(12);
  cout << ans << endl;
  return 0;
}
  
  
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
const int MAX = 300005;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ll Pow(ll a , ll b){
	if(b == 0) return 1 ;
	ll c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c)% mod )) % mod ;
	return (c * c) % mod ;
}
int N, M , Q ;
ll parent[MAX] , component_size[MAX] , result[MAX] ;

int findRoot(int node){
	return parent[node] == node ? node : parent[node] = findRoot(parent[node]) ;
}
void UnionNodes(int x , int y){
	int rootX = findRoot(x) ;
	int rootY = findRoot(y) ;
	if(rootX == rootY) return ; 
	if(rand() & 1) swap(rootX , rootY) ;
	parent[rootY] = rootX ;
	component_size[rootX] += component_size[rootY];
    component_size[rootY] = 0;
}
//check modulo
int main(){
	IOS;
	cout.precision(50) ;
	ll n , m; cin >> n >> m;
	N = n ;
	for (int i = 0; i < N; i ++) {
        parent[i] = i;
        component_size[i] = 1;
    }
    vll ans(m) ;
    vector<pii> v(m);
    int a , b ;
    for(int i = 0 ; i < m ; i++){
		cin >> a >> b;
		a--;b--;
		v[i] = mp(a , b); 
	}
	reverse(v.begin() , v.end()) ;
	ll res = (n * (n - 1)) / 2 ;
	for(int i = 0 ; i < m ; i++){
		ans[m - 1 - i] = res ;
		a = findRoot(v[i].x) ;
		b = findRoot(v[i].y) ;
		ll anc1 = (component_size[a] * (component_size[a] - 1)) / 2  ;
		ll anc2= (component_size[b] * (component_size[b] - 1)) / 2 ;
		//cout << a << " " << b << " " << anc1 << " " << anc2 <<" " << component_size[a] <<" " << component_size[b]<< " " << res << endl; 
		if(a != b){
			UnionNodes(a ,b);
			res += anc1 + anc2 ;
			if(findRoot(a) == a){
				
				res -= (component_size[a] * (component_size[a] - 1)) / 2 ; 
			}
			else{
				
				res -= (component_size[b] * (component_size[b] - 1)) / 2 ;
			}
		}
		//cout <<"hiiii " << a << " " << b << " " << anc1 << " " << anc2 <<" " << component_size[a] <<" " << component_size[b]<< " " << res << endl; 
		
	}
	for(int i = 0 ; i < m ; i++) cout << ans[i] << "\n" ;
	
	return 0;
}


Measured memory_bytes: 7040
/**
 *    author:  Saurav Paul 
 *    created: June 20, 2020 12:22 PM
 *    Problem Name : A - Five Variables
 *    Problem Url : https://atcoder.jp/contests/abc170/tasks/abc170_a
**/

#include<bits/stdc++.h>
using namespace std;

int main(){

    int n = 5;
    vector <int > v(n);
    for(auto &x : v){
         cin >> x ;
    }
    
    for(int i = 0 ; i < n; i++){
        if(v[i]==0){
            cout << i + 1 << endl ;
            break;
        }    
    }
    return 0;
}


Measured memory_bytes: 3600
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] l = new int[3];
		while (n-->0) {
			l[0] = s.nextInt();
			l[1] = s.nextInt();
			l[2] = s.nextInt();
			Arrays.sort(l);
			System.out.println((l[0]*l[0]+l[1]*l[1]-l[2]*l[2] == 0)?"YES":"NO");
		}
	}
}

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

int main(){
   int K;
   std::string S;
   std::cin >> K >> S;
   if (S.size() <= K){
      std::cout << S << std::endl;
   } else{
      std::cout << S.substr(0, K) + "..." << std::endl;
   }
}



Measured memory_bytes: 3628
#include<iostream>
#include<math.h>
#define long long int
using namespace std;
int main()
{
    int n;
    int d;
    cin>>n>>d;
    int ct=0;
   while(n--)
   {
       int a,b;
       cin>>a>>b;
       if(sqrt(pow(double(a),2)+pow(double(b),2))<=d)
        ct++;
   }
   cout<<ct;

}



Measured memory_bytes: 3644
#include <stdio.h>

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

    for (;;){
        int s1 = N / 100;
        int s2 = (N / 10) % 10;
        int s3 = N % 10;
        if (s1 != s2 || s2 != s3){
            N += 1;
        }
        if (s1 == s2 && s2 == s3){
            break;
        }
    }

    printf("%d",N);

    return 0;
}


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

using namespace std;

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

const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1000000000000000000L;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int ddx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int ddy[] = {0, 1, 1, 1, 0, -1, -1, -1};

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

int main() {
    int n, k;
    cin >> n >> k;
    int g;
    cin >> g;
    int mx = g;
    rep(i, n - 1) {
        int a;
        cin >> a;
        mx = max(mx, a);
        g = gcd(g, a);
    }
    cout << ((k <= mx && k % g == 0)? "POSSIBLE" : "IMPOSSIBLE") << endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int n = ir.nextInt();
		out.println(n < 1200 ? "ABC" : "ARC");
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

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

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}

Measured memory_bytes: 21332
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;

int main(void)
{
	ll n,m;
	scanf("%lld%lld",&n,&m);
	if(n==1 || m==1) printf("1");
	else if(n&1) printf("%lld",n/2*m + (m+1)/2);
	else printf("%lld",n/2*m);
	return 0;
}

Measured memory_bytes: 128
N = int(input())
a = 0
b = 0
c = 0
d = 0
for i in range(N):
  temp = str(input())
  if temp == "AC":
    a += 1
  elif temp == "WA":
    b +=1
  elif temp == "TLE":
    c += 1
  else:
    d += 1
print("AC x "+str(a))
print("WA x "+str(b))
print("TLE x "+str(c))
print("RE x "+str(d))

Measured memory_bytes: 9208
from collections import Counter
def main():
    N = int(input())
    d = Counter()
    l = 0
    for _ in range(N):
        s = input()
        if s not in d:
            d[s] = 1
        else:
            d[s] += 1
        l = max(d[s], l)
    d2 = []
    for i in d:
        if d[i] == l:
            d2.append(i)
    d2.sort()
    for j in d2:
        print(j)
main()


Measured memory_bytes: 32460
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <functional>
#include <random> 
using namespace std;

#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int

#define M_DEBUG 1
#define PI 3.141592653589793


int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    for (int i = 1; i < 10; ++i) {
      for (int j = 1; j < 10; ++j) {
        if (n == i * j) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }

    cout << "No" << endl;
    return 0;
}


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

#define MAXN (200010)

int n;
int q[MAXN], t[MAXN], f[MAXN];

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; ++ i){
		int pi;
		scanf("%d", &pi);
		q[pi] = i;
	}
	for(int i = n - 1; i; -- i){
		if(!t[i + 1]){
			if(q[i] > q[i + 1]){
				t[i] = 1;
				f[i] = i + 1;
			}
			else{
				continue;
			}
		}
		else{
			if(q[f[i + 1]] < q[i]        && q[i]        < q[i + 1]    ||
			   q[i]        < q[i + 1]    && q[i + 1]    < q[f[i + 1]] ||
			   q[i + 1]    < q[f[i + 1]] && q[f[i + 1]] < q[i]){
			   	t[i] = t[i + 1];
			   	f[i] = f[i + 1];
			}
			else{
				t[i] = t[i + 1] + 1;
				f[i] = i + 1;
			}
		}
	}
	printf("%d\n", t[1]);
	return 0;
}

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

public class Main {


    public Main(FastScanner in, PrintWriter out) {
        int N = in.nextInt();
        char[] C = in.next().toCharArray();
        int i = 0, j = N - 1;
        int res = 0;
        while (i < j) {
            while (i < j && C[i] == 'R') i++;
            while (j > i && C[j] == 'W') j--;
            if (i < j) {
                res++;
                i++;
                j--;
            }
        }
        out.println(res);
    }

    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        // Scanner in = new Scanner(
                // new BufferedReader(new InputStreamReader(System.in)));
        FastScanner in = new FastScanner(System.in);

        Main sol = new Main(in, out);

        out.close();
    }
}


class FastScanner{
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

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

    int read()
    {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars){
            curChar = 0;
            try{
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

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

    boolean isEndline(int c)
    {
        return c=='\n'||c=='\r'||c==-1;
    }

    int nextInt()
    {
        return Integer.parseInt(next());
    }

    long nextLong()
    {
        return Long.parseLong(next());
    }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String next(){
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do{
            res.appendCodePoint(c);
            c = read();
        }while(!isSpaceChar(c));
        return res.toString();
    }

    String nextLine(){
        int c = read();
        while (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do{
            res.appendCodePoint(c);
            c = read();
        }while(!isEndline(c));
        return res.toString();
    }
}


Measured memory_bytes: 34712
#include<bits/stdc++.h>
using namespace std;
                       ///****   Hasebul Hassan Chowdhury ***////
#define ms(a,v)        memset(a,v,sizeof a)
#define lll            long long
#define FOR(i,a,b)     for(int i=a;i<=b;i++)
#define fast           ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Read           freopen("input.txt", "r", stdin)
#define Write          freopen("output.txt", "w", stdout)
#define INF            1000000000


int main()
{
    string s;
    cin>>s;
    int n=s.size();
    string x=s;
    reverse(s.begin(),s.end());
    if(x!=s) { cout<<"No"<<endl; return 0; }
    string now="";
    for(int i=0;i<(n-1)/2;i++) now+=x[i];
    string now2=now;
    reverse(now.begin(),now.end());
    if(now!=now2) { cout<<"No"<<endl; return 0; }
    ///
    string now3="";
    for(int i=((n+3)/2)-1;i<n;i++) now3+=x[i];
    string now4=now3;
    reverse(now3.begin(),now3.end());
    if(now3!=now4) { cout<<"No"<<endl; return 0; }
    cout<<"Yes"<<endl;
}


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

using namespace std;

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

	int N;
	cin >> N;
	vector<double> heads(N);
	for(auto& p : heads)
	{
		cin >> p;
	}

	vector<vector<double> > dp(N + 1, vector<double>(N + 1, 0));
	dp[0][0] = 1;
	for(int i = 1; i <= N; ++i)
	{
		dp[i][0] = dp[i - 1][0] * (1 - heads[i - 1]);
	}

	for(int i = 1; i <= N; ++i)
	{
		for(int j = 1; j <= N; ++j)
		{
			dp[i][j] = dp[i - 1][j - 1] * heads[i - 1] + dp[i - 1][j] * (1 - heads[i - 1]);
		}
	}

	double res = 0;

	for(int j = (N + 1) >> 1; j <= N; ++j)
	{
		res += dp[N][j];
	}

	cout << fixed << setprecision(10) << res << "\n";

	return 0;
}

Measured memory_bytes: 70784
import sys
input = sys.stdin.buffer.readline

def cal(x,y):
    return (x**2 + y**2)**0.5
    
N, D = map(int,input().split())
ans = 0
for i in range(N):
    X, Y = map(int,input().split())
    if cal(X,Y) <= D:
        ans += 1
print(ans)

Measured memory_bytes: 9684
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
int a[114514],gu[114514],ki[114514];
signed main(){
	ic(n) ic(a) ic(b)
	c((b-1)/max(n,a)+1)
}	

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

const double PI = acos(-1.0);
typedef long long ll;

inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	for(; !isdigit(ch); ch = getchar()) if(ch=='-') f=-1;
	for(; isdigit(ch); ch = getchar()) x = (x*10)+(ch^48);
	return x * f;
}

int n, top;
struct Point {
	ll x, y;
	int id;
	Point(ll x = 0, ll y = 0): x(x), y(y) {}
	bool operator < (const Point &rhs) const {
		return x < rhs.x || (x == rhs.x && y < rhs.y);
	}
}p[110], s[110], h[110];

typedef Point Vector;

Vector operator - (const Point &a, const Point &b) {
	return Vector(a.x-b.x, a.y-b.y);
}

Vector operator + (const Vector &a, const Vector &b) {
	return Vector(a.x+b.x, a.y+b.y);
}

Vector operator * (const Vector &a, const double &b) {
	return Vector(a.x*b, a.y*b);
}

inline ll cross(const Vector &a, const Vector &b) {
	return a.x*b.y-a.y*b.x;
}

Vector rot(Vector a) {
	return Vector(-a.y, a.x);
}

double res[110];

int main() {

	n = read();
	int i;
	for(i = 1; i <= n; i++) 
		p[i].x = read(), p[i].y = read(), p[i].id = i;

	sort(p+1, p+n+1);
	for(i = 1; i <= n; i++) {
		while(top >= 2 && cross(s[top]-s[top-1], p[i]-s[top]) >= 0) top--;
		s[++top] = p[i];
	}
	int cnt = top;
	for(i = n-1; i >= 1; i--) {
		while(top >= cnt+1 && cross(s[top]-s[top-1], p[i]-s[top]) >= 0) top--;
		s[++top] = p[i];
	}
	if(top == 3) {
		res[s[1].id] = 0.5;
		res[s[2].id] = 0.5;
	}
	else {
		/*for(i = 1; i <= top; i++) {
			printf("%.6lf %.6lf\n", s[i].x, s[i].y);
		}
		printf("\n");*/
		for(i = 1; i < top; i++) {
			h[i] = rot(s[i+1]-s[i]);
			//printf("%.6lf %.6lf\n", (p[i+1]-p[i]).x, (p[i+1]-p[i]).y);
		}
		/*for(i = 1; i <= top; i++) {
			printf("%.6lf %.6lf\n", h[i].x, h[i].y);
		}
		printf("\n");*/
		for(i = 1; i < top-1; i++) {
			double alpha = atan2(h[i].y, h[i].x)-atan2(h[i+1].y, h[i+1].x);
			//printf("?%.8lf\n", alpha/PI*180);
			while(alpha > PI) alpha -= PI;
			while(alpha < 0) alpha += PI;
			//printf("%.8lf\n", alpha/PI*180);
			res[s[i+1].id] = alpha/(2*PI);
		}
		double alpha = atan2(h[top-1].y, h[top-1].x)-atan2(h[1].y, h[1].x);
		while(alpha > PI) alpha -= PI;
		while(alpha < 0) alpha += PI;
		res[s[1].id] = alpha/(2*PI);
	}
	for(i = 1; i <= n; i++) printf("%lf\n", res[i]);
	return 0;
}


Measured memory_bytes: 384
// A to Z String
#include <iostream>
#include <string>
using namespace std;

string s;

int main(){
    cin>>s;
    int a=-1,z;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A'&&a==-1) a=i;
        if(s[i]=='Z') z=i;
    }
    cout<<z-a+1<<endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = n-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int dist(pair<int, int> x, pair<int, int> y){
    return abs(x.first - y.first) + abs(x.second - y.second);
}

int main(){
    int h, w, d; cin >> h >> w >> d;
    vector<pair<int, int> > vp(90005);
    rep(i, h) rep(j, w){
        int a; cin >> a;
        vp[a] = make_pair(i, j);
    }
    vector<int> vd(90005);
    rep(m, d){
        vd[m] = 0;
        int k = m + d;
        while(k <= h * w){
            vd[k] = vd[k-d] + dist(vp[k-d], vp[k]);
            k += d;
        }
    }

    int q; cin >> q;
    rep(i, q){
        int l, r; cin >> l >> r;
        cout << vd[r] - vd[l] << endl;
    }
}

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


int main(void){
    int N; cin >> N;
    int d[N];
    for (int i = 0; i < N; i++)
    {
        cin >> d[i];
    }
    sort(d,d+N);
    cout << d[N/2] - d[N/2 - 1] << endl;
}

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

int main(){
  char s[3];
  int a=0,b=0;
  for(int i = 0;i < 3;i++){
    cin >> s[i];
    if(s[i] == 'A')
      a++;
    if(s[i] == 'B')
      b++;
  }

  if(a == 3 || b == 3)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}


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

int main()
{
    i64 n;
    string s;
    cin >> n >> s;
    i64 left = 0, p = 0;
    for (i64 i = 0; i < n; i++)
        if (s[i] == '(')
            p++;
        else
        {
            if (p == 0)
                left++;
            else
                p--;
        }
    i64 right = p;
    cout << string(left, '(') << s << string(right, ')') << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#define N 210000
#define M 4100
#define mmod 1000000007
using namespace std;
int f[M][M],n,a[N],b[N],o=2000,ans,ny[2*M],jc[2*M];
void upd(int &x,int y)
{
	x=(x+y)%mmod;
}
int C(int n,int m)
{
	return 1ll*jc[n]*ny[m]%mmod*ny[n-m]%mmod;
}
int main()
{
	jc[0]=ny[0]=jc[1]=ny[1]=1;
	for(int i=2;i<2*M;i++) jc[i]=1ll*i*jc[i-1]%mmod,ny[i]=1ll*(-mmod/i)*ny[mmod%i]%mmod;
	for(int i=2;i<2*M;i++) ny[i]=1ll*ny[i]*ny[i-1]%mmod;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) 
	{
		scanf("%d%d",&a[i],&b[i]);
		f[o-a[i]][o-b[i]]++;
	}
	for(int i=-o;i<=o;i++)
		for(int j=-o;j<=o;j++)
			upd(f[i+o][j+o+1],f[i+o][j+o]),upd(f[i+o+1][j+o],f[i+o][j+o]);
	for(int i=1;i<=n;i++) upd(ans,f[a[i]+o][b[i]+o]);
	for(int i=1;i<=n;i++) 
		upd(ans,-C(2*(a[i]+b[i]),a[i]+a[i]));
	int ny=(mmod+1)/2;
	ans=1ll*ans*ny%mmod;
	upd(ans,mmod);
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n;
  cin>>n;
  REP(i, n+1){
    int tmp=i;
    tmp*=1.08;
    if(tmp==n){
      cout<<i<<'\n';
      return 0;
    }
  }
  cout<<":("<<'\n';
  return 0;
}

Measured memory_bytes: 256