akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stack>
#include<vector>
#include<numeric>
#include<cmath>
using namespace std;

int main(){
	int N,A,B,C;
	cin>>N>>A>>B>>C;
	int sum=A+B+C;
	int l[N];
	for(int i=0;i<N;++i)cin>>l[i];
	int ans=10000;
	vector<int> status;
	for(int i=0;i<N;++i){
		status.push_back(0);
	}
	status.push_back(-1);
	stack<vector<int> >S;
	S.push(status);
	vector<vector<int> >statusarr;
	while(!S.empty()){
		status=S.top();
		/*
		for(int i=0;i<status.size();++i){
			cout<<status[i]<<" ";
		}
		cout<<endl;
		*/
		S.pop();
		if(status[N]==N-1){
			vector<int>a,b,c;
			for(int i=0;i<N;++i){
				if(status[i]==1)a.push_back(l[i]);
				if(status[i]==2)b.push_back(l[i]);
				if(status[i]==3)c.push_back(l[i]);
			}
			if(a.size()>0 && b.size()>0 && c.size()>0){
				int mp=0;
				int tmpa=accumulate(a.begin(),a.end(),0);
				int tmpb=accumulate(b.begin(),b.end(),0);
				int tmpc=accumulate(c.begin(),c.end(),0);
				mp+=abs(tmpa-A)+abs(tmpb-B)+abs(tmpc-C);
				mp+=(a.size()-1)*10+(b.size()-1)*10+(c.size()-1)*10;
				if(ans>mp)ans=mp;
			}
		}
		else{
			status[N]++;
			for(int i=0;i<=3;++i){
				status[status[N]]=i;
				S.push(status);
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const ldouble pi = acos(-1), eps = 1e-10;
const ldouble pi2 = acos(-1) / 2;
ldouble a, b, x, v, h, needs;

ldouble radToDeg(ldouble angle)
{
  return (ldouble) 180 / pi * angle;
}

ldouble volume(ldouble angle)
{
  ldouble other = pi2 - angle;
  ldouble hh = b * tan(angle);
  // printf("kk %Lf\n", 90 - radToDeg(angle));
  // printf("## %Lf\n", hh);
  if (hh <= a)
    return a * b * hh / 2;
  ldouble hhh = tan(other) * (hh - a);
  // printf("-- %Lf\n", hhh);
  return a * a * hhh + a * (b - hhh) * a / 2;
}

ldouble ternarySearch()
{
  ldouble lo = 0, hi = pi2;
  while ((hi - lo) >= eps)
  {
    ldouble midlo = (2*lo + hi) / 3, midhi = (lo + 2*hi) / 3;
    ldouble elo = abs(volume(midlo) - x), ehi = abs(volume(midhi) - x);
    // printf("%Lf %Lf %Lf %Lf\n", radToDeg(midlo), elo, volume(midlo), x);
    if (elo <= ehi) hi = midhi;
    else lo = midlo;
  }
  return lo;
}

int main()
{
  scanf("%Lf %Lf %Lf", &a, &b, &x);
  h = x / (a * a);
  needs = b - h;
  // printf("%Lf %Lf %Lf %Lf\n", needs, h, 1 / h, 1 / needs);
  printf("%.12Lf\n", 90 - radToDeg(ternarySearch()));
  // printf("%Lf\n", volume(pi2 - 0.07393));
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
using namespace std;

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

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
int ans;

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

  cin >> n;
  ans = 0;
  rep(i, n) {
    int a;
    cin >> a;
    ans += a - 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#! /usr/bin/python3

N = int(input())
1 <= N <= 10000

if N % 1000 == 0:
 print(0)
else:
  sen = N//1000
  sen2 = sen*1000
  atai = N-sen2
  atai2 = 1000-atai
  print(atai2)

Measured memory_bytes: 9072
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}



//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
キュー　queue<int> q;
   q.push(7);　//７が入る
   cout << q.front() << endl;  // 先頭の値を出力
   q.pop();  // 先頭の値を削除
*/



int main(void){
cout<<fixed<<setprecision(14);
//cin.tie(0); ios::sync_with_stdio(false);



  ll N;
  cin>>N;
  vector<ll> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  vsort(vec);
  ll counter=0;
  
    for(int i=0;i<N-2;i++){
      for(int j=i+1;j<N-1;j++){
        for(int k=j+1;k<N;k++){
          if((vec[i]<vec[j]&&vec[j]<vec[k])&&abs(vec[i]-vec[j])<vec[k]&&vec[k]<vec[i]+vec[j]){
            counter++;
          }
        }
      }
    }
  cout<<counter<<endl;
}




Measured memory_bytes: 3632
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;


int main()
{
    IOS
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    ll hf=n/2;
    cout<<a[hf]-a[hf-1]<<endl;
    return 0;
}


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

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  string ans;
  ans += (char)((int)s1[0] + 'A' - 'a');
  ans += (char)((int)s2[0] + 'A' - 'a');
  ans += (char)((int)s3[0] + 'A' - 'a');
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int n, ans;
	cin >> n;
	ans = n * 800 - (n / 15) * 200;
	cout << ans;

	return 0;
}



Measured memory_bytes: 256
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

#[fastout]
fn main() {
   input! {
      n: usize,
      _t: usize,
      mut a: [usize; n]
   }

   let mut mn = a[0];
   a[0] = 0;
   for i in 1..n {
      if a[i] < mn {
         mn = a[i];
      }
      a[i] -= mn;
   }
   a.sort();
   let mut ans = 1;
   for i in (0..n - 1).rev() {
      if a[i] == a[n - 1] {
         ans += 1;
         continue;
      }
      break;
   }
   println!("{}", ans);
}


Measured memory_bytes: 4200
from collections import Counter

def main():
    n, k = map(int, input().split())
    a = [int(s) for s in input().split()]
    print(solve(n, k, a))

def solve(n, k, a):
    counter = Counter(a)
    s = 0
    for _, m in counter.most_common(k):
        s += m

    return n - s

main()


Measured memory_bytes: 32508
using System;

namespace B_Balance
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ');
            var w = new int[n];
            var a = 0;
            var b = 0;
            var c = int.MaxValue;
            for (var i = 0; i < n; i++)
            {
                w[i] = int.Parse(input[i]);
                a += w[i];
            }
            for (var i = 0; i < n - 1; i++)
            {
                var e = b += w[i];
                var d = Math.Abs((a - e) - e);
                if (d < c)
                {
                    c = d;
                }
            }
            Console.WriteLine(c);
        }
    }
}

Measured memory_bytes: 13140
import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = list(map(lambda x: x * (-1), a))
heapq.heapify(a)
while m != 0:
    price = heapq.heappop(a) * (-1)
    price //= 2
    m -= 1
    heapq.heappush(a, (-1) * price)
print(sum(a) * (-1))


Measured memory_bytes: 14180
from collections import deque

n, k = map(int, input().split())
v = deque(list(map(int, input().split())))
m = min(n, k)
ans = 0
for i in range(m + 1):
    for j in range(m + 1 - i):
        w = deque(v)
        a = []
        for _ in range(i):
            p = w.pop()
            a.append(p)
        for _ in range(j):
            p = w.popleft()
            a.append(p)
        a.sort()
        for l in range(min(k - i - j, len(a))):
            if a[l] < 0:
                a[l] = 0
            else:
                break
        if sum(a) > ans:
            ans = sum(a)
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define pii pair<int,int>
#define x first
#define y second

const int N=1e5+5;
int en,h[N],num[N],f[N],n,m;
bool v[N],s[N];
vector<int> ans;
pii a[N];

struct edge{
	int n,v,id;
}e[N<<1];

void add(int x,int y,int z){
	e[++en]=(edge){h[x],y,z};
	h[x]=en;
}

int getf(int x){
	if(f[x]==x) return x;
	return f[x]=getf(f[x]);
}

bool dfs(int x){
	v[x]=1;
	bool cur=s[x];
	for(int i=h[x];i;i=e[i].n){
		int y=e[i].v;
		if(v[y]) continue;
		if(dfs(y)){
			ans.push_back(e[i].id);
			cur^=1;
		}
	}
	return cur;
}

signed main(){
	read(n);read(m);
	for(int i=1;i<=n;i++) read(a[i].x),read(a[i].y);
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i++) num[i]=a[i].x,s[i]=a[i].y^a[i-1].y;
	for(int i=1;i<=n+1;i++) f[i]=i;
	for(int i=1;i<=m;i++){
		int l,r;
		read(l);read(r);
		l=lower_bound(num+1,num+1+n,l)-num;
		r=upper_bound(num+1,num+1+n,r)-num;
		int fl=getf(l),fr=getf(r);
		if(fl==fr) continue;
		f[fl]=fr;
		add(l,r,i);add(r,l,i);
	}
	dfs(n+1);
	for(int i=1;i<=n;i++) if(!v[i]){
		if(dfs(i)){
			write(-1);
			return 0;
		}
	}
	write(ans.size());puts("");
	sort(ans.begin(),ans.end());
	for(auto x:ans) write(x),putchar(' ');
}

