akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<unordered_map>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const int N=1e5+10;
ll d[N];
unordered_map<ll,vector<int> > p;
ll cnt[N],sum[N],n,r[N];
vector<pair<int,int> > w;
bool comp(int a,int b){
	return d[a]>d[b];
}
int main(){
	cin>>n;
	for (int i=1;i<=n;i++)scanf("%lld",&d[i]),r[i]=i,p[d[i]].push_back(i),cnt[i]=1;
	sort(r+1,r+n+1,comp);
	for (int i=1;i<n;i++){
		ll x=r[i],s=d[x]-(n-2*cnt[x]),y;
		if (p[s].empty()||s>=d[x]){
			cout<<-1<<endl;
			return 0;
		}
		y=p[s].back();
		w.push_back(make_pair(x,y));
		cnt[y]+=cnt[x];
		sum[y]+=sum[x]+cnt[x];
	}
	if (sum[r[n]]!=d[r[n]]){
		cout<<-1<<endl;
		return 0;
	}
	for (int i=0;i<n-1;i++)printf("%d %d\n",w[i].first,w[i].second);
}

Measured memory_bytes: 14752
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


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> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	set<char> st;
	REP(i, s.size()) {
		st.insert(s[i]);
	}
	if (st.size() == s.size())cout << "yes" << endl;
	else cout << "no" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws IOException
	{
		int n=nextInt();
		int a[]=new int[n*n+1];
		Pair x[]=new Pair[n+1];
		for(int i=1;i<=n;i++)
			x[i]=new Pair(i,nextInt());
		Arrays.sort(x,1,n+1,new Comparator<Pair>(){
			public int compare(Pair a,Pair b){
				return a.second-b.second;
			}
		});
		Queue<Integer> queue=new LinkedList<>();
		for(int i=1,j=1;i<=n*n;i++)
		{
			if(j<=n && x[j].second==i)
			{
				a[i]=x[j].first;
				for(int t=1;t<=x[j].first-1;t++)
				{
					if(queue.isEmpty())
					{
						out.println("No");
						return;
					}
					a[queue.remove()]=x[j].first;
				}
				j++;
			}
			else
				queue.add(i);
		}
		queue.clear();
		for(int i=n*n,j=n;i>=1;i--)
		{
			if(j>=1 && x[j].second==i)
			{
				for(int t=1;t<=n-x[j].first;t++)
				{
					if(queue.isEmpty())
					{
						out.println("No");
						return;
					}
					a[queue.remove()]=x[j].first;
				}
				j--;
			}
			else if(a[i]==0)
				queue.add(i);
		}
		out.println("Yes");
		for(int i=1;i<=n*n;i++)
			out.print(a[i]+" ");
	}
	class Pair{
	    int first,second;
	    Pair(int a,int b){
	        first=a;
	        second=b;
	    }
	}

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

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 48756
#include <iostream>
#include <stdio.h>

using namespace std;

void trace(int A[], int N) {
    for(int i = 0 ; i < N ; i++) {
        if(N-1 != i) {
            printf("%d ", A[i]);
        } else {
            printf("%d", A[i]);
        }
    }
    printf("\n");
}

void insertion(int A[], int N) {
    int c, j;
    for (int i = 1; i < N; i++) {
        c = A[i];
        j = i - 1;
        while(j >= 0 && c < A[j]) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = c;
        trace(A, N);
    }
}

int main(void) {

    int A[100], N;
    cin >> N;

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

    trace(A, N);
    insertion(A, N);

    return 0;
}


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

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define MOD_1_000_000_007 (1000000007)
#define IINF (1<<28)
#define LINF (1LL<<60)
#define rep(i, n)      REP(i, 0, (n))
#define repc(i, n)     REPC(i, 0, (n))
#define REP(i, n, m)   for (int i = (int)(n); i <  (int)(m); i++)
#define REPC(i, n, m)  for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
#define yesno(cond)       YESNO((cond), "Yes", "No")
#define YESNO(cond, a, b) cout << ((cond) ? (a) : (b)) << "\n"

namespace solver {
  using namespace std;
  typedef long long ll;

  string K;
  int N, D, digits[10010];
  ll dp[10010][110];

  void init() {
    cin >> K >> D;
    N = K.size();
    rep(i, N) {
      digits[i] = K[N-i-1] - '0';
    }
  }

