akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#include <map>
#include <climits>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int,int> NODE;

map< int,vector<int> > info;

int bfs(int s,int d){
	queue<NODE> Q;
	
	map<int,bool>done;
	
	
	Q.push( make_pair(s,0) );

	while(!Q.empty()){
		NODE now = Q.front();
		Q.pop();
		done[now.first] = true;
		if(now.first == d){
			return now.second;
		}
		for(int i=0;i<info[now.first].size();i++){
			if(!done[info[now.first][i]])
				Q.push( make_pair(info[now.first][i],now.second+1));
		}
	}
	return INT_MAX;
}

int main(){
	int n,r,k,t;
	int p,s,d,v;
	
	cin >> n;
	
	for(int i=0;i<n;i++){
		cin >> r >> k;
		for(int j=0;j<k;j++){
			cin >> t;
			info[r].push_back(t);
		}
	}
	
	cin >> p;
	
	for(int i=0;i<p;i++){
		cin >> s >> d >> v;
		if(v > bfs(s,d) )cout << bfs(s,d)+1 << endl;
		else cout << "NA" << endl;
	}
}

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

typedef long long ll;

int main()
{
    ll i,j;
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    ll ans = 0;
    sort(a.begin(), a.end());
    
    int max_number = n;
    int MOD = 1e9+7;
    vector<ll> fnc(max_number+1,1);
    vector<ll> inv(max_number+1,1);
    for(i = 2;i <= max_number;++i){
        fnc.at(i) = fnc.at(i-1)*i%MOD;
        inv.at(i) = MOD - inv.at(MOD%i)*(MOD/i)%MOD;
    }
    vector<ll> finv(max_number+1,1);
    for(i = 2;i <= max_number;++i){
        finv.at(i) = finv.at(i-1)*inv.at(i)%MOD;
    }
    for(i = k-1;i < n;++i){
        ans += a.at(i)*(fnc.at(i)*(finv.at(i-k+1)*finv.at(k-1)%MOD)%MOD)%MOD;
        ans %= MOD;
    }
    for(i = 0;i < n-k+1;++i){
        ans += (MOD - a.at(i)*(fnc.at(n-1-i)*(finv.at(n-k-i)*finv.at(k-1)%MOD)%MOD)%MOD);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    string s;
    
    while( getline(cin, s) ){
        for(int i=0 ; i < s.size() ; i++ ){
            if( 'a' <= s[i] && s[i] <= 'z' ){
                s[i] = s[i] - 'a' + 'A';
            }
        }
        cout << s << endl;
    }
}

Measured memory_bytes: 1172
// 基本テンプレート

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int dp[50][100001];

struct Elem {
    int sum, mod;
    bool operator<(const Elem &a) const {
        if(sum != a.sum) return sum > a.sum;
        return dp[sum][mod] > dp[a.sum][a.mod];
    }
};

signed main() {
    int K; cin >> K;
    rep(i,0,50) rep(j,0,100001) dp[i][j] = INF;
    dp[0][0] = 0;

    // sum, mod
    priority_queue<Elem> q;
    q.push(Elem{0, 0});
    while(!q.empty()) {
        Elem cur = q.top(); q.pop();
        if(cur.sum != 0 && cur.mod == 0) {
            cout << cur.sum << endl;
            return 0;
        }
        rep(x,0,10) {
            int nsum = cur.sum + x;
            int nmod = (cur.mod * 10 + x) % K;
            if(nsum > 45) continue;
            if(dp[nsum][nmod] > dp[cur.sum][cur.mod] + 1) {
                dp[nsum][nmod] = dp[cur.sum][cur.mod] + 1;
                q.push(Elem{nsum, nmod});
            }
        }
    }
    return 0;
}

Measured memory_bytes: 105696
def solve(N, As):
    k = 0
    for i in range(1, N):
        k = As[i] - (k // 2)
        k *= 2

    k = As[0] - (k // 2) 
    ans = [k]
    for i in range(1, N):
        k = As[i] - (k // 2)
        k *= 2
        ans.append(k)
    ans.insert(0, ans.pop())
    return " ".join([str(a) for a in ans])



if __name__ == "__main__":
    N = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(N, As))


Measured memory_bytes: 19088
# -*- coding: utf-8 -*-
# abc139/abc139_d
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    n = N - 1
    print((n * (1 + n)) >> 1)
    return

main()


Measured memory_bytes: 3064
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val x = sc.nextInt()
  val a = (1..n).map { sc.nextInt() }

  println(abc116b(n, x, a))
}

private fun abc116b(n: Int, x: Int, a: List<Int>): Int {
  val sorted = a.sorted()
  var sum = 0

  var count = 0
  for (ai in sorted) {
    if (sum >= x) {
      break
    }
    sum += ai
    count++
  }
  if (sum != x) {
    count--
  }

  return count
}


Measured memory_bytes: 36032
#include <iostream>

using namespace std;

int count(int i, int j, int n) {
    int ret = 0;
    int m = n;
    int k = 0;
    while (m >= 10) {
        m /= 10;
        ++k;
    }
    if (k > 1) {
        if (m == i) {
            int l = 1;
            while (k-- > 0) l *= 10;
            ret += (n - i * l) / 10;
            if (n % 10 >= j) ++ret;
        } else if (m > i) {
            int l = 1;
            while (--k > 0) l *= 10;
            ret += l;
        }
    } else {
        if (n >= i * 10 + j) ++ret;
    }
    if (i == j && n >= i) ++ret;
    if (n > 99999) ret += 1000;
    if (n > 9999) ret += 100;
    if (n > 999) ret += 10;
    if (n > 99) ret += 1;
    return ret;
}

int main() {
    int n;
    cin >> n;
    int answer = 0;
    for (int i = 1; i < 10; ++i) {
        for (int j = 1; j < 10; ++j) {
            answer += count(i, j, n) * count(j, i, n);
        }
    }
    cout << answer << endl;
}


Measured memory_bytes: 256
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define REP(a) for(i = 0; i < a; i++)

int main(void) {
    int a,b;
    scanf("%d%d",&a,&b);
    double c = ceil(((double)a + (double)b) / 2.0);
    printf("%d\n",(int)c);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
	int H,W,N;
  	int n=0,count=0; //nは塗った数,countは塗った回数
 
  	scanf("%d", &H);
  	scanf("%d", &W);
  	scanf("%d", &N);
  
  	while(n<N){
     	if(H>W){
        	n += H;
          	count++;
        }
      	else{
        	n += W;
          	count++;
        }
    }
  
  	printf("%d", count);

  
	return 0;
}
  


Measured memory_bytes: 128
#include<iostream>
#include<cstring>
#include<sstream>

using namespace std;


int main() {
	string s;
	int n,nr=0;
	cin >> s;
	string x = "",y="";
	for (int i = 0;i <= s.size() - 1;i++) {
		x = x + s[i];
		if (x!=y) {
			nr++;
			y = x;
			x = "";
		}
	}

	cout << nr;

	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
    public static void main(String[] defargs) {
        Scanner scanner = new Scanner(System.in);
        int W = scanner.nextInt();
        int H = scanner.nextInt();
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int r = scanner.nextInt();
        if(x - r < 0 || x + r > W || y - r < 0 || y + r > H){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}



Measured memory_bytes: 26408
n,c=map(int,input().split())
l,L,m,M,C,a,x,v=[0],[0],[0],[0],0,0,[],[]
for i in range(n):X,V=map(int,input().split());x.append(X);v.append(V)
for i in range(n):C+=v[i];l.append(max(l[-1],C-x[i]));L.append(max(L[-1],C-2*x[i]))
C=0
for i in range(n)[::-1]:C+=v[i];m.append(max(m[-1],C-(c-x[i])));M.append(max(M[-1],C-2*(c-x[i])))
for i in range(n+1):a=max(a,l[i]+M[n-i],L[i]+m[n-i])
print(a)

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

using namespace std;

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

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

int main() {
  int n;
  S(n);
  rep(i,0,n+1) {
    int x = n - 4 * i;
    if(x >= 0 && x % 7 == 0) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 256
mod=[]
answer = 2018
count = 0
sub=0
mod = [int(i) for i in input().split()]
#if(mod[0]==mod[1]):
    #answer = (mod[0]*mod[1])%2019

for i in range(mod[0],mod[1]+1):
    if 2019<=mod[1]-mod[0]:
        answer = 0
        break
    for j in range(i+1,mod[1]+1):
        sub = (i*j)%2019
        if sub<answer:
            answer = sub
print(answer)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(void){
    string str;
    cin >> str;

    if(str.at(2) == str.at(3) && str.at(4) == str.at(5)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}

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

using namespace std;

vector <vector <int> > g(200005);
int used[200005];

void dfs(int n, int &tmp) {
    used[n] = 1;
    ++tmp;
    for (auto a : g[n]) {
        if (!used[a]) dfs(a, tmp);
    }
}


signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int ans = 0, tmp = 0;
    for (int i = 0; i < n; ++i) {
        if (!used[i]) {
            tmp = 0;
            dfs(i, tmp);
            ans = max(ans, tmp);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 25064
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn min (a: &i64, b: &i64)-> i64{
    if *a <= 0i64 {*b}
    else if *b <= 0i64  {*a}
    else if *a < *b {*a}
    else {*b}
}

fn abs (a: &i64, b: &i64) -> i64{
    if *a - *b <= 0 {*b - *a} else {*a - *b}
}

fn main(){
    input!{
        a: [usize; 5],
        s: chars
    }
    let mut bl = true;
    for i in a[1]-1 .. a[3]-2{
        if s[i] == '#' && s[i+1] == '#'{
            bl = false;
        }
    }
    for i in a[2]-1 .. a[4]-2{
        if s[i] == '#' && s[i+1] == '#'{
            bl = false;
        }
    }
    if a[3] > a[4] {
        let mut next = false;
        for i in a[2]-1..a[4] {
            if s[i-1] == '.' && s[i] == '.' && s[i+1] == '.'{
                next = true;
            }
        }
        bl &= next;
    }
    print!("{}", if bl {"Yes".to_string()} else {"No".to_string()})
}


Measured memory_bytes: 4352
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H1 = Integer.parseInt(sc.next());
        int M1 = Integer.parseInt(sc.next());
        int H2 = Integer.parseInt(sc.next());
        int M2 = Integer.parseInt(sc.next());
        int K = Integer.parseInt(sc.next());

        LocalDateTime date1 = LocalDateTime.of(2020,1,1,H1,M1,0);
        LocalDateTime date2 = LocalDateTime.of(2020,1,1,H2,M2,0);

        System.out.println(ChronoUnit.MINUTES.between(date1,date2)-K);
     }
}

Measured memory_bytes: 32620
N,Q=gets.chomp.split.map(&:to_i)
S=gets.chomp
csum = [0,0]
0.upto(N-2) do |i|
  if S[i,2] == 'AC'
    csum[i+2] = csum[i+1] + 1
  else
    csum[i+2] = csum[i+1]    
  end
end

Q.times do
  l,r=gets.chomp.split.map(&:to_i)
  puts csum[r]-csum[l]
end

Measured memory_bytes: 3452
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;


constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    void CCout(long long x, const char* end = "\n") { std::cerr << x << end; }
    template <typename T> void CCout(const T& x, const char* end = "\n") { std::cerr << x << end; }
    template <typename T> void CCout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cerr << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
        template <typename T, typename U> operator std::pair<T, U>() const { T f; U s; std::cin >> f >> s; return std::pair<T, U>(f, s); }
    };

    inp inp1; // input one
}

int main() {

    int x, y, z;
    cin >> x >> y >> z;

    cout << z << " " << x << " " << y << endl;

    return 0;
}


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

void chmax(int& a, int& b, int c, int& counter) {
  if (b < c) {
    a = b;
    b = c;
    counter = 1;
  } else if (b == c) {
    counter++;
  } else if (b > c && a < c) {
    a = c;
  }
}

int main() {
  int N;
  cin >> N;
  
  int A[N];
  int MAX = 0;
  int MAX_2 = 0;
  
  int MAX_count = 0;
  for (int i = 0; i < N; i++)  {
    int x;
    cin >> x;
    A[i] = x;
    
    chmax(MAX_2, MAX, x, MAX_count);
  }

  
  
  for (int i = 0; i < N; i++) {
    if (MAX_count >= 2) {
      cout << MAX << endl;
    } else {
      if (A[i] == MAX) {
        cout << MAX_2 << endl;
      } else {
        cout << MAX << endl;
      }
    }
  }
    
    
}

Measured memory_bytes: 2432
amari = 10

li = []
for i in range(5):
    a = int(input())
    if a % 10 == 0:
        li.append(a)
    else:
        li.append((a // 10 + 1) * 10)
        if a % 10 < amari:
            amari = a % 10


print(sum(li)-10+amari)


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int d=n%10;
    // cout<<d<<"\n";
    if(d==2 or d==4 or d==5 or d==7 or d==9){
        cout<<"hon\n";
    }
    if(d==0 or d==1 or d==6 or d==8){
        cout<<"pon\n";
    }
    if(d==3){
        cout<<"bon\n";
    }
}

Measured memory_bytes: 3624
#include<iostream>
#include<stdlib.h>
using namespace std;
#define INF 2100000000
int getData(int **table ,int i,int j){
	if(j<=0){
		return 0;
	}
	if(i<0){
		return INF;
	}
	return table[i][j];
}
void myprint(int **table,int N,int H){
	for(int i=0;i<N;i++){
		for(int j=0;j<=H;j++){
			cout << table[i][j] << " ";
		}
		cout << endl;
	}
}
int main(){
	int H,N;
	cin >> H;
	cin >> N;
	int **table=(int**)malloc(sizeof(int*)*N);
	int magic[N];
	for(int i=0;i<N;i++){
		table[i]=(int*)malloc(sizeof(int)*(H+1));
		int damage;
		cin >> damage;
		int cost;
		cin >> cost;
		for(int j=0;j<=H;j++){
			int from_above=getData(table,i-1,j);
			int from_left_above=getData(table,i-1,j-damage)+cost;
			int from_left=getData(table,i,j-damage)+cost;
			int min=(from_above < from_left ? from_above : from_left);
			min= ( min < from_left_above ? min : from_left_above);
			table[i][j]=min;
		}
	}
	
	//myprint(table,N,H);
	cout << table[N-1][H] << endl;


	return 0;
}


Measured memory_bytes: 39296
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);

int __inf_ignore(){
	int t = inf<int>;
	return t;
}

typedef pair<int,int> pii;

const string nl = "\n";

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int N;
	cin>>N;
	int M = (1<<N);
	multiset<int> S;
	REP(i,M){
		int s;cin>>s;
		S.insert(s);
	}
	vector<int> parent;
	auto it = S.end();
	it--;
	parent.push_back(*it);
	S.erase(it);
	for(int i = 0;i < N;i++){
		vector<int> child;
		for(auto &&p:parent){
			auto it = S.lower_bound(p);
			if(it == S.begin()){
				cout<<"No"<<endl;
				return 0;
			}
			it--;
			child.push_back(*it);
			S.erase(it);
		}
		parent.insert(parent.end(),ALL(child));
	}
	cout<<"Yes"<<endl;
}


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

double calcDistance(const int x[], const int y[], int n, int p);
double calcChebyshevDistance(const int x[], const int y[], int n);

int main(void)
{	
	int n, x[100], y[100];
	cin >> n;	
	for (int i = 0; i < n; i++) cin >> x[i];
	for (int i = 0; i < n; i++) cin >> y[i];
	
	cout << fixed << calcDistance(x, y, n, 1) << endl;
	cout << calcDistance(x, y, n, 2) << endl;
	cout << calcDistance(x, y, n, 3) << endl;
	cout << calcChebyshevDistance(x, y, n) << endl;
	
	return 0;
}

double calcDistance(const int x[], const int y[], int n, int p)
{
	long int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += pow(fabs(x[i] - y[i]), p);
	}
	
	return pow(sum, 1.0 / p);
}

double calcChebyshevDistance(const int x[], const int y[], int n)
{
	int max = 0;
	for (int i = 0; i < n; i++) {
		int d = fabs(x[i] - y[i]);
		if (d > max) max = d;
	}
	
	return max;
}

Measured memory_bytes: 3432
#include<stdio.h>
#include<string.h>

int main() {
    char w[11], t[1001];
    int cnt = 0;
    int i = 0;
    
    scanf("%s", w);
    
    for (i=0; w[i]!='\0'; i++) {
        if ('A' <= w[i] && w[i] <= 'Z') {
            w[i] += 'a' - 'A';
        }
    }
    
    while(1) {
        scanf("%s", t);
        
        if ( !strcmp("END_OF_TEXT", t) ) {
            break;
        }
        
        for (i=0; t[i]!='\0'; i++) {
            if ('A' <= t[i] && t[i] <= 'Z') {
                t[i] += 'a' - 'A';
            }
        }
        
        if ( !strcmp(w, t) ) cnt++;
    }
    
    printf("%d\n", cnt);
    return 0;
}



Measured memory_bytes: 2080
#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 FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  bool t = true;
  while (true) {
    if (t) {
      c -= b;
      if (c <= 0) {
        cout << "Yes" << endl;
        return 0;
      }
    } else {
      a -= d;
      if (a <= 0) {
        cout << "No" << endl;
        return 0;
      }
    }
    t = !t;
  }
  return 0;
}

Measured memory_bytes: 3636
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
a = int(input())
c = [int(input()) for i in range(a)]

from collections import defaultdict
d = defaultdict(int)
for i in c:
    d[i] += 1
cnt = 0
for v in d.values():
    cnt +=  v%2
print(cnt)

Measured memory_bytes: 16656
N, T = map(int, input().split())
A = [int(_) for _ in input().split()]
A.append(0)

Profit = []
tempMin = A[0]
tempMax = A[0]
for i in range(1, N+1):
    if tempMin > A[i]:
        Profit.append(tempMax - tempMin)
        tempMin = A[i]
        tempMax = A[i]
    if tempMax < A[i]:
        tempMax = A[i]

ans = Profit.count(max(Profit))
print(ans)

Measured memory_bytes: 14252
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define MOD 1000000007
typedef long long ll;
using namespace std;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int x,y; cin >> x >> y;
    bool flag = false;
    for(int i=0;i<=x;i++){
        if(2*i+4*(x-i) == y){
            flag = true;
            break;
        }
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3560
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
typedef long long int ll;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define MOD 1000000007
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);  
//*s.find_by_order(p)   returns the value of pth largest starting from 0 
//s.order_of_key(p)   returns no. of items that are strictly < p 
//string bin = bitset<64>(m).to_string();     convert decimal m to binary
int main()
{
	fast;ll t1;t1=1;
	while(t1--)
	{
		ll n,k,i;
		cin>>n;
		ll a[n+2],b[n+2];
		k=0;
		for(i=0;i<n;i++){
			cin>>a[i]>>b[i];
		}
		for(i=2;i<n;i++){
			if(a[i]==b[i] && a[i-1]==b[i-1] && a[i-2]==b[i-2]){k=1;}
		}
		if(k==1){cout<<"Yes\n";}
		else{cout<<"No\n";}
	}
}


Measured memory_bytes: 3664
N = int(input())
H = list(map(int,input().split()))

H[0]=H[0]-1
flag=0
for i in range(N-1):
    if H[i] > H[i+1]:
        flag=1
        break
    elif H[i] == H[i+1]:
        continue
    else:
        H[i+1]=H[i+1]-1

if flag==0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 63856
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;

void main() {
	int [] dp = new int[101];
	dp[] = 0;
	long n;
	while(!stdin.eof()) {
		auto s = readln().replace(",", " ").split();
		if(!s.empty()){
			int [] newdp;
			int offset;
			if(n < s.length) {
				offset = 1;
			} else {
				offset = 2;
			}
			n = s.length;
			newdp ~= 0;
			for(int i = 0; i < s.length; ++i) {
				newdp ~= max(dp[i+offset], dp[i-1+offset])+to!int(s[i]);
			}
			newdp ~= 0;
			dp = newdp;
		}
	}
	writeln(dp[1]);
}

Measured memory_bytes: 1236
H,W,m[10302];E(x,c){c=m[x];m[x]=10;m[x-W]-c||E(x-W);m[x+W]-c||E(x+W);m[x-1]-c||E(x-1);m[++x]-c||E(x);}main(r){for(;~scanf("%d%d\n",&H,&W);W-1&&printf("%d\n",r+1)){for(r=H*++W;r--;)m[r+W]=getchar();for(H*=W;H--;)m[H+W]-10&&E(H+W,r++);}}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - 台形 / Trapezoids
            var lines = ReadLines(3);
            int a = lines[0];
            int b = lines[1];
            int h = lines[2];

            Console.WriteLine((a + b) * h / 2);
        }

        static List<int> ReadLines(int count = 0)
        {
            //[summary]コンソールの値を読み込む
            var lines = new List<int>();
            string s;

            //読み込む行数が未指定のときは、1行目の値を"count"とみなす
            if (count == 0)
            {
                s = Console.ReadLine().TrimEnd();
                count = int.Parse(s);
            }

            for (int i = 0; i < count; i++)
            {
                s = Console.ReadLine().TrimEnd();
                lines.Add(int.Parse(s));
            }

            return lines;
        }
    }
}

