akhauriyash/Code-Regression huggingface dataset:
class Segtree:
    def __init__(self, A, intv, initialize = True, segf = max):
        self.N = len(A)
        self.N0 = 2**(self.N-1).bit_length()
        self.intv = intv
        self.segf = segf
        if initialize:
            self.data = [intv]*self.N0 + A + [intv]*(self.N0 - self.N)
            for i in range(self.N0-1, 0, -1):
                self.data[i] = self.segf(self.data[2*i], self.data[2*i]) 
        else:
            self.data = [intv]*(2*self.N0)
        
    def update(self, k, x):
        k += self.N0
        self.data[k] = x
        while k > 0 :
            k = k >> 1
            self.data[k] = self.segf(self.data[2*k], self.data[2*k+1])
    
    def query(self, l, r):
        L, R = l+self.N0, r+self.N0
        s = self.intv
        while L < R:
            if R & 1:
                R -= 1
                s = self.segf(s, self.data[R])
            if L & 1:
                s = self.segf(s, self.data[L])
                L += 1
            L >>= 1
            R >>= 1
        return s

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

dp = Segtree([0]*(max(H)+1), 0, False)

for h, a in zip(H, A):
    dp.update(h, a+dp.query(0, h))
print(dp.data[1])


Measured memory_bytes: 121296
//
//  main.cpp
//  ICPC2005B
//
//  Created by aki33524 on 2014/07/03.
//  Copyright (c) 2014年 aki33524. All rights reserved.
//

#include <iostream>
#include <vector>
#include <complex>
using namespace std;

typedef pair<int, int> PII;
typedef complex<int> CI;

int N;
vector<CI> PolyLines[51];

bool check(vector<CI> poly0, vector<CI> polyn){
    int m = poly0.size();
    if(polyn.size() != m)
        return false;
        
    bool ok = true;
    for(int i=0; i<m-1; i++){
        if(abs(poly0[i+1]-poly0[i]) != abs(polyn[i+1]-polyn[i])){
            ok = false;
            break;
        }
    }
    if(ok){
        for(int i=1; i<m-1; i++){
            CI v01 = poly0[i] - poly0[i-1];
            CI v02 = poly0[i+1] - poly0[i];
            CI vn1 = polyn[i] - polyn[i-1];
            CI vn2 = polyn[i+1] - polyn[i];
            
            int ccw0 = v01.real()*v02.imag() - v02.real()*v01.imag();
            int ccwn = vn1.real()*vn2.imag() - vn2.real()*vn1.imag();
            
            if(ccw0 != ccwn){
                ok = false;
                break;
            }
        }
    }
    if(ok) return true;
    
    ok = true;
    for(int i=0; i<m-1; i++){
        if(abs(poly0[m-1-(i+1)]-poly0[m-1-(i)]) != abs(polyn[i+1]-polyn[i])){
            ok = false;
            break;
        }
    }
    if(ok){
        for(int i=1; i<m-1; i++){
            CI v01 = poly0[m-1-i] - poly0[m-1-(i-1)];
            CI v02 = poly0[m-1-(i+1)] - poly0[m-1-(i)];
            CI vn1 = polyn[i] - polyn[i-1];
            CI vn2 = polyn[i+1] - polyn[i];
            
            int ccw0 = v01.real()*v02.imag() - v02.real()*v01.imag();
            int ccwn = vn1.real()*vn2.imag() - vn2.real()*vn1.imag();
            
            if(ccw0 != ccwn){
                ok = false;
                break;
            }
        }
    }
    return ok;
}


void solve()
{
    vector<CI> poly0 = PolyLines[0];
    
    for(int n=1; n<=N; n++){
        vector<CI> polyn = PolyLines[n];
        if(check(poly0, polyn))
            cout << n << endl;
    }
    cout << "+++++" << endl;
}

int main(int argc, const char * argv[])
{
    while(cin >> N, N){
        
        for(int n=0; n<=N; n++){
            int M;
            cin >> M;
            PolyLines[n].clear();
            int x, y;
            for(int m=0; m<M; m++){
                cin >> x >> y;
                CI c(x, y);
                PolyLines[n].push_back(c);
            }
        }
        solve();
    }
    
    return 0;
}

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

using ll = int64_t;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  ll a, aa, b, bb, k; std::cin >> a >> b >> k;
  aa = a, bb = b;
  aa = max(a - k, (ll)0);
  if (aa == 0)
    bb = max(b - (k - a), (ll)0);
  std::cout << aa << " " << bb << "\n";
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const ll MOD = 998244353;
const int MAX_N = 3000;
int n, s;
ll a[MAX_N];

