akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
from itertools import product

D, G = map(int, input().split())
pc_table = [tuple(map(int, input().split())) for _ in range(D)]

bit_table = list(product([0, 1], repeat=D))
cnts = []
for bits in bit_table:
    g = sum([
        pc_table[i][1] + 100 * (i + 1) * pc_table[i][0]
        for i, bit in enumerate(bits) if bit
    ])
    cnt = sum([pc_table[i][0] for i, bit in enumerate(bits) if bit])

    max_p = 0 if sum(bits) == D else max(
        [i for i, bit in enumerate(bits) if not bit])
    for _ in range(pc_table[max_p][0]):

        if g >= G:
            cnts.append(cnt)
            break
        else:
            g += 100 * (max_p + 1)
            cnt += 1

print(min(cnts))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
         
using namespace std;
 
#define ll  long long
#define mod 1000000007
#define pb push_back
#define pie 3.141592653589
#define inf 1e9


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

   /*#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif*/

    ll i,n,n2,m,t,j,l,r,pos,mpos,f=0,k,p,n1,z,q,x,y,x1,y1,x2,y2,x3,y3,x4,y4,w;
 
    t=1;
    //cin>>t;

    while(t--)
    {
       cin>>x;
       if(x)
        cout<<0;
    else
        cout<<1;
   
    }
    return 0;
}

Measured memory_bytes: 3612
import numpy as np
n = int(input())
an = np.array([int(i) for i in input().split()])
bn = np.array([int(i) for i in input().split()])
difn = an - bn
cnt = 0
m_ab = 0

difn.sort()

for i in range(n):
  if difn[i] < 0:
    m_ab += difn[i]
    cnt += 1
  else:
    break

if cnt == 0:
  print(0)
  exit()

for i in range(1,n+1):
  if difn[-i] <= 0:
    print(-1)
    exit()
  m_ab += difn[-i]
  cnt += 1
  if m_ab >= 0:
    print(cnt)
    exit()

Measured memory_bytes: 24864
n, x, y, z = map(int, input().split())
mod = 10 ** 9 + 7
simple_xyz = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1))
def isnotxyz(b):
    return b & simple_xyz != simple_xyz
