akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

/*
struct Tp {
    lli x, y, z;
    Tp(lli _x, lli _y, lli _z)
        : x(_x), y(_y), z(_z) {}
    Tp operator+(const Tp t) {
        return Tp(x + t.x, y + t.y, z + t.z);
    }
    lli abs_sum() const {
        return abs(x) + abs(y) + abs(z);
    }
    bool operator<(const Tp t) const {
        lli as = this->abs_sum();
        lli ts = t.abs_sum();
        return as < ts;
    }
};
*/

int main() {
    int N, M;
    cin >> N >> M;
    vector<lli> x(N), y(N), z(N);
    REP(i, 0, N) {
        cin >> x[i] >> y[i] >> z[i];
    }
    lli ans = -(1LL << 60);
    REP(t, 0, 8) {
        auto dp = make_v(N + 1, M + 2, -(1LL << 60));
        dp[0][0] = 0LL;
        int tx = 2 * ((t >> 2) & 1) - 1, ty = 2 * ((t >> 1) & 1) - 1, tz = 2 * (t & 1) - 1;

        REP(i, 0, N) {
            REP(j, 0, M + 1) {
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + (tx * x[i] + ty * y[i] + tz * z[i]));
            }
        }
        ans = max(ans, dp[N][M]);
    }
    cout << ans << endl;
    return 0;
}


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

#define fa(x,v) for(auto x:v)
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define spc " "
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(s) (ll)int(s.length())
#define sz(v) (ll)int(v.size())
#define MOD 1000000007

void Fast_IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    freopen("debug.out","w",stderr);
    #endif
} 

// Code Here

int main()
{
    // Fast_IO();
    ll x, n; cin >> x >> n;
    ll a[n]; f(i,0,n-1) cin >> a[i];
    ll F[100000];
    f(i,0,99999) F[i] = 0;
    f(i,0,n-1) F[a[i]] = 1;
    ll l = x-1, r = x+1;
    if(F[x] != 1) {
    	cout << x;
    	return 0;
    }
    ll ans;
    while(true) {
    	if(l < 1) {
    		ans = l;
    		break;
    	}
    	if(F[l] != 1) {
    		ans = l;
    		break;
    	}
    	if(F[r] != 1) {
    		ans = r;
    		break;
    	}
    	l--; r++;
    }
    cout << ans;
    return 0;
}

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

ifstream in("test.in");
ofstream out("test.out");

map<int, int> mmp;

int main(void)
{
    ios :: sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    int n;
    cin >> n;
    
    for (int i = 1; i <= n; ++i) {
        int x;
        cin >> x;
        
        ++mmp[x];
    }
    
    int m;
    cin >> m;
    
    for (int i = 1; i <= m; ++i) {
        int x;
        cin >> x;
        
        --mmp[x];
        
        if (mmp[x] < 0) {
            cout << "NO";
            return 0;
        }
    }
    
    cout << "YES";
    return 0;
}


Measured memory_bytes: 9600
#include<cstdio>
	int main()
{
	int a[3];
	int z,c;
	z=0,c=0;
	for(int i=0;i<3;i++){
		scanf("%d",&a[i]);
	}
	for(int k=0;k<3;k++){
	if(a[k]==5){	
		z++;
	}
	if(a[k]==7){
		c++;
	}}
	if(z==2&&c==1){
	printf("YES\n");
	}
	else
	{
	printf("NO\n");
	}
	}	

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)
#define EPS         (1e-10)
#define EQ(a, b)    (abs((a)-(b)) < EPS)

using P   = pair<int, int>;
using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int a, b, c, d, e, f;cin >> a >> b >> c >> d >> e >> f;
    int answ;
    int anss;
    double ans = -1;
    for(int i=0;i*a*100<=f;i++){
        for(int j=0;i*a*100+j*b*100<=f;j++){
            int w = i*a*100+j*b*100;
            if(w == 0) continue;
            for(int k=0;w+k*c<=f;k++){
                for(int l=0;l<=(f-w-k*c)/d;l++){
                    int s = k*c+l*d;
                    if(w+s>f) continue;
                    if(s>(i*a+j*b)*e) continue;
                    if(ans <= 100.0*double(s)/(double(w)+double(s))){
                        //cout << w << " " << s << endl;
                        ans = 100.0*double(s)/(double(w)+double(s));
                        answ = w;
                        anss = s;
                    }
                }
            }
        }
    }
    cout << (answ+anss) << " " << anss << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  ll n;
  cin >> n;
  ll m=1000000000000000000;
  ll k=1;
  ll p[n];
  rep(i,n)cin >> p[i];
  rep(i,n){
    if(p[i]==0){
      cout << 0 << endl;
      return 0;
    }
  }
  rep(i,n){
    ll o=p[i];
    if(k*o>m){
      cout << -1 << endl;
      return 0;
    }
    if(m/o<k){
      cout << -1 << endl;
      return 0;
    }
    else k=o*k;
  }
  cout << k << endl;
}  