int main() {
    fastio();

    cin >> n >> s;

    ll ans = 0;
    vl cnt(3000 + 1);
    cnt[0] = 1;
    forn(i, n) {
        cin >> a[i];

        vl temp(3000 + 1);
        for (int j = 0; j <= 3000; j++) {
            if (a[i] + j <= 3000) {
                temp[a[i] + j] = (temp[a[i] + j] + cnt[j]) % MOD;
            }
        }

        for (int j = 0; j <= 3000; j++) {
            cnt[j] = (cnt[j] + temp[j]) % MOD;
        }

        ans = (ans + cnt[s]) % MOD;

        cnt[0]++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main() {
	map<int, int> m, mm;
	for (string s; getline(cin, s), s.size() != 0; ) {
		istringstream is(s);
		char c;
		int a, b;
		is >> a >> c >> b;
		m[a]++;
	}
	for (string s; getline(cin, s); ) {
		istringstream is(s);
		char c;
		int a, b;
		is >> a >> c >> b;
		if (m[a] > 0) mm[a]++;
	}
	tr(i, mm) cout << i -> fst << ' ' << m[i -> fst] + i -> snd << endl;
	return 0;
}

Measured memory_bytes: 0
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int[] num1 = new int[6];
		int[] num2 = new int[6];

		for (int i=0; i<6; i++) {
			num1[i] = stdIn.nextInt();
		}
		for (int i=0; i<6; i++) {
			num2[i] = stdIn.nextInt();
		}

		int[] num1Copy = num1.clone();
		int[] num2Copy = num2.clone();
		Arrays.sort(num1Copy);
		Arrays.sort(num2Copy);
		for (int i=0; i<6; i++) {
			if(num1Copy[i] != num1Copy[i]){
				System.out.println("No");
				return;
			}
		}

		Dice dice1 = new Dice(num1);
		Dice dice2 = new Dice(num2);
		if(dice1.solve(num2[0],num2[1])){
			if(dice1.compareTo(dice2))
				System.out.println("Yes");
			else
				System.out.println("No");
		}else{
			System.out.println("No");
		}
	}

	static class Dice {

		int top;
		int front;
		int right;
		int left;
		int back;
		int bottom;

		Dice(int[] num){
			top = num[0];
			front = num[1];
			right = num[2];
			left = num[3];
			back = num[4];
			bottom = num[5];
		}

		void change(char dir) {
			int temp = 0;
			switch(dir){
				case 'N': moveN(); break;
				case 'S': moveS(); break;
				case 'E': moveE(); break;
				case 'W': moveW(); break;
			}
		}

		void moveN(){
			int temp = top;
			top = front;
			front = bottom;
			bottom = back;
			back = temp;
		}

		void moveS(){
			int temp = top;
			top = back;
			back = bottom;
			bottom = front;
			front = temp;
		}

		void moveE(){
			int temp = top;
			top = left;
			left = bottom;
			bottom = right;
			right = temp;
		}

		void moveW(){
			int temp = top;
			top = right;
			right = bottom;
			bottom = left;
			left = temp;
		}

		int isTop(){
			return top;
		}

		int isRight(){
			return right;
		}

		void turn(){
			int temp = front;
			front = right;
			right = back;
			back = left;
			left = temp;
		}

		boolean solve(int top,int front){
			boolean flag = false;
			for (int i=0; i<4; i++) {
				moveN();
				if(this.top == top){
					flag = true;
					break;
				}
			}
			if(!flag){
				while(this.top != top){
					moveE();
				}
			}

			flag = false;

			for (int i=0; i<4; i++) {
				turn();
				if(this.front == front){
					flag = true;
					break;
				}
			}
			return flag;
		}

		boolean compareTo(Dice x){
			if(x.top == this.top
				&& x.front == this.front
				&& x.right == this.right
				&& x.left == this.left
				&& x.back == this.back
				&& x.bottom == this.bottom)
				return true;
			else
				return false;
		}

		void show(){
			System.out.println("top "+this.top);
			System.out.println("front "+this.front);
			System.out.println("right "+this.right);
			System.out.println("left "+this.left);
			System.out.println("back "+this.back);
			System.out.println("bottom "+this.bottom);
		}
	}
}

Measured memory_bytes: 17364
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

ll dp[100010][5];
const ll MOD = 1000000007;

void add(ll &a, ll b){
    a+=b;
    if(a>=MOD)a-=MOD;
}