  void solve() {
    dp[0][0] = 1;
    REPC(j, 0, 9) dp[1][j%D]++;
    REPC(j, 0, 99) dp[2][((j%10)+(j/10))%D]++;
    REPC(i, 3, N) rep(j, D) rep(k, 10) {
      int l = j+D-k;
      while(l<0) l += D;
      dp[i][j] += dp[i-1][l%D];
      dp[i][j] %= MOD_1_000_000_007;
    }
    int acc = 0;
    ll ans = dp[N][0];
    REPCM(i, N-1, 0) {
      REPC(j, digits[i]+1, 9) {
        int k = D-acc-j;
        while(k<0) k += D;
        ans = (ans + MOD_1_000_000_007 - dp[i][k]) % MOD_1_000_000_007;
      }
      acc += digits[i];
      acc %= D;
    }
    ans = (ans + MOD_1_000_000_007 - 1) % MOD_1_000_000_007;
    cout << ans << "\n";
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solver::init();
  solver::solve();
  return 0;
}


Measured memory_bytes: 8960
/* 十 聖イシドールスよ、迷えるプログラマを導き給え！ 十 */
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>

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

const long long INF = 1LL << 60;

int main()
{
	int K;
	std::cin >> K;

	std::vector<int> checker( 1000001, -1 );

	// 1回目は決め打ち	ほかの項と出し方が違うので
	checker[1] = 7 % K;

	for( int cntup = 2; cntup <= K; cntup++ )
	{
		checker[cntup] = ( checker[cntup-1] * 10 + 7 ) % K;	// mod前を保持するとすぐオーバーフローする 
		//printf( "%d:%d\n", cntup, checker[cntup] );
	}

	rep( ans, 1000001 )
	{
		if( checker[ans] == 0 )
		{
			std::cout << ans << std::endl;
			return 0;
		}
		else
		{
			continue;
		}
	}

	std::cout << -1 << std::endl;

    return 0;
}


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

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String in[] =  scan.nextLine().split(" ");
		BigDecimal A =  new BigDecimal(in[0]);
		BigDecimal B = new BigDecimal(in[1]);

		System.out.println(A.multiply(B).longValue());
	}
}

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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* na, Arg1&& arg1, Args&&... args) {
  const char* c = strchr(na + 1, ',');
  cerr.write(na, c - na) << " : " << arg1 << " , ";
  __f(c + 1, args...);
}
#define endl "\n"
#define all(v) v.begin(), v.end()
#define UNIQUE(v) sort(all(v)),v.erase(unique(all(v)),v.end())
typedef long long LL;
typedef pair <int,int> pii;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 1e5 + 5;

LL a[ N ][ 5 ];
LL dp[ N ][5 ];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif // LOCAL
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 3; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 3; j++) {
      for (int k = 1; k <= 3; k++) {
        if (j != k) dp[i][j] = max(dp[i][j], dp[i - 1][k] + a[i][k]);
      }
    }
  }
  cout << max(dp[n][1], max(dp[n][2], dp[n][3])) << endl;
  return 0;
}


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

using ll = long long;
using namespace std;

#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define FORR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define REPR(i,n) FORR(i,(int)(n)-1,0)

#define LFOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define LFORR(i,a,b) for(ll i = (int)(a); i >= (ll)(b); i--)
// #define LREP(i,n) LFOR(i,0,(ll)(n)-1)
// #define LREPR(i,n) LFORR(i,(ll)(n)-1,0)

#define SIZ(v) int(v.size())
const int INF = 1e8;
const ll LINF = 1e15;
const int MOD = 1e9+7;



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if(n%2==0)cout << 1.0/2 << endl;
  else cout << (double)(n/2 + 1)/n << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long i64;
typedef pair<i64,i64> P;


i64 n, m, a[101010];
map<int,int> d;

int main(){
	cin >> n >> m;
	for(int i = 0; i < n; i++){cin >> a[i]; a[i] %= m;}
	
	i64 ans = 0;
	d[0]++;
	for(int i = 0; i < n; i++){
		if(i != 0) a[i] += a[i-1];
		ans += d[a[i]%m];
		d[a[i]%m]++;
	}
	//累積和のmodが同じであるとこは、「1周した」的なイメージ
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define SZ(c) int(c.size())
#define pb push_back
#define loop(i,start,n)  for(int i=start;i<n;i++)
#define rloop(i,start,n)  for(int i=start;i>n;i--)

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
const ll inf = 2e9+3;

void solve(){
    int tc=1 ;
    //cin >> tc;
    while(tc--) {
        ll n; cin >> n;
        string res = "";
        while (n){
            int c = n%26;

            if(c-1>=0)res+=char('a'+c-1);
            else res+='z';

            if(c==0) n--;
            n/=26;
        }
        reverse(res.begin(),res.end());
        cout << res << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

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

#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ll long long
#define ld long double
#define pb push_back
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define LDMX LDBL_MAX
#define LDMN LDBL_MIN
#define MAX 1000000
#define pll pair<ll, ll>
#define vl vector<ll>
#define vll vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >


ll mulmod(ll, ll);
ll fastpower(ll, ll);
void getprime(vector<bool>&);
void getfact(vector<ll>&, vector<ll>&);
ll ncr(ll, ll, vector<ll>&, vector<ll>&);

void solve()
{
    ll n, ac = 0, re  = 0, tle = 0, wa = 0;
    cin>>n;
    for(ll i = 0; i < n ; i++)
    {
        string s;
        cin>>s;
        if(s == "AC")
            ac++;
        else if(s == "RE")
            re++;
        else if(s == "WA")
            wa++;
        else if(s == "TLE")
            tle++;
    }
    cout<<"AC x "<<ac<<"\n";
    cout<<"WA x "<<wa<<"\n";
    cout<<"TLE x "<<tle<<"\n";
    cout<<"RE x "<<re<<"\n";

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        solve();        
    }
    return 0;
}

ll mulmod(ll a, ll b)
{
    ll res = 0; 
    a = a % MOD;
    while(b > 0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
 
        a = (a * 2) % MOD; 
        b /= 2;
    } 
    return res % MOD; 
}

ll  fastpower(ll a, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n % 2 != 0)
        {
            res = (res * a) % MOD;
        }
        n /= 2;
        a = (a * a) % MOD;
    }
    return res;
}

