akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

long long int getMinimumCost(long long int arr[], long long int size, long long int k)
{
    long long int dp[size];
    dp[0] = 0;
    dp[1] = abs(arr[0] - arr[1]);
    for(long long int i = 1 ; i < size ; i++)
    {
        long long int currMin = 1000000000;
        for(long long int j = i-1 ; (j >= i - k) && (j >= 0) ; j--)
        {
            currMin = min(currMin, abs(arr[i]-arr[j]) + dp[j]);
        }
        dp[i] = currMin;
    }
    return dp[size-1];
}

int main(int argc, const char * argv[])
{
    long long int size;
    long long int k;
    cin>>size>>k;
    long long int arr[size];
    for(long long int i = 0 ; i < size ; i++)
    {
        cin>>arr[i];
    }
    cout<<getMinimumCost(arr, size, k)<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>
#include <unordered_map>
#include <map>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
struct Edge{
    int to,weight;
};
typedef vector<vector<Edge> > Graph;

int main(){
    int num;
    cin >> num;
    unordered_map<int, int> even_map;
    unordered_map<int, int> odd_map;
    rep(i,num){
	int tmp;
	cin >> tmp; 
	if(i%2 == 0){
	    even_map[tmp]++;
	}
	else{
	    odd_map[tmp]++;
	}
    }

    priority_queue<pint> even, odd;
    for(auto pair : even_map){
	even.push(make_pair(pair.second, pair.first));
    }
    for(auto pair : odd_map){
	odd.push(make_pair(pair.second, pair.first));
    }

    auto even_item = even.top();
    int even_size = even.size();
    auto odd_item = odd.top();
    int odd_size = odd.size();
    pint even_item2, odd_item2;

    if(even_item.second != odd_item.second){
	cout << num - even_item.first - odd_item.first << endl;
    }
    else{
	if(even_size == 1){
	    if(odd_size == 1){
		cout << num - max(even_item.first, odd_item.first) << endl;
	    }
	    else{
		odd.pop();
		odd_item2 = odd.top();
		cout << num - even_item.first - odd_item2.first << endl;
	    }
	}
	else{
	    even.pop();
	    even_item2 = even.top();
	    if(odd_size == 1){
		cout << num - even_item2.first -odd_item.first << endl;
	    }
	    else{
		odd.pop();
		odd_item2 = odd.top();
		cout << num - max(even_item.first+odd_item2.first, even_item2.first+odd_item.first) << endl;
	    }
	}
    }
}


Measured memory_bytes: 5524
// deque
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int mod=1e9+7;
const int inf = (1<<30);
string toBin(ll a){
	int i;
	string s1="";
	while(a>0){
		if(a&1){
			s1="1"+s1;
		}else{
			s1="0"+s1;
		}
		a>>=1;
	}
	return s1;
}
ll dp[5000][5000];

ll fun(ll arr[], ll s, ll e, bool t){
	if(s>e){
		return 0;
	}
	if(dp[s][e]!=-1){
		return dp[s][e];
	}
	ll c=0;
	if(t){
		ll a=arr[s]+fun(arr, s+1, e, !t);
		ll b=arr[e]+fun(arr, s, e-1, !t);
		c=max(a, b);
	}else{
		ll a=fun(arr, s+1, e, !t);
		ll b=fun(arr, s, e-1, !t);
		c=min(a, b);
	}
	return dp[s][e]=c;
}

void solve(){
	ll i, n, sum=0;
	cin>>n;
	ll arr[n];
	for(i=0;i<n;i++){
		cin>>arr[i];
		sum+=arr[i];
	}
	memset(dp, -1, sizeof(dp));
	ll x=fun(arr, 0, n-1, true);
	sum=accumulate(arr, arr + n, 0LL);
	cout<<(2*x- sum)<<endl;
}

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

Measured memory_bytes: 195712
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <cmath>
#include <iomanip>

using namespace std;

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

    sort(a, a+n);
    for(int i = 0; i < n; i++) sum += a[i];
    cout << a[0] << ' ' << a[n-1] << ' ' << sum << endl;


    return 0;
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define fr first
#define sc second
#define ll long long int
#define bit(idx) idx&(-idx)
#define bin(x, a) bitset<a>(x)
#define all(A) A.begin(), A.end()
#define debug(x) cout << #x << " = " << x << endl;
using namespace std;

const long double PI = 3.1415926535897932384626;

int main(){
	ios_base::sync_with_stdio(NULL); cin.tie(); cout.tie();
	long double r; cin >> r;
	cout << (long double) 2* r * PI << endl;
}
/**

*/

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

// GCD, LCM
// https://youtu.be/8lm8o8L9Bmw?t=2285
// https://youtu.be/XI8exXVxZ-Q?t=3595
// https://youtu.be/F2p_e6iKxnk?t=843
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

void solve(long long N, long long M, std::vector<long long> a){
    ll num = a[0]/2;
    set<ll> s;
    for(int i=0;i<N;i++){
        s.insert(a[i]);
    }
    for(auto itr = s.begin();itr != s.end();++itr){
        ll t = *itr;
        t/=2;
        ll old = num;
       
        if(num ==1 ){
            num = t;
        }else{
            num = lcm(num,t);
        }
        // cerr <<"num=" << num <<endl;
        if(num>M){
            cout << 0<<endl;
            return;
        }
        if((num/t) %2==0 || (num/old) %2 ==0){
            cout << 0 <<endl;
            return;
        }

    }
    
    cout <<  1 + (M-num)/(2*num) << endl;

}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, M, std::move(a));
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  vector<vector<int>> E(n);
  for(int i=0;i<n-1;i++){
    int l, r;
    cin >> l >> r;
    l--;r--;
    E[l].emplace_back(r);
    E[r].emplace_back(l);
  }
  vector<int> val(n, 0);
  for(int i=0;i<q;i++){
    int id, x;
    cin >> id >> x;
    val[id-1] += x;
  }
  vector<bool> visited(n, false);
  function<void(int)> dfs = [&](int cur){
    visited[cur] = true;
    for(auto&& to:E[cur]){
      if(!visited[to]){
        val[to] += val[cur];
        dfs(to);
      }
    }
  };
  dfs(0);
  for(auto&& x:val)
	cout << x << " ";
  cout << endl;
}