int main(){
    string S; cin >> S;
    rep(i,100010)rep(j,5)dp[i][j]=0;
    dp[0][0]=1;
    int n = S.size();
    rep(i,n){
        //共通部分列を進めない
        rep(j,4){
            if(S[i]=='?')add(dp[i+1][j],dp[i][j]*3%MOD);
            else add(dp[i+1][j],dp[i][j]);
        }
        //共通部分列を進める
        if(S[i]=='A'||S[i]=='?')add(dp[i+1][1],dp[i][0]);
        if(S[i]=='B'||S[i]=='?')add(dp[i+1][2],dp[i][1]);
        if(S[i]=='C'||S[i]=='?')add(dp[i+1][3],dp[i][2]);
    }

    cout << dp[n][3] << endl;

    return 0;
}

Measured memory_bytes: 4352
#include <stdio.h>

#define N 100
#define WHITE 0
#define BLACK 1
#define NIL -1

int prim();

int A[N][N];
int num;
int color[N];

int main(){
  int i, j;

  scanf("%d", &num);

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

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

  return 0;
}

int prim(){
  int i,j,u,v,min,res = 0;

  for(i=0; i<num; i++)
    color[i] = WHITE;

  color[0] = BLACK;

  while(1){
    min = 2100000000;

    for(i=0; i<num; i++){
      if(color[i] == WHITE){
	continue;
      }
      
      for(j=0; j<num; j++)
	if(A[i][j] != NIL)
	  if(color[j] != BLACK && A[i][j] < min){
	    min = A[i][j];
	    u = i;
	    v = j;
	  } 
    }

    if(min == 2100000000) break;
    
    color[v] = BLACK;
    res += A[u][v];
  }

  return res;
}



Measured memory_bytes: 2112
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
using namespace std;

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

int main() {
    int N,K;
    cin >> N >> K;
    vector<pair<short,short>> P(N);
    int i,j;
    for(i=0;i<N;i++)cin >> P[i].first >> P[i].second;
    sort(P.begin(),P.end());
    bool f = true;
    for(i=0;i<N-1;i++) {
        vector<double> list(1,100000);
        for(j=i+1;j<N;j++)list.push_back(P[i].first==P[j].first?20000:(double)(P[i].second-P[j].second)/(P[i].first-P[j].first));
        sort(list.begin(),list.end());
        int cnt = 1;
        for(j=1;j<list.size();j++) {
            if(list[j-1]==list[j])cnt++;
            else {
                if(cnt>=K-1)f = false;
                cnt = 1;
            }
        }
    }
    cout << (f?0:1) << endl;
}


Measured memory_bytes: 3228
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 200005
#define ll long long
const ll inf=1e12;
int n;
using namespace std;
ll a[maxn];
ll sum[maxn];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    sum[0]=0;
    for(int i=1;i<=n;i++)
        sum[i]=sum[i-1]+a[i];
        ll minn=inf;
    for(int i=1;i<n;i++)
    {
        minn=min(minn,abs(sum[n]-2*sum[i]));

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


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int  num[205],m1[205],m2[205];
int n,m,k,s;

int main(){

    cin >> n >> m;

    int s=1;

    for(int i=0;i<2*n;i++)num[i]=s++;

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

        s=0;

        cin >> k;
        if(k==0){
            for(int j=0;j<n;j++)m1[j]=num[j];
            for(int j=n;j<2*n;j++)m2[j]=num[j];

            for(int j=0;j<2*n;j=j+2)num[j]=m1[s++];
            for(int j=1;j<2*n;j=j+2)num[j]=m2[s++];
        }else{
            for(int j=0;j<k;j++)m1[j]=num[j];
            for(int j=k;j<2*n;j++)m2[j]=num[j];

            for(int j=k;j<2*n;j++)num[s++]=m2[j];
            for(int j=0;j<k;j++)num[s++]=m1[j];
        }

    }

    for(int i=0;i<n*2;i++)cout << num[i] << endl;

return 0;
}