dp = [[0] * (1 << (x + y + z - 1)) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
    for b in range(1 << (x + y + z - 1)):
        if dp[i][b] == 0:
            continue
        for j in range(10):
            # 右から10...0(0はj個)を付け足し、(x + y + z)桁目より左の情報は忘れる
            new_b = ((b << 1 | 1) << j) & ((1 << (x + y + z)) - 1)
            if isnotxyz(new_b):
                new_b &= (1 << (x + y + z - 1)) - 1
                dp[i + 1][new_b] += dp[i][b]
                dp[i + 1][new_b] %= mod
def summod(a, mod):
    res = 0
    for ai in a:
        res += ai
        res %= mod
    return res
#俳句的でないほうの数を求めたので、全体から引く
print((pow(10, n, mod) - sum(dp[n])) % mod)

Measured memory_bytes: 62700
N=int(input())
a=list(map(int,input().split()))
for i in range(N):
    a[i]//=400

ans=0
for i in range(8):
    if i in a:
        ans+=1
y=0
for x in a:
    if x>=8:
        y+=1
print(max(ans,1),ans+y)


Measured memory_bytes: 9100
/* Coached by Dukkha */
#include <stdio.h>
#include <string.h>

#define N 100000
#define M 100000

int dsu[N];

int find(int i) {
	return dsu[i] < 0 ? i : (dsu[i] = find(dsu[i]));
}

long long join(int i, int j) {
	long long m;

	i = find(i);
	j = find(j);
	if (i == j)
		return 0;
	m = (long long) dsu[i] * dsu[j];
	if (dsu[i] > dsu[j]) {
		int tmp;

		tmp = i, i = j, j = tmp;
	}
	dsu[i] += dsu[j];
	dsu[j] = i;
	return m;
}

int main() {
	static int ii[M], jj[M];
	static long long ans[M];
	int n, m, h, i, j;
	long long t;

	scanf("%d%d", &n, &m);
	for (h = 0; h < m; h++) {
		scanf("%d%d", &i, &j), i--, j--;
		ii[h] = i, jj[h] = j;
	}
	memset(dsu, -1, sizeof dsu);
	t = (long long) n * (n - 1) / 2;
	for (h = m - 1; h >= 0; h--) {
		ans[h] = t;
		t -= join(ii[h], jj[h]);
	}
	for (h = 0; h < m; h++)
		printf("%lld\n", ans[h]);
	return 0;
}


Measured memory_bytes: 3200
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const ll MOD = 998244353;
//}}}

int main(){
  int a, b;
  cin >> a >> b;
  int n = b - a;
  int ans = n * (n + 1) / 2 - b;
  cout << ans << endl;
  return 0;
}


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

const int MOD = 17;

long long resolve(long long h) {
    long long n = 2;
    while(h >= n) {
        n *= 2;
    }
    return n- 1;
}

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

    long long h;
    cin >> h;
    cout << resolve(h);
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

using P = pair<int, int>;

struct Edge {
    int to, id;

    Edge(int to, int id) : to(to), id(id) {}
};

vector<Edge> g[55];

vector<int> es;

bool dfs(int v, int tv, int p = -1) {
    if (v == tv) {
        es = vector<int>(); // 終点に到達したらidを格納するvectorを用意する
        return true;
    }
    for (Edge e: g[v]) {
        if (e.to == p) continue;
        if (dfs(e.to, tv, v)) {
            es.push_back(e.id);
            return true;
        }
    }
    return false;
}

int bit_count(ll bits) {
    int cnt = 0;
    for (; bits != 0; bits >>= 1) cnt += bits & 1;
    return cnt;
}

int main() {
    int N, M;
    cin >> N;
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        g[a].emplace_back(b, i);
        g[b].emplace_back(a, i);
    }

    cin >> M;
    vector<ll> eset(M);
    rep(i, M) {
        // a=>b間の辺のidをbitで保持する
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        dfs(a, b);
        for (int e: es) {
            eset[i] |= 1ll << e;
        }
    }

    ll ans = 0;
    rep(i, 1 << M) { // bitが立っているesetを使う
        ll mask = 0;
        rep(j, M) {
            if (i >> j & 1) mask |= eset[j];
        }
        int white = bit_count(mask); // 白く塗る辺の個数
        ll now = 1ll << (N - 1 - white); // 2^(n-1-white)
        if ( (bit_count(i) % 2) == 0) ans += now;
        else ans -= now;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

const int maxN = 14;

int n, m, i, db, sg;
char s[maxN][maxN];
vector< vector<int> > data;
bool used[maxN];

int p[maxN];
vector< pair<string, string> > act;

void solve() {
    int i, j;
    string A, B;
    bool used = false;

    i = 1; j = n;
    for (auto e : data) {
        if (e.size() == 1) {
            p[(n + 1) / 2] = e[0];
        } else {
            p[i] = e[0];
            p[j] = e[1];
            i++; j--;
        }
    }

    act.clear();
    for (j = 1; j <= m; j++) {
        A.clear();
        for (i = 1; i <= n; i++) A.pb(s[p[i]][j]);

        B = A;
        reverse(B.begin(), B.end());

        act.pb(mp(A, B));
    }

    for (i = 0; i < act.size(); i++) {
        if (act[i].first.size() == 0) continue;

        for (j = i + 1; j < act.size(); j++) {
            if (act[j].first.size() == 0) continue;
            if (act[i].first == act[j].second) {
                act[j].first = "";
                break;
            }
        }

        if (j == act.size()) {
            if (act[i].first == act[i].second) {
                if (used) return;
                used = true;
            } else {
                return;
            }
        }
    }

    printf("YES");
    exit(0);
}

void get_combs() {
    if (db == 0 && sg == 0) {
        solve();
        return;
    }

    int i, j;
    for (i = 1; used[i]; i++);
    if (sg > 0) {
        sg--;
        data.pb({i});
        used[i] = true;

        get_combs();

        sg++;
        data.pop_back();
        used[i] = false;
    }

    if (db > 0) {
        for (j = i + 1; j <= n; j++) {
            if (used[j]) continue;

            db--;
            data.pb({i, j});
            used[i] = used[j] = true;

            get_combs();

            db++;
            data.pop_back();
            used[i] = used[j] = false;
        }
    }
}

int main()
{
    //freopen("test.in","r",stdin);

    scanf("%d%d\n", &n, &m);
    for (i = 1; i <= n; i++) scanf("%s\n", s[i] + 1);

    db = n / 2;
    sg = n % 2;
    get_combs();

    printf("NO");


    return 0;
}


Measured memory_bytes: 384
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
w = [1,2,4,8,16,32,64,128,256,512]
w.reverse()

for l in range(len(N)):
    n = int(N[l])
    ans = []
    for i in range(10):
        if n >= w[i]:
            n = n - w[i]
            ans.append(w[i])
    ans.sort()
    print(ans[0], end="")
    for i in range(1,len(ans)):
        print(" " + str(ans[i]), end="")
    print("")



Measured memory_bytes: 5616
#include <iostream>
#include <vector>
#include <map>

using namespace std;

map<vector<int>, int> dp;
vector<vector<int>> data;

// 各プレイヤーの残り勝数と先頭の番号
int rec(vector<int> win, int id) {
    if (win.size() == 1 && win[0] == 0) return 1;
    if (dp.count(win)) return dp[win];

    int n = win.size(), h = win.front();
    dp[win] = 0;

    for (int pat = 0; pat < (1 << (n - 1)); ++pat) {
        // 勝数条件
        if (__builtin_popcount(pat) != h) continue;

        bool judge = true;

        // 与えられた条件と合致するか
        for (int i = 0; i < n - 1; ++i) {
            int opp = id + i + 1;
            if (data[id][opp] >= 0 && ((pat >> i) & 1) != data[id][opp]) {
                judge = false;
            }
        }

        auto nwin = win;

        // 自分が「負けた」相手の残り勝数を1減らす
        for (int i = 0; i < n - 1; ++i) {
            int opp = i + 1;
            nwin[opp] -= 1 - ((pat >> i) & 1);
            if (nwin[opp] < 0) judge = false;
        }
        nwin.erase(nwin.begin());
        if (judge) dp[win] += rec(nwin, id + 1);
    }

    return dp[win];
}

bool solve() {
    dp.clear();
    int N;
    cin >> N;
    if (N == 0) return false;
    data.assign(N, vector<int>(N, -1));

    int M;
    cin >> M;
    for (int i = 0; i < M; ++i) {
        int x, y;
        cin >> x >> y;
        --x, --y;
        data[x][y] = 1;
        data[y][x] = 0;
    }


    vector<int> win(N, N / 2);
    cout << rec(win, 0) << endl;
    return true;
}

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



Measured memory_bytes: 3332
#include<iostream>
using namespace std;
int main(){
  int a,b,c,x,y; cin >> a >> b >> c >> x >> y;
  int max_v = (max(x,y)==x) ? a : b; // 枚数が多い方のピザの価格
  long long ans=0;
  if((a+b)<=2*c){
    cout << a*x+b*y << endl;
  }else{
    if(max_v>=2*c) cout << c*2*max(x,y) << endl;
    else{
      cout << c*2*min(x,y) + max_v*(max(x,y)-min(x,y)) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
from math import sqrt
N = int(input())
root_N = int(sqrt(N)) + 1


def F(a, b):
    return max(len(str(a)), len(str(b)))


min_F = 10**6
for a in range(1, root_N + 1):
    if N % a == 0:
        b = N // a
        min_F = min(min_F, F(a, b))
print(min_F)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
   #define PP pair<int,pair<int,int>>
const int MAX = 510000;
const int MOD =  998244353;
const int INV2 = (MOD+1)/2;

     signed main(){
  int a[3];
  cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3);
  cout<<a[0]+a[1]+a[2]*10<<endl;
    


}


        


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, a;
  cin >> n >> a;
  if (n < 500) {
      if (n < a+1) {
          cout << "Yes" << endl;
      }
      else{
          cout << "No" << endl;
      }
  }
  else{
      int amari;
      amari = n%500;
      if (amari < a+1) {
          cout << "Yes" << endl;
      }else{
          cout << "No" << endl;
      }
  }
}

Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
d = defaultdict(int)

for a in A:
    d[a] += 1

ans = 0

for k, v in d.items():
    ans += v * (v-1) // 2

for a in A:
    ans_ = ans - (d[a] * (d[a] - 1) // 2) + ((d[a] - 1) * (d[a] - 2) // 2)
    print(ans_)

Measured memory_bytes: 88140
#include<bits/stdc++.h>
#define FOR(i,a,b) for(register int i=a;i<=b;i++)

using namespace std;

inline int read(){
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}

struct SHOP{
	string name;
	int P;
	int num;
}shop[102];

bool cmp(SHOP a,SHOP b){
	if(a.name==b.name){
		return a.P>b.P;
	}
	else
		return a.name<b.name;
}

int main(){
	
	int n=read();
	FOR(i,1,n){
		cin>>shop[i].name;
		shop[i].P=read();
		shop[i].num=i;
	}
	sort(shop+1,shop+1+n,cmp);
	
	FOR(i,1,n){
		cout<<shop[i].num<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc068c()
}

fun abc068c() {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val abList = (1..m).map { readLine()!!.split(' ').map { it.toInt() } }
        .map { Pair(it[0], it[1]) }

    val from1 = abList.filter { it.first == 1 }.map { it.second }
    val toN = abList.filter { it.second == n }.map { it.first }

    val answer = if ((from1.intersect(toN)).isNotEmpty()) "POSSIBLE" else "IMPOSSIBLE"

    println(answer)
}


Measured memory_bytes: 94840
{-# LANGUAGE ScopedTypeVariables #-}
import Control.Applicative
import Data.List
main = do
	[w, h, x, y, r]::[Int] <- map read . words <$> getLine
	if x - r >= 0 && y - r >= 0  && x + r <= w && y + r <= h
		then putStrLn "Yes"
		else putStrLn "No"

Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define INF 9223372036854775807 / 2
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair


using namespace std;

std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

struct uf_tree {
	std::vector<int> parent;
	int __size;
	uf_tree(int size_) : parent(size_, -1), __size(size_) {}
	void unite(int x, int y) {
		if ((x = find(x)) != (y = find(y))) {
			if (parent[y] < parent[x]) std::swap(x, y);
			parent[x] += parent[y];
			parent[y] = x;
			__size--;
		}
	}
	bool is_same(int x, int y) { return find(x) == find(y); }
	int find(int x) { return parent[x] < 0 ? x : parent[x] = find(parent[x]); }
	int size(int x) { return -parent[find(x)]; }
	int size() { return __size; }
};

//!!!問題をちゃんと読む!!!
//!!!問題をちゃんと読め!!!
//!!!問題は読みましたか？!!!


signed main() {
	int N, K;
	cin >> N >> K;
	cout << N - K + 1 << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a=0,x=0;
  cin >> n;
  char s[n+1];
  cin >> s;
  for(int i=0;i<n;i++){
    if(s[i]=='I'){
      x++;
      a=max(a,x);
    }
    else{
      x--;
      a=max(a,x);
    }
  }
  cout << a;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int ans = -1;

    
    int[] list = new int[n];
    boolean flg = false;
    for (int i =0; i < n; i++){
      list[i] = sc.nextInt();
      if(list[i] == 2){
        flg = true;
      }
    }
    
    boolean[] flgList = new boolean[n];
    
    if (flg){
      int a = 0;
      int count = 0;
      do{
        flgList[a] = true;
        a = list[a] - 1;
        count++;
          
        if (a == 1){
          ans = count;
          break;
        }
      }while (!flgList[a]);
      
    }
    
    System.out.print(ans);
    
  }
}

Measured memory_bytes: 51976
#include <bits/stdc++.h>
using namespace std;
long long a[100005], b, n, k, q;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> k >> q; 
for (int i=0;i<q;i++){
	cin >> b; a[b]++;
}
for (int i=1;i<=n;i++){
	if (a[i]>(q-k)) cout << "Yes\n";
	else cout << "No\n";
}
return 0;
}

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

using namespace std;

const int N = 1<<17;

int n,k,curr;
char a[N];

int main() {
    int i;
    
    scanf("%s", a+1);
    n=strlen(a+1);
    scanf("%d", &k);
    for(i=1;i<=n;i++) {
        if(a[i]=='a') curr=0;
        else curr='z'-a[i]+1;
        if(curr<=k) a[i]='a',k-=curr;
    }
    k%=26;
    while(k--) a[n]=((a[n]=='z') ? ('a') : (a[n]+1));
    for(i=1;i<=n;i++) printf("%c", a[i]);
    printf("\n");

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }
template<typename V> void printVec(V v) {ll i=0;for(auto x : v){std::cout << " [" << i++ << "] " << x;} print();}

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

  ll A, B;
  std::cin >> A >> B;

  if (A <= 8 && B <= 8) {
    print("Yay!");
  } else {
    print(":(");
  }

  return 0;
}


Measured memory_bytes: 256
#ifdef LOCAL
 #include <P.hpp>
 #include <debugger.hpp>
 #define __int64 __int64_t
#else 
 #include <bits/stdc++.h>
 #define debug(a...) //
 #define __int64 long long int
#endif
using namespace std;

const int maxn = 1e7 + 1;
bitset<maxn> is_prime;
vector<__int64> ans(maxn , 1);

__int64 p(int j , int i) {
 __int64 ret = 0;
 while(j % i == 0) j /= i , ret++;
 return ret;
}

void seive()
{
 is_prime.set();
 is_prime[1] = false;
 for(int i = 2; i < maxn; i++) {
  if(is_prime[i]) {
   for(int j = i; j < maxn; j += i) {
    if(j != i) is_prime[j] = false;
    ans[j] *= (p(j , i) + 1);
   }
  }
 }
}

int main()
{
 ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
 seive();
 for(int i = 1; i < 10; i++) debug(i , ans[i]);
 vector<__int64> dp(maxn);
 for(int i = 1; i < maxn; i++) {
  dp[i] += dp[i - 1] + (i * ans[i]);
 }
 int n;
 cin >> n;
 cout << dp[n] << '\n';
 return 0;
}


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

int main() {
	double a, b, c, x, h, v;
	cin >> a >> b >> x;
	h = x / (a*a);
	v = a * a*b / 2;
	if (v <= x) {
		cout << fixed;
		cout << setprecision(10) << atan2(b - h, a / 2) / M_PI * 180 << endl;
	}
	else {
		c = 2 * x / (a*b);
		cout << ::fixed;
		cout << setprecision(10) << atan2(b, c) / M_PI * 180 << endl;
	}
	return 0;
}

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

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

Measured memory_bytes: 3672
import java.util.Scanner; 

class Main{

 public static void main(String[] args){

 Scanner scan = new Scanner(System.in);

 int A = scan.nextInt();
 int B = scan.nextInt();
 int C = scan.nextInt();
   
 int w = A;
   A = B;
   B = w;
   w = A;
   A = C;
   C = w;
System.out.println(A+" "+B+" "+C);

 }
}

Measured memory_bytes: 23636
import java.util.Scanner;

class Rectangle{
    int w;
    int h;
 
    Rectangle(int w, int h){ //?????????????????????
        this.w = w;
        this.h = h;
    }

    boolean judgeInRectangle(Circle c){
        if (c.x - c.r < 0 || c.y - c.r < 0)
            return false;
        if (c.x + c.r > w || c.y + c.r > h)
            return false;
        return true;
    }
}

class Circle{
    int x;
    int y;
    int r;

    Circle(int x, int y, int r){
        this.x = x;
        this.y = y;
        this.r = r;
    }
}

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        int W = Integer.parseInt(scan.next());
        int H = Integer.parseInt(scan.next());
        int x = Integer.parseInt(scan.next());
        int y = Integer.parseInt(scan.next());
        int r = Integer.parseInt(scan.next());
        
        Rectangle rec = new Rectangle(W, H);
        Circle cir = new Circle(x, y, r);

        if (rec.judgeInRectangle(cir))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

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

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;

        int n = Integer.parseInt (f.readLine());
        int [][]arr=new int[n][3];
        for(int i=0;i<n;i++){
            st = new StringTokenizer (f.readLine());
            arr[i][0]=Integer.parseInt(st.nextToken());
            arr[i][1]=Integer.parseInt(st.nextToken());
            arr[i][2]=Integer.parseInt(st.nextToken());
        }

        int dp[][]=new int[n][3];
        //best answer at day 3 with the last day using one two or three
        dp[0][0]=arr[0][0];
        dp[0][1]=arr[0][1];
        dp[0][2]=arr[0][2];
        for(int i=1;i<n;i++){
            for(int j=0;j<3;j++){
                for(int k=0;k<3;k++){
                    if(k==j)continue;
                    dp[i][j]=Math.max(dp[i][j],arr[i][j]+dp[i-1][k]);
                }
            }
        }
            //19 17 21
        int ret=0;
        ret=Math.max(Math.max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
        System.out.println(ret);
        f.close();

        //print to System. out.println

    }

}


Measured memory_bytes: 49980
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << -1; return;}
#define yes {cout << "Yes"; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

void solve() {
    int c[4] = { 0 };
    int n; cin >> n;
    loop(i, n) {
        string s; cin >> s;
        if (s == "AC")
            ++c[0];
        else if (s == "WA")
            ++c[1];
        else if (s == "TLE")
            ++c[2];
        else if (s == "RE")
            ++c[3];
    }
    cout << "AC x " << c[0] << "\n";
    cout << "WA x " << c[1] << "\n";
    cout << "TLE x " << c[2] << "\n";
    cout << "RE x " << c[3] << "\n";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3656
loop {
	n = gets.to_i
	break if n == 0
	a = (1..n).map{ gets.split.map &:to_i }
	
	table = Array.new(1<<n, Float::INFINITY)
	table[0] = 0
	for x in 1..(1<<n)-1
		idx = (0..n-1).select{|i| x[i] == 1}
		min_time = Float::INFINITY
		for i in idx
			prev_t = table[x-(1<<i)]
			cost_table = a[i]
			min_cost = cost_table[0]
			for j in idx - [i]
				c = cost_table[j+1]
				min_cost = c if c < min_cost
			end
			t = prev_t + min_cost
			min_time = t if t < min_time
		end
		table[x] = min_time
	end
	p table[-1]
}

Measured memory_bytes: 21764
using System;
using System.Linq;

namespace ABC125B
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int N = ConsoleInput.Int();
            int[] V = ConsoleInput.IntArray();
            int[] C = ConsoleInput.IntArray();

            int ans = 0;
            for (int i = 0; i < N; i++)
            {
                ans += Math.Max(0, V[i] - C[i]);
            }
            Console.WriteLine(ans);
        }
    }
    
    internal static class ConsoleInput
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