Measured memory_bytes: 11092
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<math.h>
#include<cstring>
#include<iostream>
#include<stack>
#include<queue>
#include<functional>
#include<set>
#include<vector>
#include<map>
#include<stdlib.h>
#define ll long long
using namespace std;
int main(){
	int c[5][5],n,i,j,k,a[5],b[5],flag=0;
	for(i=1;i<=3;i++){
		for(j=1;j<=3;j++){
			scanf("%d",&c[i][j]);
		}
	}
	for(i=0;i<=100;i++){
		flag=1;
		a[1]=i;
		b[1]=c[1][1]-a[1];
		b[2]=c[1][2]-a[1];
		b[3]=c[1][3]-a[1];
		a[2]=c[2][1]-b[1];
		a[3]=c[3][1]-b[1];
		for(j=1;j<=3;j++){
			for(k=1;k<=3;k++){
				if(c[j][k]!=a[j]+b[k]){
					flag=0;
					
				}
			}
		}
		if(flag==1){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
n1 = int(readline())
if n1 % 2 == 1:
    print(0)
else:
    n1 //= 2
    ans = 0
    while n1:
        n1 //= 5
        ans += n1
    print(ans)

Measured memory_bytes: 3060
import re

p = 0
class N(int):
    def __add__(self,n):
        return N((int(self) + int(n)) % p)
    def __sub__(self,n):
        return N((int(self) - int(n)) % p)
    def __mul__(self,n):
        return N((int(self) * int(n)) % p)
    def __floordiv__(self,n):
        if not n:
            raise ZeroDivisionError
        return self*pow(int(n),p-2,p)

while True:
    s = input()
    p,s = s.split(':')
    p = int(p)
    if not p:
        break
    s = s.replace(' ','')
    try:
        n = eval(re.sub(r'(\d+)',r'N(\1)',s).replace('/','//'))
        print('%s = %s (mod %s)'%(s,n,p))
    except ZeroDivisionError:
        print('NG')

Measured memory_bytes: 22752
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;

int main(){
	cin>>n;
	bool B=0;
	for(int i=1;i<10;i++) for(int j=1;j<10;j++) if(i*j==n) B=1;
	cout<<(B?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int ans;
 
        while(true){
 
            try {
                String inputed = br.readLine();
                if(inputed.length() == 1 && inputed.equals("0"))break;
 
                ans = 0;
                for(int i = 0; i < inputed.length(); i++){
                    ans += inputed.charAt(i)-'0';
                }
 
                System.out.printf("%d\n", ans);
 
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}


Measured memory_bytes: 25056
#include<stdio.h>
int main(void)
{
	int H, W, i, j;
	scanf("%d %d", &H, &W);
	while (H != 0 || W != 0)
	{
		for (i = 0; i < H; i++)
		{
			for (j = 0; j < W; j++)
			{
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d", &H, &W);
	}
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;

    int ans = a + b;
    ans = max(ans, a - b);
    ans = max(ans, a * b);
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int[][] bingo = new int[3][3];
		int[] row = new int[101];
		int[] col = new int[101];
		for(int i = 0; i < 101; i++) {
			row[i] = -1;
			col[i] = -1;
		}
		for(int i = 0; i < 3; i++) {
			for(int j = 0; j < 3; j++) {
				bingo[i][j] = in.nextInt();
				row[bingo[i][j]] = i;
				col[bingo[i][j]] = j;
			}
		}
		int n = in.nextInt();
		for(int i = 0; i < n; i++) {
			int cur = in.nextInt();
			if(row[cur] != -1) {
				bingo[row[cur]][col[cur]] = 1;
			}
		}
		boolean ans = false || rw(0, bingo) || rw(1, bingo) || rw(2, bingo);
		ans |= cl(0, bingo) || cl(1, bingo) || cl(2, bingo);
		int c = 0;
		boolean temp = true;
		for(int i = 0; i < 3; i++) {
			if(bingo[i][c] != 1) temp = false;
			c += 1;
		}
		ans |= temp;
		temp = true;
		c = 0;
		for(int i = 2; i >= 0; i--) {
			if(bingo[i][c] != 1) temp = false;
			c += 1;
		}
		ans |= temp;
		if(ans == true) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
	public static boolean rw(int r, int[][] bingo) {
		for(int i = 0; i < 3; i++) {
			if(bingo[r][i] != 1) return false;
		}
		return true;
	}
	public static boolean cl(int c, int[][] bingo) {
		for(int i = 0; i < 3; i++) {
			if(bingo[i][c] != 1) return false;
		}
		return true;
	}
} 


Measured memory_bytes: 21844
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<utility>
#include<string>
#include<map>
#include<unordered_map>
#include<queue>

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

using namespace std;

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
ll gcd(int a, int b){return b ? gcd(b, a%b) : a;}
ll lcm(int a, int b){return a*b / gcd(a, b);}
const ll MAX = 1e9+7;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

    int pass = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(a[i][j] == '#') pass++;
        }
    }

    if(pass == h+w-1){
        cout << "Possible" << endl;
    }
    else{
        cout << "Impossible" << endl;
    }
    return 0;
}


Measured memory_bytes: 3620
package main
import "fmt"
const mod int64 = 1000000007
func main() {
  var n int
  fmt.Scan(&n)
  a := make([]int64,n)
  m := int64(0)
  s := int64(0)
  for i:=0;i<n;i++ {
    fmt.Scan(&a[i])
    s = (s+inv(a[i]))%mod
    if m < a[i] { m = a[i] }
  }
  for p:=int64(2);p*p<=m;p++ {
    x := 0
    for i:=0;i<n;i++ {
      y := 0
      for a[i]%p == 0 { a[i],y = a[i]/p,y+1 }
      if x < y { x = y }
    }
    s = (s*pow(p,x))%mod
  }
  set := make(map[int64]struct{})
  for i:=0;i<n;i++ {
    if a[i] != 1 { set[a[i]] = struct{}{} }
  }
  for k,_ := range set { s = (s*k)%mod }
  fmt.Println(s)
}
func pow(a int64,b int) int64 {
  p := int64(1)
  for b != 0 {
    if b&1 == 1 { p = (p*a)%mod }
    a,b = (a*a)%mod,b>>1
  }
  return p
}
func inv(n int64) int64 {
  var a,b,c,x int64 = (n%mod+mod)%mod,mod,0,1
  for b != 0 { a,b,c,x = b,a%b,x-(a/b)*c,c }
  return (x%mod+mod)%mod
}

Measured memory_bytes: 1664
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n;
  	cin >> n;
    vector<int> v(n);
    for(int i=0;i<n;i++)
    {
      cin >> v[i];
    }
    int cnt = 1;
    int minnum = v[0];
    for(int i=1;i<n;i++)
    {
        if(v[i]<minnum)
        {
            cnt++;
            minnum = v[i];
        }
    }
    cout << cnt << endl;
 
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VL a(n+1), b(n);
  rep(i, n+1) cin >> a[i];
  rep(i, n) cin >> b[i];
  ll ans = 0;
  rep(i, n) {
    ans += min(a[i], b[i]);
    b[i] -= min(a[i], b[i]);
    ans += min(a[i+1], b[i]);
    a[i+1] -= min(a[i+1], b[i]);
  }
  out(ans);
  return 0;
}


Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BSumo solver = new BSumo();
        solver.solve(1, in, out);
        out.close();
    }

    static class BSumo {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] s = in.next().toCharArray();

            int k = s.length;
            int n = 15;

            int wins = 0;
            for (int i = 0; i < k; i++) {
                if (s[i] == 'o') {
                    wins++;
                }
            }
            wins += n - k;

            String answer = wins >= 8 ? "YES" : "NO";
            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 23124
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		for(int i=1;i<=5;i++) {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		}
		
	}	
}
 


Measured memory_bytes: 35772
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	fmt.Println(Lcm(a, b))
}