void getprime(vector<bool>&prime)
{
    prime[0] = false;
    prime[1] = false;
    
    for(ll i = 2;i <= MAX; i++)
    {
        if(prime[i])
        {
            for(ll j = i*i; j <= MAX; j += i)
                prime[j] = false;
        }
    }
}

void getfact(vector<ll> &fact, vector<ll> &ifact)
{
    fact[0] = 1;
    ifact[0] = 1;
    
    for(ll i = 1; i <= MAX; i++)
    {
        fact[i] = (fact[i-1] * i)%MOD;
        ifact[i] = (ifact[i-1] * fastpower(i, MOD -2) )%MOD;
    }
}

ll ncr(ll n, ll r, vector<ll>&fact, vector<ll>&ifact)
{
    ll res;
    res = (((fact[n] * ifact[r]) % MOD) * ifact[n-r]) % MOD;
    return res;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    string s[h];
    for(int i = 0; i < h; i++){
        cin >> s[i];
    }
    
    int ans = 0;
    for(int i = 0; i < (1 << h); i++){
        for(int j = 0; j < (1 << w); j++){
            int sum = 0;
            for(int m = 0; m < h; m++){
                for(int n = 0; n < w; n++){
                    if(((i >> m) & 1) && ((j >> n) & 1) && (s[m][n] == '#')){
                       sum++;
                    }
                }
            }
            if(sum == k){ans++;}
        }
    }

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

Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <cmath>
#define rep(i,k,n) for(int i = k; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RSORT(x) sort(x.begin(), x.end(), std::greater<int>())
#define swap(a, b) \
  do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
#define vi vector<int>
using namespace std;

const double EPS = 1e-10;
const double PI  = acos(-1.0);

int N;

int main() {

  vi A;
  cin >> N;
  int sum = 0;
  A.push_back(0);
  
  for(int i = 1; i <= N; i++) {
    int a;
    scanf("%d", &a);
    A.push_back(a);
    
    if(i == 1)
      sum += abs(A[i]);
    else
      sum += abs(A[i] - A[i-1]);
  }
  A.push_back(0);

  // abs(0 - A[N])
  sum += abs(A[N]);
  
  for(int i = 1; i <= N; i++) {
    cout << sum - abs(A[i] - A[i-1]) - abs(A[i+1] - A[i]) + abs(A[i-1] - A[i+1]) << endl;
  }
  
}


Measured memory_bytes: 1784
import Data.List
import Data.Char

headA :: String -> Bool
headA s = head s == 'A'

existC :: String -> Bool
existC s = elem 'C' (midiam s)
        where
          midiam x = drop 1 (reverse (drop 2 x ))

smallalfabet :: String -> Bool
smallalfabet s = length [x | x <- s, elem x ['A'..'Z']] == 2

main :: IO ()
main = do
  s <- getLine
  putStrLn $ if (headA s && existC s && smallalfabet s)
    then "AC"
    else "WA"


Measured memory_bytes: 380
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
const int N=109;
int k,n;
string st;
int dp[N][4][2];
int solve(int i,int x,int f){
	if(x<0 or i>n)return 0;
	if(i==n){
		if(x==0)return 1;
		else return 0;
	}
	if(dp[i][x][f]!=-1)return dp[i][x][f];
	int sum=0,m=10;
	if(f)m=st[i]-'0';
	for(int j=0;j<m;j++){
		sum+=solve(i+1,x-(j!=0),0);
	}
	if(f){
		sum+=solve(i+1,x-(m!=0),1);
	}
	return dp[i][x][f]=sum;
}
int32_t main(){
	if(fopen("input.txt", "r"))
		freopen("input.txt", "r", stdin),
		freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0),cin.tie(0);
	cin >> st;
	cin >> k;
	n=st.size();
	memset(dp,-1,sizeof dp);
	// cout << k << endl;
	cout << solve(0,k,1);
}

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



void print(vector<int> v){
	
	for(int i=0;i<v.size();i++){
		cout<<v[i];
	}
	//cout<<endl;
}
int jud(int x){
	
	if(x%2==0)return x/2;
	else return (3*x)+1;
}
int N,P;
int P_max=0;
int P_sum=0;
int cnt=0;
int m[10000001]={0};
string str= "Christmas Eve Eve Eve";

void solve(){
	
	cin>>N;
	for(int i=0;i<N;i++){
		
		cin>>P;
		P_max=max(P,P_max);
		P_sum+=P;
	}
	P_sum-=P_max;
	P_sum+=(P_max/2);
	cout<<P_sum<<endl;

}


int main(){

    solve();
    return 0;
}




Measured memory_bytes: 256
N = int(input())
li = [list(map(int,input().split())) for _ in range(2)]
ma = 0
for i in range(N):
    li1 = li[0][0:i+1]
    li2 = li[1][i::]
    if ma <= sum(li1)+sum(li2):
        ma = sum(li1)+sum(li2)
