akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;

pub fn read<t: FromStr>() -> t {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let x: usize = read();
    let mut maxv = 0;
    if x <= 3 {
        println!("{}", 1);
        return;
    }

    for i in 2..x {
        let mut imut = i;

        while imut * i <= x {
            imut *= i;
        }

        if maxv < imut && i != imut {
            maxv = imut;
        }
    }
    println!("{}", maxv);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int R[200000];
  for(int i=0;i<n;i++)
    cin >> R[i];
  int minv=R[0],maxv=INT_MIN;
  for(int i=1;i<n;i++){
    maxv=max(maxv,R[i]-minv);
    minv=min(minv,R[i]);
  }
  cout << maxv << endl;
  return 0;
}


Measured memory_bytes: 3916
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
 lint digit(lint);

int main(){

    lint A,B,M;
    cin >> A >> B >> M;

    vector<lint> a(A), b(B);

    lint ami = 999999, bmi = 999999;

    for(lint i = 0; i < A; ++i){
        cin >> a[i];
        ami = min(a[i], ami);
    }
    for(lint i = 0; i < B; ++i){
        cin >> b[i];
        bmi = min(b[i], bmi);
    }

    lint mi = ami+bmi;

    for(lint i = 0; i < M; ++i){
        lint x, y, c;
        cin >> x >> y >> c;
        mi = min(mi, a[x-1]+b[y-1]-c);
    }

    cout << mi << endl;

}
lint digit(lint num){
    lint dig = 0;
    while(num){
        num /= 10;
        ++dig;
    }
    return dig;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long int
pair<int,int> ar[200005];
int32_t main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>ar[i].second>>ar[i].first;
	}
	sort(ar+1,ar+n+1);
	int cur = 0;
	for(int i=1;i<=n;i++){
		cur+=ar[i].second;
		if(cur>ar[i].first){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}


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

using namespace std;

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

    long long max = -1;
    long long min = 1000000001;

    for(int i = 0; i < n; ++i)
    {
        long long a;
        cin >> a;
        if(a > max) max = a;
        if(a < min) min = a;
    }

    cout << abs(max-min) << endl;

    return 0;
}


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

