akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Linq;
using System.Collections.Generic;

namespace VirtualAtCorder
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] a = Console.ReadLine().Split(' ');
            int defSweetsC = int.Parse(a[0]);
            int weight = int.Parse(a[1]);
            List<int> material = new List<int>();
            int minSweets = 0;
            int sweetsC = 0;

            for (int i = 0; i < defSweetsC; i++)
            {
                int buf = int.Parse(Console.ReadLine());
                if (!IsWeight(buf))
                {
                    i--;
                    continue;
                }
                material.Add(buf);
            }

            minSweets = material.Min();

            foreach (var i in material)
            {
                weight -= i;
                if (0 > weight) break;
                sweetsC++;
            }
            while (weight >= minSweets)
            {
                sweetsC++;
                weight -= minSweets;
            }

            Console.WriteLine(sweetsC);

            Console.ReadKey();
        }
        static bool Donats(int n)
        {
            return 2 <= n && n <= 100;
        }

        static bool IsWeight(int m)
        {
            return 1 <= m && m <= 1000;
        }

        static bool IsSweetWeight(int[] material, int x)
        {
            int sum = material.Sum();
            return sum <= x && x <= Math.Pow(10, 5);
        }




    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> a(n, 0);
  vector<ll> count(n + 5, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    count[a[i]]++;
  }
  ll sum = 0;
  for (auto i : count) {
    sum += max(0ll, i * (i - 1) / 2);
  }
  for (int i = 0; i < n; i++) {
    cout << sum - (count[a[i]] - 1) << '\n';
  }
}


Measured memory_bytes: 4864
#include <iostream>
using namespace std;
#define M 1000000007

void mult(int *a, int *b, int n) {
    int temp[n][n];
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) {
            long long sum = 0;
            for (int k = 0; k < n; k++) sum += (long long)a[i*n+k] * b[k*n+j] % M;
            temp[i][j] = sum % M;
        }
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) a[i*n+j] = temp[i][j];
}

void power(int *a, long long e,  int n) {
    int p[n][n] = {};
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) p[i][j] = a[i*n+j], a[i*n+j] = (i==j);
    while (e > 0) {
        if (e % 2) mult(a, &p[0][0], n);
        mult(&p[0][0], &p[0][0], n);
        e /= 2;
    }
}