Measured memory_bytes: 4412
#include <iostream>

using namespace std;

int main(){

   int n, k, d;
   int ans = 0;
   
   cin >> n >> k;

   int a[n] = {0};

   for(int i = 0; i < k; i++){
      cin >> d;
      for(int j = 0; j < d; j++){
         int ai;
         cin >> ai;
         a[ai-1]++;
      }
   }

   for(int i = 0; i < n; i++){
      if(a[i] == 0){
         ans++;
      }
   }

   cout << ans << endl;

   return 0;
}

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

using namespace std;

string s[2];
int q;
int dp[1000][1000];

int solve(int x,int y) {
	if(x == -1 || y == -1) return 0;
	if(dp[x][y] == -1) {
		if(s[0][x] == s[1][y]) dp[x][y] = solve(x-1,y-1) + 1;
		else dp[x][y] = max(solve(x-1,y),solve(x,y-1));
	}
	return dp[x][y];
}

int main() {
	cin >> q;
	for(int i = 0;i < q;i++) {
		for(int i = 0;i < 1000;i++)for(int j = 0;j < 1000;j++)dp[i][j] = -1;
		cin >> s[0] >> s[1];
		cout << solve(s[0].size()-1,s[1].size()-1) << endl;
	}
}



Measured memory_bytes: 7128
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
long long int mod = 998244353;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
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};
//↓,→,↑,←
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
} 

ll i,j,k,ii,jj;
ll n,m,num,sumxor,sum,ans;
ll a,b,c,d,e,f,g,h,w,v,p;
string s[500005];
string t;
ll x[800005],y[800005],z[900005];
ll dp[5000][5000];


int main(){	
	cin>>k>>n;
	dp[0][0]=1;
	for(i=0;i<=4005;i++){
		for(j=0;j<=i;j++){
			if(i==j || j==0){
				dp[i][j]=1;
			}else{
				dp[i][j] = dp[i-1][j] + dp[i-1][j-1];
				dp[i][j] %= mod;
			}
		}
	}
	//dp[i][j] := i C j
	for(i=2;i<=2*k;i++){
		ans = 0;
		if(i%2==1){
			if(i<=k){
				p = i/2;
			}else{
				p = (2*k+2-i)/2;
			}
			for(j=0;j<=p;j++){
				//p個のpairのうちj個には何にもない
				g = k - p - j;
				//出していい目がg個
				num = dp[p][j];
				if(g<=0)continue;
				ans += (num * dp[n+g-1-p+j][g-1])%mod * rui(2,p-j);
				ans %= mod;
			}
		}else{
			//iが偶数の時
			if(i<=k){
				p = i/2 -1;
			}else{
				p = (2*k+2-i)/2 -1;
			}
			for(j=0;j<=p;j++){
				g = k - p - j;
				//出していい目がg個
				if(g<=1)continue;
				num = dp[p][j];
				
				ans += (num * dp[n+g-2-p+j][g-2])%mod * rui(2,p-j);
				ans %= mod;
				ans += (num * dp[n+g-3-p+j][g-2])%mod * rui(2,p-j);
				ans %= mod;
			}
		}
		p(ans);
	}
	//p(dp[5][-100]);
	return 0;
}


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

using namespace std;
using ll = long long;

ll calc(ll n, ll x) {
    return (n / x);
}

int main() {
    ll a, b, x; cin >> a >> b >> x;
    ll ans = 0;
    if (a == 0) {
        if (b == 0) ans = 1;
        else ans = calc(b, x) + 1;
    } else {
        ans = calc(b, x) - calc(a - 1, x);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main(){
    int e;
    while(cin >> e && e > 0){
        int min;
        min = 1000000;
        for(int y=0; y<=1000; y++){
            for(int z=0; z<=100; z++){
                int m, x;
                m = e - y*y + y - z*z*z + z;
                x = e - y*y - z*z*z;
                if(min > m && x >= 0 ){
                    min = m;
                }
            }
        }
        cout << min << endl;
    }
}

Measured memory_bytes: 3016
#include <iostream>

int main () {
    int x;
    std::cin >> x;
    x = x - 400;
    for (int i = 0; i < 8; ++i){
        if(x - 200 < 0){
            std::cout << 8 - i << std::endl;
            break;
        }
        x -= 200;
    }
}

Measured memory_bytes: 3620
#![allow(unused_imports)]

use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::stdin;
use std::ops::*;
use std::process::exit;
use std::str::FromStr;


fn main() {
    let n: usize = input();
    let a: Vec<i64> = input_vec();

    let mut ans = std::i64::MAX;
    for base in -100..101 {
        let mut c = 0;
        for i in a.iter() {
            c += (base - *i).pow(2);
        }
        ans = min(ans, c);
    }
    println!("{}", ans);
}



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

pub fn input_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>()
}

pub fn input_lines<T: FromStr>(l: usize) -> Vec<T> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input());
    }
    res
}