print(ma)

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
int i,j,n,m,k,l,b[20],a,c;
int main()
{
  for(;i<5;i++){
    cin>>a;
    c+=(a%10!=0?a+(10-a%10):a);
    if(a%10!=0)k=max(k,abs(a%10-10));
  }
  cout<<c-k;
}

Measured memory_bytes: 256
A,B,C,X = int(input()),int(input()),int(input()),int(input())
n = 0
for i in range(0,A+1):
    for j in range(0,B+1):
        for k in range(0,C+1):
            if 500*i+100*j+50*k == X:
                n+=1
print(n)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n;

    for (int i = 1; (n = scanner.nextInt()) != 0; ++i) {
      System.out.println("Case " + i + ": " + n);
    }
  }
}


Measured memory_bytes: 44684
#include<iostream>
#include<vector>

using namespace std;
typedef long long ll;

int main() {
	ll n, x;
	cin >> n >> x;
	ll b = x;
	ll a = n - x;
	ll ans = 0;
	ans += b+a;
	while (a > 0) {
		//cout << a << " " << b << endl;
		ans += a*((b / a) * 2 );
		ll pa = a;
		a = b%a;
		b = pa;
		if (a == 0)ans -= pa;
	}

	cout << ans << endl;
}



Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    n = I()
    a = LI()
    b = LI()

    def f(c,n):
        c0 = c[0]
        if len(c) == 1:
            return n % c0[0] + n // c0[0] * c0[1]

        r = n
        for i in range(0,n+1,c0[0]):
            t = i // c0[0] * c0[1] + f(c[1:], n-i)
            if r < t:
                r = t
        return r

    c = sorted([(ai,bi) for ai,bi in zip(a,b) if ai < bi], reverse=True)
    t = n
    if len(c) > 0:
        t = f(c,n)

    d = sorted([(ai,bi) for ai,bi in zip(b,a) if ai < bi], reverse=True)
    r = t
    if len(d) > 0:
        r = f(d,t)

    return r


print(main())



Measured memory_bytes: 67176
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <regex>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define for(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)    for(i, 0, n)
#define sz(x)        ((int)(x).size())
#define inf          1<<25

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; }

//typedef vector<int> vi;
//typedef vector<long long> vl;
//typedef vector<double> vd;
//typedef pair<int,int> pii;
//typedef pair<long,long> pll;
//typedef long long ll;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};