func Gcd(x, y int) int {
	mod := x % y
	if mod > 0 {
		return Gcd(y, mod)
	} else {
		return y
	}
}

func Lcm(x, y int) int {
	return x * y / Gcd(x, y)
}


Measured memory_bytes: 512
#include <cstdio>

int main(){
	char cs[]="ABCDE";
	for(;;){
		int a,b;
		scanf("%d%d",&a,&b);
		if(a==0&&b==0) break;
		int ma=a+b;
		char c='A';
		for(int i=0;i<4;i++){
			scanf("%d%d",&a,&b);
			if(a+b>ma){
				ma=a+b;
				c=cs[i+1];
			}
		}
		printf("%c %d\n",c,ma);
	}
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

int main() {
    int A, B, C, D; cin >> A >> B >> C >> D;
    while (true) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
//#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define maxe max_element
#define mine min_element
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<ll,ll>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define debug(x) cerr<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define SIZE 5000 + 1
const ll MAX=1e9;
const ll mod=1e9;

ll expo(ll x,ll n){
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%mod;}
                x=(x*x)%mod;
                n>>=1;
    }
    return ans;
}


void solve()
{
    ll r;
    cin>>r;
    cout<<2*pai*r<<endl;
}

int main()
{
  boost;
  ll t=1;
 // cin>>t;
  while(t--)
  {

      solve();
  }
}