Measured memory_bytes: 13268
#include<stdio.h>
 static const int INFTY = (1<<21);
 
main(){
  int n, i, j,u,v,r,k,m;
  int M[501][501],a[501],t[501];
 
  scanf("%d", &n);
  for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      M[i][j] = INFTY;
    }
  }
 
  for (i = 0; i<n; i++){
    scanf("%d %d", &u, &k);
    for (j = 0; j<k; j++){
      scanf("%d %d", &v, &r);
      M[u][v] = r;
    }
  }
 
  for(i = 0; i<n; i++){
      t[i]=0;
      a[i]=INFTY;
  }
  a[0]=0;
  
 
  while(1){
      m=INFTY;
      u=-1;
      for(i = 0; i<n; i++){
          if(a[i]<m && t[i]==0){
              u=i;
              m=a[i];
          }
      }
 
      if(u==-1)break;
 
      t[u]=1;
 
      for(v=0; v<n; v++){
          if(a[v] >=a[u]+M[u][v]) a[v]=a[u]+M[u][v];
      }
  }
  for ( i = 0; i < n; i++ ){
     printf("%d %d\n", i, (a[i]==INFTY?-1:a[i]));
}
  return 0;
}

Measured memory_bytes: 800
import java.io.*;
public class Main{
	public static void main(String[] args)  throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		String str;
		while((str=br.readLine())!=null){
			String[] num=str.split(" ");
			int sum=Integer.parseInt(num[0])+Integer.parseInt(num[1]);
			System.out.println(String.valueOf(sum).length());
		}
	}

}