Measured memory_bytes: 1160
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
ll rui1[ohara], rui2[ohara];

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

  cin >> n >> s;
  ll tatu = 0, be1 = 0, be2 = 0, h1, h2;
  rep(i, n) {
    if (s[i] == '1') tatu++;
  }
  rui1[n - 1] = 1;
  rui2[n - 1] = 1;
  rrrep(i, n - 2, 0) {
    if (tatu != 1) rui1[i] = rui1[i + 1] * 2;
    rui2[i] = rui2[i + 1] * 2;
    if (tatu != 1) rui1[i] %= (tatu - 1);
    rui2[i] %= (tatu + 1);
  }
  rep(i, n) {
    if (s[i] == '1') {
      if (tatu != 1) be1 += rui1[i];
      if (tatu != 1) be1 %= (tatu - 1);
      be2 += rui2[i];
      be2 %= (tatu + 1);
    }
  }
  h1 = be1;
  h2 = be2;

  rep(i, n) {
    ll curr;
    be1 = h1;
    be2 = h2;
    if (s[i] == '1') {
      if (tatu == 1) {
        Cout(0);
        continue;
      }
      be1 -= rui1[i];
      if (be1 < 0) {
        be1 += (tatu - 1);
        be1 %= (tatu - 1);
      } else
        be1 %= (tatu - 1);
      curr = be1;
    } else {
      be2 += rui2[i];
      be2 %= (tatu + 1);
      curr = be2;
    }
    ans = 0;
    // debug(curr);
    while (1) {
      if (curr == 0) break;
      ans++;
      tmp = __builtin_popcount(curr);
      curr = curr % tmp;
    }
    Cout(ans + 1);
  }
  return 0;
}

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

int n;
long long dp[65536];
struct wd{
	long long w,s,v;
	bool operator < (const wd a) const{
		return w+s<a.w+a.s;
	}
}zhr[1024];

int main(){
	cin>>n;
	for(int i=0;i!=n;++i){
		cin>>zhr[i].w>>zhr[i].s>>zhr[i].v;
	}
	sort(zhr,zhr+n);
	for(int i=0;i<n;++i){
		for(int j=zhr[i].s;j>=0;--j){
			dp[j+zhr[i].w]=max(dp[j+zhr[i].w],dp[j]+zhr[i].v);
		}
	}
	long long ans=0;
	for(int i=0;i<=30000;++i) ans=max(ans,dp[i]);
	cout<<ans<<"\n";
	return 0;
} 

Measured memory_bytes: 384
a,b,c = [int(x) for x in input().split( )]
div = []
for x in range(1,c+1):
    if c % x == 0:
        div.append(x)
r = []
for x in range(a,b+1):
    r.append(x)
answer = 0
for x in div:
    for y in r:
        if x == y:
            answer += 1
print(answer)


Measured memory_bytes: 5716
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

p = 10**9 + 7
 
fac = [0] * (N + 33)
inv = [0] * (N + 33)
finv = [0] * (N + 33)

fac[0] = fac[1] = 1
inv[1] = 1
finv[0] = finv[1] = 1
 
for i in range(2, N+33):
  fac[i] = fac[i-1] * i % p
  inv[i] = p - inv[p%i] * (p // i) % p
  finv[i] = finv[i-1] * inv[i] % p

def comb(n, k):
  return fac[n] * finv[k] * finv[n-k] % p

ans = 0
ansm = 0

for i in range(K-1, N):
  ans = (ans + A[i] * comb(i, K-1)) % p

for i in range(N-K, -1, -1):
  ansm = (ansm + A[i] * comb(N-i-1, K-1)) % p

print((ans-ansm)%p)


Measured memory_bytes: 18780
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin >>a;
    if(a[2]==a[3]&&a[4]==a[5])
    {
        cout <<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;

    }
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <unordered_map>
//#include"testlib.h"
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout << (#x)<<" = "<<x<<endl
#define sz(s)    (int)(s.size())
#define PI acos(-1)
#define EPS 1e-100
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
//	file();
	fast();
	int n; cin >> n;
	cout << fixed << setprecision(15);
	cout << 2 * PI * n << endl;
	return 0;
}

Measured memory_bytes: 3768
using System;
using System.Text;
using System.Linq;

class AtCoder
{
    static void Main(){
		int n = int.Parse(Console.ReadLine());
		string[] tmp = Console.ReadLine().Split();
		double[] v = new double[n];
		int sum = 0;
		for(int cnt=0;cnt < n ;cnt++){
			v[cnt]=double.Parse(tmp[cnt]);
		}
	
	    for(int cnt=0;cnt<n-1;cnt++){
          	Array.Sort(v);
          	v[0]=(v[0]+v[1])/2;
          	v[1]=9999;
	    }
      Console.WriteLine(v[0].ToString());
    }
}

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

int main() {
  int n;
  cin >> n;
  
  if (n % 2 == 0) {
    cout << (double) 1 / (double) 2 << endl;
  }
  else {
    cout << (double) (n + 1) / (double) (2 * n) << endl;
  }
}


Measured memory_bytes: 256
/*       Rohan Balot
    NSIT, New Delhi, India  */
#include <algorithm>
#include <bitset>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <utility>
#include <unordered_set>
#include <valarray>

#include <cctype>
#include <cstdio>
#include <cmath>
#include <climits>
#include <cstring>
#include <ctime>
using namespace std;
 
#define ALL(t) (t).begin(), (t).end()
#define ALLR(t) (t).rbegin(), (t).rend()
#define MP make_pair
 
const int N = int( 1e5 ) + 1;
const int M = int( 1e6 ) + 1;
const int MOD = int( 1e9 ) + 7;
const double PI = acos(-1);
const double eps = 1e-6;

void __answer()
{
	int h, w; cin >> h >> w;
	vector< vector< char > >g(103, vector<char>(103, '#'));
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> g[i][j];
		}
	}
	for (int i = 0; i < h + 2; i++) {
		for (int j = 0; j < w + 2; j++) {
			cout << g[i][j];
		}
		cout << endl;
	}
}
int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    #ifdef LOCAL
        freopen("sample_input.txt", "r", stdin);
    #endif
    __answer();
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int n;
    scanf("%d", &n);
    vector<pair<int, int> > pts;
    for (int i = 0; i < n; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        pts.push_back(make_pair(x, y));
    }
    map<int, map<int, int> > m;
    int findMax = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            int x1 = pts[i].first;
            int y1 = pts[i].second;
            int x2 = pts[j].first;
            int y2 = pts[j].second;
            m[x2 - x1][y2 - y1]++;
            findMax = max(findMax, m[x2 - x1][y2 - y1]);
        }
    }
    int ans = n - findMax;
    printf("%d", ans);
}

