akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <cstring>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main() {
    int n;
    cin >> n;
    if (n % 2 == 0) {
        cout << n/2;
        return 0;
    }
    cout << (n+1) / 2;
}


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

int main(){
  int k,s;
  cin>>k>>s;
  int ans=0;
  for(int x=0;x<=k;x++){
    for(int y=0;y<=k;y++){
      int z=s-x-y;
      if(z>=0&&z<=k) ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 1e18;
const ll fact_table = 5000000;
double Pi = 3.1415926535897932384626;
 
vector<ll> G[550010];
vector<pair<ll, double> > tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<"\n";
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 998244353;
//ll mod = 1000000007;
 
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5];
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = rui(fact[fact_table],mod - 2);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q,r,l;
ll k,ans;
ll x[500005],y[500005],z[500005];
char s[500005];
vector <P> table[20];

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

    cin >> a >> b >> c;
    if(a + b + c >= 22){
        p("bust");
    }else{
        p("win");
    }
    return 0;
}
 

Measured memory_bytes: 26880
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;
constexpr int MN = 1e5+5;

ll L[MN], R[MN], A[MN], B[MN], ans;

int main() {
    if (fopen("in", "r")) freopen("in", "r", stdin), freopen("out", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0);

    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> L[i] >> R[i];
    sort(L, L+N, greater<ll>()), sort(R, R+N);
    for (int i = 0; i < N; ++i) A[i+1] = L[i]+A[i], B[i+1] = R[i]+B[i];
    for (int i = 0; i < N; ++i) ans = max({ A[i]-B[i+1], A[i+1]-B[i], A[i+1]-B[i+1], ans });
    cout << 2*ans;
}


Measured memory_bytes: 6700
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
//#define pi acos(-1.0)
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
#define FALSE 0
#define TRUE 1
int num[9];
int used[10];
int dfs(int id);
int check();
int main() {
	int i;
	for (i = 0; i < 9; i++) {
		fscanf(stdin, "%d", &num[i]);
		if (num[i] != -1) used[num[i]] = TRUE;
	}
	P(d, dfs(0));
	return 0;
}

int dfs(int id) {
	if (id == 9) return check();
	if (num[id] != -1)return dfs(id + 1);
	int i, ans = 0;
	for (i = 1; i <= 9; i++) {
		if (used[i]) continue;
		num[id] = i, used[i] = TRUE;
		ans += dfs(id + 1);
		num[id] = -1, used[i] = FALSE;
	}
	return ans;
}

int check() {
	int sum = 0;
	sum += num[0] + num[2] + num[5] - num[8];
	sum += (num[1] + num[4] - num[7]) * 10;
	sum += (num[3] - num[6]) * 100;
	if (sum == 0) return 1;
	else return 0;
}

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

const int MAXN = 2000 + 10;

std::vector<int> G[MAXN];
int dis[MAXN], sz[MAXN], ht[MAXN];
int valid[MAXN];
int n, m;

int get_diameter() {
  std::queue<int> Q;
  for (int i = 0; i < n; ++i) dis[i] = -1;
  Q.push(0);
  dis[0] = 0;
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (auto &&v: G[u]) {
      if (dis[v] == -1) {
        dis[v] = dis[u] + 1;
        Q.push(v);
      }
    }
  }
  int src = 0;
  for (int i = 0; i < n; ++i) {
    if (dis[src] < dis[i]) src = i;
  }
  for (int i = 0; i < n; ++i) dis[i] = -1;
  Q.push(src);
  dis[src] = 0;
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (auto &&v: G[u]) {
      if (dis[v] == -1) {
        dis[v] = dis[u] + 1;
        Q.push(v);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (dis[src] < dis[i]) src = i;
  }
  return dis[src];
}

void dfs(int u, int f = -1, int d = 0) {
  dis[u] = d;
  sz[u] = 1;
  ht[u] = 0;
  for (auto &&v: G[u]) {
    if (v != f) {
      dfs(v, u, d + 1);
      sz[u] += sz[v];
      ht[u] = std::max(ht[u], ht[v] + 1);
    }
  }
}

int dfs_lim(int u, int f, int lim) {
  if (dis[u] > lim) return 0;
  int ret = 1;
  for (auto &&v: G[u]) {
    if (v != f) ret += dfs_lim(v, u, lim);
  }
  return ret;
}

int solve(int rt) {
  dfs(rt);
  for (auto &&u: G[rt]) {
    valid[u] = dfs_lim(u, rt, m / 2);
  }
  if (m == 1) return n - 2;
  int x = (m + 1) / 2, y = m / 2;
  int ret = n;
  for (auto &&u: G[rt]) {
    if (ht[u] < x) continue;
    int now = dfs_lim(u, rt, x);
    bool flag = false;
    for (auto &&v: G[rt]) {
      if (u == v) continue;
      if (ht[v] + 1 >= y) flag = true;
      now += valid[v];
    }
    if (!flag) continue;
    ret = std::min(ret, n - now - 1);
  }
  return ret;
}

void run() {
  std::cin >> n >> m;
  for (int i = 1; i < n; ++i) {
    int u, v;
    std::cin >> u >> v;
    --u, --v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  int dia = get_diameter();
  int ret = n;
  if (dia <= m) ret = 0;
  for (int i = 0; i < n; ++i) {
    ret = std::min(ret, solve(i));
  }
  printf("%d\n", ret);
}

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


Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli n, r;
    cin >> n >> r;
    if(n>9){
        out(r);
    }
    else{
        r += 100 * (10 - n);
        out(r);
    }
}

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

int main()
{
    int n, count = 1;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++)
    {
        cin >> d.at(i);
    }
    sort(d.begin(), d.end());
    reverse(d.begin(), d.end());
    for (int i = 0; i < n - 1; i++)
    {
        if (d.at(i) > d.at(i + 1))
        {
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
n = int(input())
lst = []
S_lst = []
H_lst = []
C_lst = []
D_lst = []
for i in range(n):
    m, r = input().split()
    r = int(r)
    lsts = []
    lsts.append(m)
    lsts.append(r)
    lst.append(lsts)
for i in range(len(lst)):
    if lst[i][0] == 'S':
        S_lst.append(lst[i][1])
    elif lst[i][0] == 'H':
        H_lst.append(lst[i][1])
    elif lst[i][0] == 'C':
        C_lst.append(lst[i][1])
    elif lst[i][0] == 'D':
        D_lst.append(lst[i][1])

for i in range(1,14):
    if i not in S_lst:
        print('S',i)
for i in range(1,14):
    if i not in H_lst:
        print('H',i)
for i in range(1,14):
    if i not in C_lst:
        print('C',i)
for i in range(1,14):        
    if i not in D_lst:
        print('D',i)


Measured memory_bytes: 5612
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)) {
            Map<String, Integer> sen = new HashMap<String, Integer>();
            String fre = "";
            String max = "";
            int senc = 0;
            while(sc.hasNext()) {
                String s = sc.next();
                if(max.length() < s.length()) max = s;
                if(sen.containsKey(s)) {
                    int c = sen.get(s);
                    if(senc < c + 1) {
                        senc = c + 1;
                        fre = s;
                    }
                    sen.put(s, c+1);
                }
                else {
                    if(senc < 1) {
                        senc = 1;
                        fre = s;
                    }
                    sen.put(s, 1);
                }
            }
            System.out.println(fre + " " + max);
        }
    }
}