Measured memory_bytes: 24284
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MAX_N = 1e5;
long long n;
long long A[MAX_N+2] ={0};


long long  make_pair(int idx){
    long long  num_pair = (A[idx]+A[idx+1])/2;
    if(A[idx]<num_pair*2){
        A[idx+1] -= (num_pair*2 - A[idx]);
        A[idx] = 0;
    }
    else {
        A[idx] -= num_pair*2;
    }
    return num_pair;
}


void solve(){
    long long res=0;
    for(int i=1;i<=n;i++){
        res += make_pair(i);
    }

    printf("%lld",res);
}

int main() {
    scanf("%lld",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&A[i]);
    }
    solve();
    printf("\n");
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int used[101];
long long ar[101];
long long ways(int now, int maxx){
    if(now>maxx){
        long long ret = 0LL;
        for(int i = 100; i>33; i--){
            if(i<=50){
                if(used[i]!=0){
                    continue;
                }
                if(used[i+i]!=0 || ar[i+i]<=0LL){
                    ret+=max(0LL,ar[i]);
                    continue;
                }
                if(ar[i+i]+ar[i]>0LL){
                    ret += ar[i];
                }
                else{
                    ret -= ar[i+i];
                }
            }
            else if(used[i]==0 && ar[i]>0LL){
                ret += ar[i];
            }
        }
        return ret;
        //check
    }
    long long ret = ways(now+1,maxx);
    if(used[now]==0){
        ret += ar[now];
        for(int j = now; j<=100; j+=now){
            used[j]++;
        }
        ret = max(ret,ways(now+1,maxx));
        for(int j = now; j<=100; j+=now){
            used[j]--;
        }
    }
    return ret;
}
int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i = 0; i<=100; i++){
        used[i] = 0;
        ar[i] = 0LL;
    }
    for(int i = 1; i<=n; i++){
        cin >> ar[i];
    }
    cout << ways(1,33) << endl;
    return 0;
}