Measured memory_bytes: 5372
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N, M, K = input_int()
A = many_int()
B = many_int()


import itertools as it
import bisect

def bins(A, B, K):
    A_it = list(it.accumulate(A))
    B_it = list(it.accumulate(B))

    A_index = bisect.bisect_right(A_it, K)
    B_index = bisect.bisect_right(B_it, K)

    A_it = [0]+A_it[:A_index]
    B_it = B_it[:B_index]

    maxs = 0
    count=0
    for i in A_it[::-1]:
        if K-i < 0:
            continue
        now = K-i
        B_index = bisect.bisect_right(B_it, now)

        maxs = max(maxs, B_index + max(A_index - count,0))
        count+=1

    return maxs

print(bins(A,B,K))

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

int main() {
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;

	vector<int> Nums;
	int now = 1; //今見ている数
	int cnt = 0; //nowがいくつ並んでいるか
	for (int i = 0; i < N; i++)
	{
		if (S[i] == (char)('0' + now)) cnt++;
		else {
			Nums.push_back(cnt);
			now = 1 - now; //0と1を切り替える時の計算 now ^= 1;
			cnt = 1; //新しいのをカウントし始める
		}
	}
	if (cnt != 0) Nums.push_back(cnt);

	//1-0-1-0-1-0-1って感じの配列が欲しい
	//1-0-1-0みたいに0で終わってたら、適当に１つ足す
	if (Nums.size() % 2 == 0) Nums.push_back(0);

	int Add = 2 * K + 1;

	int ans = 0;

	//1-0-1...の1から始めるので、偶数番目だけ見る
	for (int i = 0; i < Nums.size(); i += 2)
	{
		int tmp = 0;

		int left = i;
		int right = min(i + Add, (int)Nums.size());
		for (int j = left; j < right; j++)
		{
			tmp += Nums[j];
		}
		ans = max(tmp, ans);
	}

	cout << ans << endl;
}



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