int main() {
    int a, b;
    cin >> a >> b;
    
    string s;
    cin >> s;
    
    bool ans = 1;
    
    for(i, 0, a) if (s[i] < '0' || '9' < s[i]) ans = 0;
    for(i, a+1, a+b+1) if (s[i] < '0' || '9' < s[i]) ans = 0;
    if (s[a] != '-') ans = 0;
    
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

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

template <typename T>
void print_vector(vector<T>& vec) {
    cout << "print_vector -> ";
    for(int i=0; i<vec.size(); i++) {
        if(i == vec.size()-1) {
            cout << vec[i] << endl;
        }
        else {
            cout << vec[i] << " ";
        }
    }
    return;
}

int main() {

    int n;
    string s;
    cin >> n >> s;

    int count = 0;
    for(int i=0; i<n-2; i++) {
        if(s.substr(i,3) == "ABC") {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		String fes = sc.next();
		char[] name = fes.toCharArray();
		int size = fes.length();
		for(int i = 0;i<size-8;i++){
			System.out.print(name[i]);
		}
		
	}
}


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

using namespace std; 
const int MAX_K = 100005; 
int f[MAX_K]; 
int a[105]; 
int n, k; 

int main () {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin >> n >> k; 
	for (int i = 1; i <= n; i++) {
		cin >> a[i]; 
	} 

	for (int i = 1; i <= k; i++) {
		for (int j = 1; j <= n; j++) {
			if (i >= a[j] && f[i - a[j]] == 0) {
				f[i] = 1;
				break; 	
			}
		}
	}

	cout << (f[k] == 1 ? "First" : "Second"); 
	return 0; 
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n, x[200100], i, cop[200100], ans1, ans2;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> x[i];
        cop[i]=x[i];
    }
    sort(cop, cop+n);
    ans1=cop[(n/2)-1];
    ans2=cop[(n/2)];
    for(i=0;i<n;i++){
        if(x[i]<=ans1) cout << ans2 <<endl;
        else if(x[i]>=ans2) cout << ans1 <<endl;
    }
    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    //入力
    int n;
    cin>>n;
    vector<vector<pair<int,int>>> edge(n+5);
    for(int i=0;i<n-1;i++){
        int a,b,c;
        cin>>a>>b>>c;
        edge[a].push_back({b,c});
        edge[b].push_back({a,c});
    }
    int q,k;
    cin>>q>>k;
    vector<pair<int,int>> que(q+5);
    for(int i=0;i<q;i++){
        int x,y;
        cin>>x>>y;
        que[i]={x,y};
    }
    //ダイクストラ
    vector<ll> dist(n+5,INF);
    dist[k]=0;
    vector<int> visit(n+5);
    priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>> > queue;
    queue.push({dist[k],k});
    while(!queue.empty()){
        int sec=queue.top().second;
        queue.pop();
        visit[sec]=1;
        for(int i=0;i<edge[sec].size();i++){
            int e1=edge[sec][i].first,e2=edge[sec][i].second;
            if(visit[e1]==0 && dist[e1]>dist[sec]+e2) {
                dist[e1]=dist[sec]+e2;
                queue.push({dist[e1],e1});
            }
        }
    }
    //出力
    for(int i=0;i<q;i++) cout<<dist[que[i].first]+dist[que[i].second]<<endl;
    return 0;
}


Measured memory_bytes: 11248
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main() {
   int a, b, c, k;
   cin >> a >> b >> c >> k;
   int res = 0;
   res += min(a, k);
   k -= a;
   if (k <= 0) {
      cout << res << endl;
      return 0;
   }  
   k -= b;
   if (k <= 0) {
      cout << res << endl;
      return 0;
   }
   res += min(c, k) * (-1);
   cout << res << endl;
}

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

typedef long long ll;

#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back

const long double PI = acos(-1);

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll GetDigit(ll num) {return log10(num)+1;}

int main(){
  ll n, r;
  cin >> n >> r;
  if(n >= 10){
    cout << r << endl;
  }else{
    cout << r + 100*(10-n) << endl;
  }
  return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    deque<int>q;
    rep(i,n){
        int a; cin>>a;
        if(n%2==i%2)q.push_back(a);
        else q.push_front(a);
    }
    while(!q.empty()){
        if(q.size()!=1)cout<<q.front()<<" ";
        else cout<<q.front()<<endl;
        q.pop_front();
    }
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
using ll=unsigned long long;
ll p10(ll n){return n==1?10:10*p10(n-1);}
int main(void){
    ll ans=0,dig=1;
    ll n;cin>>n;
    
    for(ll i=0;ans<=n;){
        dig++;
        ll diff=(dig*8+32)*(p10(dig)-i-10)/15-5; //1~90,91~990?????????????????°?????????
        if(ans+diff>n){
            ll lim=n-ans;
            ll start,index;
            if(lim<=(dig*8+35-8)){
                //cout<<"??°???"<<i+1<<"??????"<<ans+1<<"????????????????????????"<<endl;
                start=i+1;
                index=ans+1;
            }else{
                ans+=dig*8+35-8;//i+16???ans???????????????
                lim=n-ans;//?????¨lim???.(dig*8+32)*p<=lim????????§???p????±???????
                //cout<<"??°???"<<i+16+15*(ll)floor(lim/(dig*8+32))<<"??????"<<ans+(ll)floor(lim/(dig*8+32))*(dig*8+32)+1<<"????????????????????????"<<endl;
                start=i+16+15*(ll)floor(lim/(dig*8+32));
                index=ans+(ll)floor(lim/(dig*8+32))*(dig*8+32)+1;
            }
            string s;
            for(ll st=start;s.length()<=10000;st++){
                if(st%3==0){
                    s+="Fizz";
                    if(st%5==0)
                        s+="Buzz";
                }else if(st%5==0){
                    s+="Buzz";
                }else{
                    s+=to_string(st);
                }
            }
            cout<<s.substr(n-index,20)<<endl;
            return 0;
        }
        ans+=diff;
        i=p10(dig)-10;
    }
}

Measured memory_bytes: 3336
#include<iostream>
using namespace std;
int main()
{
int n,s,h;
int i,ans;
cin >> n;
for(i=0;i<n;i++)
{
cin >> s >> h;
ans=s%h;
if(ans==0)cout << h << endl;
else cout << ans << endl;
}
return 0;
}

Measured memory_bytes: 3088
#include<iostream>
#include<set>
#include <cstdio>
#include<vector>
#include<algorithm>

using namespace std;
	long long a,b,c ;
int main(){
    cin>>a>>b>>c;
    if(a%2 && b%2 && c%2){
	cout<<min(min(a*b, b*c), a*c);
    }else{
	cout<<0;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
int dp[1001][1001];
char g[1001][1001];
int mod = 1000000000+7;

bool ok(int i,int j)
{
    return (i>=0&&i<n&&j>=0&&j<m&&g[i][j]=='.');

}
void make()
{
    cin >> n >> m;
    for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)cin>>g[i][j];
   dp[0][0] = 1;
    for(int i =0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(ok(i-1,j))
            {
                dp[i][j] = (dp[i-1][j]+dp[i][j])%mod;
            }
            if(ok(i,j-1))
            {
                dp[i][j] = (dp[i][j]+dp[i][j-1])%mod;
            }
        }
    }
    cout<<dp[n-1][m-1]<<"\n";

}


int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    make();
   
   
}

Measured memory_bytes: 5120
N,M = map(int, input().split())

L = []
R = []
for i in range(M):
    l,r = map(int, input().split())
    L.append(l)
    R.append(r)

l1 = max(L)
r1 = min(R)
if r1 >= l1:
    ans = r1-l1+1
else:
    ans = 0
print(ans)

Measured memory_bytes: 10996
#!/usr/bin/env python

a, b = input().split()

if a == "H" and b == "H":
    print("H")
elif a == "D" and b == "H":
    print("D")
elif a == "H" and b == "D":
    print("D")
elif a == "D" and b == "D":
    print("H")

Measured memory_bytes: 2940
object Main {
    def main(args: Array[String]) = {
        val in = io.Source.stdin.getLines.map(_.toInt).toList.init
        val (x, y) = Array((30, 160), (20, 140), (10, 125)).unzip
        in.foreach(n => println(3130-(x.scanLeft((n, n))((a, b) => (a._2-b max 0, a._2 min b)).tail.map(_._1) zip y).map(p => p._1 * p._2).sum))
    }
}

Measured memory_bytes: 44208
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  int ans = -1;
  if(n >= 4){
    for(int i = 2; i < n; i++){
      int temp_ans = i;
      while(temp_ans <= n){
        temp_ans *= i;
      }
      if(i*i <= n)ans = max(ans, temp_ans/i);
    }
    cout << ans << endl;
  }else{
    cout << 1 << endl;
  }
}

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