Measured memory_bytes: 25956
// 1_3_A
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFSIZE 900
#define STACKSIZE 100

typedef long elemtype;

typedef struct{
    elemtype operands[STACKSIZE];
    int top;
} stack_t;

void InitStack(stack_t *stack){
    stack->top = -1;
    return;
}

void Push(stack_t *stack, long num){
    stack->top += 1;
    stack->operands[stack->top] = num;
    return;
}

long Pop(stack_t *stack){
    long num;
    num = stack->operands[stack->top];
    stack->top -= 1;
    return num;
}

int main(){
    char buf[BUFSIZE + 2], *p;
    stack_t stack;
    long x, y;

    InitStack(&stack);
    fgets(buf, BUFSIZE, stdin);

    if((p = strchr(buf, '\n')) != NULL) *p = '\0';

    p = strtok(buf, " ");
    while(p != NULL){
        if(*p == '+'){
            x = Pop(&stack); y = Pop(&stack);
            Push(&stack, y+x);
        } else if(*p == '-'){
            x = Pop(&stack); y = Pop(&stack);
            Push(&stack, y-x);
        } else if(*p == '*'){
            x = Pop(&stack); y = Pop(&stack);
            Push(&stack, y*x);
        } else{
            Push(&stack, (long)atoi(p));
        }

        p = strtok(NULL, " ");
    }
    printf("%ld\n", Pop(&stack));
    return 0;
}

Measured memory_bytes: 540
import bisect

n, k = map(int, input().split())
v = list(map(int, input().split()))

ans = 0
for i in range(0, k + 1):
    for j in range(0, min(k, n) - i + 1):
        if j:
            toridashita = v[:i] + v[-j:]
        else:
            toridashita = v[:i]
        toridashita.sort()
        tsumeru = min(k - i - j, bisect.bisect_left(toridashita, 0))
        ans = max(ans, sum(toridashita[tsumeru:]))

print(ans)