int main(){
   int x,y;
   cin >> x >> y;
   for(int i=0;i<=x;i++){
       if(2*i+4*(x-i)==y){
           printf("Yes\n");
           return 0;
       }
   }
   printf("No\n");
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int cnt[4];

int main(){
    int n;
    cin>>n;
    rep(i,n){
        string s;
        cin>>s;
        if(s=="AC") cnt[0]++;
        else if(s=="WA") cnt[1]++;
        else if(s=="TLE") cnt[2]++;
        else if(s=="RE") cnt[3]++;
    }

    cout<<"AC x "<<cnt[0]<<endl;
    cout<<"WA x "<<cnt[1]<<endl;
    cout<<"TLE x "<<cnt[2]<<endl;
    cout<<"RE x "<<cnt[3]<<endl;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  string s1 = "CODEFESTIVAL2016";
  string s;
  cin>>s;
  ll ans = 0;
  rep(i,0,s1.sz){
    if(s[i]!=s1[i])ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 764
#include <stdio.h>
int main () {
    int n, x;
    int count = 0;
    scanf("%d %d", &n, &x);
    while((n != 0) || (x != 0)) {
        for(int i = 3; i <= n; i++) {
            for (int j = 2; j < i; j++) {
                for (int k = 1; k < j; k++){
                    if (i + j + k == x) count++;
                }
            }
        }
        printf("%d\n", count);
        scanf("%d %d", &n, &x);
        count = 0;
    }
    return 0;
}



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

const int INF = (1LL<<31)-1;

class RUQ{
public:
    int N;
    vector<int> data;
    vector<int> times;
    
    void update(int time, int a, int b, int x, int k, int l, int r){
        if(a <= l && r <= b){
            if(times[k] < time){
                data[k] = x;
                times[k] = time;
            }
            return;
        }
        if(b <= l || r <= a)
            return;
        update(time, a, b, x, 2*k+1, l, (l+r)/2);
        update(time, a, b, x, 2*k+2, (l+r)/2, r);
    }
    
public:
    RUQ(int N_){
        N = 1;
        while(N < N_)
            N <<= 1;
        data.assign(2*N-1, INF);
        times.assign(2*N-1, -1);
    }
    void update(int time, int s, int t, int x){
        update(time, s, t, x, 0, 0, N);
    }
    int find(int x){
        x += N-1;
        int res = INF;
        int time = -1;
        while(true){
            if(time < times[x]){
                time = times[x];
                res = data[x];
            }
            if(x == 0)
                break;
            x = (x-1)/2;
        }
        return res;
    }
};

int main(){
    int N, Q;
    cin >> N >> Q;
    
    RUQ ruq(N);
    
    for(int i=0; i<Q; i++){
        int com; cin >> com;
        if(com == 0){
            int s, t, x;
            cin >> s >> t >> x;
            ruq.update(i, s, t+1, x);
        }
        if(com == 1){
            int i; cin >> i;
            cout << ruq.find(i) << endl;
        }
    }
    
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(vi c, vi d){
	return c.S < d.S;
}

bool is_prime(int n){
	bool test = false;
	for(int i = 2; i*i <= n; i++){
		if(n % i == 0){
			test = true;
			break;
		}
	}
	return test;


}

int main() {
	int N;
	cin >> N;
	while(is_prime(N)) ++N;
	
	cout << N;
	

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>  // sort, 二分探索, etc
#include <iomanip>  // setprecision (浮動小数点の出力の誤差)
#include <map>
#include <queue>
#include <set>
#include <stack>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a,i##_len=(b);i<i##_len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define cauto const auto&
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SIZE(x) ((ll)(x).size()) // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

using namespace std;
using ll = long long;
using ull = unsigned long long;

template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return true;}return false;}

const char newl = '\n';

ll qp(ll a,ll b){ll ans=1;do{if(b&1)ans*=a;a*=a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mod){ll ans=1;do{if(b&1)ans=ans*a%mod;a=a*a%mod;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll comb(int n, int r) {
    vector<vector<ll> > v(n+1, vector<ll>(r+1, 0));
    for(int i=0;i<n+1;i++) {v[i][0]=1; if(i < r+1)v[i][i]=1; }
    for(int i=1;i<n+1;i++) {for(int j=1;j<min(i,r+1);j++) {v[i][j]=v[i-1][j-1]+v[i-1][j];}}
    return v[n][r];
}

// INT_MAX   = 2.1e+09 (2147483647)
// LONG_MAX  = 9.2e+18 (9223372036854775807)
// LLONG_MAX = 9.2e+18 (9223372036854775807)


int main() {
    ll n;
    cin >> n;
    vector<string> vec;
    rep(i, n) {
        string x;
        cin >> x;
        vec.push_back(x);
    }
    sort(all(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());

//    UNIQUE(vec);
    cout << vec.size() << newl;


    return 0;
}


Measured memory_bytes: 9068
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

int main()
{
  char S[4];
  char T[4];

  cin >> S;
  cin >> T;
  int ans = 0;
  REP(i, 3){
    if(S[i]==T[i]){
      ans++;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

int limit;
char cand[] = {0, 1};
int ans = 0;
int denkyu = 0;
vector<set<int>> ccond;   // 電球のスイッチ接続条件
vector<int> parr;         // スイッチの個数のparity


void dfs(vector<int> &v, int i) {
    if (i == limit) {
        //   電球毎に調べる
        int num_on = 0;
        for (int j = 0; j < ccond.size(); j++) {
            //  現在の電球
            set<int> cur_cond = ccond[j];  // 現在の電球の条件
            int curp = parr[j];  // スイッチの個数のparity

            //  スイッチの状態
            int num = 0;
            for (int i = 0; i < limit; i++) {
                if (v[i] == 1) {
                    if (cur_cond.find(i + 1) != cur_cond.end()) {
                        num++;
                    }
                }
            }
            if (num % 2 == curp) {
                num_on++;
            }
        }
        if (num_on == denkyu) {
            ans++;
        }
        return;
    }

    //  ON
    v.push_back(1);
    dfs(v, i+1);
    v.pop_back();

    //  OFF
    v.push_back(0);
    dfs(v, i+1);
    v.pop_back();
    return;
}

int main(int argc, char *argv[]) {
    //
    //  N個のスイッチの状態を全探索する 
    //   
    int N, M;
    cin >> N >> M;
    limit = N;
    denkyu = M;


    for (int i = 0; i < M; i++) {
        int n;
        cin >> n;
        set<int> tarr;
        for (int j = 0; j < n; j++) {
            int k;
            cin >> k;
            tarr.insert(k);
        }
        ccond.push_back(tarr);
    }

    for (int k = 0; k < M; k++) {
        int c;
        cin >> c;
        parr.push_back(c);
    }

    vector<int> v;
    dfs(v, 0);

    cout << ans << endl;
    return 0;
}


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

#
B = [0 for _ in range(N)]
B[0] = A[0]
for i in range(1, N):
    B[i] = B[i-1] + A[i]

B.reverse()
A.reverse()

# print(A)
# print(B)

# [40, 30, 20, 7, 2, 1]
# [100, 60, 30, 10, 3, 1]


i = 1
while i < N:
    if A[i-1] > B[i] * 2:
        break
    i += 1

print(i)



Measured memory_bytes: 64232
/* constant */

#define MAX_P   (10000000)

/* global variables */

static char primes[MAX_P + 1];

/* subroutines */

void gen_primes(int max_p) {
  int p, q, s_max_p;

  primes[0] = primes[1] = 0;
  for (p = 2; p <= max_p; p++) primes[p] = 1;

  s_max_p = (int)sqrt((double)max_p + 0.5);

  for (p = 2; p <= s_max_p; p++)
    if (primes[p])
      for (q = p * p; q <= max_p; q += p)
        primes[q] = 0;
}

/* main */

int main(int argc, char **argv) {
  int k, n;

  gen_primes(MAX_P);

  while (1) {
    scanf("%d", &n);
    if (n == 0) break;

    for (k = n; k >= 13; k--)
      if (primes[k] && primes[k - 2] && primes[k - 6] && primes[k - 8]) {
        printf("%d\n", k);
        break;
      }
  }

  return 0;
}

Measured memory_bytes: 10360
from collections import Counter
input()
a = [int(x) for x in input().split()]

sum_ = sum(a)
d = Counter(a)

q = int(input())
for i in range(q):
    # print(d)
    b, c = map(int, input().split())
    n = d[b]
    d[b] = 0
    if(c in d):
        d[c] += n
    else:    
        d[c] = n
    
    print(sum_ + n * (c - b))
    sum_ += n * (c - b)


Measured memory_bytes: 24000
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    val Array(a, b, k) = sc.nextLine.split(" ").map(_.toInt)
    (a to b).foreach(i => if (i < a + k || i > b - k) println(i))
  }
}


Measured memory_bytes: 25536
n,m=map(int ,input().split())
h=list(map(int ,input().split()))
N=[[i] for i in range(n)]
c=0
for i in range(m):
    a,b=map(int, input().split())
    N[a-1].append(b-1)
    N[b-1].append(a-1)
for i in range(n):
    l=N[i]
    if len(l)==1:
        c+=1
    else:
        max=0
        for j in range(1,len(l)):
            if h[l[j]]>max:
                max=h[l[j]]
        if h[l[0]]>max:
            c+=1
print(c)

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

int main() {
	int X, N;
	cin >> X >> N;
	vector<bool> pi(1000, false);
	for (int n = 0; n < N; n++) {
		int temp_pi;
		cin >> temp_pi;
		pi[temp_pi] = true;
	}
	int i = 0;
	int now = X;
	int ans = X;
	while (true) {
		if (pi[now] == false) {
			ans = now;
			break;
		}
		i++;
		now = max(X - i,0);
		if (pi[now] == false) {
			ans = now;
			break;
		}
		now = min(X + i,999);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3624
/*
**   Contest : AtCoder Beginner Contest 177
**   Problem : C - Sum of product of pairs
**
**    Author : Dhiraj Govindvira
**      Date : 29-Aug-2020 ~ Saturday
**      Time : 07:20:43 PM
*/

#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define FOR(i, a, b, s)     for(ll i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define FOR1(b)             FOR(i, 0, b, 1)
#define FOR2(i, b)          FOR(i, 0, b, 1)
#define FOR3(i, a, b)       FOR(i, a, b, (a) <= (b) ? 1 :-1)
#define FOR4(i, a, b, s)    FOR(i, a, b, s)
#define GET5(a, b, c, d, e, ...) e
#define FORC(...)           GET5(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)
#define loop(...)           FORC(__VA_ARGS__)(__VA_ARGS__)
#define all(x)              x.begin(), x.end()
#define rall(x)             x.rbegin(), x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename... T> 
inline void inp(T&... args) {
    ((cin>>args), ...);
}
// scan vector
template <typename T> 
inline istream& operator >>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream& operator >>(istream &in, pair<T, U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

const ll Mod = 1e9 + 7;
inline ll md(ll x, ll M = Mod)
{
    x %= M;
    return ((x < 0) ? (x + M) : x);
}

void solve(int &T)
{
    ll n;
    cin >> n;
    
    vector<ll> a(n);
    cin >> a;

    vector<ll> suf(n, 0);
    ll sm = 0;
    loop(i, n) {
        sm += a[n - i - 1];
        suf[n - i - 1] = sm;
    }
    d(suf);

    ll ans = 0;
    loop(i, n - 1) {
        ans = md(ans + md(a[i] * md(suf[i + 1])));
    }
    cout << ans << endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt", "r", stdin);
        freopen("D:/dhiraj/Programming/o1.txt", "w", stdout);
        // freopen("D:/dhiraj/Programming/e1.txt", "w", stderr);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    for(int i = 1; i <= t; i++) {
        cerr << "Case #" << i << "\n";
        solve(i);
    }
    return 0;
}

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

using namespace std;


#define MAXN 101
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, a[2*MAXN];
  cin >> n;
  for (int i = 0; i < 2*n; ++i) {
    cin >> a[i];
  }
  sort(a, a+2*n);
  int ans = 0;
  for (int i = 0; i < 2*n; i+=2) {
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int N;scanf("%d",&N);
    int p[N];
    int max=0;
    int ans=0;
    int ind=0;
    for(int i=0;i<N;i++){
        scanf("%d",&p[i]);
            if(max<p[i]){
                max=p[i];
                ind=i;
            }   
        ans+=p[i];
    }
    ans-=p[ind]/2;
    printf("%d",ans);
    return 0;
}

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


using namespace std;

const int INF = 2e9 + 3;
const int N = 1e2 + 3;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

const double PI = acos(-1);


void solve() {
    int n, d;
    cin >> n >> d;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        double dist = sqrt(1ll * x * x + 1ll * y * y);
        if (dist <= d)
            ans++;
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t;
    t = 1;
    while (t--) {
        solve();
    }
}

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

int main() {
    string a;
    cin>>a;
    if(a[0]==a[1]&&a[1]!=a[2]&&a[2]==a[3]){
        cout<<"Yes"<<endl;
    }
    else if(a[0]==a[2]&&a[2]!=a[1]&&a[1]==a[3]){
        cout<<"Yes"<<endl;
    }
    else if(a[0]==a[3]&&a[3]!=a[2]&&a[1]==a[2]){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    readint;
    auto a = readints;

    auto rates = new int[8];
    int redOver = 0; // (>= 3200)
    foreach (x; a) {
        if (x < 3200) rates[x / 400]++;
        else redOver++;
    }

    auto x = rates.count!(e => e > 0);
    writeln(max(x, 1), " ", x + redOver);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};


int main(){
    string s;
    cin >> s;
    queue<int> que;
    vector<int> ans(s.size());
    for(int i = 0;i < s.size();i++){
        if(s.at(i) == 'R'){
            que.push(i);
        }else{
            while(!que.empty()){
                int q = que.front();
                que.pop();
                int dis = abs(i - q);
                if(dis%2 == 1){
                    ans.at(i-1)++;
                }else{
                    ans.at(i)++;
                }
            }
        }
    }
    for(int i = s.size()-1;i >= 0;i--){
        if(s.at(i) == 'L'){
            que.push(i);
        }else{
            while(!que.empty()){
                int q = que.front();
                que.pop();
                int dis = abs(i - q);
                if(dis%2 == 1){
                    ans.at(i+1)++;
                }else{
                    ans.at(i)++;
                }
            }
        }
    }
    for(int i : ans){
        cout<<i<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
#define trav(x,c) for(auto &x:c)
using namespace std;

int toint(string s) {
  int ans = 0;
  for(char x: s) ans = ans*10 + (x - '0');
  return ans;
}

int sum(int x) {
  int s = 0;
  while(x) {
    s += x%10;
    x /= 10;
  }
  return s;
} 

int main() {
  int n;
  cin>>n;
  int max = -1, ans = 0;
  
  fr(i,1,n+1) {
    int d = 0;
    int j = i;
    while(j) {
      if(j%2 == 0) {
        d++;
        j /= 2;
      }
      else break;
    }
    if(d > max) {
      max = d;
      ans = i;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define bp  __builtin_popcount
#define pb push_back
#define sz(s) (int)(s.size())

using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=1e6+5;
const  double EPS = 1e-14;
const int MOD = 1e9+7;
/*
ll GCD(ll a,ll b){return (a)?GCD(b%a,a):b;}
ll LCM(ll a, ll b){return a*b/GCD(a,b);}
ll fastpow(ll b, ll p){if(!p)return 1;ll ret = fastpow(b, p >> 1);ret *= ret;if(p&1)ret*= b;return ret;}
*/
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
   // freopen("in.txt", "r", stdin);
#endif
    int n;
    string s,t;
    cin >> n >> s >> t;
    for (int i = n; i >= 0; --i)
    {
        if (s.substr(n - i, i) == t.substr(0, i))
        {
            cout << 2 * n - i << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(void)
{
  int num;
  int i;
 
  scanf("%d", &num);
 
  for(i=1;i<=num;i++)
    {
      if (i%3==0)
    printf(" %d", i);
      else if (i%10==3)
    printf(" %d", i);
      else if (i/10==3)
    printf(" %d", i);
      else if (i/10%10==3)
    printf(" %d", i);
      else if (i/10/10%10==3)
    printf(" %d", i);
      else if (i/100==3)
    printf(" %d", i);
      else if (i/1000==3)
    printf(" %d", i);
    }
 
  printf("\n");
 
  return 0;
}
 

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e10;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;

int main() {
    int n,p[21],c = 0;
    cin >> n;
    rep(i,n) cin >> p[i];
    rep(i,1,n-1){
        if ((p[i-1] < p[i] && p[i] < p[i+1]) || (p[i-1] > p[i] && p[i] > p[i+1])) c++;
    }
    PRINT(c);
}

Measured memory_bytes: 256
s=input()
canw=0
canb=0
for i in range(len(s)):
  if i%2==1:
    if s[i]=='1':
      canw+=1
    else:
      canb+=1
  elif i%2==0:
    if s[i]=='1':
      canb+=1
    else:
      canw+=1

print(min(canb,canw))

Measured memory_bytes: 9224
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	ll n;
	cin>>n;
	std::vector<double> v(n);
	for (int i = 0; i < n; ++i)
	{
		cin>>v[i];
	}
	sort(v.begin(),v.end());
	for (int i = 0; i < n-1; ++i)
	{
		v[i+1]=(v[i]/2+v[i+1]/2);
	}
	cout<<v[n-1]<<"\n";

}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

static const ll MOD = 2;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll a, b, c;
    ll aa, bb, cc;
    ll ans = 0;

    cin >> a >> b >> c;

    if (a % MOD == 0 && b % MOD ==  0 && c % MOD == 0 && a == b && b == c) {
        cout << -1 << endl;

        return 0;
    }

    while (true) {
        if (a % MOD == 1 || b % MOD == 1 || c % MOD == 1) break;

        aa = a / 2;
        bb = b / 2;
        cc = c / 2;

        a = bb + cc;
        b = aa + cc;
        c = aa + bb;

        ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

typedef long double D;
typedef complex<D> P;
typedef pair<D,int> pdi;

const D INF = 1e100L;

void mainmain(){
	D xs, ys, xt, yt;
	int n;
	cin >> xs >> ys >> xt >> yt >> n;
	vector<P> cs(n + 2);
	vector<D> rs(n + 2);
	cs[n] = P(xs, ys);
	cs[n + 1] = P(xt, yt);
	for(int i = 0; i < n; ++i){
		D x, y;
		cin >> x >> y >> rs[i];
		cs[i] = P(x, y);
	}

	vector<D> ds(n + 2, INF);
	ds[n] = 0;
	priority_queue<pdi,vector<pdi>,greater<pdi> > pq;
	pq.emplace(0, n);
	while(!pq.empty()){
		D d = pq.top().first;
		int u = pq.top().second;
		pq.pop();
		if(ds[u] != d){ continue; }
		for(int i = 0; i < n + 2; ++i){
			D nd = d + max(abs(cs[u] - cs[i]) - rs[u] - rs[i], 0.0L);
			if(ds[i] > nd){
				ds[i] = nd;
				pq.emplace(nd, i);
			}
		}
	}
	
	cout << ds.back() << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


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

int main(){
    const int INF = 1000000000;
    int h, n;
    cin >> h >> n;
    vector<int> a(n);
    vector<int> b(n);
    rep(i, n){
        cin >> a[i] >> b[i];
    }
    vector<vector<int>> dp(n+1, vector<int>(h+1, INF));
    dp[0][0] = 0;
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= h; j++){
            if(j <= a[i]){
                dp[i+1][j] = min(dp[i][j], b[i]);
                
            }else{
                dp[i+1][j] = min(dp[i][j], dp[i+1][j-a[i]] + b[i]);
            }
        }
    }
    cout << dp[n][h] << endl;
}

Measured memory_bytes: 39424
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        string[] input = ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
        int a = int.Parse(input[2]);
        int b = int.Parse(input[3]);
//        string temp = ReadLine();
//        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        int c = int.Parse(ReadLine());
//        int d = int.Parse(ReadLine());
//        string a = ReadLine();
//        string b = ReadLine();
//        string c = ReadLine();
        if(Abs(n-a) <= b || (Abs(n-m) <= b && Abs(m-a) <= b)){
            WriteLine("Yes");
        }else{
            WriteLine("No");
        }
    }
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    ll total = 0;
    rep(i, m) {
        int ai;
        cin >> ai;
        total += ai;
    }
    
    if (total > n) {
        cout << -1 << endl;
        return 0;
    }
    
    cout << n - total << endl;
    return 0;
}


Measured memory_bytes: 7220
#include <bits/stdc++.h>
using LL = long long;
using namespace std;
class UnionFind{
public:
    vector<int> data;
    UnionFind(int s) : data(s,-1){}
    int root(int x){
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    bool connect(int x,int y){
        x = root(x);y = root(y);
        if(x != y){
            if(data[x] > data[y])swap(x,y);
            data[x] += data[y];data[y] = x;
        }
        return x != y;
    }
    bool check(int x,int y){
        return root(x) == root(y);
    }
    int size(int x){
        return -data[root(x)];
    }
};

int main(){
    int N,M;cin >> N >> M;
    UnionFind Uni(N+M);
    for(int a = 0;a < N;a++){
        int k;cin >> k;
        for(int b = 0;b < k;b++){
            int d;cin >> d;
            Uni.connect(a,N-1+d);
        }
    }
    int r = Uni.root(0);
    bool flag = true;
    for(int a = 0;a < N;a++){
        if(r != Uni.root(a)){
            flag = false;
        }
    }
    cout<<(flag?"YES":"NO")<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int curd;
int l;
int n,x;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>x;
	for(int i=1;i<=n;i++){
		cin>>l;
		curd+=l;
		if(curd>x){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<n+1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const LL INF=1<<28;


string s;
int t[26];
vector<string> a;

void dfs(int k){
    if(k==s.length()){
        a.pb(s);
        return ;
    }
    bool f=t[s[k]-'a'],ff=t[s[k]-'a'+1];
    if(!f&&ff&&s[k]!='a') return ;
    if(f||s[k]=='a'){
        dfs(k+1);
    }
    if(!ff&&s[k]!='z'){
        s[k]=(char)(s[k]+1);
        t[s[k]-'a']=1;
        dfs(k+1);
        t[s[k]-'a']=0;
        s[k]=(char)(s[k]-1);
    }
    return ;
}

int main(){
    while(cin >> s){
        if(s=="#") break;
        a.clear();
        memset(t,0,sizeof(t));
        dfs(0);
        if(a.size()==1&&a[0]==s){
            puts("0");
            continue;
        }
        cout << a.size() << endl;
        if(a.size()<=10){
            sort(ALL(a));
            for (int i = 0; i < a.size(); i++) {
                cout << a[i] << endl;
            }
        }
        else{
            sort(ALL(a));
            for (int i = 0; i < 5; i++) {
                cout << a[i] << endl;
            }
            sort(RALL(a));
            for (int i = 0; i < 5; i++) {
                cout << a[4-i] << endl;
            }
        }
    }
    return 0;
}




Measured memory_bytes: 4108
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;

int main() {
    long long n, h[100], k[100] = {0};
    long long i, l, r, ans = 0;

    cin >> n;
    rep(i, n) {
        cin >> h[i];
    }

    while (true) {
        for (l = 0; l < n; l++) {
            if (k[l] < h[l]) break;
        }

        for(r = l; r < n; r++) {
            if (k[r] == h[r]) break;
        }

        if (l == n and r == n) break;

        for (i = l; i < r; i++) k[i]++;

        ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
    public static void main(String args[]){
      Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        String check = scanner.nextLine();

        if (check.matches(input + "[a-z]")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 26984
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,a,i,b,call=0,cov=0;
    string s;
    cin>>n>>a>>b>>s;
    for(i=0;i<n;i++)
    {
        if(s[i]=='a' && call!=a+b)
        {
            call++;
            cout<<"Yes\n";
        }
        else if(s[i]=='b' && call!=a+b && cov!=b)
        {
            call++;
            cov++;
            cout<<"Yes\n";
        }
        else cout<<"No\n";
    }
}


Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
  		cin>>a[i];
 	int dp[n];
  for(int i=0;i<n;i++)
    dp[i]=INT_MAX;
  dp[0]=0;
  for(int i=1;i<n;i++)
    for(int j=1;j<=k;j++)
      if(i-j>=0)
        dp[i]=min(dp[i],(dp[i-j]+abs(a[i]-a[i-j])));
  cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
n, m = map(int, input().split())
A = set()
for i in range(m):
    a = int(input())
    A.add(a)
dp = [0] * (n + 1)
for i in range(n + 1):
    if i in A:
        dp[i] = 0
    else:
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])

"""
100 5
1
23
45
67
89
"""


Measured memory_bytes: 11884
/**
 *    author:  FromDihPout
 *    created: 2020-08-18
**/

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


const int INF = 1e8;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    vector<pair<int,int>> a(m);
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        a[i] = {x, y};
    }
    sort(a.begin(), a.end());
    
    int ans = 1;
    int l = -INF, r = INF;
    for (int i = 0; i < m; i++) {
        int x = a[i].first, y = a[i].second;
        if (x >= r) {
            l = x;
            r = y;
            ans++;
        }
        else {
            l = max(l, x);
            r = min(r, y);
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 3988
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if(a==5 && b==5 && c==7) {
			System.out.println("YES");
			
		} else if(a==5 && b==7 && c==5) {
			System.out.println("YES");
			
		} else if(a==7 && b==5 && c==5) {
			System.out.println("YES");
			
		} else {
			System.out.println("NO");
			
		}	 
  	}
}

Measured memory_bytes: 23764
n=int(input())
house=list(map(int,input().split()))

min=10000
for j in range(2001):
    dis=[]
    for i in range(n):
        dis.append(abs(house[i]-j))
    a=max(dis)
    #print(a)
    if min>a:
        min=a
    else:
        pass
print(min)  


Measured memory_bytes: 5624
#include <cstdio>
using namespace std;

int main()
{
  int a, b;
  scanf("%d %d", &a, &b);

  if (a >= 13)
  {
    printf("%d\n", b);
  }
  else if (6 <= a && a <= 12)
  {
    printf("%d\n", b / 2);
  }
  else
  {
    printf("%d\n", 0);
  }

  return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  
  if(a == b) {
    cout << "Draw" << endl;
  }
  else if( a == 1){
    cout << "Alice" << endl;
  }
  else if(b == 1){
    cout << "Bob" << endl;
  }
  else if (a > b){
    cout << "Alice" << endl;
  }
  else if (a < b) {
    cout << "Bob" << endl;
  }
  

}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<utility>

using namespace std;

char f(char c) {
  if(c == 'B') return 'W';
  return 'B';
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<long long> x(n), y(n);
  vector<char> c(n);
  for(int i = 0; i < n; i++) cin >> x[i] >> y[i] >> c[i];
  for(int i = 0; i < n; i++) {
    x[i] = (x[i] % (2 * k));
    y[i] = (y[i] % (2 * k));
  }
  for(int i = 0; i < n; i++) {
    if(x[i] >= k) {
      x[i] %= k;
      c[i] = f(c[i]);
    }
    if(y[i] >= k) {
      y[i] %= k;
      c[i] = f(c[i]);
    }
  }
  
  vector<vector<int>> wc(k + 1), bc(k + 1), wn(k + 1), bn(k + 1);
  for(int i = 0; i < k + 1; i++) {
    wc[i].resize(k + 1);
    bc[i].resize(k + 1);
    wn[i].resize(k + 1);
    bn[i].resize(k + 1);
  }
  for(int i = 0; i < n; i++) {
    if(c[i]  == 'B') {
      bc[y[i] + 1][x[i] + 1]++;
    } else {
      wc[y[i] + 1][x[i] + 1]++;
    }
  }
  for(int i = 1; i < k + 1; i++) {
    for(int j = 1; j < k + 1; j++) {
      wn[i][j] = wn[i][j - 1];
      wn[i][j] += wc[i][j] + wn[i - 1][j] - wn[i - 1][j - 1];
      bn[i][j] = bn[i][j - 1];
      bn[i][j] += bc[i][j] + bn[i - 1][j] - bn[i - 1][j - 1];
    }
  }
  int bcnt = 0;
  for(int i = 0; i < n; i++) if(c[i] == 'B') bcnt++;
  int ans = 0;
  for(int i = 0; i < k; i++) {
    for(int j = 0; j < k; j++) {
      int ww = wn[k][k] - wn[k][j] - wn[i][k] + wn[i][j] * 2;
      int bb = bcnt - (bn[k][k] - bn[k][j] - bn[i][k] + bn[i][j] * 2);
      ans = max(ans, ww + bb);
      ans = max(ans, n - ww - bb);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 17664
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, char> pic;
const ll MOD = (ll)1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

ll fac[1] = {1}, inv[1] = {1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll mp(ll a,ll b){ll ret=1;while(b){if(b&1)ret=ret*a%MOD;a=a*a%MOD;b>>=1;}return ret;}
ll cmb(ll r, ll c) {return fac[r] * inv[c] % MOD * inv[r - c] % MOD;}

int p[5000];
int spa[5000][30];
ll cc[5000][30];
ll c[5000];

int main() {
    int n,k;
    scanf("%d %d", &n, &k);

    for (int i = 0; i < n; i++) {
        scanf("%d", &p[i]);
        p[i]--;
        spa[i][0] = p[i];
    }

    ll ans = -2e18;
    for (int i = 0; i < n; i++) scanf("%lld", &c[i]);   // 여기로 오는 비용이잔항.

    for (int i = 0; i < n; i++) cc[i][0] = c[p[i]];

    for (int j = 1; j < 30; j++) {
        for (int i = 0; i < n; i++) {
            cc[i][j] = cc[spa[i][j-1]][j-1] + cc[i][j-1];
            spa[i][j] = spa[spa[i][j-1]][j-1];
            // printf("%d : %d / %lld\n", i,j,cc[i][j]);
        }
    }

    for (int i = 0; i < n; i++) {
        ll now;
        int nn;
        for (int kk = k; kk >= k-n && kk >= 1; kk--) {
            now = 0;
            nn = i;

            for (int j = 29; j >= 0; j--) {
                if (kk & (1 << j)) {
                    now += cc[nn][j];
                    nn = spa[nn][j];
                }
            }
            ans = max(ans, now);
        }

        for (int kk = 1; kk <= n && kk <= k; kk++) {
            now = 0;
            nn = i;

            for (int j = 29; j >= 0; j--) {
                if (kk & (1 << j)) {
                    now += cc[nn][j];
                    nn = spa[nn][j];
                }
            }
            ans = max(ans, now);
        }
    }

    printf("%lld", ans);
}


Measured memory_bytes: 5640
/*________________________Bismillahir Rahmanir Rahim___________________
|                                                                      |
|                    /\     |     | |\    |     /\     |-------        |
|                   /  \    |     | | \   |    /  \    |               |
|                  /----\   |-----| |  \  |   /----\   |-----          |
|                 /      \  |     | |   \ |  /      \  |               |
|                /        \ |     | |    \| /        \ |               |
|                     14th batch CSE , ID : 12008029                   |
|                     Comilla University                               |
|                     Email : sheikhahnafshifat@gmail.com              |
|______________________________________________________________________*/
#include<bits/stdc++.h>
using namespace std;
#define ll                      long long
#define MAX                     1234567
#define pb(x)                   push_back(x)
#define mp(x,y)                 make_pair(x,y)
#define vii                     vector<int>
#define vll                     vector<long long>
#define vp                      vector<pair<int, int> >
#define v_min(a)                *min_element(a.begin(),a.end())
#define v_max(a)                *max_element(a.begin(),a.end())
#define v_sum(a)                accumulate(a.begin(),a.end(),0)
#define un(a)                   a.erase(unique(a.begin(),a.end()),a.end())
#define SORT(a)                 sort(a.begin(),a.end())
#define AHNAF                   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define gcd(a,b)                __gcd(a,b)
#define lcm(a,b)                ((a)*(b))/gcd(a,b)
#define YES                     cout<<"YES"<<endl;
#define NO                      cout<<"NO"<<endl;
#define testcase(t)             int t;cin>>t;while(t--)
#define reverse(a)              reverse(a.begin(),a.end())
#define ff                      first
#define ss                      second
int main()
{
    AHNAF;
    double a;
    cin>>a;
    double ans=2*M_PI*a;
    cout<<ans;
}


Measured memory_bytes: 3804
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array

import qualified Data.ByteString.Char8 as B

main :: IO()
main = do
  n <- readLn :: IO Int
  -- cs <- replicateM n $ fmap words getLine :: IO [[String]]
  -- solve cs Leaf
  cs <- replicateM n B.getLine :: IO [B.ByteString]
  solve' cs

solve' :: [B.ByteString] -> IO ()
solve' = foldM_ go Leaf
  where  
    go :: Tree Int -> B.ByteString -> IO (Tree Int)
    go !tree bs
      | c == bInsert = val `seq` return $ insertTree val tree
      | c == bPrint = do 
        printTree tree
        return tree
      | c == bFind = do
        putStrLn $ if (elemTree val tree) then "yes" else "no"
        return tree
      where
        (c:cs) = B.words bs
        val = fst . fromJust . B.readInt $ head cs :: Int

bInsert = B.pack "insert"
bPrint = B.pack "print"
bFind = B.pack "find"


printTree tree = do
  putStrLn . (' ':) . unwords . map show $ inorder tree
  putStrLn . (' ':) . unwords . map show $ preorder tree

data Tree a = Leaf | Node !a (Tree a) (Tree a) deriving (Show)

insertTree :: (Ord a) => a -> Tree a -> Tree a
insertTree !c Leaf = Node c Leaf Leaf
insertTree !c !(Node v left right)
  = if v < c
    then Node v left (insertTree c right)
    else Node v (insertTree c left) right

inorder :: Tree a -> [a]
inorder Leaf = []
inorder (Node v left right) = (inorder left) ++ [v] ++ (inorder right)

preorder :: Tree a -> [a]
preorder Leaf = []
preorder (Node v left right) = v:(preorder left) ++ (preorder right)

elemTree :: (Ord a) => a -> Tree a -> Bool
elemTree _ Leaf = False
elemTree key (Node v left right)
  | key == v = True
  | key < v = elemTree key left
  | key > v = elemTree key right



Measured memory_bytes: 135012
W,H,N = map(int,input().split())

grid = []
for i in range(W):
  grid.append([])
  for j in range(H):
    grid[i].append(0)

for _ in range(N):
  x,y,a = map(int,input().split())
  if a == 1:
    for i in range(x):
      for j in range(H):
        grid[i][j] = 1
  elif a == 2:
    for i in range(x,W):
      for j in range(H):
        grid[i][j] = 1
  elif a == 3:
    for i in range(W):
      for j in range(y):
        grid[i][j] = 1
  else:
    for i in range(W):
      for j in range(y,H):
        grid[i][j] = 1
count = 0
for i in range(W):
  for j in range(H):
    count += 1 - grid[i][j]
print(count)

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

int main(){
	int a[5];
	int i, j, temp = 0;
	for(i = 0;i < 5;i++){
		cin >> a[i];
	}

	for(i = 0;i < 5;i++){
		for(j = i+1;j < 5;j++){
			if(a[i] < a[j]){
				temp = a[i];
				a[i] = a[j];
				a[j] = temp;
			}
			
		}
	}

	for(i = 0;i < 5;i++){
		if(i == 0){
			cout << a[i];
		}
		else{
			cout << " " << a[i];
		}
	}
	cout << endl;


	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long int
#define vi vector<int>
#define vii vector<pair<int,int>>
#define pi pair<int,int>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define deb(x) cerr<<#x<<" : "<<x<<endl;
#define fi first
#define se second
#define mi map<int,int>
#define PI   3.141592653589
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define f(i,x,n) for(int i=x;i<n;i++)
#define rf(i,x,n) for(int i=n;i>=x;i--)
#define check(x)   cerr<<#x<<" : "<<x<<endl;
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define fbo find_by_order
#define ook order_of_key
#define baar exit(0)
using namespace __gnu_pbds;
using namespace std;
int powmod(int base,int exponent)
{
	int ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base);
		base=(base*base);
		exponent/=2;
	}
	return ans;
}
vi v[100005],vis(100005);
void dfs(int x)
{
	vis[x]=1;
	for(int y:v[x])
	{
		if(!vis[y]) dfs(y);
	}
}
signed main()
{
  fast
  int n,m;
  cin>>n>>m;
  f(i,0,m)
  {
  	int x,y;cin>>x>>y;
  	v[x].pb(y);
  	v[y].pb(x);
  }
  int cnt=0;
  f(i,1,n+1)
  {
  	if(!vis[i])
  	{
  	   cnt++;
		 dfs(i);	
	}
  }
  cout<<cnt-1;
  cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
  return 0;
}
 

Measured memory_bytes: 10568
#include<bits/stdc++.h>
using namespace std;
#define bada 1000000000000000000

int64_t gcd(int64_t a, int64_t b)
{
    if(b)
        return gcd(b,a%b);
    return a;
}
int64_t lcm(int64_t a,int64_t b)
{
    return (a*b)/gcd(a,b);
}
int main ()
{
    int64_t n;
    cin>>n;
    int64_t a[n];
    for(int64_t i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int64_t sum=a[0];
    for(int64_t i=1;i<n;i++)
    {
        sum^=a[i];
    }
    for(int64_t i=0;i<n;i++)
    {
        a[i]=sum^a[i];
        cout<<a[i]<<" ";
    }
    cout<<endl;

}



Measured memory_bytes: 5128