Measured memory_bytes: 3776
n, l = map(int, input().split())
a = 0
if l >= 0:
    a = (l+1+n + l -1)*(n-1)/2
    print(int(a))

elif l < 0 and -l < n:
    a = (l+n + l -1)*n/2
    print(int(a))
elif l < 0 and -l >=n:
    a = (l+ n + l -2)*(n-1)/2
    print(int(a))

Measured memory_bytes: 9212
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=1000000000000000003;
const int32_t LOG=21;
const int MOD=MOD1;

int a[100005];
int b[100005];
int c[100005];

int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      {  
            int x,y,n1,n2,n3;
            cin>>x>>y>>n1>>n2>>n3;
            rep(i,0,n1)cin>>a[i];
            rep(i,0,n2)cin>>b[i];
            rep(i,0,n3)cin>>c[i];
            sort(a,a+n1),sort(b,b+n2),sort(c,c+n3);
            reverse(a,a+n1);
            reverse(b,b+n2);
            reverse(c,c+n3);
            vector<int> v;

            rep(i,0,x)
            {
            	v.push_back(a[i]);
            }

            rep(i,0,y)
            {
            	v.push_back(b[i]);
            }

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

            int ptr=0;

            int sum1=0;
            int sum2=0;
            
            int siz=v.size();
            int sum=accumulate(v.begin(),v.end(),0LL);
            int ans=sum;
            rep(i,0,min(n3,siz))
            {
            	 sum1+=v[i];
            	 sum2+=c[i];
            	 if(sum1<sum2)
            	 {
            	 	 ans=max(ans,sum-sum1+sum2);
            	 }	
            }
            cout<<ans<<endl;
            

      }

      return 0;     
}