pub fn input_lines_two<T: FromStr, U: FromStr>(l: usize) -> Vec<(T, U)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_two());
    }
    res
}

pub fn input_lines_three<T: FromStr, U: FromStr, V: FromStr>(l: usize) -> Vec<(T, U, V)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_three());
    }
    res
}

pub fn input_two<T: FromStr, U: FromStr>() -> (T, U) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
    )
}

pub fn input_three<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
        s[2].parse::<V>().ok().unwrap(),
    )
}

pub fn input_four<T: FromStr, U: FromStr, V: FromStr, W: FromStr>() -> (T, U, V, W) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse().ok().unwrap(),
        s[1].parse().ok().unwrap(),
        s[2].parse().ok().unwrap(),
        s[3].parse().ok().unwrap(),
    )
}


Measured memory_bytes: 4352
from collections import deque

N, M = map(int, input().split())
edges = {}
connections = {}
for _ in range(M):
    l, r, d = map(int, input().split())
    l -= 1
    r -= 1
    assert (l, r) not in edges
    assert (r, l) not in edges
    edges[l, r] = d

    if l not in connections:
        connections[l] = set()
    if r not in connections:
        connections[r] = set()
    connections[l].add(r)
    connections[r].add(l)


def solve():
    fixed = [None] * N
    undone = set(range(N))

    while undone:
        start = undone.pop()
        undone.add(start)
        queue = deque()
        queue.append(start)

        while queue:
            x = queue.popleft()
            if x not in undone:
                continue
            undone.remove(x)
            if x not in connections:
                continue

            for y in connections[x]:
                if y in undone:
                    queue.append(y)
                if (x, y) in edges:
                    if fixed[x] is None:
                        if fixed[y] is None:
                            fixed[x] = 0
                            fixed[y] = edges[x, y]
                        else:
                            fixed[x] = fixed[y] - edges[x, y]
                    else:
                        if fixed[y] is None:
                            fixed[y] = fixed[x] + edges[x, y]
                        else:
                            if fixed[x] + edges[x, y] != fixed[y]:
                                return False
                elif (y, x) in edges:
                    if fixed[y] is None:
                        if fixed[x] is None:
                            fixed[y] = 0
                            fixed[x] = edges[y, x]
                        else:
                            fixed[y] = fixed[x] - edges[y, x]
                    else:
                        if fixed[x] is None:
                            fixed[x] = fixed[y] + edges[y, x]
                        else:
                            if fixed[y] + edges[y, x] != fixed[x]:
                                return False

    xmin = xmax = None
    for i in range(N):
        if fixed[i] is None:
            continue
        if xmin is None:
            xmin = xmax = fixed[i]
        else:
            xmin = min(xmin, fixed[i])
            xmax = max(xmax, fixed[i])
    if xmax is not None and xmin is not None:
        if 10 ** 9 < xmax - xmin:
            return False
    return True


print('Yes' if solve() else 'No')

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

int main() {
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  int X=(C+B-1)/B;
  int Y=(A+D-1)/D;
  if(X>Y){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
  int n,d;
  cin >> n >> d;
  vvi x(n,(vector<int>(d)));
  rep(i,n){
    rep(j,d){
      cin >> x.at(i).at(j);
    }
  }
  int ans=0;
  rep(i,n){
    rep(j,n){
      if(i ==  j) continue;
      int sum=0;
      rep(k,d){
        sum += pow(x.at(i).at(k)-x.at(j).at(k),2);
      }
      int sum2 = sqrt(sum);
      if(pow(sum2,2) == sum) ans++;
    }
  }
  cout << ans/2 << endl;
}

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

int main(){
    int n;
    double ans,g;
    cin>>n;
    rep(i,n){
        cin>>g;
        ans+=1/g;
        }
    cout<<setprecision(16)<<1/ans<<endl;
    }


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

int main() {
  int X, A, B;
  cin >> X >> A >> B;

  if (B - A <= 0) {
    cout << "delicious" << endl;
  } else if (B - A <= X) {
    cout << "safe" << endl;
  } else {
    cout << "dangerous" << endl;
  }
}


Measured memory_bytes: 3596
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);
	static int count = 0;

	public static void main(String[] args){

		for(;;){
			count = 0;
			int n = scan.nextInt();
			int s = scan.nextInt();
			if(n == 0 && s == 0)break;
			solve(0, n, s);
			System.out.printf("%d\n", count);
		}
	}
	
	// p: ?????\????????°???
	// n: ?????\????????°????????°
	// s: ????¨????????¨????
	private static void solve(int p, int n, int s){
		if(p > 9 || n == 0 || p > s){
			return;
		}
		if(n == 1 && p == s){
			count++;
		}
		solve(p+1, n-1, s-p);
		solve(p+1, n, s);
	}
}