bool check( vector<int> A ){
    return unique( begin( A ), end( A ) ) == end( A );
}
 
int main()
{
  int n;
  cin >> n;
  vector<int> input(n,0);
  int l;
  for (int i = 0; i < n; i++) {
    cin >> input.at(i);
  }
  sort( begin(input), end(input) );
  
  if(check(input)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 1792
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double x = sc.nextDouble();
		sc.close();
		double right = 2 * Math.PI;
		double left = 0.0;
		for(int i = 1;i <= 100000;i++) {
			double mid = (right + left) / 2.0;
			if(function(a,b,mid) < x) {
				right = mid;
			}else {
				left = mid;
			}
		}
		System.out.println(right / Math.PI * 180);
	}

	private static double function(double a, double b, double θ) {
		if(θ > Math.PI/2.0 - 0.0000000001) {
			return 0.0;
		}
		double res = 0.0;
		if(a * Math.tan(θ) <= b) {
			BigDecimal tan = new BigDecimal(a*a*b - (a*a*a*Math.tan(θ)/2.0));
			res = tan.doubleValue();
		}else {
			BigDecimal tan = new BigDecimal(b * b / Math.tan(θ) * a / 2.0);
			res = tan.doubleValue();
		}
		return res;
	}
}

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

int main(){
  string s;
  cin >> s;
  if(s == "SUN") cout << 7 << endl;
  else if(s == "MON") cout << 6 << endl;
  else if(s == "TUE") cout << 5 << endl;
  else if(s == "WED") cout << 4 << endl;
  else if(s == "THU") cout << 3 << endl;
  else if(s == "FRI") cout << 2 << endl;
  else if(s == "SAT") cout << 1 << endl;
}

Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

int dp[101][4][4][4];

int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    int n;
    cin>>n;
    ll ans=0;
    dp[0][3][3][3]=1;
    for(int len=0;len<n;len++){
        for(int c1=0;c1<4;c1++){
            for(int c2=0;c2<4;c2++){
                for(int c3=0;c3<4;c3++){
                    for(int a=0;a<4;a++){
                        if(a==2&&c1==1&&c2==0) continue;
                        if(a==2&&c1==0&&c2==1) continue;
                        if(a==1&&c1==2&&c2==0) continue;
                        if(a==2&&c1==1&&c3==0) continue;
                        if(a==2&&c2==1&&c3==0) continue;

                        dp[len+1][a][c1][c2]+=dp[len][c1][c2][c3];
                        dp[len+1][a][c1][c2]%=MOD;
                    }
                }
            }
        }
    }
    
    for(int c1=0;c1<4;c1++){
        for(int c2=0;c2<4;c2++){
            for(int c3=0;c3<4;c3++){
                ans+=dp[n][c1][c2][c3];
                ans%=MOD;
            }
        }
    }

    fin(ans);
    
    
//////////////////////////////////////////////////////
return 0;}


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