typedef long long ll;
typedef pair<int, int> pii;
const int N = 1e5 + 100;

int n, ans, c[N];
vector<pii> nei[N];
set<int> st[N];

void go(int v = 0, int par = 0) {
	for (pii p: nei[v])
		if (p.first ^ par) {
			int C = *st[v].begin();
			c[p.second] = C;
			st[p.first].erase(C);
			st[v].erase(C);
			go(p.first, v);
		}
}

int main() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int u, v;
		cin >> u >> v;
		nei[--u].push_back(pii(--v, i));
		nei[v].push_back(pii(u, i));
		ans = max(ans, (int)max(nei[u].size(), nei[v].size()));
	}
	for (int i = 0; i < n; i++)
		for (int j = 0; j <= nei[i].size(); j++)
		st[i].insert(j);
	go();
	cout << ans << '\n';
	for (int i = 0; i < n - 1; i++)
		cout << ++c[i] << '\n';
}


Measured memory_bytes: 25728
import java.util.*;
import java.io.*;
public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int[] dice = new int[6];
        int[] nwse = {1,5,4,2,3};
        String[] str = br.readLine().split(" ");
        for(i = 0; i < 6; i++){
            dice[i]=Integer.parseInt(str[i]);
        }
        String a = br.readLine();
        char dis[]=a.toCharArray();
        for(i = 0; i < a.length(); i++){
            nwse=roll(dis[i],nwse);
        }
        System.out.println(dice[nwse[0]-1]);
    }   
         
    public static int[] roll(char b,int nwse[]){
            int p=0,q=0;
            switch (b){
            case 'S':
                {p=3;q=1;break;}
            case 'W':
                {p=2;q=4;break;}
            case 'N':
                {p=1;q=3;break;}
            case 'E':
                {p=4;q=2;break;}
            }
            nwse[p]=nwse[0];nwse[0]=nwse[q];nwse[q]=7-nwse[p];
            return nwse;
    }
}



Measured memory_bytes: 26344
#include <iostream>
#include <map>
#include <set>
using namespace std;
int main()
{
    map<long long, long long> pp, p;
    long long m, n, a, s = 0, ss = 0, i;
    string ks;
    cin >> m >> n;
    while (n--)
    {
        cin >> a >> ks;
        if (ks[0] == 'W' && p[a] == 0)
            pp[a]++;
        else if (ks[0]=='A')
            p[a]++;
    }//cout<<p[0];
    for (i = 1; i <= m; i++)
    {
        if (p[i] > 0)
        {
            s++;
            ss += pp[i];
        }
    }
    cout << s << " " << ss;
}

Measured memory_bytes: 16056
def main():
    N = int(input())
    S = input()
    div = pow(10, 9) + 7
    facN = 1
    for i in range(1, N+1):
        facN = (facN * i) % div

    if S[0] != "B": return 0
    t = "L"
    ctL, ctR = 1, 0
    for i in range(1, 2*N):
        if S[i-1] != S[i]:
            t += t[-1]
        else:
            if t[-1] == "L":
                t += "R"
            else:
                t += "L"
        if t[-1] == "L": ctL += 1
        else: ctR += 1
    if S[-1] != "B":
        return 0
    if ctL != ctR: return 0

    prefixL = [0]
    for c in t:
        if c == "L":
            prefixL.append(prefixL[-1]+1)
        else:
            prefixL.append(prefixL[-1])

    # print(S, t)
    # print(prefixL)
    ans = 1
    countR = 0
    for i in range(len(t)):
        if t[i] == "R":
            ans *= prefixL[i] - countR
            ans %= div
            countR += 1
    return (ans * facN) % div

if __name__ == '__main__':

    print(main())

Measured memory_bytes: 8296
aru = False
antenas = []
for i in range(5):
  k=int(input())
  antenas.append(k)
k=int(input())
for i in range(5):
  for t in range(i,5):
    if abs(antenas[i]-antenas[t])>k:
      aru = True
if aru:
  print(':(')