Measured memory_bytes: 26264
N,*xys=$<.read.split.map(&:to_i)
xys=xys.each_slice(2).to_a.sort

if N == 1
    puts 1
    exit
end

h = Hash.new(0)
xys.combination(2) do |(x1,y1),(x2,y2)|
    h[[x1-x2,y1-y2]] += 1
end

puts N-(h.values.max)

Measured memory_bytes: 14260
import fractions
num = [int(i) for i in input().split()]
lower_limit = num[0]
upper_limit = num[1]
c = num[2]
d = num[3]

def count_multi(x):
  count = upper_limit//x- (lower_limit-1)//x                          
  return count

cd_gcd = fractions.gcd(c, d)

multi_c_d = count_multi(c) + count_multi(d) - count_multi(c*d//cd_gcd)
print(upper_limit - lower_limit + 1 - multi_c_d)

Measured memory_bytes: 5048
n = int(input())
a = list(map(int, input().split()))

fromLeft = [-1]*n

for i in range(n):
    fromLeft[i] = a[i] - i

ans = 0

ldList = [0]*(n*2+5)

for i in reversed(range(n)):
    if 0 <= fromLeft[i]+n+1 and fromLeft[i]+n+1 < n*2+5:
        ldList[fromLeft[i]+n+1] += 1
    if 0 <= -1*a[i]-i+n+1 and -1*a[i]-i+n+1 < n*2+5:
        ans += ldList[-1*a[i]-i+n+1]

print(ans)

Measured memory_bytes: 32244
#include<iostream>
#include<cmath>

using namespace std;

long long func(long long num){
    long long cnt = 0;

    while(num > 0){
        num /= 10;
        cnt++;
    }

    return cnt;

}
int main(){
    long long n;
    long long ans = 1;
    cin >> n;
    for(long long i = 1;i <= sqrt(n); i++){
        if(n%i == 0) ans = n/i;
    }

    if(ans == 1)cout << func(n) <<endl;
    else cout << func(ans) <<endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {

	int N, T, A;
	cin >> N;
	cin >> T >> A;
	vector<pair<int,int>> H(N);
	for (int i = 0; i < N; i++) {
		cin >> H[i].first;
		H[i].second = i;
		int a = T * 1000 - H[i].first * 6;
		H[i].first = abs(a - A * 1000);
	}
	sort(H.begin(), H.end());
	cout << H[0].second + 1 << endl;

	return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  while(true){
    int n,m;
    cin>>n>>m;
    if(n==0&&m==0)return 0;
    vector<int>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    vector<int>b;
    b.push_back(-1);
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
        if(a[i]+a[j]<=m)b.push_back(a[i]+a[j]);
      }
    }
    sort(rng(b));
    reverse(rng(b));
    if(b[0]==-1)cout<<"NONE"<<endl;
    else cout<<b[0]<<endl;
  }
  return 0;
}



Measured memory_bytes: 6820
N, D = list(map(int, input().split()))
X = []
Y = []
for i in range(N):
    xy = list(map(int, input().split()))
    X.append(xy[0])
    Y.append(xy[1])

ans = 0
for i in range(N):
    if X[i] ** 2 + Y[i] ** 2 <= D ** 2:
        ans += 1
print(ans)


Measured memory_bytes: 96680
#include <stdio.h>
int main(void){
    int a,b;
    char op;
    char i = 0;
    while(1){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+'){
            printf("%d\n",a+b);
        }
        else if(op=='-'){
            printf("%d\n",a-b);
        }
        else if(op=='*'){
            printf("%d\n",a*b);
        }
        else if(op=='/'){
            printf("%d\n",a/b);
        }
        else{
            break;
        }
    }












    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 200010;  // デフォルトでnの最大値は300000
const ll MAX_M = 40001;  // デフォルトでnは1000以下

// aのn乗を求める。計算量はO(logn)
ll modpow(ll a, ll n) {
    if(n == 0) {
        return 1;
    }
    if(n%2 == 1) {
        return (a * modpow(a, n-1))%mod;
    }
    return (modpow(a, n/2) * modpow(a, n/2))%mod;
}

ll inv(ll a) {
    return modpow(a, mod-2);
}

ll fact[MAX_N];
ll invfact[MAX_N];

// main関数でinit()を呼び出してからComb()を使用する
void init() {
    fact[0] = 1;
    invfact[0] = 1;
    for(ll i = 1; i < MAX_N; i++) {
        fact[i] = (i*fact[i-1])%mod;
        invfact[i] = inv(fact[i]);
    }
}
 
ll Comb(ll n, ll r) {
    if(r < 0 || n < 0 || n < r) {
        return 0;
    }
    ll res = fact[n];
    res = (res * invfact[r])%mod;
    res = (res * invfact[n-r])%mod;
    return res;
}

vl Prime(MAX_M, 1);  // Prime[i] : iが素数のとき1、iが素数でないとき0