Measured memory_bytes: 384
#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>
using namespace std;

int main(){
    int a,b;

    cin  >> a >> b;
    
    if(a>=b)cout<< 10 << endl;
    else cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
#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+1];
	FOR(i,0,N){SCD(a[i]);}
	
	int maxA = 0;
	int minA = 1000;
	
	FOR(i,0,N){
		maxA = max(maxA,a[i]);
		minA = min(minA,a[i]);
	}
	
	PRINTD(maxA-minA);
	
}



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


    }
    int maxS=0;
    int s=0;
    for(int i=0;i<n-1;i++){
      if(a[i] >= a[i+1]){
          s++;


      }
      else{
        s=0;
      }
      if(maxS < s)
        maxS = s;




    }
    cout<<maxS<<endl;





}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,a,b,c,d; cin>>n>>a>>b>>c>>d;
  a--,b--,c--,d--;
  string s; cin>>s;
  
  bool ok=true;
  irep(i,a,c){
    if(s[i]=='#'&&s[i+1]=='#') ok=false;
  }
  irep(i,b,d){
    if(s[i]=='#'&&s[i+1]=='#') ok=false;
  }
  
  if(d<c){
    bool flg=false;
    irep(i,b-1,d){
      if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.') flg=true;
    }
    ok=flg;
  }
  
  if(ok) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

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