else:
  print("Yay!")


Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashMap;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main{
	public static int[][] map;
	public static Node[] node;
	public static int w;
	public static int h;
	public static int[] c;
	public static HashMap<Integer, Integer> cost;
	public static final int[] dx = {1, 0, -1, 0};
	public static final int[] dy = {0, 1, 0, -1};
	public static final int mask = (1<<12)-1;
	public static final int diff = 12;
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		while(true){
			w = in.nextInt();
			h = in.nextInt();
			if(w == 0) break;
			map = new int[h][w];
			for(int i=0; i<h; i++){
				for(int j=0; j<w; j++){
					map[i][j] = in.nextInt();
				}
			}
			node = new Node[4*h*w];
			// id = dir*h*w + y*w + x
			// ID_MAX = 3600 < 2^12
			int size = 4*h*w;
			for(int i=0; i<size; i++){
				node[i] = new Node(i);
			}
			c = new int[4];
			for(int i=0; i<4; i++){
				c[i] = in.nextInt();
			}
			cost = new HashMap<Integer, Integer>();
			for(int i=0; i<h; i++){
				for(int j=0; j<w; j++){
					edge(i, j, map[i][j]);
				}
			}
			int goal = h*w-1;
			int res = 0;
			Queue<Pos> qu = new PriorityQueue<Pos>();
			BitSet used = new BitSet(4*h*w);
			qu.add(new Pos(0, 0));
			while(!qu.isEmpty()){
				Pos p = qu.poll();
				if(used.get(p.id)) continue;
				if(p.id%(w*h) == goal){
					res = p.dist;
					break;
				}
				used.set(p.id);
				for(Node v: node[p.id].edge){
					int c = cost.containsKey(v.id)
							? Math.min(cost.get(v.id), p.dist+cost.get(p.id<<diff|v.id))
									: p.dist+cost.get(p.id<<diff|v.id);
					cost.put(v.id, c);
					qu.add(new Pos(v.id, c));
				}
			}
			System.out.println(res);
		}
	}
	
	public static void edge(int y, int x, int command){
		int base = h*w;
		for(int i=0; i<4; i++){
			// 命令iをつかう
			for(int j=0; j<4; j++){
				// 階層jから階層j+iへ、yからy+dy[j+i]へ、xからx+dx[j+i]へコストc[i]の辺を張る
				int ny = y+dy[(j+i)%4];
				int nx = x+dx[(j+i)%4];
				if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
				int from = j*base + y*w + x;
				int to = ((j+i)%4)*base + ny*w + nx;
				node[from].createEdge(node[to]);
				cost.put(from<<diff|to, i==command?0:c[i]);
			}
		}
	}
}

class Pos implements Comparable<Pos>{
	int id;
	int dist;
	public Pos(int id, int dist){
		this.id = id;
		this.dist = dist;
	}
	
	@Override
	public int compareTo(Pos o) {
		return dist-o.dist;
	}
}

class Node{
	int id;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id){
		this.id = id;
	}
	
	public void createEdge(Node nd){
		edge.add(nd);
	}
	
	public String toString(){
		return "(depth:"+(id/Main.w/Main.h)+", x:"+(id%Main.w)+", y:"+(id/Main.w)%Main.h+")";
	}
}

Measured memory_bytes: 67568
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
#include<random>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, -1, 0, 1};
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