void Eratosthenes(ll n) {  // n未満の素数を求める
    Prime[0] = Prime[1] = 0;
    for(ll i = 2; i*i < n; i++) {
        if(Prime[i]) {
            for(ll j = 2; i*j < n; j++) {
                Prime[i*j] = 0;
            }
        }
    }
}

//--- main関数でinit()を呼び出すのを忘れるな ---//
int main() {
    ll n, m;
    cin >> n >> m;

    init();
    Eratosthenes(MAX_M);

    vl e(MAX_M);  // e[i] : mの素因数iの指数(iが素数でないときは0)
    ll u = m;
    for(ll i = 2; i*i <= m; i++) {
        if(Prime[i]) {
            while(u%i == 0) {
                u /= i;
                e[i]++;
            }
        }
    }
    if(u != 1) {
        if(u < MAX_M) {
            e[u]++;
        }
        else {
            e[MAX_M-1]++;
        }
    }

    ll ans = 1;
    rep(i, MAX_M) {
        if(e[i] == 0) {
            continue;
        }
        ans *= Comb(n-1+e[i], n-1);
        ans %= mod;
    }

    out(ans);
    re0;
}

Measured memory_bytes: 4096
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
n,k = map(int,input().split())
lis = list(map(int,input().split()))
lis.sort()
ans = 0
for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
for i in range(n):
    if i >= k-1:
        ans += lis[i] * cmb(i,k-1,mod)
    if n-i-1 >= k-1:
        ans -= lis[i] * cmb(n-i-1,k-1,mod)
    ans %= 10 ** 9+7
print(ans)

Measured memory_bytes: 20304
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int count = 700;
		for(int i=0; i<3; i++) {
			char S1 = S.charAt(i);
			if(S1== 'o') {
				count = count + 100;
			}
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 26748
h, w = map(int,input().split(' '))

ws = -1
wss = -1

if h == 1 or w == 1:
    print(1)
    exit(0)

if (w % 2) == 0:
    ws = w//2
else:
    ws = (w + 1)//2

wss = w//2

hs = -1
hss = -1

if (h % 2) == 0:
    hs = h//2
else:
    hs = (h+1)//2

hss = h//2


# print(ws, wss, hs, hss)
print(ws*hs + wss*hss)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

string s[50];
int dx[] = {0,0, 1, -1};
int dy[] = {1, -1, 0, 0};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < h; ++i)
        cin >> s[i];
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            if (s[i][j] == '.') continue;
            bool can = false;
            for (int k = 0; k < 4; ++k)
            {
                int ii = i + dx[k];
                int jj = j + dy[k];
                if (ii < 0 || jj < 0 || ii == h || jj == w) continue;
                if (s[ii][jj] == '#')
                    can = true;
            }
            if (!can)
                return cout << "No\n", 0;
        }
    }
    cout << "Yes\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fo(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define umap unordered_map
#define minHeap(t) priority_queue<t, vector<t>, greater<t>>
#define maxHeap(t) priority_queue<t>