const int MAXN = 305;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int LOG = 18;
const double EPS = 1e-9;
const double PI = 3.1415926535;

double dp[MAXN][MAXN][MAXN];
double prob_empty, prob_one, prob_two, prob_three;

int main() {
    int N, x, n1, n2, n3;

    cin >> N;
    n1 = n2 = n3 = 0;
    for(int i = 0; i < N; i++) {
        cin >> x;
        if(x == 1) n1 ++;
        if(x == 2) n2 ++;
        if(x == 3) n3 ++;
    }

    for(int k = 0; k <= N; k++) {
        for(int j = 0; j <= N; j++) {
            for(int i = 0; i <= N; i++) {
                if(i == 0 && j == 0 && k == 0)
                    continue;
                if(i + j + k > MAXN)
                    continue;

                prob_empty = N / (double)(i + j + k);
                prob_one = i / (double)(i + j + k);
                prob_two = j / (double)(i + j + k);
                prob_three = k / (double)(i + j + k);

                if(i != 0)
                    dp[i][j][k] += prob_one * dp[i - 1][j][k];
                if(j != 0)
                    dp[i][j][k] += prob_two * dp[i + 1][j - 1][k];
                if(k != 0)
                    dp[i][j][k] += prob_three * dp[i][j + 1][k - 1];
                dp[i][j][k] += prob_empty;
            }
        }
    }

    printf("%.10f\n", dp[n1][n2][n3]);

    return 0;
}


