akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int n,d;
int x,p[11][11];
int dp[11][111111];

int main(){
	cin.sync_with_stdio(false);
	cin>>n>>d>>x;
	rep(i,d)rep(j,n)cin>>p[i][j];
	memset(dp,-1,sizeof(dp));
	rep(i,n)dp[i][x]=x;
	rep(i,d)repl(sell,i+1,d)for(int j=100001;j>=0;j--){
		if(dp[i][j]==-1)continue;
		rep(k,n){
			if(j<p[i][k]||p[sell][k]-p[i][k]<0)continue;
			int prof=p[sell][k]-p[i][k];
			maxch(dp[sell][dp[i][j]+prof],dp[i][j]+prof);
			maxch(dp[i][j-p[i][k]],dp[i][j]+prof);
			//dbg(sell); dbg(j+prof);
		}
	}
	int res=0;
	rep(i,11)rep(j,111111)maxch(res,dp[i][j]);
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 7984
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n,k;
    cin>>n>>k;
    vector<double>arr(200001);
    for(ll i=1;i<=200000;i++)
    {
        double a=i*(i+1)*1.0;
        a/=2;
        a/=i;
        arr[i]=a;
    }
    double arr1[n];
    for(ll i=0;i<n;i++)
    {
        ll a;
        cin>>a;
        arr1[i]=arr[a];
    }
    for(ll i=1;i<n;i++)
    {
        arr1[i]+=arr1[i-1];
    }
    double maxi=arr1[k-1];
    for(ll i=k;i<n;i++)
    {
        maxi=max(maxi,arr1[i]-arr1[i-k]);
    }
    cout<<fixed<<setprecision(15)<<maxi;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int W = scan.nextInt(), H = scan.nextInt(), x = scan.nextInt(), y = scan.nextInt(), r = scan.nextInt();

        if (x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 26264
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N, x[100], y[100];
map<pll, ll> mp;

signed main(){
    cin >> N;
    REP(i, N) cin >> x[i] >> y[i];
    REP(i, N){
        REP(j, N){
            if(i == j) continue;
            mp[pll(x[i] - x[j], y[i] - y[j])]++;
        }
    }
    ll m = 0;
    for(auto p : mp) m = max(m, p.second);
    PRINT(max(1LL, N - m));
    return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

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

    vector<ll> cum(n + 1, 0);
    rep(i, n) cum[i + 1] = cum[i] + a[i];

    map<ll, ll> mp;
    rep(i, n + 1)
    {
        mp[cum[i]]++;
    }

    ll ans = 0;
    for (auto itr: mp)
    {
        ll nn = itr.second;
        ans += nn * (nn - 1) / 2;
    }

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

Measured memory_bytes: 15872
let () =
  let r, d, x = Scanf.scanf "%d %d %d\n" (fun a b c -> a, b, c) in
  let rec f x i = if i = 10 then [] else string_of_int (r*x-d) :: f (r*x-d) (i+1) in
  let lst = (f x 0) in List.iter print_endline lst


Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;

public class Main { 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int hoge = Integer.parseInt(sc.next());
        int fuga= Integer.parseInt(sc.next());
        sc.close();
        System.out.println(Math.max(hoge+fuga, Math.max(hoge-fuga, hoge*fuga)));
    }
}

Measured memory_bytes: 22996
#include<stdio.h>
int main(){
  int n,i;
  int maxI=0;
  int max=0;
  int sum=0;
  int l[11];
  scanf("%d",&n);
  for(i=0;i<n;++i){
    scanf("%d",&l[i]);
  }
  for(i=0;i<n;++i){
    if(l[i]>max){
      max=l[i];
      maxI=i;
    }
  }
  for(i=0;i<n;++i){
    if(i!=maxI){
      sum+=l[i];
    }
  }
  if(sum>max){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}

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

using namespace std;

int main(){
    int n,x;
    cin>>n>>x;
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    int sum=0;
    int cnt=1;
    for(int i=0;i<n;i++){
        sum+=l[i];
        if(sum>x)
            break;
        else
            cnt++;
    }
    cout<<cnt;
}


Measured memory_bytes: 256
N = int(input())
ABC = list()
for _ in range(N):
    ABC.append(list(map(int, input().split(" "))))

dp = [ABC[0][0], ABC[0][1], ABC[0][2]]

for day in range(1, N):
    new_dp = [max(dp[1], dp[2])+ABC[day][0],
              max(dp[0], dp[2])+ABC[day][1],
              max(dp[0], dp[1])+ABC[day][2]]
    dp = new_dp
    
print(max(dp))


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

int main() {
  int h1,m1,h2,m2,k,l,ans=-1;
  cin>>h1>>m1>>h2>>m2>>k;
  if(h1<h2||(h1==h2&&m1<m2)){
    l=(h2-h1)*60+(m2-m1);
    ans=l-k;
  }else{
    l=(24-h1-1+h2)*60+(60-m1+m2);
    ans=l-k;
  }
  cout<<ans<<endl;
}

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

#define SLAY ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define LL long long
#define PII pair<int , int>
#define PLL pair<long long , long long>
#define INPUT freopen("/Users/amrfahmy/Documents/Problem solving/CF/CF/input.txt", "r", stdin);
using namespace std;
 
const LL MOD = 1000000007;
LL a[1000000];
LL b[1000000];
LL n,q,c,cnt,mx,m,temp,k;
string str;
vector< int > dp;

bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){
    return (a.first < b.first);
}


int main()
{
    bool readfromfile=false; if(!readfromfile){SLAY} else{INPUT}
    
 

//    cin>>n;
//    cin>>n>>m;
//    for(int i = 0 ; i < n ; i++)cin>>a[i];
//    for(int i = 0 ; i < n ; i++)cin>>b[i];

//    string str1 , str2;
//    cin>>str1>>str2;
//    cout<<str2<<str1;
    
    LL x , y , z , temp;
    
    cin>>x>>y>>z;
    
    
    if(z>x){
        cout<<"0"<<" ";
    }else{
        cout<<x-z<<" ";
    }
    
    
    z-=x;
    
    if(z>0){
        if(z>y){
            cout<<0;
        }else{
            cout<<y-z;
        }
    }else{
        cout<<y;
    }
    
    return 0;
}



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

bool isLeap(int year){
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}

int main(){
  int fr, to;
  bool line = false;
  while(true){
    cin >> fr >> to;
    if(fr == 0 && to == 0) break;
    
    if(!line) line = true;
    else cout << endl;
    
    bool NA = true;
    
    for(int i=fr;i<=to;i++){
      if(isLeap(i)) { cout << i << endl; NA = false; }
    }
    
    if(NA) cout << "NA" << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#ifdef ONLINE_JUDGE
  #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#endif

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define ld long double
#define mtr vector<vector<int>>

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))

mtr x;
const int mod = 1e9 + 7;
mtr mul(mtr a, mtr b) {
  mtr c(a.size(), vector<int>(a.size()));
  for (int i = 0; i < a.size(); i ++) {
    for (int j = 0; j < a.size(); j ++) {
      for (int k = 0; k < a.size(); k ++) {
        c[i][k] = (c[i][k] + a[i][j] * b[j][k]) % mod;
      }
    }
  }
  return c;
}

signed main() {
  #ifndef ONLINE_JUDGE
    ifstream cin("in");
  #endif
  ios_base::sync_with_stdio(0); cin.tie(0); // harris leung ioi gold calling it 18.09

  int n, k; cin >> n >> k;
  x = vector<vector<int>>(n, vector<int>(n));
  mtr ans(n, vector<int>(n));
  for (int i = 0; i < n; i ++) {
    ans[i][i] = 1;
    for (int j = 0; j < n; j ++) {
      cin >> x[i][j];
    }
  }
  while (k) {
    if (k & 1) {
      ans = mul(ans, x);
    }
    x = mul(x, x);
    k >>= 1;
  }
  int total = 0;
  for (int i = 0; i < n; i ++) {
    for (int j = 0; j < n; j ++) {
      total = (total + ans[i][j]) % mod;
    }
  }
  cout << total << endl;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
 int a,b;
 cin >> a>>b;
 int ans = a*(a-1)/2;
 int bns = b*(b-1)/2;
 cout << ans+bns << endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  ll n,m,v,p;
  cin>>n>>m>>v>>p;

  vector<ll> q(n);
  rep(i,n){
    cin>>q[i];
  }

  sort(all(q));
  reverse(all(q));

//————————————————二分探索——————————————————————————

  int ng = n;
  int ok = p-1;
  while (abs(ok - ng) > 1) {
    int mid = (ng + ok) / 2;

    ll x=q[mid]+m;

    if(x<q[p-1]){
      ng=mid;
      continue;
    }

    int cnt=n-mid+p-1;
    ll hyo=m*cnt;

    for(int i=p-1;i<mid;i++){
      hyo+=x-q[i];
    }

    (m*v<=hyo? ok : ng) = mid;
  }

  cout << ok+1 << endl;

//——————————————————————————————————————————


}

Measured memory_bytes: 3996
use proconio::input;

fn main() {
  input! {
    k: usize
  }  

  if k % 2 == 0 {
    println!("-1");
    return
  }
  
  let mut seven = 7;
  let mut count = 0;
  while count <= k {
    count += 1;
    seven %= k;
    if seven == 0 {
      println!("{}", count);
      return
    }
    
    seven = (seven * 10 + 7) % k;
  }
  
  println!("-1");
}

Measured memory_bytes: 2144
#include<iostream>
using namespace std;
int main(){
	int i,H,j,W;
	
	for(;;){
		cin>>H>>W;
		if(H==0 && W==0)break;
		for(i=1;i<=H;i++){
			for(j=1;j<=W;j++){
				if((i+j)%2==0){
				cout<<"#";
			    }
				else{
                cout<<".";
				}
			}
			cout<<endl;
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 3100
N, M, X = map(int, input().split())
CAAA = [input().split() for i in range(N)]

ans = 1000000000
for k in range(1, 2**N):
  price = 0
  rikaido=[0]*M
  for l in range(N):
    if k>>l & 1:
      #if CAAA[m][1] < price:
      price += int(CAAA[l][0])
      for t in range(M):
        rikaido[t] += int(CAAA[l][t+1])
        for r in rikaido:
          if r < X:
            break
        else:
          ans = min(ans, price)
if ans == 1000000000:
  print(-1)
else:
  print(ans)

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

int main()
{
  int N, D, X;
  cin >> N >> D >> X;
  vector<int> A(N);
  for (auto &a : A)
  {
    cin >> a;
  }
  int sum = X;
  for (int i = 0; i < N; i++)
  {
    int days = 1;
    int j = 0;
    while (days <= D)
    {
      sum += 1;
      days += A[i];
      j++;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
var
	n:Longint;
function f(x:int64;a,b,c:Longint):Longint;
begin
	f:=0;
	if x<=n then f:=a*b*c+f(x*10+3,1,b,c)+f(x*10+5,a,1,c)+f(x*10+7,a,b,1);
end;
begin
	read(n);
	if n>777777752 then begin writeln(26484);exit;end;
	writeln(f(0,0,0,0));
end.

Measured memory_bytes: 128
N, K = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
dp = [False for _ in range(K+1)]
for i in range(1, K+1):
    for j in a:
        if i - j >= 0:
            dp[i] = dp[i] or not dp[i - j]
        else:
            break
if dp[-1]:
    print("First")
else:
    print("Second")

Measured memory_bytes: 79292
def readinput():
    k,s = list(map(int,input().split()))
    return k,s

def main(k,s):
    count=0
    for x in range(k+1):
        for y in range(k+1):
            z=s-x-y
            #print(x,y,z)
            if 0<=z and z<=k:
                count+=1
    return count

if __name__=='__main__':
    k,s=readinput()
    ans=main(k,s)
    print(ans)



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

using namespace std;

int main(){
    int n, temp;
    long long vol = 1;
    int line[1005];
    for(int i = 0; i < 1005; i++){
        line[i] = 0;
    }
    cin >>n;
    for(int i = 1; i <= n; i++){
        temp = i;
        for(int j = 2; j <= n; j++){
            while(temp % j == 0){
                temp /= j;
                line[j] += 1;
            }
        }

    }
    for(int i =0; i < 1005; i++){
        if(line[i] != 0){
            vol *= line[i] + 1;
            vol %= 1000000007;
            //cout << i << ":" << line[i] << endl;
        }
    }
    //vol %= 1000000007;
    cout << vol << endl;

}

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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	int a,b;
	cin >> a >> b;
	cout << 2*b - a << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	int H,W;
	while(true){
		scanf("%d %d",&H,&W);
		if(H == 0 && W == 0) break;
		for(int i = 0; i < W; i++) printf("#");
		printf("\n");

		for(int i = 1; i < H-1; i++){
			printf("#");
			for(int j = 1; j < W-1; j++) printf(".");
			printf("#\n");
		}

		if(H > 1){
			for(int i = 0; i < W; i++) printf("#");
			printf("\n");
		}
		printf("\n");
	}
}



Measured memory_bytes: 2576
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        string S = cin.next();
        Console.WriteLine(S.Substring(0,4) + " " + S.Substring(4, 8));
    }




}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) std::cin>>(P)
#define IN2(P1,P2) std::cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) std::cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) std::cin>>V[I]
#define OUT(P) std::cout<<P<<std::endl
#define OUT2(P1,P2) std::cout<<P1<<" "<<P2<<std::endl
#define OUT3(P1,P2,P3) std::cout<<P1<<" "<<P2<<" "<<P3<<std::endl
#define OUTS(I,N,V) REP(I,N) std::cout<<V[i]<<std::endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
using namespace std;
using namespace __gnu_pbds;
typedef unsigned long ul;
ul N,h[100],ans,active,i;
inline void solve(){
  IN(N);
  INS(i,N,h);
  REP(i,N){
    if(active>=h[i])active=h[i];
    else{
      ans+=h[i]-active;
      active=h[i];
    }
  }
  OUT(ans);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

int main(){
    int k;
    cin>>k;
    string s="";
    rep(i,k)s+="ACL";
    cout<<s<<endl;
}

Measured memory_bytes: 3596
#include <iostream>
using namespace std;
int main(void){
    int x;
    cin >>x;
    if(x==7){
        cout <<"YES";
    }else{
        if(x==5){
            cout <<"YES";
        }else{
            if(x==3){
                cout <<"YES";
            }else{
                cout <<"NO";
            }
        }
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();	//サイコロの面の数
		int K = sc.nextInt();	//得点
		double d = 0.0;	//勝つ確率
		int coin = 0;	//コインの回数記録
		int calc = 0;	//コインの回数計算
		for(int i = 1; i <= N; i++) {
			calc = i; coin = 0;
			for(;calc < K;coin++) calc *= 2;
			d += (1.0/N) * Math.pow((1.0/2), coin);
		}
		System.out.println(d);
	}

}

Measured memory_bytes: 21460
import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer[] l = new Integer[n];
        int sum = 0;
        for(int i=0; i<n; i++){
            l[i] = sc.nextInt();
        }
        
        Arrays.sort(l,Comparator.reverseOrder());
        for(int i=0; i<k; i++){
            sum += l[i];
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
int main(){
    ll n,m;
    ll ans=0;
    cin>>n>>m;
    vector<pair<ll,ll>> vc(n);
    rep(i,0,n)cin>>vc[i].first>>vc[i].second;
    sort(vc.begin(),vc.end());
    rep(i,0,n){
        if(vc[i].second>=m){
            ans+=vc[i].first*m;
            break;
        }else{
            m-=vc[i].second;
            ans+=vc[i].first*vc[i].second;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
/**
 *    author:  tourist
 *    created: 24.12.2019 19:44:51       
**/
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int> > a(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  vector<long long> sub(1 << n);
  for (int t = 1; t < (1 << n); t++) {
    int i = 0;
    while (!(t & (1 << i))) {
      ++i;
    }
    sub[t] = sub[t ^ (1 << i)];
    for (int j = i + 1; j < n; j++) {
      if (t & (1 << j)) {
        sub[t] += a[i][j];
      }
    }
  }
  vector<long long> dp(1 << n);
  for (int t = 1; t < (1 << n); t++) {
    int nt = t;
    int u = nt;
    while (true) {
      dp[t] = max(dp[t], dp[t ^ u] + sub[u]);
      if (u == 0) {
        break;
      }
      u = (u - 1) & nt;
    }
  }
  cout << dp.back() << '\n';
  return 0;
}

Measured memory_bytes: 1280
def main():
    abc_list=[]
    W,H,x,y,r=map(int,input().split())
    if x+r>W or x-r<0:
        print("No")
    elif y+r>H or y-r<0:
        print("No")
    else:
        print("Yes")

if __name__=="__main__":
    main()


Measured memory_bytes: 5600
K = int(input())
lunlun = []
# x=123


def dfs(x):
    lunlun.append(x)

    if len(str(x)) == 11:
        return

    a = x % 10
    for v in [-1, 0, 1]:
        b = a + v
        if 0 <= b <= 9:
            y = x*10 + b
            dfs(y)


for i in range(1, 10):
    dfs(i)

lunlun.sort()
print(lunlun[K-1])


Measured memory_bytes: 103216
// https://atcoder.jp/contests/abc129/tasks/abc129_a
package main

import "fmt"
import "bufio"
import "os"
import "strconv"

var _sw = bufio.NewScanner(os.Stdin)

func main() {
	P := NextInt()
	Q := NextInt()
	R := NextInt()

	ans := Min(P+Q, Min(Q+R, R+P))
	fmt.Println(ans)
}

func init() {
	_sw.Split(bufio.ScanWords)
}

func NextInt() int {
	if _sw.Scan() == false {
		panic(_sw.Err())
	}
	i, e := strconv.Atoi(_sw.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func NextString() string {
	if _sw.Scan() == false {
		panic(_sw.Err())
	}
	return _sw.Text()
}

func Max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func Min(x, y int) int {
	if x > y {
		return y
	}
	return x
}


Measured memory_bytes: 640
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

ld inf = 1e15;

struct CHT{
    vec<pdd> line;
    vec<pdd> gr;

    CHT(){
        line.pb({0,0});
        gr.pb({-inf, inf});
    }

    ld gval(ld X){
        int l = -1, r = (int)(gr.size())-1;
        for(; l+1<r;){
            int md = (l+r)/2;
            if(X > gr[md].S) l = md;
            else r = md;
        }
        assert(gr[r].F<=X && X<=gr[r].S);
        return line[r].F*X+line[r].S;
    }

    void add_line(ld K, ld B){
        ld px;
        for(;;){
            px = (B-line.back().S) / (line.back().F-K);
            if(px >= gr.back().F) break;
            line.pop_back();
            gr.pop_back();
        }
        gr.back().S = px;
        line.pb({K, B});
        gr.pb({px, inf});
    }
};

ll a,c;
vec<ll> m, dp;

int main() {
    fast;
    cout.precision(2);
    cout<<fixed;
    cin>>a>>c;
    m = vec<ll>(a);
    for(int q=0; q<a; q++) cin>>m[q];
    dp = vec<ll>(a);
    CHT cht;
    cht.add_line(-2*m[0], m[0]*m[0]+dp[0]);
    for(int q=1; q<a; q++){
        ll mn = cht.gval(m[q]);
        dp[q] = mn + m[q]*m[q]+c;
        cht.add_line(-2*m[q], m[q]*m[q]+dp[q]);
    }
    cout<<dp[a-1];
}

Measured memory_bytes: 19288
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MC = 111;
int N;
P2 r[MC],b[MC];
bool c[MC*2];
 
int main(){
	cin >> N;
	repp(i,0,N){
		int x,y;
		cin >> x >> y;
		r[i] = MP(x,y);
	}
	repp(i,0,N){
		int x,y;
		cin >> x >> y;
		b[i] = MP(x,y);
	}
	sort(r,r+N); sort(b,b+N);
	int ans = 0;
	int pr = 0 , pb = 0;
	r[N] = b[N] = MP(1234567,1234567);
	while(pr < N || pb < N){
		if(r[pr].first < b[pb].first){
			c[r[pr].second] = 1;
			++pr;
		} else {
			repm(k,b[pb].second-1,-1){
				if(c[k]){
					c[k] = 0;
					++ans;
					break;
				}
			}
			++pb;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <assert.h>
#include <algorithm>
#include <iomanip>
#include <time.h>
#include <math.h>
#include <bitset>

#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int ll;
typedef long double ld;

const int INF = 1000 * 1000 * 1000 + 21;
const ll LLINF = (1ll << 60) + 5;
const int MOD = 1000 * 1000 * 1000 + 7;

bool is_prime(int x)
{
	if (x == 2) return true;
	if (x == 1) return false;

	if (x % 2 == 0) return false;

	for (int i = 3; i * i <= x; ++i)
		if (x % i == 0) return false;
	
	return true;
}

int q;
int arr[100228];

int main()
{
#ifdef CH_EGOR
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("", "r", stdin);
	//freopen("", "w", stdout);
#endif
	
	arr[0] = 0;
	for (int i = 1; i < 100228; ++i)
	{
		if (i % 2 == 1)
			arr[i] = (is_prime(i) && is_prime((i + 1) / 2));
		else
			arr[i] = 0;
	}

	for (int i = 1; i < 100228; ++i) arr[i] += arr[i - 1];
	
	scanf("%d", &q);

	for (int i = 0; i < q; ++i)
	{
		int l, r;
		scanf("%d%d", &l, &r);

		printf("%d\n", arr[r] - arr[l - 1]);
	}

	return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
      using namespace std;
      #define ll long long
      #define pb push_back
      #define pll  pair <long long,long long>
      #define mp make_pair
      #define ss second
      #define ff first
      #define maa 1000000007
      #define endl '\n'
      #define ld long double
      #define all(x) x.begin(),x.end()
      ll  power(ll  i,ll  j)
      {
        if(j==0)
        return 1 ;
        ll t=power(i,j/2)%maa ;
        if(j%2==0)
        return (t%maa*t%maa)%maa ;
        else
        return ((t%maa*t%maa)%maa*(i%maa)%maa)%maa ;
      }
      bool is(ll  i)
      {
        if(i==1)
            return 0 ;
        ll  f=0 ;
        for(ll  j=2;j<=sqrt(i);j++)
        {
            if(i%j==0)
            {
                f=1 ;
                break ;
            }
        }
        return !f ;
      }
      ll n,k ;
      ll r[100001] ;
      ll dp[100001] ;
      ll fun(ll i)
      {
          if(i==n)
          return 0 ;
          else if(dp[i]!=-1)
          return dp[i] ;
          else
          {
              ll j=i+1 ;
              ll ans=LLONG_MAX ;
              for(ll j=i+1;j<=min(n,i+k);j++)
              {
                  ans=min(ans,fun(j)+abs(r[i]-r[j])) ;
              }
              return dp[i]=ans ;
          }
      }
      int main()
      {

        /// 50-4
        /// freopen("input.txt","r",stdin);
        /// freopen("output.txt","w",stdout);
        cin>>n ;
        k=2 ;
        for(ll i=1;i<=n;i++)
        cin>>r[i] ;
         
        for(ll i=0;i<=n;i++)
        {
            dp[i]=-1 ;
        }
        cout<<fun(1)<<endl ;
        
        
        
        
        
      }








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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> time(n,-1);
  priority_queue<pair<int,int>> heap;
  rep(i,n){
    if(a[i]==0){
      heap.push({IINF,i});
    }
  }
  while(!heap.empty()){
    auto p = heap.top();
    heap.pop();
    if(time[p.second]!=-1) continue;
    time[p.second]=p.first;
    if(p.second>0){
      if(time[p.second-1]==-1){
        int k = p.first-1;
        if(a[p.second-1]<0) k = min(k,-a[p.second-1]);
        heap.push({k,p.second-1});
      }
    }
    if(p.second<n-1){
      if(time[p.second+1]==-1){
        int k = p.first-1;
        if(a[p.second+1]<0) k = min(k,-a[p.second+1]);
        heap.push({k,p.second+1});
      }
    }
  }
  int ans=0;
  rep(i,n){
    if(a[i]>0&&time[i]!=-1) ans+=max(0,min(a[i],time[i]));
  }
  cout << ans << endl;
  return 0;
}



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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 55, M = 3e3, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;

int main(){
    init();

    int n, t;   cin >> n >> t;

    int a[n];
    for(int i = 0;i < n;i++)    cin >> a[i];

    int mx = 0, mxProfit = 0;
    for(int i = n - 1;i >= 0;i--){
        mxProfit = max(mxProfit, mx - a[i]);
        mx = max(mx, a[i]);
    }


    map<int, int> mp;
    int ans = 0;
    for(int i = n - 1;i >= 0;i--){
        ans += mp.count(a[i] + mxProfit);
        mp[a[i]]++;
    }

    cout << ans;
}

Measured memory_bytes: 5376
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    return

#C
def C():
    x,y = LI()
    ans = 1
    for i in range(10000000000000):
        x *= 2
        if x > y:break
        ans += 1
    print(ans)

#D
def D():
    s = S()
    n = len(s)
    ans = n
    for i in range(n-1):
        if s[i] != s[i+1]:
            ans = min(ans,max(i+1,n-i-1))
    print(ans)

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    D()


Measured memory_bytes: 50416
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
const ll mod=998244353;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> data_struct;

int main()
{
	ll h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	ll mn=0;
	if(h1==h2)
		mn+=(m2-m1);
	else
	{
		mn+=(60-m1);
		h1++;
		if(h1==h2)
			mn+=(m2);
		else
			mn+=((h2-h1)*60) + (m2);
	}
	cout<<(mn-k);
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int64_t res=1;
    int64_t p = pow(10,9)+7;
    for(int i=1;i<=n;i++){
        res=(res*i)%p;
    }
    cout << res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
ll modpow(ll a,ll n){
 long long pow=1;
  while(n){
   if(n&1) pow=pow*a%mod;
   a=a*a%mod;
   n>>=1;    
}  
 return pow;
}

//a^(-1)

ll modinv(ll a){
 return modpow(a,mod-2);
}

void solve(){
  ll n;
  cin >> n;
  vll a(n);
  mint  s=0;
  rep(i,0,n) {
    cin >> a[i];
    s+=a[i];
  }
  s*=s;
  
  rep(i,0,n) s-=a[i]*a[i];


  s*=modinv(2);
  
 cout << s << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 4768
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
while (true) {
   var a = arr.shift();
   if(a==".")break;
   var b = arr.shift();
   var memo=[];
   var aa = a.replace(/".*?"/g,function(s){
      memo.push(s);
      return "\"";
   });
   var cnt =0;
   var bb = b.replace(/".*?"/g,function(s){
      if(s != memo.shift())cnt++;
      return "\"";
   });
   if(aa==bb && cnt==0) console.log("IDENTICAL");
   else if( aa==bb && cnt==1) console.log("CLOSE");
   else if(aa != bb || (aa==bb && cnt>1))console.log("DIFFERENT");
}


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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define debug(v) {for (auto z : v) {cerr << z << ' ';} cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	//~ cout.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	if ((a == b && a != c) || (a == c && a != b) || (b == c && a != b))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


Measured memory_bytes: 256
h,q=map(int,input().split())

if h==2 or q==2:print(0)
elif h==1 or q==1:
    if h!=1:print((h-2)*1)
    elif q!=1:print((q-2)*1)
    else:print(1)
else:
    print((h-2)*(q-2))

Measured memory_bytes: 38256
#include <bits/stdc++.h>
    using namespace std;
     
    int main()
    {
    	int a,b,c,d;
    	scanf("%d %d %d %d",&a,&b,&c,&d);
    	int x,y;
    	x = max(a,c);
    	y = min(b,d);
    	int ans;
    	ans = y - x;
    	if(ans>0){
    		printf("%d\n",ans);
    	}
    	else{
    		int ans2=0;
    		printf("%d\n",ans2);
    	}
    }

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var all = 0;
            var prev = 0;
            for (var i = 0; i < A.Length; i++)
            {
                all += Math.Abs(A[i] - prev);
                prev = A[i];
            }
            all += Math.Abs(prev);

            var tmp = new int[N + 2];
            for (var i = 0; i < A.Length; i++)
            {
                tmp[i + 1] = A[i];
            }
            for (var i = 1; i < tmp.Length - 1; i++)
            {
                if (tmp[i - 1] <= tmp[i] && tmp[i] <= tmp[i + 1] ||
                tmp[i - 1] >= tmp[i] && tmp[i] >= tmp[i + 1])
                {
                    Console.WriteLine(all);
                }
                else
                {
                    var sub = Math.Abs(tmp[i] - tmp[i - 1]) + Math.Abs(tmp[i + 1] - tmp[i]);
                    var add = Math.Abs(tmp[i + 1] - tmp[i - 1]);
                    Console.WriteLine(all - sub + add);
                }
            }
        }
    }
}


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

int main(){
    int a; cin >> a;
    int L = a / 100;
    int R = a % 100;
    if(1 <= L && L <= 12){
        if(1 <= R && R <= 12)cout << "AMBIGUOUS" << endl;
        else cout << "MMYY" << endl;
    }else{
        if(1 <= R && R <= 12)cout << "YYMM" << endl;
        else cout << "NA" << endl;
    }
}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue
typedef priority_queue<int> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

ll gcd(ll x,ll y){
    ll b=max(x,y),s=min(x,y);
    if(s<=0)return b;
    return gcd(s,b%s);
}


int main(){    
    double R;
    cin>>R;
    cout<<setprecision(15)<<R*2.0*3.1415926535<<endl;
}


Measured memory_bytes: 3784
X=int(input())

if X==1:
    print(1)
    exit()

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

while True:
    a=prime_factorize(X)
    temp=[]
    c=1
    sw=True
    if len(a)==1:
        sw=False
    for i in range(len(a)-1):
        if a[i]!=a[i+1]:
            temp.append(c)
            c=0
        c+=1
    temp.append(c)

    for j in range(len(temp)-1):
        if temp[j]!=temp[j+1] or temp[j]==1:
            sw=False
    if sw==True:    
        print(X)
        exit()
    X-=1


Measured memory_bytes: 8964
#include<iostream>
#include<iomanip> 
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	
	cout<<a/b<<" "<<a%b<<" "<<setiosflags(ios::fixed)<<setprecision(5)<<1.0*a/b<<endl;
	return  0;
 } 


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

int main()
{
    int n; cin>>n;
    string s; cin>>s;
    vector<int> L(n+1), R(n+1);
    for(int i=0; i<n; ++i) {
        L[i+1]=L[i]+(s[i]=='W');
        R[i+1]=R[i]+(s[i]=='E');
    }

    int res=n;
    for(int i=1; i<=n; ++i)
        res=min(res, L[i-1]+R[n]-R[i]);
    cout<<res<<endl;
}


Measured memory_bytes: 3076
n = gets.to_i
c = gets.split.map(&:to_i)
h = {}
n.times do |i|
  if h[c[i]]
    h[c[i]] += 1
  else
    h[c[i]] = 1
  end
end
s = h.select{|k, v| v >= 4}.keys.sort{|a, b| b<=>a}
t = h.select{|k, v| v >= 2}.keys.sort{|a, b| b<=>a}
ans = 0
ans = s[0] * s[0] if s.size > 0
ans = [ans, t[0] * t[1]].max if t.size > 1
puts ans

Measured memory_bytes: 14988
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int N = s[0];
            int D = s[1];

            WriteLine((N+D*2) / (D*2+1));
        }
    }
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  string s, t;
  cin >> s >> t;
  sort(all(s));
  sort(rall(t));
  cout << (s < t ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
from collections import Counter

def main():
    n = int(input().strip())
    p = []
    for i in range(n):
        x, y = map(int, input().strip().split())
        p.append((x, y))
    vtable = [0] * n**2
    for i in range(n):
        for j in range(n):
            vtable[i * n + j] = (p[i][0] - p[j][0], p[i][1] - p[j][1])
    c = sorted(Counter(vtable).values(), reverse=True)
    if len(c) == 1:
        print(1)
    else:
        print(n - c[1])


if __name__ == '__main__':
    main()


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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// ordered_set X;
// *X.find_by_order(i) = ith largest element (counting from zero)
// X.order_of_key(k) = number of items in X < k (strict lt)

constexpr ll BIG = 1000000000000L;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int H, W, K;
    cin >> H >> W >> K;

    vs grid(H);
    for (int y=0;y<H;y++) cin >> grid[y];

    vb has_berry(H, false);
    for (int y=0;y<H;y++) {
        for (int x=0;x<W;x++) {
            if (grid[y][x] == '#') has_berry[y] = true;
        }
    }

    int first_row = H;
    for (int i=0;i<H;i++) if(has_berry[i]) first_row = min(first_row, i);

    vi ansrow(W, 0);
    vvi ans(H, ansrow);
    int num_berries = 0;
    for (int y=first_row;y<H;y++) {
        if (has_berry[y]) {
            num_berries++;
            bool first = true;
            for (int x=0;x<W;x++) {
                if (grid[y][x] == '#') {
                    if (first) {
                        first = false;
                    } else {
                        num_berries++;
                    }
                }

                ans[y][x] = num_berries;
            }
        } else {
            for (int x=0; x<W; x++) ans[y][x] = ans[y-1][x];
        }
    }

    for (int y=first_row - 1;y>=0;y--) {
        for (int x=0; x<W; x++) ans[y][x] = ans[y+1][x];
    }

    for (int y=0;y<H;y++) {
        for(int x=0;x<W;x++) {
            cout << ans[y][x] << " \n"[x+1==W];
        }
    }

    return 0;
}

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

int main(){
	int N;
	unordered_map<int, int> um;
	cin >> N;
	for(int i = 0; i < N; i++){
		int tmp;
		cin >> tmp;
		um[tmp] = i+1;
	}
	for(int i = 0; i < N; i++){
		if(i != 0) cout << " ";
		cout << um[i+1];
	}
	cout << endl;
	return 0;
}

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

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(),(a).rend())
#define ll long long
#define pb(a) push_back(a)

#define PRINTV(v) {for(ll deB=0; deB<(v).size(); deB++){cout << (v)[deB] << " ";}cout << endl;}

int main(){
	
	
	ll H,W,K;
	char c[6][6];
	cin >> H >> W >> K;
	REP(h,H){
		REP(w,W){
			cin >> c[h][w];
		}
	}
	ll ans = 0;
	ll bit = 0x1 << (H+W);
	REP(i, bit){
		ll test = 0;
		REP(h,H){
			if((i >> h) & 0x1) continue;
			REP(w,W){
				if((i >> w+H) & 0x1) continue;
				if(c[h][w] == '#') test++;
			}
		}
		if(test == K) ans++;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  double n;
  cin>>n;
  double p;
  double odd=0;
  for(int i=1;i<=n;i++){
    if(i%2!=0)
      odd++;
  }
  p=odd/n;
  cout<<fixed<<setprecision(10)<<p<<"\n";
  return 0;
}


Measured memory_bytes: 384
using namespace std;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int a,b;
    cin >> a >> b;
    if (a * b % 2 == 0){
        cout << "Even" << endl;
    } else {
        cout << "Odd" << endl;
    }

}


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

using namespace std;
#define X first
#define Y second
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl;
typedef double db;
typedef long long ll;
typedef pair<int,int> P;
int n,m;db x,d,sum,res;

int main()
{
	scanf("%d%lf%lf",&n,&x,&d);
	for(int m=2*n;m;m-=2)
	{
		res+=(2*x+(m-1)*d)/2;
		sum=(2*x+(m-1)*d)*m/2-(4*x+(2*m-2)*d)/m;
		x+=(2*x+5*d)/m;
		d=2*sum/(m-2)/(m-3)-2*x/(m-3);
	}
	printf("%.10lf",res);
	return 0;
}

Measured memory_bytes: 256
h, w, k = readline.split.map(&:to_i)
MOD = 1000000007

oy = (1..w).map{|i|(w-i)*i}.reduce(&:+) % MOD
oy = h*h * oy % MOD

ox = (1..h).map{|i| (h-i)*i}.reduce(&:+) % MOD
ox = w*w * ox % MOD

#a = p (0...h).flat_map{|x| (0...w).map{|y| [x,y]}}.combination(2).to_a
#p a.map{|((x1, y1),(x2,y2))| (x1-x2).abs}.reduce(&:+)
#p a.map{|((x1, y1),(x2,y2))| (y1-y2).abs}.reduce(&:+)

MAX_N = w * h
FACT = Array.new(MAX_N+1){1}
INV = Array.new(MAX_N+1){1}
FINV = Array.new(MAX_N+1){1}

(2..MAX_N).each{|i|
  FACT[i] = FACT[i-1] * i % MOD
  INV[i] = MOD - INV[MOD % i] * (MOD / i) % MOD
  FINV[i] = FINV[i-1] * INV[i] % MOD
}

def ncr n, r
  return 0 if n < r or n < 0 or r < 0
  return FACT[n] * FINV[r] * FINV[n - r] % MOD
end

al = oy + ox
als = ncr(h*w-2, k-2) * al % MOD
p als

Measured memory_bytes: 8188