struct UnionFind {
    vector<int> par;
    int n, cnt;
    UnionFind(const int& x = 0) {init(x);}
    void init(const int& x) {par.assign(cnt=n=x, -1);}
    inline int find(const int& x) {return par[x] < 0 ? x : par[x] = find(par[x]);}
    inline bool same(const int& x, const int& y) {return find(x) == find(y);}
    inline bool unite(int x, int y) {
        if ((x = find(x)) == (y = find(y))) return false;
        --cnt;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    inline int count() const {return cnt;}
    inline int count(int x) {return -par[find(x)];}
};

const int MAXN = 100100;
int X[MAXN], Y[MAXN];
vi Xp[MAXN], Yp[MAXN];
bool done[MAXN];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, H, W;
    cin >> N >> W >> H;
    int flag = 0;
    for (int i = 0; i < N; i++) {
        cin >> X[i] >> Y[i];
        Xp[X[i]].push_back(i);
        Yp[Y[i]].push_back(i);
        if (X[i] == 1 || Y[i] == 1 || X[i] == W || Y[i] == H) flag = 1;
    }
    UnionFind uf(N);
    for (int i = 0; i < MAXN; i++) {
        for (int j = 1; j < Xp[i].size(); j++)
            uf.unite(Xp[i][j], Xp[i][0]);
        for (int j = 1; j < Yp[i].size(); j++)
            uf.unite(Yp[i][j], Yp[i][0]);
    }
    int ans = 0;
    int sz = 0;
    for (int i = 0; i < N; i++) {
        int p = uf.find(i);
        if (!done[p]) {
            done[p] = true;
            sz++;
            ans += uf.count(p)-1;
        }
    }
    if (sz > 1) {
        if (flag) ans += 2*(sz-1);
        else ans += 2*sz-1;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define ANTHRO(x...) cerr << "[" << #x << "] = [", _print(x)
#else
#define ANTHRO(x...)
#endif


#define ll long long
#define MOD 1000000007
#define INF (ll)1e18
#define EPS 1e-9
/*
	XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    No, nothing good starts in a getaway car
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long double pi=3.1416;
    long double r; cin>>r;
    cout<<setprecision(5)<<(long double)(2*pi*r)<<endl;
    return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
const int INF = 1000000000;
typedef pair<int, int> P;
const int MAX_N = 1000000;
typedef int64_t ll;
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; }



int main() {
	int N;
	cin >> N;
	N++;
	vector<ll> dp(N);
	dp[0] = 2;
	dp[1] = 1;
	
	for (int i = 2; i < N ; i++)
	{
		dp[i] = dp[i - 1] + dp[i - 2];
	}
	N--;
	cout << dp[N] << endl;
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		double x;
		String u;
		double sum = 0;
		
		for(int i = 0; i < N; i++) {
			x = sc.nextDouble();
			u = sc.next();
			if(u.equals("JPY")) {
				sum += x;
			} else {
				sum += x * 380000.0;
			}
		}
		
		System.out.println(sum);
		
	}
}


Measured memory_bytes: 22996
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<stack>
#include<set>


using namespace std;


int main() {
	int N, R;
	cin >> N >> R;
	int x = 0;
	if (N < 10) {
		x = 100 * (10 - N);
	}
	cout << R + x << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Collections;

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

    static class Gluttony {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long k = in.nextLong();

            Integer[] foods = new Integer[n];
            Integer[] team = new Integer[n];

            for (int i = 0; i < n; i++) {
                team[i] = in.nextInt();
            }

            for (int i = 0; i < n; i++) {
                foods[i] = in.nextInt();
            }

            Arrays.sort(foods);
            Arrays.sort(team, Collections.reverseOrder());

            if (score(team, foods, 0) <= k) {
                out.println(0);
                return;
            }

            long left = 0;
            long right = Long.MAX_VALUE;
            while (right - left > 1) {
                long middle = (left + right) / 2;
                long s = score(team, foods, middle);
                if (s <= k) {
                    right = middle;
                } else {
                    left = middle;
                }
            }

            out.println(right);

        }

        public static long score(Integer[] team, Integer[] foods, long target) {

            long score = 0;
            for (int i = 0; i < team.length; i++) {
                long count = target / foods[i];
                score += Math.max(team[i] - count, 0);
            }
            return score;
        }

    }
}



Measured memory_bytes: 68928
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools, bisect
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007
INF = float("inf")

def main():
    N, K = LI()
    V = LI()
    V2 = V + V

    ans = 0
    for k in range(1, min(K + 1, N + 1)):
        for i in range(len(V) - k, len(V) + 1):
            neg = []
            tmp = 0
            for vi in V2[i:i + k]:
                if vi < 0:
                    neg.append(vi)
                tmp += vi
            tmp -= sum(sorted(neg)[:K - k])
            ans = max(ans, tmp)

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 78944
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a==b){
			printf("a == b\n");
	}
	if
	(a>b){
			printf("a > b\n");
		}
	if
	(a<b){
			printf("a < b\n");
		}
	return 0;
}

Measured memory_bytes: 1748
#include <bits/stdc++.h>
int main()
{
    int n;
    scanf("%d", &n);

    int a[100000] = {};
    for (int i = 0; i < n; i++) {
        int idx;
        scanf("%d", &idx);

        a[idx]++;
        a[idx + 1]++;
        a[idx - 1]++;
    }
    std::sort(a, a + 100000);
    printf("%d\n", a[99999]);
}


Measured memory_bytes: 640
#include<cstdio>
#define root 1
#define leaf 2
#define internal 3

const int maxn = 1e5 + 5;

struct Node{
    int parent;
    int down;
    int right;
};

Node Tree[maxn * 20];
int input[maxn];

void init(int n){
    for(int i = 0; i < n; i ++){
        Tree[i].parent = -1;
        Tree[i].down = -1;
        Tree[i].right = -1;
    }
}

void build(int n){
    for(int ii = 0; ii < n; ii ++){
        int k, x, i;
        scanf("%d%d", &i, &k);
        if(k){
            scanf("%d", &x);
            Tree[i].down = x;
            Tree[x].parent = i;
            for(int j = 1; j < k; j ++){
                int xx;
                scanf("%d", &xx);
                Tree[xx].parent = i;
                Tree[x].right = xx;
                x = xx;
            }
        }
    }
}

int depth(int now){
    int dep = 0;
    while(Tree[now].parent != -1){
        dep += 1;
        now = Tree[now].parent;
    }
    return dep;
}

int part(int now){
    if(Tree[now].parent == -1)
        return root;
    else{
        if(Tree[now].down == -1)
            return leaf;
        else
            return internal;
    }
}

void print(int now){
    printf("node %d: parent = %d, depth = %d, ", now, Tree[now].parent, depth(now));
    if(part(now) == root)
        printf("root, [");
    else if(part(now) == leaf)
        printf("leaf, [");
    else
        printf("internal node, [");
    if(Tree[now].down != -1){
        for(now = Tree[now].down; now != -1; now = Tree[now].right){
            printf("%d", now);
            if(Tree[now].right != -1)
                printf(", ");
        }
    }
    puts("]");
}

int main(){
    int n;
    scanf("%d", &n);
    init(n);
    build(n);
    for(int i = 0; i < n; i ++){
        print(i);
    }
    return 0;
}



Measured memory_bytes: 3772