Measured memory_bytes: 3060
using System;
using System.Linq;
using static System.Console;
using System.Collections.Generic;
class Program{
	static void Main(){
        var order = ReadLine().Split(' ').Select(int.Parse).ToArray();
		var flag = new bool[order[0]];
        var wac = new int[order[0]];
        var ac = 0;
        var wa = 0;      
        
      	for(var i = 0;i < order[1];i++){
        	var input = ReadLine().Split(' ');
          	var num = int.Parse(input[0])-1;
 			
          	if(flag[num]){
              continue;
            }else if(input[1].Equals("AC")){
           	  flag[num] = true;
              wa = wa + wac[num];
              ac++;
            }else if(input[1].Equals("WA")){
              wac[num]++;
            }

        }
        WriteLine(ac + " " + wa);
    }
  
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const ld eps = 1e-12;
const ll inf = 1e9;

ll P, Q, A, N;
ll power(ll x, ll n) {
	ll res = 1;
	for (int i = 1; i <= n; i <<= 1) {
		if (n & i) {
			res = min(inf, res * x);
		}
		x = min(inf, x * x);
	}
	return res;
}
ll dfs(ll p, ll q, ll n, ll last) {
	if (q > A) return 0;
	if (p * Q > P * q) return 0;
	if (n > N) return 0;
//	if (q * power(last, N-n) > A) return 0;
//	ll Mp = p * last + q * (N-n), Mq = q * last;
//	if (Mp * Q < Mq * q) return 0;
	if (p * Q == P * q) return 1;
	ll res = 0;
	for (ll i = last; q * i <= A; ++i) {
		res += dfs(q + p * i, q * i, n+1, i);
	}
	return res;
}
int main() {
	while ( cin >> P >> Q >> A >> N, P || Q || A || N ) {
		cout << dfs(0, 1, 0, 1) << endl;
	}
}

Measured memory_bytes: 1156
// In the name of Allah the Most Merciful.

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

typedef long long ll;

int ar[3][3];
int a[3] , b[3];
bool check()
{
    for(int i=0;i<3;i++){

        for(int j=0;j<3;j++){

            if(ar[i][j]!=a[i]+b[j])return false;
        }
    }
    
    return true;
}

int main(void)
{
    for(int i=0;i<3;i++){

        for(int j=0;j<3;j++){

            cin >> ar[i][j];
        }
    }

    for(int i=0;i<=100;i++){

        for(int j=0;j<=100;j++){

            for(int k=0;k<=100;k++){

                a[0] = i;
                b[0] = ar[0][0] - i;
                a[1] = j;
                b[1] = ar[1][1] - j;
                a[2] = k;
                b[2] = ar[2][2] - k;

                if(check()==true){

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

            }
        }
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
def prim(cost):
    sumcost = 0
    V = len(cost)
    mincost = [float('inf')] * V
    used = [False] * V
    mincost[0] = 0
    while True:
        j = -1
        for i in range(V):
            if not used[i] and (j == -1 or mincost[i] < mincost[j]):
                j = i
        if j == -1:
            break
        used[j] = True
        sumcost = sumcost + mincost[j]
        for i in range(V):
            if cost[i][j] == -1:
                continue
            mincost[i] = min(mincost[i], cost[j][i])
    return sumcost
 
n = int(raw_input())
A = [0] * n
for i in range(n):
    A[i] = map(int, raw_input().split())
 
result = prim(A)
print(result)

Measured memory_bytes: 6508
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10;
const int P=1e9+7;
ll a[N];
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n,i,j;
    ll sum=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        scanf("%lld",a+i);
        sum+=a[i];
    }
    ll ans=INFINITY,sum1=0;
    for(i=0;i<n-1;i++)
    {
        sum1+=a[i];
        sum-=a[i];
        ans=min(ans,abs(sum1-sum));
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1792
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef bitset<16> BS;

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 1E+05;

int Q;

int L[MAX_N], R[MAX_N];

bool isprime[MAX_N + 1];
int pn[MAX_N + 1];

void sieve(int n);

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

    cin >> Q;

    int nmax = 0;
    for (int i = 0; i < Q; i++) {
        cin >> L[i] >> R[i];
        nmax = max(nmax, R[i]);
    }

    /*
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << "i = " << i << ", j = " << j << ", dp = " << dp[i][j] << "\n";
        }
    }
    */

    sieve(nmax);

    for (int i = 1; i <= nmax; i++) {
        if (isprime[i] && isprime[(i + 1) / 2]) {
            pn[i] = pn[i - 1] + 1;
        } else {
            pn[i] = pn[i - 1];
        }
    }

    for (int i = 0; i < Q; i++) {
        cout << pn[R[i]] - pn[L[i] - 1] << "\n";
    }
    /*
    for (int i = 1; i <= nmax; i++) {
        cout << "i = " << i << ", pn = " << pn[i] << "\n";
    }
    */

    return 0;
}

void sieve(int n)
{
    fill(isprime + 2, isprime + n + 1, true);
    for (int i = 2; i <= n; i++) {
        if (isprime[i]) {
            for (int j = 2; i * j <= n; j++) {
                isprime[i * j] = false;
            }
        }
    }
}

Measured memory_bytes: 4836
N = int(input())
node_array = [list(map(int, input().split())) for i in range(N - 1)]
# print(node_array)
tree_num_array = [-1] * N
# print(tree_num_array)

tree_num_max = -1
tree = {}
last_tree_num = -1
for node in node_array:
    # print(tree)
    i, j, w = node
    i = i - 1
    j = j - 1
    if tree_num_array[i] == -1 and tree_num_array[j] == -1:
        # print(i, j, "added")
        tree_num_max += 1
        tree[tree_num_max] = {i: 0, j: w}
        tree_num_array[i] = tree_num_max
        tree_num_array[j] = tree_num_max
        last_tree_num = tree_num_max
        continue
    elif tree_num_array[i] == -1:
        # print(i, "added")
        tree_num_added = tree_num_array[j]
        tree[tree_num_added][i] = tree[tree_num_added][j] + w
        tree_num_array[i] = tree_num_added
        last_tree_num = tree_num_added
    elif tree_num_array[j] == -1:
        # print(j, "added")
        tree_num_added = tree_num_array[i]
        tree[tree_num_added][j] = tree[tree_num_added][i] + w
        tree_num_array[j] = tree_num_added
        last_tree_num = tree_num_added
    else:
        tree_num_i = tree_num_array[i]
        tree_num_j = tree_num_array[j]
        # print(tree_num_i, tree_num_j, "unite")
        if len(tree[tree_num_i]) > len(tree[tree_num_j]):
            tree_main_num = tree_num_i
            tree_main_value = tree[tree_main_num][i]
            tree_sub_num = tree_num_j
            tree_sub_value = tree[tree_sub_num][j]
        else:
            tree_main_num = tree_num_j
            tree_main_value = tree[tree_main_num][j]
            tree_sub_num = tree_num_i
            tree_sub_value = tree[tree_sub_num][i]

        for key, value in tree[tree_sub_num].items():
            tree[tree_main_num][
                key] = tree_main_value + w + abs(value - tree_sub_value)
            tree_num_array[int(key)] = tree_main_num
        last_tree_num = tree_main_num
# print(tree)
ans_dict = sorted(tree[last_tree_num].items(), key=lambda x: int(x[0]))
# print(ans_dict)
for distance in ans_dict:
    print(distance[1] % 2)


Measured memory_bytes: 108960
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


void solve()
{
    int n; ll K;
    scanf("%d%lld", &n, &K);
    ll K2=(ll)n*(n-1)/2-K;
    vector<ll> a(n),b(n);
    int i;
    for(i=0; i<n; i++) {
        scanf("%lld", &a[i]);
        b[i]=-a[i];
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());

    ll l=-1223300000000000000, r=1223300000000000000;
    while(r-l>1) {
        ll cnt=0;
        ll m=(r+l)/2;
        for(i=0; i<n; i++) {
            if(a[i]>0) {
                if(m>=0) {
                    ll tmp=m/a[i];
                    if(m%a[i]) tmp++;
                    int k=lower_bound(a.begin(),a.end(),tmp)-a.begin();
                    cnt+=(n-k);
                }
                else {
                    ll tmp=m/a[i];
                    int k=lower_bound(a.begin(),a.end(),tmp)-a.begin();
                    cnt+=(n-k);
                }
            }
            else if(a[i]<0) {
                ll aa =-a[i];
                if(m>=0) {
                    ll tmp=m/aa;
                    if(m%aa) tmp++;
                    int k=lower_bound(b.begin(),b.end(),tmp)-b.begin();
                    cnt+=(n-k);
                }
                else {
                    ll tmp=m/aa;
                    int k=lower_bound(b.begin(),b.end(),tmp)-b.begin();
                    cnt+=(n-k);
                }
            }
            else {
                if(m<=0) cnt+=n;
            }
        }
        for(i=0; i<n; i++) {
            if(a[i]*a[i]>=m) cnt--;
        }
        cnt/=2;
        if(cnt>K2) {
            l=m;
        }
        else {
            r=m;
        }
    }
    printf("%lld\n", l);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	int N; cin >> N; 
	int D[55] = {}; 
	for(int i = 0; i < N; i++){
		cin >> D[i]; 
	}
	int ans = 0; 
	for(int i = 0; i < N; i++){
		for(int j = i+1; j < N; j++){
			ans += D[i] * D[j]; 
		}
	}
	cout << ans << endl; 
}

Measured memory_bytes: 256
import bisect
import heapq
import sys
N,Q = [int(x) for x in sys.stdin.readline().split()]

hitos = []
ans = [-1] * Q
queries =[]
jump = [-1] * Q



queries = [[int(x) for x in sys.stdin.readline().split()] for i in range(N)]
hitos = [int(sys.stdin.readline()) for i in range(Q)]


# for i in range(N):
    # S,T,X =list(map(int,input().split(" ")))
    # lt = S -X -0.5
    # rt = T -X -0.5
    # queries.append([lt,rt,X]) #-1 → 挿入クエリ lが時間、-1がクエリの種類、Xが場所


queries.sort(key=lambda x:x[2])





for l,r,x in queries:
     lind  = bisect.bisect_left(hitos,l-x - 0.5)
     rind  = bisect.bisect_left(hitos,r -x - 0.5)
     while lind < rind:
         if ans[lind] == -1:
            ans[lind] = x
            jump[lind] = rind
            lind += 1
         else:
             temp = jump[lind]
             jump[lind] = rind
             lind = temp

for i  in ans:
    print(i)


Measured memory_bytes: 61964
#include <bits/stdc++.h>
using namespace std;
char s[8005];
int tx, ty;
bool dpx[8005][16005], dpy[8005][16005];
int main() {
	scanf("%s%d%d", s, &tx, &ty);
	int n = strlen(s);
	vector <int> go;
	int cur = 0;
	for (int i = 0; i < n; ++ i) {
		if (s[i] == 'T') {
			go.push_back(cur);
			cur = 0;
		}
		else cur ++;
	}
	go.push_back(cur);
	vector <int> gox, goy;
	dpx[0][8000] = dpy[0][8000] = 1;
	for (int i = 0; i < go.size(); ++ i) {
		if (i & 1) goy.push_back(go[i]);
		else gox.push_back(go[i]);
	}
	for (int i = 0; i < gox.size(); ++ i) {
		for (int x = 0; x <= 16000; ++ x) {
			if (x + gox[i] <= 16000) dpx[i + 1][x + gox[i]] |= dpx[i][x];
			if (i && x - gox[i] >= 0) dpx[i + 1][x - gox[i]] |= dpx[i][x];
		}
	}
	for (int i = 0; i < goy.size(); ++ i) {
		for (int y = 0; y <= 16000; ++ y) {
			if (y + goy[i] <= 16000) dpy[i + 1][y + goy[i]] |= dpy[i][y];
			if (y - goy[i] >= 0) dpy[i + 1][y - goy[i]] |= dpy[i][y];
		}
	}
	if (dpx[gox.size()][tx + 8000] && dpy[goy.size()][ty + 8000]) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 127232
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    string a,b; cin >> a >> b;
    if(a.size()>b.size()) cout << "GREATER" << endl;
    else if(a.size()<b.size()) cout << "LESS" << endl;
    else{
        REP(i,a.size()){
            if(a[i]>b[i]){cout << "GREATER" << endl; break;}
            else if(a[i]<b[i]){cout << "LESS" << endl; break;}
            else{if(i==a.size()-1) cout << "EQUAL" << endl;}
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;ll d;
  cin >> n >> d;
  ll x[n],y[n];
  rep(i,n)cin >> x[i] >> y[i];
  int ans = 0;
  rep(i,n){
    if(x[i]*x[i]+y[i]*y[i]<=d*d)ans++;
  }
  cout << ans << endl;
}

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

constexpr int INF = 1 << 30;

void solve() {
    int h, w;
    std::cin >> h >> w;

    std::vector<std::vector<int>> ans(h, std::vector<int>(w, INF));
    for (int x = 0; x < h; ++x) {
        for (int y = 0; y < w; ++y) {
            char c;
            std::cin >> c;
            if (c == '.') continue;
            for (int dy = 0; y + dy < w; ++dy) {
                ans[x][y + dy] = std::min(ans[x][y + dy], dy);
            }
        }
    }

    for (auto& v : ans) {
        int la = v.back();
        v.pop_back();
        for (auto x : v) {
            std::cout << (x == INF ? -1 : x) << " ";
        }
        std::cout << (la == INF ? -1 : la) << std::endl;
    }
}

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

    solve();

    return 0;
}



Measured memory_bytes: 3232
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using namespace std;
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), output("\n"))
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

int main(){
	int n;
	cin >> n;
	int d = n / 1.08 + 0.9999999;
	if((int)(d*1.08)==n){
		cout << d << endl;
	}else{
		cout << ":(" << endl;
	}
			return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
long long a,b,c,k;
int main() {
  scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
  if(k==0) {
    puts("0");
    return 0;
  }
  if(k<=(a+b)) {
    printf("%lld\n",min(k,a));
    return 0;
  }
  else {
    printf("%lld\n",a+a+b-k);
    return 0;
  }
  return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ll n,k,ans=0;
    cin >> n >> k;
    vll h(n);
    REP(i,n){
        cin >> h[i];
    }
    sort(ALL(h));
    reverse(ALL(h));
    FOR(i,k,n){
        ans+=h[i];
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;

	if (r <= x && r <= y && x <= (W - r) && y <= (H - r))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 1156
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

struct node {
	unsigned int key;
	struct node *next;
	struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key) {
	NodePointer cur=nil->next;
	while(cur!=nil && key!=cur->key){
		cur = cur->next;
	}
	return cur;
}

void init() {
	nil = malloc(sizeof(struct node));
	nil->next = nil;
	nil->prev = nil;
}

void printList() {
	NodePointer cur = nil->next;
	int isf = 1;
	while(1) {
		if ( cur == nil ) break;
		if ( isf == 0)  printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
		isf = 0;
	}
	printf("\n");
}

void deleteNode(NodePointer t) {
	if(t==nil)return;
	t->next->prev = t->prev;
	t->prev->next = t->next;
	free(t);
}

void deleteFirst() {
	NodePointer t = nil->next;
	if ( t == nil ) return;
	deleteNode(t);
}

void deleteLast() {
	deleteNode(nil->prev);
}

void delete(int key) {
	deleteNode(listSearch(key));
}


void insert(int key) {
	NodePointer x;
	x = malloc(sizeof(struct node));
	x->key = key;
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}

int main() {
	int key, n, i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for ( i = 0; i < n; i++ ) {
		scanf("%s%d", com, &key);
		if ( com[0] == 'i' ) {
			insert(key);
			np++;
			size++;
		}
		else if ( com[0] == 'd' ) {
			if (strlen(com) > 6) {
				if ( com[6] == 'F' ) deleteFirst();
				else if ( com[6] == 'L' ) deleteLast();
			} else {
				delete(key);
				nd++;
			}
			size--;
		}
	}

	printList();
	return 0;
}


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

using namespace std;

int main()
{
    string str;
    getline(cin,str);

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



Measured memory_bytes: 3164
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    int[] a=new int[n];
    for(int i=0;i<m;i++){
      a[sc.nextInt()-1]++;
      a[sc.nextInt()-1]++;
    }
    for(int i=0;i<n;i++){
      System.out.println(a[i]);
    }
  }
}

Measured memory_bytes: 21844
w,h,x,y = map(int,input().split())
#必ず半分にできる…とはいえるのか？多分いえる。
#長方形の重心を通るようにひけばok.
ans = w*h/2
if x*2==w and y*2==h:
	print(ans, 1)
else:
	print(ans, 0)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int n;
double sum,a;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a;
		sum=sum+1.0/a;
	} 
	printf("%f",1.0/sum);
	return 0;
}
/*
模拟只会猜题意
贪心只能过样例
数学上来先打表
DP一般看规律
组合数学靠运气
计算几何瞎暴力
图论强行套模板
数论只会GCD
递归递推伤不起
搜索茫然TLE
分治做得像枚举
暴力枚举数第一
数据结构干瞪眼
怒刷水题找信心
涨姿势也不容易
考试一来全懵逼
*/

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
#include<numeric>
using namespace std;
typedef long long int lli;
#define rep(i,n) for(lli i = 0;i<((lli)(n));i++)
#define reg(i,a,b) for(lli i = ((lli)(a));i<=((lli)(b));i++)
#define irep(i,n) for(lli i = ((lli)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(lli i = ((lli)(b));i>=((lli)(a));i--)
typedef pair<lli, lli> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprllif(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

struct UF {
	int n;
	vector<int> d;
	UF() {}
	UF(int n):n(n), d(n, -1) {}
	int root(int v){
		if (d[v] < 0) return v;
		return d[v] = root(d[v]);
	}
	bool unite(int x, int y){
		x = root(x); y = root(y);
		if (x == y) return false;
		if (size(x) < size(y)) swap(x,y);
		d[x] += d[y];
		d[y] = x;
		return true;
	}
	int size(int v) { return -d[root(v)];}
};


int main(void){
	int n;
	cin >> n;
	vector<pair<vector<int>, int>> w[2];
	rep(i, n){
		vector<int> x(2);
		cin >> x[0] >> x[1];
		w[0].push_back(make_pair(x, i));
		swap(x[0], x[1]);
		w[1].push_back(make_pair(x, i));
	}

	vector<vector<mp>> v(n);
	rep(i, 2){
		sort(w[i].begin(), w[i].end());
		rep(j, n-1){
			int c = w[i][j+1].fir[0] - w[i][j].fir[0];
			int p1 = w[i][j+1].sec, p2 = w[i][j].sec;
			v[p1].push_back(mp(c, p2));
			v[p2].push_back(mp(c, p1));
		}
	}
	
	UF t(n);
	lli ans = 0;
	
	pque(mp) q;
	q.push(mp(0, 0));
	while(!q.empty()){
		mp p = q.top(); q.pop();
		if(p.sec == 0 || t.unite(0, p.sec)){
			ans += p.fir;
			rep(i, v[p.sec].size()) if(t.root(0) != t.root(v[p.sec][i].sec)){
				q.push(v[p.sec][i]);
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 29912
#include<iostream>
#include <bits/stdc++.h>
#include <cstdio>
#include<set>
using namespace std;

#define PI 3.141592653589793238
int N;

int main()
{
    double x = 0.0, y = 0.0;
    int N, L;
    cin >> N;
    cin >> L;
    vector<int> T(N);
    for (int i = 0; i < N; i++)
        cin >> T[i];
    //for (int i = 0; i < N ; i++){
    //    fprintf(stderr, "%f, %f\n", cos(2 * PI * T[i]/(double)L), sin(2 * PI * T[i]/(double)L));
        
    //}
    for (int i = 0; i < N - 1; i++){
        for (int j = i + 1; j < N; j++){
            int coef2 = j - i - 1;
            int coef1 = N - 2 - coef2;
            double x0 = (coef1 - coef2) * cos(2 * PI * (T[i] + T[j])/(double)(2*L));
            double y0 = (coef1 - coef2) * sin(2 * PI * (T[i] + T[j])/(double)(2*L));
            //fprintf(stderr, "%d, %d: %f, %f\n", i, j, x0, y0);
            x += x0;
            y += y0;
        }
    }
    x /= N *(N - 1.) * (N - 2)/6.0;   
    y /= N *(N - 1.) * (N - 2)/6.0;
    //x *= 3.0;
    //y *= 3.0;
    //cout<<setprecision(10)<<x<<' '<<y<<endl;
    fprintf(stdout, "%.15f %.15f\n", x, y);
    //cout << x << " " << y << endl;
    return 0;    
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
 int n,i,a=1,b=1,c=1;

 scanf("%d",&n);

 for(i=0;i<n-1;i++){
  a=b+c;
  c=b;
  b=a;
 }
  

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

 return 0;
}

Measured memory_bytes: 1848
import math
import copy

class Score:
    def set_data(self, town, score, idx):
        self.town = set_town
        self.score = set_score
        self.idx = set_idx

inputa = input().split()
# inputb = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

# inputList=[]
# for i in range(a):
#     inputNum = input()
#     inputList.append(inputNum)

inputList=[]
for i in range(a):
    inputItem = input().split()
    inputItem.append(i+1)
    inputList.append(inputItem)


# listb = []
# listb = [int(n) for n in inputb]

inputNameListSorted = []
tmp = sorted(inputList, key=lambda x:int(x[1]), reverse = True)
inputNameListSorted = sorted(tmp, key=lambda x:x[0])

for i in range(len(inputNameListSorted)):
    print(inputNameListSorted[i][2])

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

int main(){
  int N,H;
  vector<int> sords;
  cin >> N >> H;
  int m=-1;
  for(int i=0;i<N;i++){
    int a,b;
    cin >> a >> b;
    m=max(m,a);
    sords.push_back(b);
  }
  sort(sords.begin(),sords.end(),greater<int>());
  int atk=0;
  for(int i=0;i<N;i++){
    if(sords[i]>m){
      H-=sords[i];
      atk++;
    }
    else{
      break;
    }
    if(H<=0){
     break;
    }
  }
  if(H>0){
    atk+=H/m;
    if(H%m!=0)atk++;
  }
  cout << atk << endl;
}


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

int main() {
  int N;
  cin >>N ;
  vector<int> d(110);
  for(int i=0;i<N;i++)cin>>d.at(i);
  int cnt=0;
  for(int i=0;i<101;i++){
    for(int j=0;j<101;j++){
    if((i+1)==d.at(j)){cnt++;
      break;
                      }
    }
  }
  cout<<cnt<<endl;
  
}


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

string s;
int res;

int main()
{
  while(cin >> s){
    res += 1;
    rep(i, s.size()/2) if(s[i] != s[s.size()-i-1]){ res -= 1;  break; }
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <unordered_map>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ll long long int

using namespace std;

struct UnionFind
{
  vector<int> par; //par[i]がiの根を表す

  // コンストラクタ
  UnionFind(int n)
  {
    par = vector<int>(n);
    for (int i = 0; i < n; i++)
    {
      par[i] = i;
    }
  }

  // データxの根を求める
  int root(int x)
  {
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]); // 木構造の縮約を行っている
  }

  // xとyの親が違うとき、マージする。そのときyの根がxの根の子になる
  void merge(int x, int y)
  {
    int rootx = root(x);
    int rooty = root(y);
    if (rootx == rooty)
      return;
    par[rooty] = rootx;
  }

  // 同じグループに属しているか
  bool isSame(int x, int y)
  {
    return root(x) == root(y);
  }
};

int main()
{
  // 黒が#で0、白が.で1
  int map[400][400] = {};
  int h = 0, w = 0;
  cin >> h >> w;
  REP(i, h)
  {
    string s;
    cin >> s;
    REP(j, s.length())
    {
      if (s[j] == '#')
      {
        map[i][j] = 0;
      }
      else
      {
        map[i][j] = 1;
      }
    }
  }

  UnionFind tree(h * w);

  REP(i, h)
  {
    REP(j, w)
    {
      if (j < w - 1)
      {
        if (map[i][j] != map[i][j + 1])
        {
          tree.merge(i * w + j, i * w + j + 1);
        }
      }

      if (i < h - 1)
      {
        if (map[i][j] != map[i + 1][j])
        {
          tree.merge(i * w + j, (i + 1) * w + j);
        }
      }
    }
  }

  int a[160000] = {};
  int b[160000] = {};

  REP(i, h)
  {
    REP(j, w)
    {
      int r = tree.root(i * w + j);
      if (map[i][j] == 0)
      {
        a[r]++;
      }
      else
      {
        b[r]++;
      }
    }
  }

  ll result = 0;

  REP(i, h * w)
  {
    result += a[i] * b[i];
  }

  cout << result << endl;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int m,n,sum=0; cin>>m>>n;
    int a[n];

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

    int rest=m-sum;

    if(m>=sum)
        cout<<rest<<"\n";
    else
        cout<<"-1"<<"\n";


    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pi acos(-1)
#define eps 1e-8
pair<int,int> a[100001];
bool cmp(pair<int,int> a,pair<int,int> b)
{
	return atan2(1.0*a.second,1.0*a.first)<
			  atan2(1.0*b.second,1.0*b.first);
}
signed main() 
{
	int n;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&a[i].first,&a[i].second);
		if(a[i].first==a[i].second&&a[i].first==0)
			n--,i--;
	}
	sort(a+1,a+n+1,cmp);
	int ans=0;
	for(int i=1;i<=n;i++) 
		a[n+i]=a[i];
	for(int i=1;i<=n;i++)
	{
		int sumx=0,sumy=0;
		for(int j=i;j<i+n;j++)
		{
			sumx+=a[j].first;
			sumy+=a[j].second;
			ans=max(ans,sumx*sumx+sumy*sumy);
		}
	}
	printf("%.20lf",sqrt(1.0*ans));
	return 0;
}


Measured memory_bytes: 256
a = str(input())
b = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
c = {"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9,"j":10,"k":11,"l":12,"m":13,"n":14,"o":15,"p":16,"q":17,"r":18,"s":19,"t":20,"u":21,"v":22,"w":23,"x":24,"y":25,"z":26}
print(b[c[a]])


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>

using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

int a,b;





int main()
{

	cin >> a >> b;

	if(b > 0){
		if(a > 0){
			cout << "Positive" << endl;
		} else {
			cout << "Zero" << endl;
		}
	} else if(b == 0) {
		cout << "Zero" << endl;
	} else {
		int num = b - a;
		if(num%2 == 0){
			cout << "Negative" << endl;
		} else {
			cout << "Positive" << endl;
		}
	}




}

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

int main(){
   int n,a[201],r = 0,ans = 0;
   cin >> n;
   for(int i = 0;i < n;i++){
      cin >> a[i];
   }
   
   while(1){
      for(int i = 0;i < n;i++){
         if(a[i]%2 == 0)r++;
         a[i] /= 2;
         //cout << i+1 << ":" << a[i] << endl;
      }
      if(r != n)break;
      ans++;
      r = 0;
   }
   cout << ans << endl;
}

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

int main() {
	int n[3];
	for(int i = 0; i < 3; i++){ cin >> n[i]; }
	sort(n, n +3);
	cout << n[0] << " " << n[1] << " " << n[2] << endl;
	return 0;
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;

    if(a > b)
    {
        cout << a + (a-1) << endl;
    }
    else if(b > a)
    {
        cout << b + (b-1) << endl;
    }
    else
    {
        cout << a + b << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#define N 200000
int main(void){
	int set;
	int i;
	int a[N];
	int max, min;
	int tmp;
	scanf("%d", &set);
	for(i=0;i<set;i++) {
		scanf("%d",&a[i]);
	}

	for(i=1;i<set;i++){
		if(i==1){
			max = a[1]-a[0];
			min = a[0];
		}
		tmp = a[i]-min;
		if(tmp>max)max = tmp;
		if(a[i]<min)min=a[i];
	}
	printf("%d\n", max);
	return 0;
}

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

#define REP(i, n) for(ll i=0;i<ll(n); i++)

int main(){
    int N, X, T;
    cin >> N >> X >> T;
    if(N % X != 0){
        cout << ((N / X) + 1) * T << endl;
    }
    else{cout << ( N / X ) * T << endl;}

    return 0;
}


Measured memory_bytes: 3028