Measured memory_bytes: 219392
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, W[100];
    cin >> N;
    REP(i, N) cin >> W[i];

    int ans = 100000000;
    REP(i, N + 1) {
        int s1 = 0, s2 = 0;
        REP(j, i) {
            s1 += W[j];
        }
        FOR(j, i, N) {
            s2 += W[j];
        }
        ans = min(ans, abs(s1 - s2));
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved

int main(){
    long long num[3];
    rep(i,3)cin>>num[i];
    long long k;
    cin>>k;

    long long ans=0;
    int i=0;
    long long p[3]={1,0,-1};
    while(k){    
    ans+=min(k,num[i])*p[i];
    k-=min(num[i],k);
    i++;
    }
    cout<<ans<<endl;

    return 0;

}
/*


*/


Measured memory_bytes: 3640
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    bool latte[1000000];
    fill(latte,latte+1000000,true);
    latte[0]=latte[1]=false;
    for(int i=2;i<1000000;i++){
        if(latte[i]){
            for(int j=i+i;j<1000000;j+=i)latte[j]=false;
        }
    }

    int n;
    while(scanf("%d",&n)&&n){
        int cnt=0;
        for(int i=2;i<n/2;i++)if(latte[i]&&latte[n-i])cnt++;
        if(latte[n/2])cnt++;
        printf("%d\n",cnt);
    }
    return 0;
}

Measured memory_bytes: 2004
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define rrep(i,n) for(int i=(n);i>=0;--i)
#define ssort(n) sort((n).begin(),(n).end())
using ll=long long;
using ld=long double;
typedef pair<int,int> P;
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define INF 10101010