/*
 TIPS(FOR ME):
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/


Measured memory_bytes: 4852
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

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

	unordered_map<ll, ll> ump;
	ll ans = 0;
	rep(i, n){
		ans += ump[i - a[i]];
		ump[i + a[i]]++;
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 20148
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  int count = 0, a;
  for(int i = 0; i < N; i++){
    cin >> a;
    if(a % 2 == 1)count++;
  }
  cout << (count >= 1? "first": "second") << endl;
  return 0;
}

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

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

    if(n<10){
        cout<<n<<endl;
    }
    else if (n<100) {
        cout<<9<<endl;

    }
    else if (n<1000) {
        cout<<9+(n-99)<<endl;
    }
    else if (n<10000) {
        cout<<909<<endl;
    }
    else if(n<100000){
        cout<<909+(n-9999)<<endl;
    }
    else {
        cout<<909+(n-10000)<<endl;

    }
}


Measured memory_bytes: 384
#include<stdio.h>

#define Max  1000
#define vMax 10000

int n, a[Max], s;
int b[Max], T[vMax + 1];


int partition(int a[], int p, int r){
  int i, j;
  int t, x;
  x = a[r];
  i = p - 1;

  for(j = p ; j < r ; j++){
    if(a[j] <= x){
      i++;
      t = a[i];
      a[i] = a[j];
      a[j] = t;
    }
  }

  t = a[i + 1];
  a[i + 1] = a[r];
  a[r] = t;

  return i + 1;
}

void quickSort(int a[], int p, int r){
  int q;
  if(p < r){
    q = partition(a, p, r);
    quickSort(a, p, q - 1);
    quickSort(a, q + 1, r);
  }
}



int solve(){
  int i,ans = 0, cur, S, m, an, v;

  int V[Max];
  for(i = 0 ; i < n ; i++){
    b[i] = a[i];
    V[i] = 0;
  }

  quickSort(b, 0, n - 1);

  for(i = 0 ; i < n ; i++) T[b[i]] = i;
  for(i = 0 ; i < n ; i++){
    if(V[i]) continue;
    cur = i;
    S = 0;
    m = vMax;
    an = 0;
    while(1){
      V[cur] = 1;
      an++;
      v = a[cur];

      if(v < m) m = v;

      S += v;
      cur = T[v];
      if(V[cur]) break;
    }
    if(S + (an -2) * m < m + S + (an + 1) * s) ans += S + (an -2) * m;
    else ans +=  m + S + (an + 1) * s;
  }
  return ans;
}


int main(){
  int i;

  scanf("%d", &n);
  s = vMax;
  for(i = 0 ; i < n ; i++){
    scanf("%d", &a[i]);
    if(a[i] < s) s = a[i];
}

  int ans = solve();
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 2108