int32_t main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    //cin>>t;
    while(t--){
        int a,b,c,d,e;
        cin>>a>>b>>c>>d>>e;
        if(a==0){
            cout<<1<<endl;
        }
        else if(b==0){
            cout<<2<<endl;
        }
        else if (c == 0)
        {
            cout << 3 << endl;
        }
        else if (d == 0)
        {
            cout << 4 << endl;
        }
        else if (e == 0)
        {
            cout << 5 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3564
// 

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = (1 << 29);
const long long INFL = 1LL<<60;

void dump(const vector<pair<int, int>>& a)
{
  for (auto v : a) {
    cerr << v.first << " " << v.second << endl;
  }
}

void dump(const vector<int>& a)
{
  for (auto v : a) {
    cerr << v << " ";
  }
  cerr << endl;
}

////////////////////////////////////////////////////

int main()
{
  ll n, k, q;
  cin >> n >> k >> q;

  ll m = q - k + 1;  // 必要な正解数

  vector<ll> ans(n+1, 0);
  rep(i, q) {
    int a;
    cin >> a;
    ans[a]++;
  }

  for (int i = 1; i <=n; i++) {
    if (ans[i] >= m) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=998244353;
struct UnionFind{
    vector<int> par,sizes;
    UnionFind(int n):par(n+1),sizes(n+1,1){
        rep2(i,1,n)par[i]=i;
    }
    int find(int x){
        return (x==par[x]?x:par[x]=find(par[x]));
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return ;
        if(sizes[x]<sizes[y]){
            swap(x,y);
        }
        par[y]=x;
        sizes[x]+=sizes[y];
    }
    bool same(int x,int y) {return (find(x)==find(y));}
    int size(int x) {return sizes[find(x)];}
};
int solve_min(vector<pii> G,int n){
    UnionFind uf(n);
    for(auto e:G){
        uf.unite(e.first,e.second);
    }
    int cnt=0;
    rep2(i,1,n){
        if(uf.par[i]==i)cnt++;
    }
    return cnt-1;
}

main(){
    int n;
    vec v;
    cin>>n;
    int t=in();
    rep(i,n-1){
        v.pb(in());
    }
    sort(all(v));
    if(t){
        cout<<0;return 0;
    }
    ll ans=1;
    vec cnt(n+1);
    cnt[0]=1;
    rep(i,n-1){
        if(v[i]==0){
            cout<<0;return 0;
        }
        ans=ans*cnt[v[i]-1]%MOD;
        cnt[v[i]]++;
    }
    cout<<ans;
}


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

int main(){
  int n, m;
  while(std::cin >> n >> m){
    if(n == 0 and m == 0)break;
    //std::cout << n << m << std::endl;
    vector<int> grid(n);
    for (int i = 0; i < n; i++) {
      std::cin >> grid[i];
    }
    int p = 0;
    vector<int> add(m);
    for (int i = 0; i < m; i++) {
      std::cin >> add[i];
    }
    for (int i = 0; i < m; i++) {
      p = max(p + add[i], 0);
      if(p >= n - 1){
        std::cout << i + 1 << std::endl;
        break;
      }
      p = max(p + grid[p], 0);
      if(p >= n - 1){
        std::cout << i + 1 << std::endl;
        break;
      }
      //std::cout << "i:" << i << " p:" << p << std::endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vc= vector<char>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()

int main(){
  int x,a;
  cin >> x >> a;

  if(x<a) cout << 0 << endl;
  else  cout << 10 << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
#include <vector>
using namespace std;
int main(void){
	int n,i,j,k,c3,c4,f=0,t,ans=0;
	char c1[26],c2[26];
	string s;
	cin>>n>>s;
	for(i=1;i<n;i++){
		c3=0;
		t=0;
		for(j=0;j<i;j++){
			f=1;
			for(k=0;k<c3;k++){
				if(s[j]==c1[k])f=0;
			}
			if(f){
				c1[c3]=s[j];
				c3++;
			}
		}
		c4=0;
		for(j=i;j<n;j++){
			f=1;
			for(k=0;k<c4;k++){
				if(s[j]==c2[k])f=0;
			}
			if(f){
				c2[c4]=s[j];
				c4++;
			}
		}
		for(j=0;j<c3;j++){
			for(k=0;k<c4;k++){
				if(c1[j]==c2[k])t++;
			}
		}
		ans=max(ans,t);
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

int main() {
	
	int N, a[100010], b[100010] = {0}, memo = 0;

	cin >> N;
	for (int i = 1;i<=N; ++i) {
		cin >> a[i];
		++b[a[i]-1];
		++b[a[i]];
		++b[a[i] +1];
	}

	for(int j=0;j<=100000;++j) {
		if (memo < b[j]) memo = b[j];
	}

	cout << memo << endl;

	return 0;
}


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

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

	int n, k;
	cin >> n >> k;
	vector<int> a(n+1);
	for(int i=1; i<=n; i++)
		cin >> a[i];

	bool dpX[k+1] = {false}, dpY[k+1] = {false};
	dpX[0] = false; dpY[0] = false;

	for(int i=1; i<=k; i++){
		for(int j=1; j<=n; j++)
			if(a[j]<=i){
				dpX[i] = dpX[i] or !dpY[i-a[j]];
				dpY[i] = dpY[i] or !dpX[i-a[j]];
			}
	}

	if(dpX[k])
		cout << "First" << endl;
	else
		cout << "Second" << endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    ll h;
    cin >> h;

    int pow = 0;
    ll ans = exp2(pow);
    while (h > 1)
    {
        h /= 2;
        pow++;
        ans += exp2(pow);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;

    for (int i = 1; i < n; ++i) {
        for (int j = i+1; j <= n; ++j) {
            int k = i ^ j;
            for (int x = 0; ; ++x) {
                if (k >> x & 1) {
                    cout << x+1 << " ";
                    break;
                }
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 3588
/* HARE KRSNA HARE KRSNA KRSNA KRSNA HARE HARE
    HARE RAMA HARE RAMA RAMA RAMA HARE HARE  */

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

#define nl "\n"
#define ff first
#define ss second
#define pp pop_back
#define pf pop_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define all(x) x.begin(),x.end()
#define test ll t; cin>>t; while(t--)
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define rloop(i,s,n) for(ll i=s;i>=n;i--)
#define fill(a,value) memset(a,value,sizeof(a))

#define debug2(a)  for(auto x : a)  cout<<x<<" ";  cout<<nl;
#define debug4(a)  for(auto x : a)  cout<<x.ff<<" "<<x.ss<<nl;
#define debug1(a,n) loop(i,0,n)  cout<<a[i]<<" ";  cout<<nl;
#define debug3(a,n,m)  loop(i,0,n){ loop(j,0,m)	cout<<a[i][j]<<" ";	cout<<nl; }

typedef long long ll;
typedef long double ld;

typedef stack<ll> sll;
typedef queue<ll> qll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef pair<ll, pll> ppll;
typedef vector<vector<ll>> vvll;
typedef priority_queue<ll> pqll;

const ll mod = 1000000007;	//998244353;
const ld pi =  acos((ld) - 1);	//3.1415926535;

ll num_generator()		{   return rand() % 1000;	}
void array_generator(ll a[], ll n)		{   loop(i, 0, n)	a[i] = rand() % 100;	}

void solve()
{
	ll n;	cin >> n;
	cout << n + n*n + n*n*n;
}

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

	// test
	solve();
	return 0;
}

Measured memory_bytes: 3696
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
// #define mp make_pair
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'
#define int ll
vector<ll> ft(1, 1LL);

/*======================================================================*/
vector<int> graph[100005];
int arr[100005];
void solve(){
    int n, m;
    cin >> n;
    for(int i = 0 ;; i++){
        for(int b = 0; b < 3982; b++)
        if( i*i*i*i*i == n - b*b*b*b*b){
            cout << i << " " << -b;
            return;
        }
        else if( i*i*i*i*i == n + b*b*b*b*b){
            cout << i << " " << b;
            return;
        }
    }
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 5988
#include<iostream>
#include<string.h>
using namespace std;

int main() {
	string a;
	cin >> a;

	bool flag = true;
	for (int i = 0; i < a.size(); i++) {

		if (i % 2 == 0 && (a[i] == 'R' || a[i] == 'U' || a[i] == 'D')) {
			continue;
		}
		else if (i % 2 == 1 && (a[i] == 'L' || a[i] == 'U' || a[i] == 'D')) {
			continue;
		}

		else {

			flag = false;
			break;
		}
	}
	if (flag) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    double t=0,c=0;
    cin>>n;
    double a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        t+=a[i];
    }
    t/=n;
    t=round(t);
    for(int i=0;i<n;i++)
    {
        c+=pow(a[i]-t,2);
    }
    cout<<(int)c;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int G[3][3];
int A[3];
int B[3];
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
int main() {
    FOR(i, 0, 3)
    FOR(j, 0, 3)
        std::cin >> G[i][j];

    A[0] = 0;
    FOR(j, 0, 3) {
        B[j] = G[0][j] - A[0];
    }
    FOR(i, 1, 3) {
        A[i] = G[i][0] - B[0];
    }

    FOR(i,0,3) FOR(j,0,3) {
       if (G[i][j] != (A[i] + B[j])) {
            std::cout << "No" << std::endl;
            return 0;
       }
    }
    std::cout << "Yes" << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
using namespace std;


int main(){
  int A, B; cin >> A >> B;
  if(A%3==0||B%3==0||(A+B)%3==0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

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

    int mx = (n - 1) * (n - 2) / 2;
    if (mx < k)
    {
        cout << -1 << endl;
    }
    else
    {
        vector<int> from;
        vector<int> to;
        for (int i = 2; i <= n; i++)
        {
            from.push_back(1);
            to.push_back(i);
        }

        bool flg = false;
        for (int i = 2; i <= n; i++)
        {
            if (flg)
            {
                break;
            }
            for (int j = i + 1; j <= n; j++)
            {
                if (mx == k)
                {
                    flg = true;
                    break;
                }
                mx--;
                from.push_back(i);
                to.push_back(j);
            }
        }

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

    return 0;
}

Measured memory_bytes: 384
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


class UnionFind:
    def __init__(self, N):
        self.N = N  # ノード数
        # 親ノードをしめす。負は自身が親ということ。
        self.parent = [-1] * N  # idxが各ノードに対応。

    def root(self, A):
        # print(A)
        # ノード番号を受け取って一番上の親ノードの番号を帰す
        if (self.parent[A] < 0):
            return A
        self.parent[A] = self.root(self.parent[A])  # 経由したノードすべての親を上書き
        return self.parent[A]

    def size(self, A):
        # ノード番号を受け取って、そのノードが含まれている集合のサイズを返す。
        return -self.parent[self.root(A)]

    def unite(self, A, B):
        # ノード番号を2つ受け取って、そのノード同士をつなげる処理を行う。
        # 引数のノードを直接つなぐ代わりに、親同士を連結する処理にする。
        A = self.root(A)
        B = self.root(B)

        # すでにくっついている場合
        if (A == B):
            return False

        # 大きい方に小さい方をくっつけたほうが処理が軽いので大小比較
        if (self.size(A) < self.size(B)):
            A, B = B, A

        # くっつける
        self.parent[A] += self.parent[B]  # sizeの更新
        self.parent[B] = A  # self.rootが呼び出されればBにくっついてるノードもすべて親がAだと上書きされる

        return True

    def is_in_same(self, A, B):
        return self.root(A) == self.root(B)


# aとbの友人候補
# aとbはブロックされてないけど友達でもない
# かつ直接友人じゃないけど友人同士でつながっているのは友人候補である。


# まず友達関係のdisjoint setを求めておく
# あるdisjoint setにおいて、全員が友達候補であると仮定しておく。すでに友達である人数を引く。さらにブロック関係の人数も引く。()

from collections import defaultdict
N, M, K = read_ints()
uf = UnionFind(N)
direct_friends = defaultdict(lambda: 0)
for m in range(M):
    a, b = read_ints()
    direct_friends[a - 1] += 1
    direct_friends[b - 1] += 1
    uf.unite(a - 1, b - 1)

# まって、ブロックだけど、同じunionにあるブロック数だけカウントしたい
block = defaultdict(lambda: 0)
for m in range(K):
    a, b = read_ints()
    if uf.is_in_same(a - 1, b - 1):
        block[a - 1] += 1
        block[b - 1] += 1


ans = []
for i in range(N):
    katei = uf.size(i) - 1
    katei -= direct_friends[i]
    katei -= block[i]
    ans.append(katei)
print(*ans)


Measured memory_bytes: 121108
import sys
import os
import math
import string
import collections

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def f(N):
    return sum(map(int, str(N)))


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, A, B = il()
    ret = 0
    for n in range(N + 1):
        q = f(n)
        if A <= q <= B: ret += n
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3832
using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;

    class Program
    {
        static void Main()
        {
            string k = Console.ReadLine();
            string s = Console.ReadLine();
            var k_int = int.Parse(k);
            var s_len = s.Length;
            var ans = string.Empty;
            if (s_len > k_int)
            {
                ans = Left(s, k_int) + "...";
            }
            else
            {
                ans = s;
            }
            Console.WriteLine(ans.ToString());
        }

        /// <summary>
        /// 文字列の末尾から指定した長さの文字列を取得する
        /// </summary>
        /// <param name="str">文字列</param>
        /// <param name="len">長さ</param>
        /// <returns>取得した文字列</returns>
        public static string Right(string str, int len)
        {
            if (len < 0)
            {
                throw new ArgumentException("引数'len'は0以上でなければなりません。");
            }
            if (str == null)
            {
                return "";
            }
            if (str.Length <= len)
            {
                return str;
            }
            return str.Substring(str.Length - len, len);
        }

        /// <summary>
        /// 文字列の先頭から指定した長さの文字列を取得する
        /// </summary>
        /// <param name="str">文字列</param>
        /// <param name="len">長さ</param>
        /// <returns>取得した文字列</returns>
        public static string Left(string str, int len)
        {
            if (len < 0)
            {
                throw new ArgumentException("引数'len'は0以上でなければなりません。");
            }
            if (str == null)
            {
                return "";
            }
            if (str.Length <= len)
            {
                return str;
            }
            return str.Substring(0, len);
        }
        /// <summary>
        /// 文字列の指定した位置から指定した長さを取得する
        /// </summary>
        /// <param name="str">文字列</param>
        /// <param name="start">開始位置</param>
        /// <param name="len">長さ</param>
        /// <returns>取得した文字列</returns>
        public static string Mid(string str, int start, int len)
        {
            if (start <= 0)
            {
                throw new ArgumentException("引数'start'は1以上でなければなりません。");
            }
            if (len < 0)
            {
                throw new ArgumentException("引数'len'は0以上でなければなりません。");
            }
            if (str == null || str.Length < start)
            {
                return "";
            }
            if (str.Length < (start + len))
            {
                return str.Substring(start - 1);
            }
            return str.Substring(start - 1, len);
        }
    }

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(x) x.begin(), x.end()

template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 & y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 & y) {if (x < y) x = y;}

int n;

void read() {
	cin >> n;	
}

set<string> have;
vector<string> ans;

void gen(string now, int cnt) {
	if (have.count(now)) return;
	have.insert(now);
	if (now.size() == n) {
		ans.push_back(now);
		return;
	}
	for (int i = 0; i < cnt; i++) {
		now += 'a' + i;
		gen(now, cnt);
		now.pop_back();
	}
	now += 'a' + cnt;
	gen(now, cnt + 1);
}

void run() {
	gen({}, 0);
}

void write() {
	sort(all(ans));
	for (auto i : ans ){
		cout << i << "\n";
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}

Measured memory_bytes: 17524
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <typeinfo>
#include <cmath>
#include <numeric>
#include <queue>
#include <set>
using namespace std;

int main(){
    int N;
    std::cin >> N;
    std::vector<int> D(N);
    for (int i = 0; i < N; ++i)
    {
        std::cin >> D[i];
    }
    sort(D.begin(), D.end());
    std::cout <<D[N/2] - D[N/2 - 1]<< "\n";
}

Measured memory_bytes: 640