int main()
{
    int x,y;
    cin >> x >> y;
    bool result=false;
    rep(i,x+1){
        if(i*2+(x-i)*4==y){
            result=true;
        }
    }
    if(result)Yes;
    else No;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <stdio.h>
using namespace std;

int main(){
    char S[4];
    for(int i=0;i<4;i++){
        cin>>S[i];
    }
    if((S[0]=='0'&&S[1]=='0')||(S[0]=='1'&&int(S[1]-'0')>2)||(int(S[0]-'0')>1)){
        if((S[2]=='0'&&S[3]=='0')||(S[2]=='1'&&int(S[3]-'0')>2)||(int(S[2]-'0')>1)){
            cout<<"NA"<<endl;
        }else{
            cout<<"YYMM"<<endl;
        }
    }else{
        if((S[2]=='0'&&S[3]=='0')||(S[2]=='1'&&int(S[3]-'0')>2)||(int(S[2]-'0')>1)){
            cout<<"MMYY"<<endl;
        }else{
            cout<<"AMBIGUOUS"<<endl;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <limits>
#include <climits>

using namespace std;

int main(){
    int n; cin >> n;
    vector<int> ps(n);
    for(int i=0; i<n; ++i){
        cin >> ps[i];
    }
    int ans=0;
    for(int i=0; i<n-1; ++i){
        if(ps[i]==i+1){
            swap(ps[i], ps[i+1]);
            ++ans;
        }
    }
    if(ps[n-1]==n) ++ans;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
n = int(input())
alp = [chr(ord('a') + i) for i in range(26)]
res = []
x = 26
while n>0:
    n,r = divmod(n,x)
    if r==0:
        n -=1
    res.append(alp[r-1])
res = res[::-1]
print(*res,sep='')

Measured memory_bytes: 9208
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

const LL mod = 1000000007;

// (num ^ x) % mod
LL pow_mod(LL num, LL x, LL mod)
{
	LL res = 1;
	while (x > 0)
	{
		if (x & 1)
		{
			res = (res * num) % mod;
		}
		num = (num * num) % mod;
		x >>= 1;
	}
	return res;
}

int main()
{
	std::string L;
	in >> L;

	LL ans = 0, cnt = 0;
	rep(i, L.length())
	{
		if (L[i] == '1')
		{
			LL res = pow_mod(3, L.length() - 1 - i, mod);
			(res *= pow_mod(2, cnt, mod)) %= mod;
			(ans += res) %= mod;
			++cnt;
		}
	}
	(ans += pow_mod(2, cnt, mod)) %= mod;

	out << ans << std::endl;
}


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

int main() {
    string s;
    cin >> s;
    int N = s.size();
    int K;
    cin >> K;
    set<string> st;

    for (int i = 0; i <= N - 1; ++i) {
        string S = "";
        for (int j = 0; i + j <= N - 1&&j<=K; ++j) {
            S += s[i + j];
            st.insert(S);
        }
    }
    int now = 1;
    for (auto e : st) {
        if (now == K) {
            cout << e << endl;
            return 0;
        } else
            ++now;
    }
}

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

int main() {
    int n, k = 0;
    cin >> n;
    for (int i = 2; i*(i-1) <= 2*n ; i++){
        if(i*(i-1) == 2*n){
            k = i;
            break;
        }
    }
    if (k == 0){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;

    vector<vector<int>> s(k);
    int num = 1;
    for (int i = 0; i < k; i++){
        int cnt = 1;
        while (s[i].size() < k-1){
            s[i].push_back(num);
            s[i+cnt].push_back(num);
            num++;
            cnt++;
        }
    }
    
    cout << k << endl;
    for (int i = 0; i < k; i++){
        cout << k-1 << ' ';
        for (int j = 0; j < k-1; j++){
            cout << s.at(i).at(j) << ' ';
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 4200
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

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

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL read()
{
    char c=getchar();LL f=1,sum=0;
    while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0' && c<='9'){sum=sum*10+c-'0';c=getchar();}
    return sum*f;
}
map<LL,LL> cnt,inv;
LL n,p[100005],x,ans,tot,sqq;
bool vis[100005];
void shai()
{
	for(int i=2;i<=100000;i++)
    {
        if(!vis[i]) p[++tot]=i;
        for(int j=1;j<=tot && i*p[j]<=100000;j++)
		{
			vis[i*p[j]]=1;
			if(i%p[j]==0) break;
		}
    }
}
int main()
{
	shai();
	n=read();
	for(int i=1;i<=n;i++)
    {
        x=read();
		LL tmp=x,val=1,iv=1;
        for(int j=1;j<=tot && p[j]*p[j]*p[j]<=x;j++)
		if(tmp%p[j]==0)
        {
            int mi=0;
			while(tmp%p[j]==0) tmp/=p[j],mi++;mi%=3;
            for(int k=1;k<=mi;k++) val*=p[j];
			for(int k=1;k<=(3-mi)%3;k++) iv*=p[j];
        }
        if(tmp>1)
		{
			val*=tmp;
			LL sq=sqrt(tmp);
			if(sq*sq==tmp) iv*=sq;
			else iv*=tmp*tmp;
		}
        if(val==1) sqq=1;
		else cnt[val]++,inv[iv]=val,inv[val]=iv;
    }
	for(auto it=cnt.begin();it!=cnt.end();++it)
    {
        if(cnt.find(inv[it->first])==cnt.end()) ans+=it->second;
        else ans+=max(it->second,cnt[inv[it->first]]),it->second=0,cnt[inv[it->first]]=0;
    }
    printf("%lld\n",ans+sqq);
	return 0;
}

Measured memory_bytes: 19200
#include <iostream>

int main()
{
	int N, L;
	std::cin >> N >> L;
	int sum = N * L + N * (N + 1) / 2 - N;
	int max = L + N - 1;
	int min = L;
	if (max < 0) {
		sum -= max;
	}
	else if (min > 0) {
		sum -= min;
	}

	std::cout << sum;
    return 0;
}



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

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    long long ans=1LL*(n/k)*(n/k)*(n/k);
    if(((k&1)==0) && (n>=(k/2))){
        ans+=1LL*((n-(k/2))/k + 1)*((n-(k/2))/k + 1)*((n-(k/2))/k + 1);
    }
    cout << ans << endl;
    return 0;
}

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

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

// ----- Tools ----- //
template <typename Key, typename Value, typename Arg>
bool containsKey(const unordered_map<Key, Value>& m, const Arg& value) {return m.find(value) != m.end();}
template <typename Key, typename Value, typename Arg>
bool containsKey_tm(const map<Key, Value>& m, const Arg& value) {return m.find(value) != m.end();}
bool startsWith(string str, string tar) {return (str.rfind(tar, 0) == 0);}
bool contains(string str, string tar) {return (str.find(tar) != std::string::npos);}
vector<string> split(string str, char ch) {vector<string> res; stringstream ss(str); string s; while (getline(ss, s, ch)) res.push_back(s); return res; }
char toLower(char& ch) {if ('A' <= ch && ch <= 'Z') return ch - 'A' + 'a'; else return ch;}
char toUpper(char& ch) {if ('a' <= ch && ch <= 'z') return ch - 'a' + 'A'; else return ch;}

// -------- Main Code -------- //

// --------------- //

void runcase() {
    string s;
    cin >> s;
    int res = 0;
    int cnt = 0;
    for (int i=0; i<3; i++) {
        if (s[i] == 'S') {
            res = max(res, cnt);
            cnt = 0;            
        } else {
            cnt ++;
        }
    }
    res = max(res, cnt);

    cout << res << '\n';
}

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

    // int t;
    // cin >> t;
    // while (t-- > 0)
        runcase();

    return 0;
}


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

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

  unordered_map<char, char> mpS;
  for (uint i = 0; i < S.size(); i++) {
    auto itr = mpS.find(S[i]);
    if (itr != mpS.end()) {
      if (itr->second != T[i]) {
        cout << "No" << endl;
        return 0;
      }
    }
    mpS[S[i]] = T[i];
  }

  unordered_map<char, char> mpT;
  for (uint i = 0; i < T.size(); i++) {
    auto itr = mpT.find(T[i]);
    if (itr != mpT.end()) {
      if (itr->second != S[i]) {
        cout << "No" << endl;
        return 0;
      }
    }
    mpT[T[i]] = S[i];
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
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 ll INF = 1e9;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}




// combination mod prime
// mintが必要
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

ll comb(int x){
    ll res = x*(x-1)/2;
    return res;
}
int main(){
    vector<int>v(3);
    rep(i,3)cin>>v[i];
    sort(v.rbegin(),v.rend());
    int ans = 0;
    while(v[0]!=v[1]){
        ans++;
        v[1]++;
        v[2]++;
    }
    while(v[0]>v[2]){
        ans++;
        v[2]+=2;
    }
    if(v[0]!=v[2]){
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256