Measured memory_bytes: 26624
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define print(x) cout << #x << " = " << x << endl;

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;


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

	cin >> A >> B >> X;

	if (A <= X && X - A <= B) cout << "YES" << endl;
	else cout << "NO" << endl;


	return 0;
}

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

using namespace std;

int main() {
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;
    for(int i=0; i<n-2; i++){
        if(s.substr(i,3) == "ABC") ans++; 
    }
    cout << ans << endl;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    string s,t;
    ll a,b,k,c,e,d,n,m,x,y,z;
    cin >> n >> k;

    ll ans = infll;
    chmin(ans, n%k);
    chmin(ans, abs(k-(n%k)));

    cout << ans << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef string ss;
int main()
{

    ll i,j,s,n,x,y,z,m=0;
    cin>>s;
    if(s%2==0)
        cout<<s/2<<endl;
    else
        cout<<s/2+1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#define PI 3.14159265359
typedef long long ll;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
using namespace std;

int road[201][201];

int main(){
	int n, m, r;
	cin >> n >> m >> r;
	vector<int> machi(r);
	for (int i = 0; i < r; i++){
		cin >> machi[i];
	}
	for (int i = 0; i <= 200; i++){
		for (int j = 0; j <= 200; j++){
			road[i][j] = MOD;
		}
	}
	for (int i = 0; i < m; i++){
		int a, b, c;
		cin >> a >> b >> c;
		road[a][b] = c;
		road[b][a] = c;
	}
	for (int k = 1; k <= n; k++){
    	for (int i = 1; i <= n; i++) {
      		for (int j = 1; j <= n; j++) {
        		road[i][j] = min(road[i][j], road[i][k] + road[k][j]);
      		}
    	}
  	}
	sort(machi.begin(), machi.end());
	int ans = MOD;
	do {
		int tmpans = 0;
    	for (int i = 0; i < r-1; i++){
    		tmpans += road[machi[i]][machi[i+1]];
    	}
    	ans = min(ans, tmpans);
  	} while (next_permutation(machi.begin(), machi.end()));
  	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3772
import numpy as np
 
 
def taste(N, L):
    all_abs = np.array([np.abs(L + i - 1) for i in range(1, N + 1)])
    all_base = np.array([L + i - 1 for i in range(1, N + 1)])
 
    return all_abs, all_base
 
N, L = map(int, input().split())
 
all_abs, all_base = taste(N, L)
 
N_1_all = all_base[np.min(all_abs) != all_abs]
 
re = np.sum(N_1_all)
print(re)

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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define P pair<int, int>
struct data{
	int place;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
};
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};

int H, W, K;
int many[9][3] = {};
llong int dp[101][9] = {};
int mod = 1e9+7;

llong int solve(int h, int w){
	if(dp[h][w] != -1) return dp[h][w];

	if(h == H){
		if(w == K) return 1;
		else return 0;
	}

	llong int ans = solve(h+1, w)%mod*many[w][1]%mod;
	if(w != 1) ans += solve(h+1, w-1)%mod*many[w][0]%mod;
	ans %= mod;
	if(w != 8) ans += solve(h+1, w+1)%mod*many[w][2]%mod;
	ans %= mod;

	return dp[h][w] = ans;
}

int main(){
	fn(*dp, 101*9, -1);
	cin >> H >> W >> K;
	for(int i = 0; i < 1<<(W-1); i++){
		bool check = false;
		for(int j = 0; j < (W-2); j++){
			if( ((i>>j)&1) & ( (i>>(j+1))&1) ) check++;
		}
		if(check)continue;
		// cerr << bitset<7>(i) << endl;

		if(i&1){
			many[1][2]++;
			many[2][0]++;
		}else{
			many[1][1]++;
		}
		if((i>>(W-2))&1){
			many[W-1][2]++;
			many[W][0]++;
		}else{
			many[W][1]++;
		}

		if( ((i>>(W-2))&1) == 0 && ((i>>(W-3))&1) == 0){
			many[W-1][1]++;
		}
		for(int j = 1; j <= W-3; j++){
			if((i>>j)&1){
				many[j+1][2]++;
				many[j+2][0]++;
			}else if(((i>>(j-1))&1) == 0){
				many[j+1][1]++;
			}
		}
	}

	// for(int i = 1; i <= W; i++){
	// 	for(int j = 0; j < 3; j++){
	// 		cerr << many[i][j] << " ";
	// 	}
	// 	cerr << endl;
	// }
	if(W == 1) cout << 1 << endl;
	else cout << solve(0,1) << endl;
	// for(int i = 0; i < H; i++){
	// 	for(int j = 1; j <= W; j++){
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }

	return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long INT;
double PI = 3.14159265;

const long long INF = 1LL << 60;
//---//
int a[100010] = {}, b[100010] = {}, c[100010] = {};
INT bsum[100010] = {}, sum = 0;

int main() {
    int n,x;

    cin >> n;

    rep(i, n)cin >> a[i];
    rep(i, n)cin >> b[i];
    rep(i, n)cin >> c[i];

    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);

    for (int j = 0; b[j] < c[n-1] && j < n; j++) {
        if (j == 0)bsum[j] = lower_bound(a, a + n, b[j]) - a;
        else  bsum[j] = lower_bound(a, a + n, b[j]) - a + bsum[j - 1];
    }

    for (int k = 0; k < n; k++) {
        x = lower_bound(b, b + n, c[k]) - b;
        if(x!=0)sum += bsum[x-1];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	
	int n;
	cin>>n;
	double result ;
	double ans = 0.0;
	if(n%2 == 0) result = n/2;
	else if (n%2 !=0) result = (int) (n/2) + 1;
	ans = (double) (result / (double)n );
	cout<< setprecision(12) << ans;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader sc=new FastReader();
        Long a=sc.nextLong();
        Long b=sc.nextLong();
        Long c=sc.nextLong();
        Long d=sc.nextLong();
        Long ans1=a*c;
        Long ans2=a*d;
        Long ans3=b*c;
        Long ans4=b*d;
       // System.out.println(ans1);
      //  System.out.println(ans2);
       // System.out.println(ans3);
      //  System.out.println(ans4);
        System.out.println(Math.max(Math.max(ans1,ans2),Math.max(ans3,ans4)));

    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}


Measured memory_bytes: 32676
#include<iostream>

using namespace std;
int main() {
	int a, b;
	cin >> a >> b;

	for (int i = 0; i < 1020; i++) {
		int za = i * 8 / 100;
		int zb = i * 10 / 100;

		if (a == za && b == zb) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int top = 0, S[1000];
void push(int x){
  S[++top] = x;
}
int pop(void){
  top--;
  return S[top+1];
}
int main(void){
  int a, b;
  top = 0;
  char s[100];
  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      a = pop();
      b = pop();
      push(a + b);
    }
    else if(s[0] == '-'){
      b = pop();
      a = pop();
      push(a - b);
    }
    else if(s[0] == '*'){
      a = pop();
      b = pop();
      push(a * b);
    }
    else{
      push(atoi(s));
    }
  }
  printf("%d\n",pop());
  return 0;
}


Measured memory_bytes: 2104
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<iomanip>
#include<limits>
#include<unordered_set> 
#include<cmath>
using namespace std;
//long long p = 998244353;
long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<pin,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define fcout cout << fixed << setprecision(15)
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n, int mod) {
    if (n == 0) { return 1 % mod; }
    int x = rui(a, n / 2, mod);
    x *= x; x %= mod;
    if (n % 2 == 1) { x *= a; x %= mod; }
    return x;
}
vel pa;
int root(int x) {
    if (pa[x] == -1) { return x; }
    int ans = root(pa[x]); pa[x] = ans;
    return ans;
}
void marge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) { pa[x] = y; }
}
int gcd(int x, int y) {
    if (x < y) { return gcd(y, x); }
    if (y == 0) { return x; }
    return gcd(y, x % y);
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
vel uni(vel x) {
    if (x.size() == 0) { return x; }
    sor(x);
    int n = x.size();
    vel ans(1, x[0]);
    for (int j = 1; j < n; j++) {
        if (x[j - 1] != x[j]) { ans.push_back(x[j]); }
    }
    x = ans;
    return x;
}
void pr(vel& v) {
    int n = v.size();
    if (n != 0) {
        cout << v[0];
        rep(i, n - 1) {
            cout << " " << v[i + 1];
        }
        cout << endl;
    }
}
signed main(){
    int n; cin >> n;
    int ans = 0;
    rep(i, n) {
        string s; cin >> s;
        if (s == "E869120") { ans++; }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3736
/*I wanna be the very best, like no one ever was...*/

#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define ll long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);
 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif


int pow(int a , int n ){
    ll res =1;
    while(n){
        if(n%2==1){
            res= (res*a)%MOD;
        }
        a=(a*a)%MOD;
        n/=2;
    }
    return res;
}



int main() {
    io;
    // freopen("in","r",stdin); 
    // freopen("out","w",stdout);
    ll n;
    cin>>n;
    vector<ll> v(n);
    rep(i,0,n)cin>>v[i];
    ll flag = 1;
    sort(all(v));
   for(long i=n-1; i>1; i-=2){
        if(i!=0){
            if(v[i]!=i || v[i-1]!=i){
                flag=false;
            }
        }else{
            if(v[0]!=0){
                flag=false;
            }
        }
    }
     if(!flag){
        cout << 0 <<endl;
    }else{
        long result=1;
        for(long i=0; i<n/2; i++){
            result=result*2;
            result=result%(1000000000+7);
        }
        std::cout << result << endl;    }

 
 
 
    
 
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#define y1 yy1
#define y2 yy2
using namespace std;

const int N=200005;
const int inf=1e8;
const double pi=acos(-1);

int n,x1,x2,y2,y1,f[N],g[N],b[N];
struct data{int x,y;}a[N];

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

bool cmp(data a,data b)
{
	return a.x<b.x;
}

int main()
{
	x1=read();y1=read();x2=read();y2=read();
	n=read();
	for (int i=1;i<=n;i++) a[i].x=read(),a[i].y=read();
	if (x1>x2)
	{
		x1=inf-x1;x2=inf-x2;
		for (int i=1;i<=n;i++) a[i].x=inf-a[i].x;
	}
	if (y1>y2)
	{
		y1=inf-y1;y2=inf-y2;
		for (int i=1;i<=n;i++) a[i].y=inf-a[i].y;
	}
	sort(a+1,a+n+1,cmp);
	int tot=0;
	for (int i=1;i<=n;i++)
		if (a[i].x>=x1&&a[i].x<=x2&&a[i].y>=y1&&a[i].y<=y2) b[++tot]=a[i].y;
	int mx=0;
	for (int i=1;i<=tot;i++)
	{
		f[i]=lower_bound(g+1,g+mx+1,b[i])-g;
		if (f[i]>mx) mx=f[i],g[mx]=b[i];
		else g[f[i]]=min(g[f[i]],b[i]);
	}
	double ans=(double)(x2+y2-x1-y1)*100;
	ans-=mx*(20-5*pi);
	if (mx==min(y2-y1+1,x2-x1+1)) ans+=5*pi;
	printf("%.12lf",ans);
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll N, M; cin >> N >> M;
  map<ll,ll> leg;
  for (ll i = 0; i < M; i++) {
    ll x, y; cin >> x >> y;
    leg[x]++; leg[y]++;
  }
  bool ok = true;
  for (ll i = 1; i <= 1e5; i++) {
    if (leg[i]%2 == 1) ok = false;
  }
  if (ok) {cout << "YES" << endl;}
  else {cout << "NO" << endl;}
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main() {
        int n;scanf("%d",&n);
        int cnt=0;
        rep(i,n){
                int l,r;scanf("%d%d",&l,&r);
                cnt+=r-l+1;
        }
        cout<<cnt<<endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := uint(nextInt(sc))
	k := uint(nextInt(sc))
	var t uint
	for i := uint(0); i < k; i++ {
		t |= (1 << uint(nextInt(sc)))
	}
	wtr := bufio.NewWriter(os.Stdout)
	// fmt.Fprintf(wtr, "t - %08b, n %d\n", t, n)
	for bits := 0; bits < (1 << uint(n)); bits++ {
		if (bits == 0) || ((uint(bits) & ^t) == 0 && uint(bits)&t != 0) {
			// fmt.Fprintf(wtr, "%d - %08b:\n", bits, bits)
			fmt.Fprintf(wtr, "%d:", bits)
			for j := 0; j < int(n); j++ {
				if (bits & (1 << uint(j))) != 0 {
					fmt.Fprintf(wtr, " %d", j)
				}
			}
			fmt.Fprintln(wtr)
		}
	}
	wtr.Flush()
}



Measured memory_bytes: 6148
#include "bits/stdc++.h"
using namespace std;

string st;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int main() {  cin >> st;
	bool flag = false;
	if (st.size() % 2) {
		st.erase(st.begin() + st.size() / 2);
		flag = true;
	}
	assert(st.size() % 2 == 0);
	int N; cin >> N;
	vector<int>nums(st.size() + 1);
	nums[0] = st[0] - 'a';
	for (int i = 1; i < st.size(); ++i) {
		nums[i] = (26+st[i] - st[i - 1])%26;
	}
	nums[st.size()] = 26 - (st[st.size() - 1]-'a');
	vector<pair<int, int>>edges;
	vector<long long int>nodes(st.size() + 1);
	for (int i = 0; i < N; ++i) {
		int l, r; cin >> l >> r;
		l--;
		if (flag) {
			if (l > st.size() / 2) {
				l--;
			}
			if (r>st.size()/2) {
				r--;
			}
		}
		if (l > st.size()/2) {
			l = st.size() - l;
		}
		if(r>st.size()/2){
			r = st.size() - r;
		}
		edges.push_back(make_pair(l, r));
	}
	vector<int>flags(st.size() / 2 + 1);

	UnionFind uf(st.size() / 2 + 1);
	for (auto e : edges) {
		if (e.first == e.second)flags[e.first] = true;
		else {
			uf.unionSet(e.first, e.second);
		}

	}
	for (int i = 0; i < st.size() / 2; ++i) {
		nums[i] += nums[st.size() - i];
	}
	set<int>roots;
	map<int, pair<long long int, bool>>mp;
	vector<long long int >sums(st.size() / 2 + 1);
	for (int i = 0; i < st.size() / 2 + 1; ++i) {
		mp[uf.root(i)].first += nums[i];
		if (flags[i])mp[uf.root(i)].second = true;
	}
	bool ok = true;
	for (auto m : mp) {
		m.second.first %= 26;
		//if (m.second.second) {
			if (m.second.first % 2)ok = false;
		//}
	//	else {
			if (m.second.first)ok = false;
		//}
	}
	if (ok)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 5880
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " = " << (x) << "( (L" << __LINE__ << ")" << endl;
using namespace std;

#define ll long long

ll n,m;
string s,t;
int main() {
    cin >> s >> t;
    for(ll i = 0; i < s.length(); i++) {
        if(s[i] != t[i]) {
            n++;
        }
    }
    cout << fixed << n;
}

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

using namespace std;
#define ll long long

ll INF = 1e18;

int main(){

    int n;
    cin>>n;

    ll sum = 0;
    vector<int>arr(n);
    vector<int>brr(n);

    for(int i = 0; i< n;i++)
    {
        cin>>arr[i];
        arr[i] -= (i+1); 
        brr[i] = arr[i];
    }

    sort(brr.begin(), brr.end());

    ll b, ans = 0;

    if( n%2 == 1)
    {
        b = brr[n/2];
        for(int i = 0; i< n;i++)
        {
            ans += (abs(arr[i] - b));
        }
    }
    else
    {
        b = brr[n/2];
        for(int i = 0; i< n;i++)
        {
            ans += (abs(arr[i] - b));
        }
        ll minVal = ans;
        b = brr[(n-1)/2];
        ans = 0;
        for(int i = 0; i< n;i++)
        {
            ans += (abs(arr[i] - b));
        }
        ans = min(minVal,ans);
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    ll u; cin >> u; u--;
    ll v; cin >> v; v--;
    vector <vector<ll>> as(n, vector<ll>());
    REP(i, n-1){
        ll a; cin >> a; a--;
        ll b; cin >> b; b--;
        as[b].push_back(a);
        as[a].push_back(b);
    }
    vector <ll> kyori1(n, -1);
    queue <ll> q;
    q.push(u);
    kyori1[u] = 0;
    while (!q.empty()){
        ll now = q.front();
        ll k = kyori1[now];
        q.pop();
        for(auto next: as[now]){
            if (kyori1[next] > -1){
                continue;
            }

            kyori1[next] = k + 1;
            q.push(next);
        }
    }

    vector <ll> kyori2(n, -1);
    q.push(v);
    kyori2[v] = 0;
    while (!q.empty()){
        ll now = q.front();
        ll k = kyori2[now];
        q.pop();
        for(auto next: as[now]){
            if (kyori2[next] > -1){
                continue;
            }
            kyori2[next] = k + 1;
            q.push(next);
        }
    }
    ll ans = 0;
    REP(i, n){
        if (kyori1[i] < kyori2[i]){
            ans = max(ans, kyori2[i]);
        }
    }
    cout << ans-1 << endl;
    return 0;
}

Measured memory_bytes: 8064
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
mp = {}

def divisor(n):
    p = 3
    d = {}
    while n>1:
        if n%2==0:
            d[2] = 0
        while n%2==0:
            n /= 2
            d[2] += 1
        if n%p==0:
            d[p] = 0
        while n%p==0:
            n /= p
            d[p] += 1
        p += 2
    return d

divs = {}
for i in range(2, n+1):
    for k, v in divisor(i).items():
        if k in divs:
            divs[k] += v
        else:
            divs[k] = v

# print(divs)
res = 1
for k, v in divs.items():
    res *= (v+1)
    res %= mod

print(res)

Measured memory_bytes: 41836
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define L 100005
lld Map[L];
lld Sap[L];
lld Dap[L];
lld Kap[L];
lld dfs (vector <lld> V[] ,  lld x ,  lld count){
	set <lld> visit;
	stack <lld> stk;
	lld y, j, c = 0;
	visit.insert(x);
		stk.push(x);
		while (!stk.empty()) {
			y = stk.top();
				stk.pop();
				c++;
				Dap[y]= count;
				for(j = 0; j < V[y].size(); j++){
					if (!visit.count(V[y][j])){
						visit.insert(V[y][j]);
							stk.push(V[y][j]);
					}
				}
		}
		set<lld>::iterator p;
		for(p = visit.begin();p!=visit.end();){
			Map[*p] = c;
			p ++;
		}
	return visit.size();
}
int main (){
    // #ifndef ONLINE_JUDGE
    // freopen("inputf.in",  "r",   stdin);
    // freopen("outputf.in", "w",  stdout);
    // #endif
    FastIO
    lld n, m;
    lld k, i;
    lld x, y;
    cin >> n;
    cin >> m;
    cin >> k;
    set <lld> st[n+1];
    vector<lld>V[n+1];
    foi(i,L){
    		Map[i]= 0;
    		Sap[i]= 0;
    		Dap[i]= 0;
    		Kap[i]= 0;
    }
    foi(i,m){
    	cin >> x >> y;
    V[x].push_back(y);
    V[y].push_back(x);
    Sap[x]++;
    Sap[y]++;
    }
    lld count = 1;
    for(i = 1; i<=n; i++){
    	if (Dap[i] ==  0){
    		lld l= dfs(V,i,count);
    	}
    	count+= 1;
    }
    foi(i,k){
    	cin >> x >> y;
    		if (Dap[x] == Dap[y]){
    			Kap[x] ++;
    			Kap[y] ++;
    		}
    }
    lld r;
    for(i = 1; i<=n; i++){
    	r = Sap[i]+Kap[i];
    	r+= 1;
    	cout << (Map[i]-r) << " ";
    }
    return 0;
}

Measured memory_bytes: 20468
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K, X = MAP()

print("Yes" if 500*K >= X else "No")

Measured memory_bytes: 5144
#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, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
ll tyo, ta;
ld tyo2, ta2, kakusa;
ld one, two, ans;

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

  cin >> a >> b >> h >> m;
  tyo = h * 30;
  tyo %= 360;
  tyo2 += (ld)tyo;
  rep(i, m) {
    tyo2 += (ld)0.5;
    ta2 += (ld)6.0;
  }
  kakusa = abs(tyo2 - ta2);
  kakusa = min(kakusa, 360.0 - kakusa);
  if (kakusa >= 90.0) {
    kakusa = 180.0 - kakusa;
    one = (ld)a * sin(kakusa * M_PI / 180.0);
    two = (ld)a * cos(kakusa * M_PI / 180.0);
    two += (ld)b;
    // doublecout(one);
    ans = sqrt(one * one + two * two);
    doublecout(ans);
  } else {
    one = (ld)a * sin(kakusa * M_PI / 180.0);
    two = (ld)a * cos(kakusa * M_PI / 180.0);
    two = (ld)b - two;
    // doublecout(one);
    ans = sqrt(one * one + two * two);
    doublecout(ans);
  }
  return 0;
}

Measured memory_bytes: 4204
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = np.array(list(readline().rstrip()), np.int32)
T = np.array(list(readline().rstrip()), np.int32)

LS, LT = len(S), len(T)

x = 0
for s in range(LS - LT + 1):
    same = np.sum(S[s:s + LT] == T)
    x = max(x, same)

print(len(T) - x)

Measured memory_bytes: 27348
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define Reverse(v) reverse(all(v))
#define Rsort(v) sort(all(v),greater)
#define pub(v) push_back(v)
#define pob(v) pop_back(v)
typedef long long ll;
typedef vector<ll> vel;
typedef vector<vector<ll>> vel2d;
typedef string str;
typedef pair<ll,ll> pal;
typedef vector<str> ves;
typedef vector<char> vech;

int main(){
    str S;cin>>S;
    if(S[0]!='A'){cout<<"WA"<<endl;return 0;}
    else{S[0]='a';}
    ll m=S.size();
    ll cnt=0;
    for(ll i=2;i<=m-2;i++){
        if(S[i]=='C'){S[i]='c';cnt++;}
        if(i==m-2&&cnt>=2){cout<<"WA"<<endl;return 0;}
    }
    if(cnt==0){cout<<"WA"<<endl;return 0;}
    bool flag=false;
    rep0(i,m){
        if(0<=(ll)(S[i]-'a')&&(ll)(S[i]-'a')<26){
            flag=true;
        }
        else{flag=false;break;}
    }
    if(flag){cout<<"AC"<<endl;}
    else{cout<<"WA"<<endl;}
}
      

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

using namespace std;

int main(){
	int n,c,i,j,k;
	long long d[40][40],z[510][510],a[40][3],ans;
	cin >> n >> c;
	for(i=1;i<=c;i++){
		for(j=1;j<=c;j++){
			cin >> d[i][j];
		}
	}
	
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			cin >> z[i][j];
		}
	}
	
	ans = 9000000000000;
	
	for(k=1;k<=c;k++){
		a[k][0]=0;
		a[k][1]=0;
		a[k][2]=0;
		for(i=1;i<=n;i++){
			for(j=1;j<=n;j++){
				if((i+j)%3==0){
					a[k][0] += d[z[i][j]][k];
				}
				if((i+j)%3==1){
					a[k][1] += d[z[i][j]][k];
				}
				if((i+j)%3==2){
					a[k][2] += d[z[i][j]][k];
				}
			}
		}
	}
	
	for(i=1;i<=c;i++){
		for(j=1;j<=c;j++){
			for(k=1;k<=c;k++){
				if(i==j || j==k || k==i){
					continue;
				}
				ans = min(ans,a[i][0]+a[j][1]+a[k][2]);
			}
		}
	}
	cout << ans << endl;
}
						
		

Measured memory_bytes: 2304
#include<stdio.h>



int A[10000];
int main( void ) 
{
  
    int n,count=0;
    scanf( "%d", &n );
     
    int i, j;

    for( i=0; i<n; i++ ) 
	{
        scanf( "%d", &A[i] );
    }
    for( i=n; i>0; i-- ) 
	{    
        for(j=0;j<i-1;j++)
		{
			if(A[j]>A[j+1])
			{
				int temp = A[j];
				A[j] = A[j+1];
				A[j+1]=temp;
				count++;
			}
		}
	}
	printf("%d",A[0]);
    for(i=1;i<n;i++) printf(" %d",A[i]);
    printf("\n");
    printf("%d\n",count);

    return 0;
	
}

Measured memory_bytes: 604
#include<cstdio>
#include<algorithm>
#include<utility>
#define ll long long
using namespace std;
ll ans;
int main()
{
    ll n,x;
    while(~scanf("%lld%lld",&n,&x))
    {
        ans=n;
        n-=x;
        while(1)
        {
            if(x>n)swap(x,n);
            if(n%x==0)
            {
                ans+=n*2-x;break;
            }
            else
                ans+=(n/x*2)*x;
            n-=n/x*x;
        }
        printf("%lld\n",ans);
    }
}


Measured memory_bytes: 128
def array_integer(a)
	0.upto(a.count) {|x|
		a[x] = a[x].to_i
	}
	return a
end

def check_over(a, b)
	if a <= b then
		return false
	else
		return true
	end
end

input = STDIN.gets
(w,h,x,y,r) = array_integer(input.split(" "))

judge = false

judge = check_over(0, x-r) unless judge
judge = check_over(0, y-r) unless judge
judge = check_over(x+r, w) unless judge
judge = check_over(y+r, h) unless judge

if judge then
	puts "No"
else
	puts "Yes"
end



Measured memory_bytes: 8912
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
#define il inline
#define re register
#define fo(i,j,k) for(register int i=j;i<=k;i++)
#define do(i,j,k) for(register int i=j;i>=k;i--) 
#define inf 0x7fffffff
typedef long long ll;
using namespace std;
il ll read()
{
	ll x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return f*x;	
}
int n,m,cnt; 
int ans;
/*int h[200010],dis[200010],v[200010];
int dp[1005][1005];
struct edge
{
	int v,w,next;
}e[200010*2];
il void add(int u,int v)
{
	e[++cnt].v=v;
//	e[cnt].w=w;
	e[cnt].next=h[u];
	h[u]=cnt;
}*/ 
int main()
{
	double r;
	cin>>r;
	printf("%lf",3.14*2*r);
	return 0;
}

Measured memory_bytes: 3792
#include<bits/stdc++.h>
    using namespace std;
    int main(){
    int n[5];
    for(int i=0;i<4;i++) cin>>n[i];
    sort(n,n +4);
    if(n[0]==1&&n[1]==4&&n[2]==7&&n[3]==9) cout<<"YES"<<'\n';
    else cout<<"NO"<<'\n';
    return 0;
    }

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n,k=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
p=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
#最大のリストを選定
before_pi = p[0]
before_sum = sum(p[0:k])+ 0.0
suml = [sum(p[0:k])]
for i in range(1,n-k+1):
    before_sum = before_sum - before_pi+p[i+k-1]
    suml.append(before_sum)
    before_pi = p[i]

#計算
print((max(suml)+k)/2.0)

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

int ctoi(char c) {
  string s = "";
  s += c;
  return stoi(s);
}

int main() {
  string S;
  cin >> S;
  int n = S.size() - 1;
  for (int bit = 0; bit < (1 << n); bit++) {
    int total = ctoi(S.at(0));
    string formula = "";
    formula += S.at(0);
    for (int i = 0; i < n; i++) {
      char numc = S.at(i + 1);
      if (bit & (1 << i)) {
        total += ctoi(numc);
        formula += '+';
      }
      else {
        total -= ctoi(numc);
        formula += '-';
      }
      formula += numc;
    }
    if (total == 7) {
      formula += "=7";
      cout << formula <<endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {

	string s;
	while (cin >> s, s != "0") {
		int a = 0, b = 0;
		for (int i = 1; i < s.size(); i++) {
			if (s[i] == 'A')a++;
			else b++;
		}
		if (a > b)a++;
		else b++;
		cout << a << " " << b << endl;
	}

	return 0;
}

Measured memory_bytes: 3108
// Problem : K - Stones
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_k?lang=en
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define Ma7moud_7amdy                                                                                                  \
    ios_base::sync_with_stdio(false);                                                                                  \
    cin.tie(NULL);                                                                                                     \
    cout.tie(NULL)
#define Open_Sesame Open()
#define all(v) ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(arr, x) memset(arr, x, sizeof arr)
#define endl "\n"
#define watch(x) cout << #x << " = " << x << endl;
#define RT(x) return cout << (x), 0;
#define Accepted 0
typedef long long ll;
typedef vector<int> vi;
const int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
void Open() {
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
#endif
}
const int mod = ll(1e9 + 7), N = 2000 + 5;
//“Nobody but you have to believe in your dreams to make them a reality.” ― Germany Kent
int n, a[101], k;
int dp[(int) 1e5 + 1][2]; /*
 int mem[(int)1e5 + 1][2];

 bool stones(int rem = k, bool state = 0)
 {

 if (rem == 0)
 return state;

 int &ret = mem[rem][state];
 if (~ret)
 return ret;
 ret = state;

 for (int i = 0; i < n && a[i] <= rem; i++)
 {
 if (state)
 ret &= stones(rem - a[i], !state);
 else
 ret |= stones(rem - a[i], !state);
 }
 return ret;
 }*/
int main() {
	Ma7moud_7amdy
	;
	// Open_Sesame;
	//  clr(mem, -1);
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);

	// cout << (stones() ? "First\n" : "Second\n");

	for (int rem = 0; rem <= k; rem++) {
		int &ret1 = dp[rem][0];
		ret1 = 0;
		int &ret2 = dp[rem][1];
		ret2 = 1;

		for (int i = 0; i < n && a[i] <= rem; i++) {
			ret1 |= dp[rem - a[i]][1];
			ret2 &= dp[rem - a[i]][0];
		}
	}

	cout << (dp[k][0] ? "First\n" : "Second\n");
}


Measured memory_bytes: 4372
#include<bits/stdc++.h>
#define pb push_back
#define debug(x) cerr << #x << " = " << x << "\n";
#define debug_v(x) cerr << #x << " ="; for(auto i : x){cerr << " [" << i << "]";} cerr << "\n";
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vii = vector<pii>;
const double PI = acos(-1);
const int mod = 998244353;
const int inf = 1e9 + 100;
const ll inf64 = 1e18 + 100;
const int maxn = 102;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cout << fixed << setprecision(20);
	int n, answer = 0;
	cin >> n;
	vi a(n);
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	for (int i = 1; i < n - 1; i++){
		if((a[i] > a[i - 1] && a[i] < a[i + 1]) || (a[i] < a[i - 1] && a[i] > a[i + 1])){
			answer++;
		}
	}
	cout << answer << "\n";
	return 0;
}
 


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
#define PI 3.1415926535897932
int main() {
	//freopen("input.txt", "r", stdin);
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	int minus = h * 60 + m;
	double deg_a = (double)minus / 2;
	double deg_b = (double)m * 6;
	double res = sqrt(-2 * cos(abs(deg_a - deg_b) * PI / 180) * a * b + a * a + b * b);
	printf("%.20f", res);
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;


bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}


int Gcd(int x,int y)              //最大公約数
{
  int large = max(x,y);
  int small = min(x,y);

  while(small!=0){
      int amari =large%small;

      large = small;

      small = amari;  
  }
  return large;
}

const int MOD = 1000000007;




//メイン関数--------------------------------------------



int main(){

ll n;
cin>>n;


if(n==1){
    cout<<0<<endl;
}
else{

ll ans=1,yo=1;
for(int i=0;i<n;i++){
  ans*=10;
  ans%=MOD;
  if(ans<0){
      ans+=MOD;
  }
}

  for(int i=0;i<n;i++){
  yo*=9;
  yo%=MOD;
  if(yo<0){
      yo+=MOD;
  }
  }

  ll yo1=1;

  for(int i=0;i<n;i++){
  yo1*=8;
  yo1%=MOD;
  if(yo1<0){
      yo1+=MOD;
  }
 
  }
  yo*=2;
  yo%=MOD;
  if(yo<0){
      yo+=MOD;
  }

  ans-=yo;
  ans+=yo1;
  if(ans<0){
      ans+=MOD;
  }

cout<<ans<<endl;
}
}



Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>

#define rep(i,n) for(int i = 0; i < n; i++)

using namespace std;
typedef long long ll;

// 型による変数のオーバーフローに気をつけろ！！

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];

	// ２で割るか3をかける　すべて３かけはだめ
	// すべて奇数になったら終了
	// 三倍はフェイク　偶数の数を数えれば良い
	int cnt = 0;
	rep(i, n) {
		while (a[i] % 2 == 0) {
			a[i] /= 2;
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 384
def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
    
n = int(input())
a = []
if n%2 == 0:
	for i in range(1,n+1):
		for j in range(i+1,n+1):
			if i+j != n+1:
				a.append([i,j])
else:
	for i in range(1,n+1):
		for j in range(i+1,n+1):
			if i+j != n:
				a.append([i,j])	
print(len(a))
for i in a:
	print(i[0],i[1])							

Measured memory_bytes: 4124
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
using namespace std;

#define ll long long

int main() {
	ll n, k, a[300000], hoge, ans = 0;
	cin >> n >> k;
	for (int i = 0; i < 300000; i++) a[i] = 0;
	for (int i = 0; i < n; i++) {
		cin >> hoge;
		a[hoge]++;
	}
	sort(a, a + 300000);
	reverse(a, a + 300000);
	for (int i = 0; 0 != a[k + i]; i++) {
		ans += a[k + i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2688