int main() {
    int n; cin >> n;
    long long k; cin >> k;
    int a[n][n]; for (int i = 0; i < n; i++) for (int j = 0 ; j < n; j++) cin >> a[i][j];
    power(&a[0][0], k, n);
    long long ans = 0;
    for (int i = 0; i < n; i++) for (int j = 0 ; j < n; j++) ans += a[i][j];
    cout << (ans%M + M)%M << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define debug(x) #x << "=" << (x)

#define DEBUG

#ifdef DEBUG
#define var_dump(...) fprintf(stdout, __VA_ARGS__)
#define dump(a) cout << a << "\n";
#else
#define var_dump(...) 42
#define dump(a) 42
#endif

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://beta.atcoder.jp/contests/abc076/tasks/abc076_c

int main() {
    string S; cin >> S;
    string T; cin >> T;

    if (S.length() < T.length()) {
        cout << "UNRESTORABLE" << "\n";
        return 0;
    }

    string m = "~";
    REP(i, S.length() - T.length() + 1) {
        string sub = S.substr(i, T.length());

        bool can = true;
        REP(j, T.length()) {
            if (sub[j] != T[j] && sub[j] != '?') {
                can = false;
                break;
            }
        }

        if (can) {
            string P = S;
            REP(k, T.length()) {
                P[i+k] = T[k];
            }
            REP(k, P.length()) {
                if (P[k] == '?') P[k] = 'a';
            }

            m = min(m, P);
        }

    }

    if (m == "~") {
        cout << "UNRESTORABLE" << "\n";
    } else {
        cout << m << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
Mod = 1000000007



def main(): #startline--------------------------------------------
    S = input()
    S += "R"
    N = len(S)
    part_S = []
    keep = "start"
    cnt = 0
    for i in range(N):
        if S[i] == "R":
            if keep == "L":
                part_S.append(S[cnt:i])
                cnt = i
        keep = S[i]
    ans = []
    for i in part_S:
        i = i.replace("RL","p")
        if len(i) % 2 == 1:
            for j in i:
                if j == "R":
                    ans.append(0)
                elif j == "p":
                    for k in range(2):
                        ans.append(len(i)//2+1)
                elif j == "L":
                    ans.append(0)
        else:
            cnt = 0
            for j in i:
                cnt += 1 
                if j == "R":
                    ans.append(0)
                elif j == "p":
                    if cnt % 2 == 1: 
                        ans.append(len(i)//2+1)
                        ans.append(len(i)//2)
                    else:
                        ans.append(len(i)//2)
                        ans.append(len(i)//2+1)                       
                elif j == "L":
                    ans.append(0)
    print(*ans,sep = " ")

if __name__ == "__main__":
    main() #endline===============================================




def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Measured memory_bytes: 11824
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

sum=0

for x in range(0,N):
  sum+=B[A[x]-1]
  if(x>=1 and A[x]-A[x-1]==1):
    sum+=C[A[x-1]-1]

print(sum)

Measured memory_bytes: 3064
N,M,X=map(int,input().split())
s = input().rstrip().split(' ')
counta = 0
countb = 0
for i in range(M):
  if int(s[i]) > X and int(s[i]) < N:
    counta += 1
for j in range(M):
  if int(s[j]) < X:
    countb += 1
count = min(counta, countb)
print(count)

Measured memory_bytes: 3064
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    deque<char> dq;
    string s;
    cin >> s;
    rep(i, s.size()){
        dq.push_back(s[i]);
    }
    bool flag = true;
    int q;
    cin >> q;
    rep(i, q){
        int num;
        cin >> num;
        if(num == 1){
            flag = !flag;
        } else {
            int f;
            cin >> f;
            char c;
            cin >> c;
            if(f == 1){
                if(flag){
                    dq.push_front(c);
                } else {
                    dq.push_back(c);
                }
            } else {
                if(flag){
                    dq.push_back(c);
                } else {
                    dq.push_front(c);
                }
            }
        }
    }
    if(flag){
        rep(i, dq.size()){
            cout << dq[i];
        }
    } else {
        reverse(all(dq));
        rep(i, dq.size()){
            cout << dq[i];
        }
    }

    cout << endl;
}   

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

using namespace std;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVC vector<vector<char>>
typedef long long ll;
const int  INF = 2147483647;
const ll INFL = 1LL << 50;
const ll mod = 1000000007;




int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int a = 0, b = 0;
	REP(i, n) {
		if (s[i] == '(') {
			a++;
		}
		else {
			a--;
			b = min(b, a);
		}
	}
	if (-b) {
		REP(i, -b) {
			cout << '(';
		}
	}
	cout << s;
	if (a-b) {
		REP(i, a-b) {
			cout << ')';
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,m=mp()
a=-float("inf")
b=float("inf")
for i in range(m):
    l,r=mp()
    a=max(a,l)
    b=min(b,r)
print(max(b-a+1,0))

Measured memory_bytes: 78932
#include <stdio.h>

#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, m[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int);
void dfs();

int main()
{
  int u, v, k, i, j;

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

  for(i=0; i<n; i++) {
    scanf("%d %d", &u, &k);
    u--;
    for(j=0; j<k; j++) {
      scanf("%d", &v);
      v--;
      m[u][v]= 1;
    }
  }

  dfs();
  return 0;
}

void dfs_visit(int u)
{
  int v;

  color[u] = GRAY;
  d[u] = ++tt;

  for(v=0; v<n; v++) {
    if(m[u][v] == 0)
      continue;
    if(color[v] == WHITE)
      dfs_visit(v);
  }
  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs()
{
  int u;

  for(u=0; u<n; u++)
    color[u] = WHITE;
  tt = 0;

  for(u=0; u<n; u++) {
    if(color[u] == WHITE)
      dfs_visit(u);
  }

  for(u=0; u<n; u++) {
    printf("%d %d %d\n", u+1, d[u], f[u]);
  }
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;int main() {
  int N, A, Min;
  cin >> N;
  int Ans;
  Ans = 1000;
  for(int i = 0; i < N; i++){
    cin >> A;
    Min = 0;
    while(A % 2 == 0){
      Min++;
      A /= 2;
    }
    if(Ans > Min){
        Ans = Min;
    }
  }
  cout << Ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int num1 = scan.nextInt();
		int num2 = scan.nextInt();
		System.out.printf("%d %d\n", num1*num2, num1*2 + num2*2);
	}
	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 25944
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <set>

using namespace std;

typedef long long ll;
const ll maxn = 200010;
struct node
{
    ll num0,num1,id;
    bool operator < (const node &b) const
    {
        if (num1 * b.num0 == num0 * b.num1)
            return id < b.id;
        return num1 * b.num0 < num0 * b.num1;
    }
}e[maxn];

set <node> S;

ll n,fa[maxn],f[maxn],ans;

ll find(ll x)
{
    if (x == f[x])
        return x;
    return f[x] = find(f[x]);
}

int main()
{
    scanf("%lld",&n);
    for (ll i = 2; i <= n; i++)
    {
        scanf("%lld",&fa[i]);
        f[i] = i;
    }
    f[1] = 1;
    for (ll i = 1; i <= n; i++)
    {
        scanf("%lld",&e[i].num1);
        e[i].num0 = 1 - e[i].num1;
        e[i].id = i;
        if (i != 1)
            S.insert(e[i]);
    }
    while (!S.empty())
    {
        node u = *S.begin();
        S.erase(S.begin());
        ll x = u.id;
        ll y = find(fa[x]);
        ans += e[y].num1 * e[x].num0;
        if (y != 1)
            S.erase(e[y]);
        f[find(u.id)] = y;
        e[y].num1 += e[x].num1;
        e[y].num0 += e[x].num0;
        if (y != 1)
            S.insert(e[y]);
    }
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 20608
from sys import stdin
from sys import setrecursionlimit
from numba import jit

setrecursionlimit(10 ** 7)

n,m,k = map(int,stdin.readline().rstrip().split())
mod = 998244353
wariate = 1
point = 0

@jit
def prepare(n, MOD=mod):
    facts = [1]*(n+1)
    for i in range(1, n+1):
        facts[i] = facts[i-1]*i%MOD
    invs = [1]*(n+1)
    invs[n] = pow(facts[n], MOD-2, MOD)
    for i in range(0, n)[::-1]:
        invs[i] = invs[i+1] * (i+1) % MOD
    return facts, invs

facts, invs = prepare(n, mod)
for i in range(n-1,-1,-1):
    now = m
    if i != n-1:
        wariate *= m-1
        wariate %= mod
    now *= wariate%mod
    now *= facts[n-1]*invs[n-1-i]*invs[i]%mod
    if i <= k:
        point += now%mod

print(point%mod)

Measured memory_bytes: 133528
import math
a=int(input())

# 整数xが素数かどうかを判定する
def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True

for i in range(a,a+10**5):
    if is_prime(i):
        print(i)
        break

Measured memory_bytes: 38256
n = int(input())
i = n % 10
 
if i == 2 or i == 4 or i == 5 or i == 7 or i == 9:
    print("hon")

elif i == 0 or i == 1 or i == 6 or i == 8:
    print("pon")

elif i == 3:
    print("bon")


Measured memory_bytes: 9180
import math
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
import copy
def count_order(x, n_s):
    ans = 1
    s_ = 1
    y = copy.copy(x)
    for i in x:
        y.remove(i)
        tmp = sum(1 for x in y if x<i) 
        ans += math.factorial(n_s-s_) * tmp
        s_ += 1
    return(ans)
print(abs(count_order(p,n) - count_order(q,n)))

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

int main(){
  int n;
  cin >> n;
  string str;
  cin >> str;
  int wr=0, er=0, wl=0, el=0;
  for(int i=0; i<n; i++){
    if(str[i] == 'W') wr++;
    else er++;
  }
  int smallest = 1000000007;
  for(int i=0; i<n; i++){
    if(str[i] == 'W'){
      wr--;
      smallest = min(smallest, wl+er);
      wl++;
    }else{
      er--;
      smallest = min(smallest, wl+er);
      el++;
    }
  }
  cout << smallest << endl;
  return 0;
}
      
    


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 5005;

int n, k;
char a[N];
int len;
char b[N], ans[N];

void check(int l, int r) {
	int k = 0;
	for (int i = r + 1; i <= n && k < len; ++i) {
		b[++k] = a[i];
	}
	for (int i = r == n ? l - 1 : n; i && k < len; --i) {
		b[++k] = a[i];
	}
	if (std::lexicographical_compare(b + 1, b + 1 + k, ans + 1, ans + 1 + k)) {
		for (int i = 1; i <= k; ++i) {
			ans[i] = b[i];
		}
	}
}

int main() {
	read(n), read(k);
	readStr(a + 1);
	char c = *std::min_element(a + 1, a + 1 + n);
	int now = 0, mx = 0;
	for (int i = 1; i <= n; ++i) {
		++now;
		if (i == n || a[i] != a[i + 1]) {
			if (a[i] == c) {
				mx = std::max(mx, (i == n ? now : 0) + now);
			}
			now = 0;
		}
	}
	if (k > 30 || (1ll << (k - 1)) * mx >= n) {
		for (int i = 1; i <= n; ++i) {
			putchar(c);
		}
		putchar('\n');
		return 0;
	}
	len = n - mx * (1 << (k - 1));
	for (int i = 1; i <= len; ++i) {
		ans[i] = 'z' + 1;
	}
	now = 0;
	for (int i = 1; i <= n; ++i) {
		++now;
		if (a[i] != a[i + 1]) {
			if (a[i] == c && (i == n ? now : 0) + now == mx) {
				check(i - now + 1, i);
			}
			now = 0;
		}
	}
	for (int i = 1; i <= n - len; ++i) {
		putchar(c);
	}
	for (int i = 1; i <= len; ++i) {
		putchar(ans[i]);
	}
	putchar('\n');
}


Measured memory_bytes: 3644
#include <algorithm>
#include <iostream>
#include <map>
#include <cstdio>
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORq(i, m, n) for(int i = m;i <= n;i++)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define PRINTD(n) printf("%d\n",n)
using namespace std;

int main() {
	int N;
	SCD(N);
	int a[N+2];
	bool c[15];
	int x = 0;
	int y = 0;
	int MAX = 0;
	int MIN = 100;
	FOR(i,0,N){SCD(a[i]);}
	FOR(i,0,14){c[i]=false;}
	
	FOR(i,0,N){
		if (3200 <= a[i]){x++;}
		int q = a[i] / 400;
		c[q] = true;
	}

	FORq(i,0,7){
		if (c[i] == true) {y++;}
	}
	MAX = x+y;
    if (y == 0){
		MIN = 1;
	}else{
		MIN = y;
	}
	printf("%d %d\n",MIN,MAX);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int w,h,x,y;
	cin>>w>>h>>x>>y;
	double m=(double)w/2*h;
	printf("%.12lf ",m);
	if(x*2==w&&y*2==h)
		puts("1");
	else puts("0");
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<map>
#include<cstring>
#define inf 1<<30
#define maxn 30000005
using namespace std;
int main()
{
    string res="";
    string s;
    cin>>s;
    for(int i=0;i<s.length();i+=2)
    {
        res+=s[i];
    }
    cout<<res<<endl;
}


Measured memory_bytes: 512
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n = readline() |> parseInt
	s = chomp(readline())
	a = zeros(Int,n)
	a[1] = s[1]=='#'?1:0
	for i in 2:n
		if s[i] == '#'
			a[i] = a[i-1]+1
		else
			a[i] = a[i-1]
		end
	end
	m = min(a[n],n-a[n])
	for i in 1:n
		m = min(m,a[i]+n-a[n]-i+a[i])
	end
	println(m)
end
main()


Measured memory_bytes: 117104
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	ll x;
	ll ans=0;
	cin >>n>>x;
	V a(n);
	ll bef;
	ll sum=0LL;
	rep(i,n){
		cin>>a[i];
		if(i==0){
			
			ans+=max(0LL,a[0]-x);
			a[0]=min(a[0],x);
			sum=a[0];
		
			//clog<<sum<<" "<<ans<<endl;
		}else{
			sum+=a[i];
			//clog << "(" << sum << ") ";
			bef=sum-x;
			if(bef >0){
				ans+=bef;
			
			if(a[i] >=bef){
				a[i]-=bef;
			}else{
				a[i]=0;
				a[i-1]=bef-a[i];
			}
			}
			sum=a[i]+a[i-1];

			//clog << sum << " " << ans << endl;
			sum-=a[i-1];
		}
	}
	cout<<ans<<endl;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] n = new int[3];
        for (int i = 0; i < 3; i++) {
            n[i] = sc.nextInt();
        }
        Arrays.sort(n);

        System.out.println(n[0] + n[1]);
    }
}


Measured memory_bytes: 21844
from collections import deque
n, u, v = map(int, input().split())
Tree = [ [] for _ in range(n) ]

def calc(s, tree):
    S = deque([s])
    Dist = [-1]*n
    Dist[s] = 0
    while S:
        u = S.pop()
        for v in tree[u]:
            if Dist[v] < 0:
                Dist[v] = Dist[u] + 1
                S.append(v)
    return Dist

for _ in range(n-1):
    a, b = map(int, input().split())
    Tree[a-1].append(b-1)
    Tree[b-1].append(a-1)
uDist, vDist = calc(u-1, Tree), calc(v-1, Tree)

ans = 0
for i in range(n):
    if uDist[i] < vDist[i]:
        ans = max(ans, vDist[i]-1)
print(ans)

Measured memory_bytes: 61676
#include<string>
#include<iostream>
#include<vector>


using namespace std;

int main() {
  int H,N;
  cin >> H>>N;
  vector<int> A(N);
  for(int i=0;i<N;++i) {
    cin >> A[i];
  }
  for(int i=0;i<N;++i) {
    H-=A[i];
  }
  if(H<=0){
    cout <<"Yes";
  }else{
    cout<<"No";
  }
  cout<<endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
  int num;
  scanf("%d",&num);
  int s=0,n=0,r=0;
  for(int i=0;i<num;i++)
  {
    int z;
    scanf("%d",&z);
    if(s==0)n=z,s=1;
    else if(s==1)
    {
      if(n<z)s=2;
      else if(n>z)s=3;
      n=z;
    }
    else if(s==2)
    {
      if(n>z)s=1,r++;
      n=z;
    }
    else
    {
      if(n<z)s=1,r++;
      n=z;
    }
  }
  if(s!=0)r++;
  printf("%d\n",r);
}

Measured memory_bytes: 128
let make_fib_memo () =
  let m = Array.make 45 0 in
  m.(0) <- 1;
  m.(1) <- 1;
  fun n ->
    let rec doit i =
      if m.(i) <> 0 then m.(i)
      else begin
        m.(i) <- doit (i - 2) + doit (i - 1);
        m.(i);
      end in
    doit n

let () =
  let fib_memo = make_fib_memo () in
  read_int () |> fib_memo |> Printf.printf "%d\n"

Measured memory_bytes: 2244
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int n;
    cin>>n;
    cout<<"Christmas";
    rep(i,25-n)cout<<" Eve";
    cout<<endl;
}


Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =998244353;
const int maxn = 300005;
#define endl '\n'
#define ld long double
#define int ll
#define all(x) (x).begin(),(x).end()
typedef long double dbl;
#define pw(x) (1LL << (x))
#define forn(i, n) for (int i = 0; i < (n); i++)
const ll md = (ll) 1e9 + 7;
 
inline ll add(ll a, ll b) {
  a += b;
  if (a >= md) a -= md;
  return a;
}
 
inline ll sub(ll a, ll b) {
  a -= b;
  if (a < 0) a += md;
  return a;
}
 
inline ll mul(ll a, ll b) {
  return (ll) ((long long)((a%md) * (b%md)) % md);
}
 
inline ll power(ll a, long long b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
 
inline ll inv(ll a) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

vector<int> g[maxn], ed;
int n;
int dfs(int u, int p){
  int sub = 1;
  for(auto v:g[u]){
    if(v == p){
      continue;
    }
    int now = dfs(v, u);
    sub += now;
    ed.push_back(now*(n-now));
  }
  return sub;
}

int32_t main()
{ 
  IOS

  string n;
  cin >> n;
  int sum =  0;
  for(auto i:n){
    sum += (i-'0');
  }
  if(sum%9 == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

  

  










  
    
} 
 

Measured memory_bytes: 10812
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>
#include <sstream>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) x.begin(),x.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

int main(){
    ll A,B,C;
    int K;
    cin >> A >> B >> C >> K;

    int i = 0;

    while(i < K){
        if(A >= B)
            B *= 2;
        else if(A < B and C <= B)
            C *= 2;
        i++;

    }

    //cout << B << "  " << C <<endl;


    if(A < B and B < C)
        cout << "Yes" << endl;
    else 
        cout << "No" << endl; 
}

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

#define MAX 200000
#define INF 2000000000

int L[MAX/2 + 2], R[MAX/2 + 2];

long long merge(int *A, int left, int mid, int right)
{
	int i, j, k;
	long long count = 0;
	int n1 = mid - left;
	int n2 = right - mid;
	for(i = 0; i < n1; i++)
		L[i] = A[left+i];
	for(i = 0; i < n2; i++)
		R[i] = A[mid+i];
	L[n1] = R[n2] = INF;
	i = j = 0;
	for(k = left; k < right; k++) {
		if(L[i] <= R[j]) {
			A[k] = L[i++];
		}
		else {
			A[k] = R[j++];
			count += n1 - i;
		}
	}
	return count;
}

long long mergeSort(int *A, int left, int right)
{
	int mid;
	long long v1, v2, v3;
	if(right - left > 1) {
		mid = (left + right) / 2;
		v1 = mergeSort(A, left, mid);
		v2 = mergeSort(A, mid, right);
		v3 = merge(A, left, mid, right);
		return v1 + v2 + v3;
	}else {
		return 0;
	}
}

int main()
{
	int i, n;
	int *A;
	long long ans;
	scanf("%d", &n);

	A = (int *)malloc(sizeof(int) * n);

	for(i = 0; i < n; i++)
		scanf("%d", &A[i]);

	ans = mergeSort(A, 0, n);

	printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 2160
#include<iostream>
#include<climits>
#include<cmath>

using namespace std;

int main(){
        int n;
        cin >> n;

        int *w = new int[n];
        int sum = 0;
        for(int i=0;i<n;i++){
                cin >> w[i];
                sum += w[i];
        }

        int ans = INT_MAX;
        for(int i=0, s = 0;i<n;i++){
                s += w[i];
                int diff = sum + -2 * s;
                if(diff < 0) diff = -1 * diff;

                if(ans > diff) ans = diff;
        }

        cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
int main(){
	string str;
	cin>>str;
	int ans = 0;
	for(int i = 0 ; i < str.length()-1 ; i++){
		 if(str[i] == 'P' && str[i+1] == 'D'){
		 	        ans++;
		 }
	}
	for(int i = 0 ; i < str.length() ; i++){
		 if(str[i] == 'D' || str[i] == '?'){
		 	str[i] = 'D';
		 	 ans++;
		 }
	}
	cout<<str<<endl;
	//cout<<ans<<endl;
}

Measured memory_bytes: 3696
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    K=int(input())
    l=[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]
    print(l[K-1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<algorithm>

using namespace std;

typedef long long ll;

const int MX = 300005;
int ans[MX];

int F(int a, int b) {
	if (a < b) return 0;
	if (a%b == 0) return a / b;
	int t = a / b + 1;
	int u = a / b * b;
	return F(a - (a - u + t - 1) / t * t, b);
}

int main()
{
	int value = 0, N;
	scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		value ^= F(a, b);
//		printf("%d\n", F(a, b));
	}
	printf("%s\n", value ? "Takahashi" : "Aoki");
}
/*
0 1 0 2 1
*/

Measured memory_bytes: 128
/*
 * Author       : YangDavid
 * Created Time : 2020.05.30 23:16:08
 */

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int MAXN = 5050, MOD = 1000000007;
int add(int x, int y) { return x + y >= MOD ? x + y - MOD : x + y; }
int sub(int x, int y) { return x - y < 0 ? x - y + MOD : x - y; }
int mul(int x, int y) { return 1LL * x * y % MOD; }
int qpow(int x, int y) {
    int ret = 1;
    for(; y; y >>= 1, x = mul(x, x))
        if(y & 1) ret = mul(ret, x);
    return ret;
}

int p[MAXN], fa[MAXN], sz[MAXN], tg[MAXN], dp[MAXN], fac[MAXN], ans;
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
bool merg(int x, int y) {
    x = find(x), y = find(y);
    if(sz[x] > sz[y]) swap(x, y);
    if(x != y) { sz[y] += sz[x], fa[x] = y, sz[x] = 0; return true; }
    return false;
}

int main() {
    int n, cc, k = 0; scanf("%d", &n), cc = n;
    for(int i = 0; i < n; ++i) fa[i] = i, sz[i] = 1, fac[i] = i==0?1:mul(fac[i-1],i);
    for(int i = 0; i < n; ++i) {
        scanf("%d", &p[i]);
        if(p[i] != -1) p[i]--, cc -= merg(i, p[i]);
        else k++;
    }
    ans = mul(n-cc+k, qpow(n-1, k));
    for(int i = 0; i < n; ++i) if(p[i] == -1) tg[find(i)] = true;
    vector<int> a;
    for(int i = 0; i < n; ++i) if(fa[i] == i && tg[i]) a.push_back(sz[i]);
    dp[0] = 1;
    for(auto ct : a) {
        for(int j = k; j >= 1; --j)
            dp[j] = add(dp[j], mul(ct, dp[j-1]));
    }
    for(int i = 1; i <= k; ++i)
        ans = sub(ans, mul(dp[i]-(i==1?k:0), mul(fac[i-1], qpow(n-1, k-i))));
    
    printf("%d\n", ans);
    return 0;
}



Measured memory_bytes: 3924
#include<iostream>
#include<stdio.h>
 using namespace std;
 long long a[1005];
 int n = 0; int flg = 0;
 int b[1005], num = 0;;
 long long testdel(int i) {
	 if ((i - flg) % 2 == 1)return a[i];
	 else return 0;
 }
 void del(int i) {
	 num++; b[num] = i;
	 if (i == n) {
		 n--;
		 return;
	 }
	 if (i == 1) {
		 n--;
		 for (int j = 1; j <= n; j++)
			 a[j] = a[j + 1];
		 return;
	 }
	 n = n - 2;
	 a[i - 1] = a[i - 1] + a[i + 1];
	 for (int j = i; j <= n; j++)
		 a[j] = a[j + 2];
	 return;
 }
int main() 
{
	 cin >> n;
	 for (int i = 1; i <= n; i++)
		 scanf("%lld",&a[i]);


	 while (n != 1) {
		 long long sumo = 0, sume = 0;
		 long long m = -9999999999;int  im = 0;

		 for (int i = 1; i <= n; i++) {
			 if (a[i] >= m) {
				 m = a[i];
				 im = i;
			 }
		 }

		 if (m <= 0) {
			 a[1] = m; num = n - 1;
			 for (int i = 1; i <= im - 1; i++)b[i] = 1;
			 for (int i = im; i < n; i++)b[i] = n+1-i;
			 break;
		 }

		 for (int i = 1; i <= n; i = i + 2)if (a[i] >= 0)sumo += a[i];
		 for (int i = 2; i <= n; i = i + 2)if (a[i] >= 0)sume += a[i];
		 if (sumo > sume)flg = 0;
		 else flg = 1;

		 m = 1; im = 0;
		 for (int i = 1; i <= n; i++) {
			 if (testdel(i) < m) {
				 im = i; m = testdel(i);
			 }
		 }
		 del(im);
	 }

	 printf("%lld\n",a[1]);
	 cout << num ;
	 for (int i = 1; i <= num; i++) {
		 printf("\n%d", b[i]);
	 }
	 return 0;
}

Measured memory_bytes: 256
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

D = I()
c = [0] + LI()
s = [0] + [[0] + LI() for _ in range(D)]

last = [[0]*27 for _ in range(D+1)]
t = [0]

for i in range(1,D+1):
    r = 0
    manzoku = 0
    for j in range(1,27):
        m = s[i][j]
        for k in range(1,27):
            if k != j:
                m -= c[k]*(i-last[i-1][k])
            else:
                continue
        if j == 1:
            r = 1
            manzoku = m
        else:
            if manzoku < m:
                manzoku = m
                r = j
    t.append(r)
    for j in range(1,27):
        if j == r:
            last[i][j] = i
        else:
            last[i][j] = last[i-1][j]


dq = []
for i in range(1,D+1,5):
    for j in range(1,27):
        dq.append([i,j])

from copy import deepcopy

for d,q in dq:
    t0 = t[d]
    manzoku = s[d][q] - s[d][t0]
    for j in range(d,D+1):
        if j == d:
            last[d][t0] = last[d-1][t0]
            manzoku -= c[t0] * (d - last[d][t0])
            last[d][q] = d
            manzoku += c[q] * (d - last[d-1][q])
        else:
            if last[j][t0] == d:
                last[j][t0] = last[d-1][t0]
                manzoku -= c[t0] * (d - last[d][t0])
            if last[j][q] == last[d-1][q]:
                last[j][q] = d
                manzoku += c[q] * (d - last[d-1][q])
    if manzoku > 0:
        t[d] = q
    else:
        for j in range(d,D+1):
            if j == d:
                last[d][t0] = t0
                last[d][q] = last[d-1][q]
            else:
                if last[j][t0] == last[d-1][t0]:
                    last[j][t0] = t0
                if last[j][q] == q:
                    last[j][q] = last[j-1][q]

del t[0]

print(*t,sep='\n')

Measured memory_bytes: 76800
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  ll n,ans;
  cin>>n;
  for(ll i=sqrt(n);i>=1;i--){
    if(n%i==0){
      ans=i+n/i-2;
      break;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
import bisect
from itertools import accumulate

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
b.sort()
c.sort()

AonB=[]
BonC=[]
ans=0
for i in range(n):
    AonB.append(bisect.bisect_left(a,b[i]))

AonB=list(accumulate(AonB))

ans=0
for g in range(n):
    search=bisect.bisect_left(b,c[g])-1
    if search>=0:
        ans+=AonB[search]

print(ans)

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

struct N {
  int i, j, d;
};
bool operator<(const N &l, const N &r) { return l.d > r.d; }
int hx[4] = {1, -1, 0, 0};
int hy[4] = {0, 0, 1, -1};

bool used[1010][1010] = {0};
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  vector<string> mp(h);
  for (int i = 0; i < h; i++)
    cin >> mp[i];
  priority_queue<N> q;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (mp[i][j] == '#')
        q.push(N{i, j, 0});
    }
  }
  int size = 0;
  while (q.size()) {
    N now = q.top();
    q.pop();
    if (used[now.i][now.j])
      continue;
    used[now.i][now.j] = true;
    size++;
    if (size == h * w) {
      cout << now.d << endl;
      return 0;
    }
    for (int k = 0; k < 4; k++) {
      int i = now.i + hy[k];
      int j = now.j + hx[k];
      if (i < 0 || j < 0 || i >= h || j >= w)
        continue;
      if (used[i][j])
        continue;
      q.push(N{i, j, now.d + 1});
    }
  }

  return 0;
}


Measured memory_bytes: 28264
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};




int main() {
    int n, m;
    cin >> n >> m;
    UnionFind x(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        x.unite(a, b);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        chmax(ans, x.size(i));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4044
N = int(input())
x=[]
y=[]
for i in range(N):
    xi,yi = list(map(int,input().split()))
    x.append(xi)
    y.append(yi)

whole_dist=0
for i in range(N):
    for j in range(N):
        if (i!=j):
            whole_dist += ((x[i]-x[j])**2+(y[i]-y[j])**2)**(1/2)

print(whole_dist/N)

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1'000'000'000ll + 7;
//const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const long double eps = 1e-8;

const i64 MAXN = 3 * 100'000 + 5;

i64 n;
i64 a[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;

    map<i64, i64> q;
    for (i64 i = 2; i <= sqrt(n) + 2; i++) {
        while (n % i == 0) {
            q[i] += 1;
            n /= i;
        }
    }
    if (n > 1) {
        q[n] += 1;
    }

    i64 R = 0;
    for (auto t : q) {
        i64 c = t.second;

        i64 i = 1;
        while (c >= i) {
            c -= i;
            i += 1;
            R += 1;
        }
    }

    cout << R << endl;


    return 0;
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

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

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

    int A, B;
    cin >> A >> B;

    if (A <= 5) {
        cout << 0 << endl;
    } else if (A >= 13) {
        cout << B << endl;
    } else {
        cout << B/2 << endl;
    }

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=50+5;
int ans,n,fa[maxn],fb[maxn],cnt,p[maxn],deg[maxn];
vector<int> A[maxn],B[maxn];
void dfsa(int x){
	if(!p[x]) ++cnt;
	for(auto v:A[x]) if(v!=fa[x]){
		fa[v]=x;
		p[v]=(p[x]|(find(B[x].begin(),B[x].end(),v)==B[x].end()));
		dfsa(v);
		++deg[x];
	}
}
void dfsb(int x){
	for(auto v:B[x]) if(v!=fb[x]){
		fb[v]=x;
		dfsb(v);
	}
}
inline int work(int rt){
	REP(i,1,n) p[i]=deg[i]=0;
	cnt=0;
	fa[rt]=fb[rt]=0;
	dfsa(rt);
	if(cnt<=ans) return -1;
	dfsb(rt);
	set<int> st;
	REP(i,1,n) if(p[i] && !deg[i]) st.insert(i);
	while(1){
		int x=0;
		for(auto u:st) if(!p[fb[u]]){x=u;break;}
		if(x==0) break;
		st.erase(x),p[x]=0;
		--deg[fa[x]];
		if(!deg[fa[x]] && p[fa[x]]) st.insert(fa[x]);
	}
	REP(i,1,n) if(p[i]) return -1;
	return cnt;
}
int main(){
	int T=read();
	while(T--){
		ans=-1;
		n=read();
		REP(i,1,n-1){
			int x=read(),y=read();
			A[x].push_back(y),A[y].push_back(x);
		}
		REP(i,1,n-1){
			int x=read(),y=read();
			B[x].push_back(y),B[y].push_back(x);
		}
		REP(i,1,n) chkmax(ans,work(i));
		if(ans==-1) REP(i,1,n) if(A[i].size()==1){
			int u=A[i][0];
			A[i].pop_back();
			A[u].erase(find(A[u].begin(),A[u].end(),i));
			REP(j,1,n) if(j!=i && j!=u){
				A[j].push_back(i);
				A[i].push_back(j);
				chkmax(ans,work(i)-1);
				A[j].pop_back();
				A[i].pop_back();
			}
			A[i].push_back(u),A[u].push_back(i);
		}
		printf("%d\n",ans==-1?ans:n-ans);
		REP(i,1,n) A[i].clear(),B[i].clear();
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long M =1e6+10,MOD=1000000000;
typedef long long ll;
double mx=0.0;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    double n;
    cin>>n;
    n=n*1,0;
    for(double i=0.0;i<=n;i+=1.0)
    {
      mx=max(mx,(double)pow(i/3.0,3.0));
    }
    cout<<fixed<<setprecision(10)<<mx<<endl;
 
    return 0;
  }

Measured memory_bytes: 384
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());
    long s = long.Parse(Console.ReadLine());
		long answer = -1;
    long[] divisions = DivisionCompression(n);
    int divisionsCount = divisions.Length;
    long answerBack = 1;
    long answerNow = 0;

    for(int i = 0; i < divisionsCount; i++)
    {
      answerNow += divisions[i];
      if(i == 0) continue;

      if(divisions[i] == 1)
      {
        if(findSumOfDigits(n,answerNow) == s)
        {
          answer = answerNow;
          break;
        }
      }else
      {
        long div = n/answerNow;
        long rest = n%answerNow;
        long inter = (n%(answerBack+1)) - (n%answerNow);
        long interCount = answerNow-(answerBack+1);
        inter /= interCount;
        if((s-div) % inter == rest)
        {
          long divMemo = (s-div)/inter;
          //Console.WriteLine(answerBack+" "+answerNow+" "+divMemo+" "+(answerNow-divMemo));
          if(answerNow-divMemo > answerBack && n/(answerNow-divMemo)+n%(answerNow-divMemo)==s)
          {
            answer = answerNow-divMemo;
            //Console.WriteLine(answerBack+" "+answerNow+" "+divMemo);
            break;
          }
        }
      }

      answerBack = answerNow;
    }
    
    if(answer == -1)
    {
      if(n == s) answer = n+1;
    }

		Console.WriteLine(answer);
	}

  static long findSumOfDigits(long n, long x) 
  {//引数をnとして、nのx進数で各桁の数の和を求める
    long sum = 0;
    while (n > 0) 
    { // n が 0 になるまで
      sum += n % x;
      n /= x;
    }
    return sum;
  }

  static long[] DivisionCompression(long num)
  {//x=1~numまでを[n/x]の値で座標圧縮。配列の個数を2√numまで圧縮できる。
  //返り値の配列は圧縮前の個数。
  //例えばnum=10なら、[1,1,1,2,5]を返す。
    long dividesCount = (long)Math.Sqrt(num);
    long[] divides = new long[(int)dividesCount+1];//前半の(x/i)の値
    long[] answers;
    for(long i = 0; i < (int)dividesCount; i++)
    {
      divides[(int)i] = num/(i+1);
    }

    if(divides[(int)dividesCount-1] == dividesCount)
    {
      answers = new long[2*(int)dividesCount-1];
      for(int i = 0; i < (int)dividesCount; i++) answers[i] = 1;

      for(int i = 0; i < (int)dividesCount-1; i++)
      {
        answers[(int)dividesCount+i] = divides[(int)dividesCount-2-i]-divides[(int)dividesCount-1-i];
      }
    }else
    {
      answers = new long[2*(int)dividesCount];
      for(int i = 0; i < (int)dividesCount; i++) answers[i] = 1;

      divides[(int)dividesCount] = dividesCount;
      for(long i = 0; i < dividesCount; i++)
      {
        answers[(int)dividesCount+i] = divides[(int)dividesCount-1-i]-divides[(int)dividesCount-i];
      }
    }
    
    return answers;
  }
  
}


Measured memory_bytes: 18272