Measured memory_bytes: 640
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k, n; cin >> k >> n;
    V<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int lll = a[0] + (k - a[n - 1]);
    for (int i = 1; i < n; i++) chmax(lll, a[i] - a[i - 1]);
    cout << k - lll << '\n';
    return 0;
}


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

int main(){
  int n,k;
  cin>>n>>k;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  vector<int>dp(n,0);
  dp[0]=0;
  dp[1]=abs(a[0]-a[1]);
  for(int i=2;i<n;i++){
    int mi=INT_MAX;
    for(int j = 1; j <= k && j <= i; j++)
      mi = min(mi,(dp[i-j]+abs(a[i]-a[i-j])));
    dp[i]=mi;
  }
  cout<<dp[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 1024
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
# from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
# from heapq import heappop, heappush, heappushpop
# from collections import Counter,defaultdict,deque
# from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
# from bisect import bisect_left,bisect_right
# from copy import deepcopy
from fractions import gcd
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
#mint
class ModInt:
    def __init__(self, x):
        self.x = x % mod
    
    def __str__(self):
        return str(self.x)
    
    __repr__ = __str__

    def __add__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x + other.x)
        else:
            return ModInt(self.x + other)

    __radd__ = __add__
        
    def __sub__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x - other.x)
        else:
            return ModInt(self.x - other)

    def __rsub__(self, other):
        if isinstance(other, ModInt):
            return ModInt(other.x - self.x)
        else:
            return ModInt(other - self.x)

    def __mul__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x * other.x)
        else:
            return ModInt(self.x * other)

    __rmul__ = __mul__

    def __truediv__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x * pow(other.x, mod-2,mod))
        else:
            return ModInt(self.x * pow(other, mod - 2, mod))
            
    def __rtruediv(self, other):
        if isinstance(other, self):
            return ModInt(other * pow(self.x, mod - 2, mod))
        else:
            return ModInt(other.x * pow(self.x, mod - 2, mod))
            

    def __pow__(self, other):
        if isinstance(other, ModInt):
            return ModInt(pow(self.x, other.x, mod))
        else:
            return ModInt(pow(self.x, other, mod))
            

    def __rpow__(self, other):
        if isinstance(other, ModInt):
            return ModInt(pow(other.x, self.x, mod))
        else:
            return ModInt(pow(other, self.x, mod))

def main():
    N=I()
    A=LI()
    l = 1
    for a in A:
        l *= a//gcd(l,a)
    ans = 0
    l = ModInt(l)
    for a in A:
        ans += l/a
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 68732
import itertools
def main():
    N = int(input())
    a = list(map(int, input().split()))
    AC = list(itertools.accumulate(a))
    M = sum(a)
    ans = abs(M - a[0]*2)

    for i in range(1,N-1):
        ans =  min(abs(M - AC[i]*2),ans)
    
    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;