int main()
{
	lint N,T;
	lint A[100010]={};

	cin >> N >> T;
	for(int i=0;i<N;i++)
		cin >> A[i];

	lint p[100010]={};
	lint Min=A[0];
	for(int i=1;i<N;i++)
	{
		Min=min(Min,A[i]);
		p[i]=(A[i]-Min)*T/2;
		
	}

	sort(p,p+N,greater<lint>());

	lint ans=0;
	for(int i=0;i<N-1;i++)
	{
		if(p[i]!=p[i+1])
		{
			ans=i+1;
			break;
		}
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#define N 10000

void print(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}                                                   
                                                 
int main(){
  int n,i,j,c=0,key,A[N];
  scanf("%d",&n);
  
  for(i = 1;i <= n;i++)
    scanf("%d",&A[i]);
  
  for(i = 1;i <= n;i++){
    key = A[i];    
    j = i - 1;
    while(j >=0 && A[j] > key){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;
    print(A,n);
  }    
      
    return 0;
}

Measured memory_bytes: 612
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 while(ir.hasNext()){
  out.println(ir.nextInt()+ir.nextInt());
 }
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
 
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
 
 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
 
 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
 
 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

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

 public BigInteger nextBigInteger(){return new BigInteger(next());}

 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }

 public long[] nextLongArray(int n){
  long[] a=new long[n];
  for(int i=0;i<n;i++) a[i]=nextLong();
  return a;
 }

 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}

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

#define int long long
#define forn(i, q, n) for (int i = q; i < n; ++i)
#define fr first
#define sc second
#define all(x), x.begin(), x.end()
#define endl '\n'
#define pb push_back

using namespace std;
const int MAXN = 3e5 + 1, INF = 1e9 + 11, MOD = 1e9 + 7;
const double EPS = 1e-9;

int masi[] = {0, 1};
int masj[] = {1, 0};
int usd[10][10];
vector<vector<char>> mas(12, vector<char>(12));

void dfs(int i, int j) {
    usd[i][j] = 1;
    forn(k, 0, 2) {
        if (mas[i + masi[k]][j + masj[k]] == '#') {
            dfs(i + masi[k], j + masj[k]);
            break;
        }
    }
}

main() {
//    freopen("treepathadd.in", "r", stdin);
//    freopen("treepathadd.out", "w", stdout);
//    freopen("input.txt", "r", stdin);
    int h, w;
    cin >> h >> w;
    forn(i, 1, h + 1)
        forn(j, 1, w + 1)
            cin >> mas[i][j];
    int i = 1, j = 1;
    dfs(i, j);
    if (mas[1][1] != '#' || !usd[h][w])
        return 0 * printf("Impossible");
    forn(i, 1, h + 1)
        forn(j, 1, w + 1)
            if (mas[i][j] == '#' && !usd[i][j])
                return 0 * printf("Impossible");
    printf("Possible");
}


Measured memory_bytes: 384
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long

#define IMIN INT_MIN;
#define IMAX INT_MAX;

int maxelem(vector<int> src) {
	int dst = IMIN;
	rep(i, src.size()) {
		dst = (dst > src[i]) ? dst : src[i];
	}
	return dst;
}

int secondelem(vector<int> src) {
	int dst = IMIN;
	int dst2 = IMIN;
	rep(i, src.size()) {
		if (dst < src[i]) {
			dst2 = dst;
			dst = src[i];
		}
		else if (dst2 < src[i]) {
			dst2 = src[i];
		}
	}
	return dst2;
}

vector<int> count(vector<int> a) {
	int ma = maxelem(a);
	vector<int> count(ma+1, 0);
	rep(i, a.size()) {
		count[a[i]]++;
	}
	return count;
}

int find(vector<int> a, int b) {
	rep(i, a.size()) {
		if (a[i] == b) return i;
	}
	return -1;
}

int main(){
	double t, x;
	cin >> t >> x;
	cout << t / x << endl;


	return 0;
}




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

using i64 = int64_t;

struct Node{
    i64 num, cost;
};

using Graph = vector<vector<i64>>;

constexpr i64 INF = 1e13;

int main(){
    i64 n, m, l;
    cin >> n >> m >> l;
    Graph graph(n, vector<i64>(n, INF));
    for(int i=0;i<n;++i)graph[i][i] = 0;
    for(int i=0;i<m;++i){
        int a, b, c;
        cin >> a >> b >> c;
        graph[a-1][b-1] = c;
        graph[b-1][a-1] = c;
    }
    for(int k=0;k<n;++k){
        for(int i=0;i<n;++i){
            for(int j=0;j<n;++j){
                graph[i][j] = min(graph[i][j], graph[i][k]+graph[k][j]);
            }
        }
    }
    Graph graph2(n, vector<i64>(n, INF));
    for(int i=0;i<n;++i)graph2[i][i] = 0;
    for(int i=0;i<n;++i){
        for(int j=i+1;j<n;++j){
            if(graph[i][j] <= l){
                graph2[i][j] = 1;
                graph2[j][i] = 1;
            }
        }
    }
    for(int k=0;k<n;++k){
        for(int i=0;i<n;++i){
            for(int j=0;j<n;++j){
                graph2[i][j] = min(graph2[i][j], graph2[i][k]+graph2[k][j]);
            }
        }
    }
    int Q;
    cin >> Q;
    for(int q=0;q<Q;++q){
        int s, t;
        cin >> s >> t;
        s--; t--;
        if(graph2[s][t] >= INF)cout << -1 << endl;
        else cout << graph2[s][t]-1 << endl;
    }

    return 0;
}


Measured memory_bytes: 1920
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[3]={};
    for(int i=0;i<n;i++){
       cin>>a[i];
    }
    for(int i=1;i<100000010;i++){
       if(a[0]%i==0&&a[1]%i==0&&a[2]%i==0){
         cout<<i<<endl;
       }
    }
    return 0;
}