int main()
{
    int n,x;
    cin>>n;
    vector<int> v,dp(n+1,0);
    for(int i=0;i<n;i++)
    {
        cin>>x;
        v.push_back(x);
    }
    v.insert(v.begin(),0);
    dp[1]=0;
    for(int i=2;i<=n;i++)
    {
        if(i!=2)
        dp[i]=min(dp[i-1]+abs(v[i-1]-v[i]),dp[i-2]+abs(v[i-2]-v[i]));
        else
        dp[i]=abs(v[i]-v[i-1]);
    }
    cout<<dp[n];
}

Measured memory_bytes: 4308
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int n, l;
  cin >> n >> l;
  
  int ans=0;
  for(int i=0; i<n; i++){
    ans+=l+i;
  }
  
  if(l>0){
    ans-=l;
  } else if(l+n-1<0){
    ans-=l+n-1;
  }
  
  cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll k,a,b;
    ci(k>>a>>b);
  ll ans=1;
  if(b>a&&k-a>=1&&b-a>1){
    k-=a-1;
    ans+=a-1;
    for(int i=k;i>1;i-=2){
      ans+=b-a;
    }
  if(k%2==1){
    ans++;
  }
    co(ans)
  }
  else{
    co(k+1)
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer[] monsters = new Integer[n];
        for (int i = 0; i < n; i++) {
            monsters[i] = sc.nextInt();
        }
        Arrays.sort(monsters, Collections.reverseOrder());
        long sum = 0;
        for (int i = 0; i < n; i++) {
            if (i <= k - 1) {
                monsters[i] = 0;
            }
            sum += monsters[i];
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 96260
xyxy=list(map(int,input().split()))
x1=xyxy[0]
y1=xyxy[1]
x2=xyxy[2]
y2=xyxy[3]
x3=x2-y2+y1
y3=y2+x2-x1
x4=x1-y2+y1
y4=y1+x2-x1
print("%d %d %d %d" % (x3,y3,x4,y4))


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

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
        cin >> h[i];
    vector<int> dp(n);
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for (int i = 2; i < n; i++)
    {
        dp[i] = min((dp[i - 2] + abs(h[i - 2] - h[i])), (dp[i - 1] + abs(h[i - 1] - h[i])));
    }
    cout << dp[n - 1];
    return 0;
}

Measured memory_bytes: 1024
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)	cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
#define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 1000005
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 1e8;
ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