Measured memory_bytes: 3108
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	int n, m=0, m2=0, m4=0,x;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (x % 4 == 0) m4++;
		else if (x % 2 == 0) m2++;
		else m++;
	}

	string ans;
	if (m2 == 0) {
		if (m <= m4 + 1) ans = "Yes";
		else ans = "No";
	}
	else {
		if (m <= m4) ans = "Yes";
		else ans = "No";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, C, D[30][30], c[505][505];
int pre[3][30];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> C;
    rep(y, 0, C) rep(x, 0, C) cin >> D[y][x];
    rep(y, 0, N) rep(x, 0, N) cin >> c[y][x], c[y][x]--;

    rep(col, 0, C) rep(y, 0, N) rep(x, 0, N) pre[(y + x) % 3][col] += D[c[y][x]][col];

    int ans = inf;
    rep(c0, 0, C) rep(c1, 0, C) rep(c2, 0, C) {
        if (c0 == c1) continue;
        if (c0 == c2) continue;
        if (c1 == c2) continue;

        chmin(ans, pre[0][c0] + pre[1][c1] + pre[2][c2]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
struct Node
{
    int l,r;
}pd[100010];
//int fd[10010][10010];
bool cmp(Node x,Node y)
{
    if(x.r==x.r) return x.l<y.l;
    else return x.r<x.r;
}
int main()
{
    int n,m,ans=0;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        cin>>pd[i].l>>pd[i].r;
    }
    sort(pd,pd+m,cmp);
    int b=0x3f3f3f,k=0;
    for(int i=0;i<m;i++)
    {
        if(pd[i].r<=b)
        {
            b=pd[i].r;
            k=i;
        }
        else if(pd[i].l>=b)
        {
            k=i;
            b=pd[i].r;
            ans++;
        }
    }
    cout<<ans+1<<endl;
}


Measured memory_bytes: 1024
A, B, C, D, E, F = map(int,input().split())

water = []
sugar =[]
ans = [-1] * 3
for i in range(F+1):
    for j in range(F+1):
        y = i * C + j * D
        if y <= F:
            sugar.append(y)

for i in range(F + 1):
    for j in range(F + 1):
        x = i * 100 * A + j * 100 * B
        if x <= F:
            water.append(x)

for i in range(len(water)):
    for j in range(len(sugar)):
        a = water[i]
        b = sugar[j]
        if a + b <= F and a / 100 * E >= b:
            if ans[0] * (a + b) < 100 * b:
                ans[0] = 100 * b / (a + b)
                ans[1] = a + b
                ans[2] = b
print("{} {}".format(ans[1], ans[2]))

Measured memory_bytes: 52220
#include<stdio.h>
#include<stdlib.h>
int Partition(int a[],int p,int r) {
	int x = a[r];
	int i = p - 1;
	for (int j = p; j < r; j++) {
		if (a[j] <= x) {
			i++;
			int temp = a[j];
			a[j] = a[i];
			a[i] = temp;
		}
	}
	a[r] = a[i + 1];
	a[i + 1] = x;
	return i + 1;
}
int main() {
	int n = 0;
	int A[100005];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	int q = Partition(A, 0, n - 1);
	for (int i = 0; i < n; i++) {
		if (i)
			printf(" ");
		if (i == q) {
			printf("[%d]", A[i]);
		}
		else {
			printf("%d", A[i]);
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
#define mem(a,n) memset(a,n,sizeof(a))
#define rep(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
typedef long long ll;
const int INF=0x3f3f3f3f;
const double PI=3.1415926;
const int MOD=1e9+7;
const double eps=1e-8;
const int N=2e3+5;
int n,k;
int x,y,tot,ans;
int cnt[N][N],sum[N][N];
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>n>>k)
    {
        mem(cnt,0);
        mem(sum,0);
        char ch;
        rep(i,0,n)
        {
            cin>>x>>y>>ch;
            if(ch=='W') x+=k;
            x%=(k*2), y%=(k*2);
            if(y>=k)
            {
                y-=k,x+=k;
                x%=(k*2);
            }
            cnt[x][y]++;
        }
        rep(i,0,k)
        {
            rep(j,0,k) sum[0][i]+=cnt[j][i];
            rep(j,1,k*2) sum[j][i]=sum[j-1][i]-cnt[j-1][i]+cnt[(j+k-1)%(k*2)][i];
        }
        rep(i,0,k*2)
        {
            tot=0;
            rep(j,0,k) tot+=sum[i][j];
            ans=max(ans,tot);
            rep(j,0,k)
            {
                tot=tot-sum[i][j]+sum[(i+k)%(k*2)][j];
                ans=max(ans,tot);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 31616
use std::io::Read;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    for c in b'a'..(b'z' + 1) {
        let mut cnt: u32 = 0;

        for &x in s.as_bytes() {
            if c == x || c == (x ^ 32) {
                cnt += 1;
            }
        }

        println!("{} : {}", c as char, cnt);
    }
}



Measured memory_bytes: 5028
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/

/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string str;
    cin >> str;
    int len = str.size();
    int s, t;
    FORD(i, len-1, 0) if(str[i]=='A') s = i;
    REP(i, len) if(str[i]=='Z') t = i;
    cout << t-s+1 << endl;
}


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	cout.tie(NULL);
	int T;	cin >> T;
	unordered_set<string> a;
	while(T--) {
		string s;	cin >>s;
		a.insert(s);		
	}
	cout << a.size() << '\n';
	return 0;
}

Measured memory_bytes: 17680
import java.util.*;

public class Main
{
	public static void main(String args[])
	{
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		double p[]=new double[n+1];
		double dp[][]=new double[n+1][n+1];
		for(int i=1;i<=n;i++)
			p[i]=in.nextDouble();
		for(int i=0;i<=n;i++)
			dp[0][i]=0;
		dp[1][0]=1-p[1];
		for(int i=2;i<=n;i++)
			dp[i][0]=dp[i-1][0]*(1-p[i]);
		dp[1][1]=p[1];
		for(int i=2;i<=n;i++)
			dp[i][i]=dp[i-1][i-1]*(p[i]);
		for(int i=2;i<=n;i++)
		{
			for(int j=1;j<i;j++)
				dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
		}
		double ans=0;
		for(int i=n/2+1;i<=n;i++)
			ans+=dp[n][i];
		System.out.println(ans);
	}
}


Measured memory_bytes: 133980
n = input()
k = int(input())
ans = 0
for i in range(1,len(n)):
    if (i < k):
        continue
    else:
        if (k==1):
            ans += 9
        elif (k==2):
            ans += 9*(i-1)*9
        else:
            ans += 9*9*9*(i-1)*(i-2)//2
    #print(ans)
if (k==1):
    ans += int(n[0])
elif (k==2):
    ans += (int(n[0])-1)*(len(n)-1)*9
    #print(ans)
    for i in range(1,len(n)):
        if (int(n[i])>0):
            ans += 9*(len(n)-i-1)
            ans += int(n[i])
            break
        if (i==len(n)-1):
            print(ans)
            exit()
else:
    ans += (int(n[0])-1)*9*9*(len(n)-1)*(len(n)-2)//2
    for i in range(1,len(n)):
        if (int(n[i])>0):
            ans += (int(n[i])-1)*9*(len(n)-i-1)
            ans += 9*9*(len(n)-i-1)*(len(n)-i-2)//2
            t = i
            break
        if (i==len(n)-2):
            print(ans)
            exit()
    for j in range(t+1,len(n)):
        if (int(n[j])>0):
            ans += int(n[j])
            ans += 9*(len(n)-j-1)
            break
print(ans)

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

int a[12][12];
const int INF = 1001001001;

int main () {
  int n,m,x;cin>>n>>m>>x;
  vector<int>c(n);
  for (int i=0;i<n;i++){
    cin>>c[i];
    for(int j=0;j<m;j++)cin>>a[i][j];
  }

  int ans =INF;
  for(int s=0;s<(1<<n);s++){
    int cost =0;
    vector<int>d(m);
    for(int i=0;i<n;i++){
      if(s>>i&1){
        cost += c[i];
        for(int j=0;j<m;j++)d[j] += a[i][j];
      }
    }

    bool ok = true;
    for(int j=0;j<m;j++)if(d[j] < x)ok = false;
    if(ok) ans = min(ans ,cost);  
  }
  if (ans == INF){
    cout << -1 << endl;
  }else{
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3616
import copy
N = int(input())

graph = []
for i in range(N):
  graph.append( list(map(int,input().split())) )

dp = copy.deepcopy(graph)
for k in range(N):
  for i in range(N):
    for j in range(N):
      dp[i][j] = min(dp[i][j], dp[i][k]+dp[k][j])

res = 0

for i in range(N):
  for j in range(N):
    if dp[i][j] < graph[i][j]:
      print(-1)
      exit()
    elif dp[i][j] == graph[i][j]:
      flg = True
      for k in range(N):
        if k!=i and k!=j and dp[i][j] == dp[i][k]+dp[k][j]:
          flg = False
      if flg:
        res += dp[i][j]

print(res//2)

Measured memory_bytes: 59440
#include<bits/stdc++.h>
using namespace std;main(){int N;cin>>N;vector<pair<int,int>>R(N);for(auto&i:R){int a,b;cin>>a>>b;i={a,a+b};}sort(R.begin(),R.end());vector<int>V(N+1,1),f(N);for(int i=N;i--;){int&l=f[i]=i+1;while(l<N&&R[l].first<R[i].second)l=f[l];V[i]=(V[i+1]+V[l])%998244353;}cout<<V[0]<<'\n';}


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

int main(){
  int N,M,R,Q;
  int t[1010], n[1010], m[1010], s[1010], ts,te,mq;
  while(cin >> N >> M, N){
    cin >> R;
    for(int i=0;i<R;i++){
      cin >> t[i] >> n[i] >> m[i] >> s[i];
    }

    cin >> Q;
    for(int i=0;i<Q;i++){
      cin >> ts >> te >> mq;

      int ans = 0, cnt = 0, id = 0;
      for(int sec=ts;sec<te;sec++){
	while(id<R && t[id]<=sec){
	  if(m[id]==mq){
	    if(s[id]==0)cnt--;
	    else cnt++;
	  }
	  id++;
	}
	if(cnt)ans++;
      }
      cout << ans << endl;
    }
  }
}

Measured memory_bytes: 1172
import java.util.*;

public class Main{
  static int h,w;
  static int dx[] = {0,1,0,-1};
  static int dy[] = {-1,0,1,0};

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    while(true){
      w = sc.nextInt();
      h = sc.nextInt();
      if(w == 0 && h == 0) break;

      int[][] t = new int[h][w];

      for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
          t[i][j] = sc.nextInt();
        }
      }

      int[] change = new int[4];
      for(int i=0;i<4;i++){
        change[i] = sc.nextInt();
      }

      PriorityQueue<State> open = new PriorityQueue<State>();
      HashSet<State> closed = new HashSet<State>();
      open.add(new State(0,0,1,0));

      State ans = null;

      while(!open.isEmpty()){
        State st = open.poll();
        if(closed.contains(st)) continue;
        closed.add(st);

        if(st.x == w-1 && st.y == h-1){
          ans = st;
          break;
        }

        for(int i=0;i<4;i++){
          int nd = (st.d + i) % 4;
          int nx = st.x + dx[nd];
          int ny = st.y + dy[nd];

          if(nx>=0 && w>nx && ny>=0 && h>ny){
            if(t[st.y][st.x] == i){
              open.add(new State(nx,ny,nd,st.cost));
            }
            else{
              open.add(new State(nx,ny,nd,st.cost+change[i]));
            }
          }
        }
      }

      System.out.println(ans.cost);
    }
  }
}

class State implements Comparable<State>{
  int x,y,d,cost;

  State(int x,int y,int d,int cost){
    this.x = x;
    this.y = y;
    this.d = d;
    this.cost = cost;
  }

  public boolean equals(Object o){
    State st = (State)o;
    return x == st.x && y == st.y && d == st.d;
  }

  public int hashCode(){
    return x + y * 100 + d * 10000;
  }

  public int compareTo(State st){
    return this.cost - st.cost;
  }
}

Measured memory_bytes: 14000
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define endl "\n"
#define ll long long
#define pb emplace_back
#define fi first
#define se second
#define pll pair<ll, ll>
#define ull unsigned long long
#define ld long double

#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=n-1; i>=0; i--)
#define repa(i,a,b) for(ll i=(a);i<=(b);i++)
#define all(x) (x).begin(), (x).end()
#define ordered_set tree<int , null_type, less<int> , rb_tree_tag, tree_order_statistics_node_update>
/*
 Ordered set docs:
 order_of_key (k) : Number of items strictly smaller than k .
 find_by_order(k) : K-th element in a set (counting from zero).
*/
#define blc boost::lexical_cast<long long>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using namespace __gnu_pbds;
const int MOD = 1e9+7;

ll add(ll x, ll y) {ll res=x+y; return(res>=MOD?res-MOD:res);}

ll sub(ll x, ll y) {ll res=x-y; return(res<0?res+MOD:res);}

ll lcm(ll x, ll y) {ll res=(x*y)/__gcd(x,y); return res;}

ll powerLL(ll x, ll n, ll mod) 
{ 
    ll result = 1; 
    while (n) { if (n & 1) result = (result%mod * x%mod) % mod; n = n / 2; x = (x%mod * x%mod) % mod; } return result; 
} 

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

void solve()
{
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    rep(i,n)
    	cin>>a[i];
	rep(i,n)
	{
		if(i>=k)
		{
			if(a[i]>a[i-k])
				cout<<"Yes"<<endl;
			else
				cout<<"No"<<endl;
		}
	}
}
int32_t main()
{
    fast;
    int t;
    t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0; 
}

Measured memory_bytes: 4780
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
//priority_queue<long long, vector<long long>, greater<long long>> pq;

const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long


const double pi = acos(-1.0);

int main() {
  //auto start_clock = clock();
#ifdef LOCAL
  freopen("in", "r", stdin);
#endif
  double r;
  cin >> r;
  cout << 2 * pi * r << endl;
  return 0;
}

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

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;

bool TEST=false;

void show(){if (TEST){cout << endl;}}
void show(string x){if (TEST){cout << x;}}
void show(string x,bool enter){
  if (TEST){if (enter) cout << "<#> " << x << endl;else cout << x;}
}
void show(ll x){if (TEST){cout << x;}}
void show(ll x,bool enter){
  if (TEST){if (enter) cout << "<#> " << x << endl;else cout << x;}
}
void show(p_ll p){
  if (TEST){cout << "{ ";show(p.first);cout << " ";show(p.second);cout << " }";}
}
void show(v_ll v){
  if (TEST){
    cout << "<begin> ";
    for (ll i=0;i<v.size();i++){show(v[i]); cout << " ";}cout <<"<end>"<< endl;
}}
void show(vv_ll v){
  if (TEST){
    cout << "//////////" << endl;
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << endl;
}}}
void show(vp_ll v){
  if (TEST){
    cout << "//////////" << endl;
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << endl;
}}}

ll P,Q,R;
int main(){
  cin >> P >> Q >> R;
  if (P>=Q && P>=R){
    cout << Q+R << endl;
    return 0;
  }
  else if (Q>=P && Q>=R){
    cout << P+R << endl;
    return 0;
  }
  else{
    cout << P+Q << endl;
    return 0;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
int RideBack[32];
void _swap(int left, int right) {int bk=RideBack[left];RideBack[left]=RideBack[right];RideBack[right]=bk;}
int main() {int N,W,i,j;scanf("%d %d",&W,&N);for (i=1;i<=W;RideBack[i]=i,i++);while (N--) {scanf("%d,%d",&i,&j);_swap(i,j);}for (i=1;i<=W;printf("%d\n",RideBack[i++]));return 0;}

Measured memory_bytes: 0
def scheduling(pctable, members)
  membertable = (members + 1).times.map{ [] }
  pctable.each do |row|
    row.each_slice(2) do |s, e|
      membertable[s[1]] << [s[0], e[0]]
    end
  end
  membertable
end

def maketimetbl(membertable)
  membertable.map do |t|
    t.sort!
    times_to_uniq = []
    t.each do |s, e|
      if times_to_uniq.size == 0 || times_to_uniq[-1][1] < s
        times_to_uniq << [s, e]
      else
        pre = times_to_uniq.pop
        if s <= pre[0]
          e <= pre[1] ? times_to_uniq << [s, pre[1]] : times_to_uniq << [s, e]
        else
          e <= pre[1] ? times_to_uniq << [pre[0], pre[1]] : times_to_uniq << [pre[0], e]
        end
      end
    end
    times_to_uniq
  end
end

def solve(tt, ts, te)
  ans = []
  tt.each do |s, e|
    if s < te
      if s <= ts
        e <= te ? ans << [ts, e] : ans << [ts, te]
      else
        e <= te ? ans << [s, e] : ans << [s, te]
      end
    end
  end
  p ans.empty? ? 0 : ans.map{ |s, e| e - s > 0 ? e - s : 0 }.reduce(:+)
end

loop do
  pcs, members = gets.split.map(&:to_i)
  break if pcs == 0
  pctable = (pcs + 1).times.map{ [] }
  gets.to_i.times do
    t, pn, mn, s = gets.split.map(&:to_i)
    pctable[pn] << [t, mn, s]
  end
  table = maketimetbl(scheduling(pctable, members))
  gets.to_i.times do
    ts, te, m = gets.split.map(&:to_i)
    solve(table[m], ts, te)
  end
end

Measured memory_bytes: 10280
N = int(input())
dicts = {}
for _ in range(N):
    s = "".join(sorted((input())))
    if s not in dicts:
        dicts[s] = 1
    else:
        dicts[s] += 1
print(sum([n*(n-1)//2 for n in list(dicts.values()) if 0<n]))
print("")

Measured memory_bytes: 67544
ab = []
cd = []
abcd = list(map(int, input().split()))
ab.append(abcd[0])
ab.append(abcd[1])
cd.append(abcd[2])
cd.append(abcd[3])
ans = []
for i in ab:
    for j in cd:
        ans.append(i * j)
print(max(ans))

Measured memory_bytes: 9192
import sys
def s():
 W=int(input().split()[1])
 C=[0]*-~W
 for e in sys.stdin:
  v,w=map(int,e.split())
  for i in range(W,w-1,-1):
   t=v+C[i-w]
   if t>C[i]:C[i]=t
 print(C[W])
if'__main__'==__name__:s()


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

using ll = long long;

int main() {
  ll n, a, b, c, d, e;

  std::cin >> n >> a >> b >> c >> d >> e;

  ll minflow = std::min({a, b, c, d, e});
  ll time = n/minflow;
  if (n%minflow>0) time += 1;

  std::cout << time + 4 << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n, m;
int tem;
int read()
{
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * w;
}
inline void write(int x)
{
  static int sta[35];
  int top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[-- top] + 48);
}
int main()
{
    n = read();
    m = read();
    while(m --) {
        cin>>tem;
        n -= tem;
        if(n < 0) {
            n = -1;
            break;
        }
    }
    cout<<n;
    return 0;
}

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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
ll n;
ll dp[3010][3010]={};
vector<ll>ho(3010);
ll dfs(int fr,int to,int now){
  if(fr==to){
    if(now==0)
      return dp[fr][to]=ho[to];
    else
      return dp[fr][to]=-ho[to];
  }
  if(dp[fr][to]!=-llINF)return dp[fr][to];
  if(now==0){
    return dp[fr][to]=max(dfs(fr+1,to,1)+ho[fr],dfs(fr,to-1,1)+ho[to]);
  }else{
    return dp[fr][to]=min(dfs(fr+1,to,0)-ho[fr],dfs(fr,to-1,0)-ho[to]);
  }
}
int main(){
  cin>>n;
  for(int i=0;i<n+1;i++)
    for(int j=0;j<n+1;j++)
      dp[i][j]=-llINF;
  for(int i=0;i<n;i++)cin>>ho[i];

  dfs(0,n-1,0);
  cout<<dp[0][n-1]<<endl;
  return 0;
}


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

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

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

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

const int maxn = 510;
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, 1, -1};

int d[maxn][maxn];
int id[maxn][maxn];

int main() {
    int N;
    cin >> N;
    int n = N * N;
    V<int> P(n);

    rep(i, n) {
        cin >> P[i], --P[i];
        id[P[i] / N][P[i] % N] = i;
    }

    rep(i, N) {
        rep(j, N) { d[i][j] = min({i, j, N - 1 - i, N - 1 - j}); }
    }

    ll ans = 0;

    rep(i, n) {
        int x = P[i] / N, y = P[i] % N;
        ans += d[x][y];
        queue<pii> que;
        rep(dir, 4) {
            int nx = x + dx[dir], ny = y + dy[dir];
            if (nx >= 0 && ny >= 0 && nx < N && ny < N && d[nx][ny] > d[x][y]) {
                d[nx][ny] = d[x][y];
                que.push(mp(nx, ny));
            }
        }

        while (!que.empty()) {
            pii p = que.front();
            que.pop();
            int r = p.fi, c = p.se;
            rep(dir, 4) {
                int nx = r + dx[dir], ny = c + dy[dir];
                if (nx >= 0 && ny >= 0 && nx < N && ny < N) {
                    int nd = d[r][c] + (id[r][c] > i);
                    if (d[nx][ny] > nd) {
                        d[nx][ny] = nd;
                        que.push(mp(nx, ny));
                    }
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6164