signed main() {

	fast
	string s, t;
	cin >> s >> t;
	ll ans = 0;
	loop(i, s.length())
	{
		if (s[i] != t[i])
			++ans;
	}
	cout << ans << END;



// #ifndef ONLINE_JUDGE
// 	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
	return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    priority_queue<int> a;
    for(int i=0;i<n;i++){
        int val;
        cin >> val;
        a.push(val);
    }
    int maxa;
    for(int j=0;j<m;j++){
        maxa = a.top()/2;
        a.pop();
        a.push(maxa);
    }

    long long  ans=0;
    while (!a.empty()){
        ans+=a.top();
        a.pop();
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 892
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<queue>
#include<stack>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	string s;
	getline(cin,s);
	for(int i=0;i<s.length();i++)if(s[i]>='a'&&s[i]<='z')cout<<"x";
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

//C++17
template<typename Type>
Type GCD(Type a,Type b){ return b ? GCD(b,a%b) : a ;}
template<typename Type>
Type LCM(Type a,Type b){ return a*b / GCD(a,b) ;}

template<typename Type>//文字列の置換/Boost:replace_all()
Type replace_str(Type str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main() {
    int n;cin >> n;
    while(n--){
        int t,x,y;cin >> t >> x >> y;
        if(t < x+y || t%2 != (x+y)%2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 501;

int X[N][N];

int main() {
  int n,m,q;
  scanf("%d%d%d",&n,&m,&q);
  while(m--) {
    int x,y;
    S2(x,y);
    X[x][y]++;
  }
  rep(i,2,n+1) {
    rep(j,1,n-i+2) {
      X[j][j + i - 1] += X[j][j + i - 2] + X[j + 1][j + i - 1];
      if(i > 2) {
        X[j][j + i - 1] -= X[j + 1][j + i - 2];
      }
    }
  }
  while(q--) {
    int x,y;
    S2(x,y);
    P(X[x][y]);
  }
  return 0;
}

Measured memory_bytes: 1920
from itertools import accumulate
N = int(input())
A = list(map(int, input().split()))
S = list(accumulate(A))
MOD = 10**9 + 7
res = 0
for i in reversed(range(1,N)):
    res += S[i-1]*A[i]
    res %= MOD
print(res)

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

const int inf = 1e9;
const ll linf = 1e18;

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

    int n, k, s; cin >> n >> k >> s;
    int rest = s == (int)1e9 ? 1 : (int)1e9;
    for (int i = 0; i < n; i++) {
        cout << (i < k ? s : rest) << " \n"[i==n-1];
    }
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

vi f(vi v, int s) {
  vi d(v.size());
  d[s] = 1;
  for (int i = s + 1; i < v.size(); ++i) {
    if (v[i] && (d[i - 1] || (i > 1 && d[i - 2]))) {
      d[i] = 1;
    }
  }
  return d;
} 

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  --a; --b; --c; --d;
  string s;
  cin >> s;
  vi v(n);
  for (int i = 0; i < n; ++i) v[i] = s[i] != '#';
  vi da = f(v, a), db = f(v, b);
  bool ok = da[c] && db[d];
  if (c > d && ok) {
    ok = 0;
    for (int i = b; i <= d; ++i) {
      if (v[i] && v[i - 1] && v[i + 1]) {
        ok = 1;
      }
    }
  }
  if (ok) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


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

int main() {
	// your code goes here
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1){
	    c = c - b;
	    if(c<=0){
	        cout<<"Yes"<<endl;
	        return 0;
	    }
	    a = a - d;
	    if(a<=0){
	        cout<<"No"<<endl;
	        return 0;
	    }
	    
	}
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int a[50];
int ans;
int main(void){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n-2;i++){
		if(a[i]<a[i+1]&&a[i+1]<a[i+2]){
			ans++;
		}else if(a[i+2]<a[i+1]&&a[i+1]<a[i]){
			ans++;
		}
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 256
N, K = map(int, input().split())

amax = (N-1)*(N-2)//2
if amax-K>=0:
    print(amax-K+N-1)
    for i in range(N-1):
        print(1, i+2)
    cnt = 0

    def out(x):
        cnt = 0
        for i in range(2, N+1):
            for j in range(i+1, N+1):
                if cnt == amax-K:
                    return
                print(i, j)
                cnt += 1
    out(amax-K)
else:
    print(-1)

Measured memory_bytes: 3608
import java.io.*;

class Main{
	public static void main(String[] args){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			String line = reader.readLine();
			int n = Integer.parseInt(line);
			String s = reader.readLine();
			char[] c = s.toCharArray();

			for(int i = 0; i < c.length; i++){
				c[i] = (char)('A' + (c[i] - 'A' + n) % 26);
				System.out.print(c[i]);
			}
			System.out.println("");
		} catch(IOException e) {
			System.out.println(e);
		} catch(NumberFormatException e){
			System.out.println(e);
		}
	}
}

Measured memory_bytes: 22996
S = str(input())
n = len(S)
total,i_sum, reg = 0, 0, 0
for i in range(2**(n-1)):
    reg = int(S[0])
    for j in range(n-1):
        if(i >> j) & 1:
            i_sum += reg
#            print(i_sum,reg,"1")
            reg = 0
        reg = reg*10 + int(S[j+1])
#        print(reg,"2")
    i_sum += reg
    total += i_sum
    i_sum = 0
#   print(i_sum, total ,"3")
print(total)


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int k = Integer.parseInt(sa[1]);
		br.close();

		if (n < 2 * k - 1) {
			System.out.println(-1);
			return;
		}

		PrintWriter pw = new PrintWriter(System.out);
		int a = k;
		int b = k + n;
		int c = k + n + n;
		int n2 = (n + 1) / 2;
		for (int i = 0; i < n2; i++) {
			int aa = a + i * 2;
			int bb = b + n2 - 1 - i;
			int cc = c + i;
			pw.println(aa + " " + bb + " " + cc);
		}
		int m = n % 2;
		if (m == 1) {
			n2--;
		}
		for (int i = 0; i < n2; i++) {
			int aa = a + 1 + i * 2;
			int bb = c - 1 - i;
			int cc = c + n2 + m + i;
			pw.println(aa + " " + bb + " " + cc);
		}
		pw.flush();
	}
}


Measured memory_bytes: 41856
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>

using namespace std;

int main() {
    int n;  cin >> n;
    string s;   cin >> s;
    int ans = 0;

    for (int i = 0; i < n-1; i++) {
        string a = s.substr(0, 1+i), b = s.substr(i+1, n-i-1);
        int **c;
        c = (int **)malloc(sizeof(int*)*26);
        for (int j = 0; j < 26; j++)
            c[j] = (int *)calloc(2, sizeof(int));

        for (int k = 0; k < a.length(); k++)
            c[a[k] - 'a'][0]++;
        for (int k = 0; k < b.length(); k++)
            c[b[k] - 'a'][1]++;
        int cnt = 0;
        for (int k = 0; k < 26; k++) {
            if (c[k][1] > 0 && c[k][0] > 0)
                cnt++;
        }
        ans = max(ans, cnt);
    }   

    cout << ans << endl;

    return 0;
}

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

int main(){
  string s ;
  cin >> s ;
  string t = "keyence" ;
  rep(i,s.size()){
    rep(j,s.size()){
      string u = s ;
    //  cout<<u.erase(i,j)<<" "<<endl;
      if( u.erase(i,j) == t ){
        cout << "YES" << endl;
        return 0 ; }
    }
  }

  cout << "NO" << endl;

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, M;
	cin >> N >> M;
	int S[2000], T[2000];
	rep(i, N) cin >> S[i];
	rep(i, M) cin >> T[i];

	int mod = 1e9 + 7;
	int dp[4001];

	rep(i, N + M + 1) dp[i] = 1;
	for (int i = N; i > 0; i--) {
		for (int j = i; j < i + M; j++) {
			if (S[N - i] == T[j - i]) dp[j] = (dp[j - 1] + dp[j + 1]) % mod;
			else dp[j] = ((ll)dp[j - 1] + dp[j + 1] - dp[j] + mod) % mod;
		}
	}
	co(dp[M]);

	Would you please return 0;
}

Measured memory_bytes: 256
// abc127_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, M;
    cin >> N >> M;

    int max_l = 0;
    int min_r = N-1;
    REP(i, M){
        int l, r;
        cin >> l >> r; l--; r--;
        max_l = max(max_l, l);
        min_r = min(min_r, r);
    }

    print(max(min_r - max_l + 1, 0));


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <boost/functional/hash.hpp>
using namespace std;
typedef long long ll;
// typedef int long long int;
typedef unsigned long long ull;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll>   vl;
#define f(i,n)  for(i=0;i<n;i++)
#define f1(i,n)  for(i=1;i<n;i++)
#define fr(i,n) for(i=n-1;i>=0;i--)
#define em emplace_back
#define mp make_pair
#define in insert
#define fi first
#define sc second
#define b begin
#define e end
#define er erase
#define l length
#define c clear
#define si size
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
const double pi=3.141592653;
const ll MOD=1000000007;
const ll mod=998244353;
const string no="NO\n",yes="YES\n";

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

// void dfs(vl v[],ll node,ll hai[]){
//     hai[node]=1;
//     for(auto i:v[node]){
//         if(hai[i]==0){
//             dfs(v,i,hai);
//         }
//     }
// }

// ll con(vl v[],ll hai[],ll sz){
//     ll count=0;
//     for(int i=1;i<sz;i++){
//         if(hai[i]==0){
//             count++;
//             dfs(v,i,hai);
//         }
//     }
    // return count;
// }

// void gcde(int a,int b,int *x,int *y){
//     if(a==0){
//         *x=0;
//         *y=1;
//         return;
//     }    
//     int x1,y1;
//     gcde(b%a,a,&x1,&y1);
    
//     *x=y1-(b/a)*x1;
//     *y=x1;
// }


// ll recur(vl v,ll in,ll m,ll n){
//     if(in==-1)  return 1000000000001;
//     ll d,e,c;
//     d=max(m/v[in],n*v[in]);
//     c=recur(v,in-1,m/v[in],n*v[in]);
//     e=recur(v,in-1,m,n);
//     return min(c,min(e,d));
// }

// ll bexpo(ll a,ll p){
//     ll x=1;
//     while(p){
//     if(p&1){
//         x=(x*a)%mod;
//     }
//     a=(a*a)%mod;
//     p>>=1;
//     }
//     return x;
// }
// ll fact[500001],invf[500001];

int main() {
    fastio
    int t=1;
    // cin>>t;
    ull n,m,a,b,i,l,r,d,ans;
    
    while(t--){ans=0;
        cin>>l>>r>>d;
        i=1;
        while(i<101){
            if(d*i>=l&&d*i<=r)  ans++;
            i++;
        }
        
        cout<<ans;
    }
    
	return 0;
}

Measured memory_bytes: 3640