akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    if(b <= n) n = b-1;
    cout << n*a/b << "\n";
    return 0;
}

Measured memory_bytes: 3608
import java.util.*;
class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),k=sc.nextInt();
  if(a>k){
    System.out.println(k);
  }else{
      k-=a;
      if(b>k){
          System.out.println(a);
      }else{
          k-=b;
          System.out.println(a-k);
      }
  }
}
}

Measured memory_bytes: 35620
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n;
    cin >> n;
    vl x(n), y(n);
    rep(i, n) {
        ll a, b;
        cin >> a >> b; 
        x[i] = a + b;
        y[i] = a - b;
    }
    sort(all(x));
    sort(all(y));
    cout << max(x.back() - x.front(), y.back()- y.front()) << '\n';
    return 0;
}

Measured memory_bytes: 6356
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

const int N=3005;

int n, m;
string s, t;
int cache[N][N];

int dp(int i, int j)
{
	if(i==n)
		return 0;
	if(j==m)
		return 0;
	int &ans=cache[i][j];
	if(ans!=-1)
		return ans;
	if(s[i]==t[j])
		ans=1+dp(i+1, j+1);
	else
		ans=max(dp(i+1, j), dp(i, j+1));
	return ans;
}

void path(int i, int j)
{
	if(i==n)
		return;
	if(j==m)
		return;
	int ans=dp(i, j);
	if(s[i]==t[j])
	{
		cout<<s[i];
		return path(i+1, j+1);
	}
	else
	{
		if(ans==dp(i+1, j))
			return path(i+1, j);
		return path(i, j+1);
	}
}



int32_t main()
{
	IOS;
	memset(cache, -1, sizeof(cache));
	cin>>s>>t;
	n=s.size();
	m=t.size();
	int len=dp(0, 0);
	path(0, 0);
	return 0;
}

Measured memory_bytes: 35968
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  ll a, b, m = 0, mi=0;
  re(i, n){
    std::cin >> a >> b;
    if(m<a) m = a, mi = b;
  }
  std::cout << m + mi << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N = in(),M = in();
    vector<bool> A(M,true);
    vector<bool> like(M);
    REP(i,N){
        int K = in();
        like.assign(M,false);
        REP(i,K){
            like[in()-1] = 1;
        }
        REP(i,M)A[i] = A[i] & like[i];
    }
    int answer = 0;
    REP(i,M)answer += A[i];
    cout << answer << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
int main(){
    ll h,w;cin>>h>>w;
    multiset<ll> t;
    multiset<P> s;
    rep(i,w)s.insert(P(i,i));
    rep(i,w)t.insert(0);
    rep(i,h){
        ll a,b;cin>>a>>b;
        a--;
        auto itr=s.lower_bound(P(a,-1));
        ll ma=-1;
        while(itr->fi<=b&&itr!=s.end()){
            auto p=*itr;
            chmax(ma,p.se);
            s.erase(itr++);
            t.erase(t.lower_bound(p.fi-p.se));
        }
        if(b!=w&&ma!=-1){
            s.insert(P(b,ma));
            t.insert(b-ma);
        }
        if(t.size())out(i+1+*t.begin());
        else out(-1);
    }
}


Measured memory_bytes: 25424
#include <bits/stdc++.h>
using namespace std;
const int inf=100000000;
int n,m;
int dist[1100][1100];
int aa[1100];
int bb[1100];
int cc[1100];
int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
     cin>>n>>m;
     for(int i=0;i<n;i++)
    {
        for (int j=0;j<n ;j++ )
        {
            if(i==j)
            {
                dist[i][j]=0;
            }
            else
            {
                dist[i][j]=inf;
            }
        }
    }

    int a,b,c;
    for(int i=0;i<m;i++)
    {
        cin>>a>>b>>c;
        a--;
        b--;
        aa[i]=a;
        bb[i]=b;
        cc[i]=c;
        dist[a][b]=dist[b][a]=c;
    }//理论上来说,只需要存边就可以了,根本就不需要临界矩阵

    for (int k=0;k<n ;k++ )
    {
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<n;j++)
            {
                dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
            }
        }

    }
    int ans=m;
    for(int i=0;i<m;i++)
    {
        bool shortest=false;
        for(int j=0;j<n;j++)
        {
            if(dist[j][aa[i]]+cc[i]==dist[j][bb[i]])
            {
                shortest =true;
            }
        }
        if(shortest==true)
        {
            ans--;
        }
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 768
# Aizu Problem 0018: Sorting Five Numbers
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


print(' '.join([str(_) for _ in sorted([int(__) for __ in input().split()], reverse=True)]))

Measured memory_bytes: 7824
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;



int main(){
  int n,a,b;
  cin >> n >> a >>b;
  cout << min(n*a,b) << endl;
}

Measured memory_bytes: 3640
//07
#include<iostream>
#include<string>

using namespace std;

int main(){
  for(string s;getline(cin,s),s!="END OF INPUT";){
    int c=0;
    for(int i=0;i<s.size();i++){
      if(s[i]==' '){
	cout<<c;
	c=0;
      }else{
	c++;
      }
    }
    cout<<c<<endl;
  }
  return 0;
}

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

int main()
{
    int n;
    cin>>n;
    string s;
    set<string>s1;

    for(int i=0;i<n;i++)

    {
        cin>>s;

        s1.insert(s);
    }

    cout<<s1.size()<<endl;
    return 0;
}


Measured memory_bytes: 19208
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}


int main(){

   int n;
   cin >> n;
   string s ;
   cin >> s;
   int l = s.length();
   int cnt =0;
   rep(i,l-1){
      if(s[i]!=s[i+1]) cnt++;
   }
   cnt++;
   cout << cnt << endl;
   return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
using namespace std;
 
int main(){
  int N,i;
  cin >> N;
  vector<int> a(50000);
  for(i=0;i<40000;i++){
    a.at(i)=i*i;
    if(a.at(i)>N){
      break;
    }
  }
  cout << a.at(i-1) << endl;
}

Measured memory_bytes: 384
import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner stdIn=new Scanner(System.in);
	int r = stdIn.nextInt();
	int g = stdIn.nextInt();
	int b = stdIn.nextInt();
	int k = g*10+b;
	if(k%4==0){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	}
    }
}


Measured memory_bytes: 21844
#include <stdio.h>
#include <ctype.h>
int main(){
	int c,cnt[256]={0};
	while((c=getchar())!=EOF){
		if(isupper(c)){
			c=tolower(c);
		}
		cnt[c]++;
	}
	for(c='a';c<='z';c++){
		printf("%c : %d\n",c,cnt[c]);
	}
	return 0;
}

Measured memory_bytes: 1768
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String str = sc.next();
        int totalEast = 0;
        for(int i = 0; i < N; i++) if(str.charAt(i) == 'E') totalEast++;

        int eastCnt = 0;
        int[] arr = new int[N];
        for(int i = 0; i < N; i++) {
            int leftTurn = i - eastCnt;
            if(str.charAt(i) == 'E') eastCnt++;
            int rightTurn = totalEast - eastCnt;
            arr[i] = rightTurn + leftTurn;
        }
        int res = Integer.MAX_VALUE;
        for(int i = 0; i < N; i++) {
            res = Math.min(res, arr[i]);
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 43712
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn main() {
    let n: u64 = input();
    let h: u64 = input();
    let w: u64 = input();
    println!("{}", (n - h  + 1) * (n - w + 1));
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
/////////

void solve(){
  ini(N , M);
  vl X(N) , Y(N) , Z(N);
  rep(i , N) in(X[i] , Y[i] , Z[i]);

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

  ll ans = -infLL;
  rep(d , 8){
    vl v(N);
    rep(i , N){
      ll cur = X[i]*dx[d] + Y[i]*dy[d] + Z[i]*dz[d];
      v[i] = cur;
    }
    sort(all(v) , greater<ll>());
    ll nya = 0;
    rep(i , M) nya += v[i];
    amax(ans , nya);
  }
  out(ans);
}

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

#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef vector<ll> dlist;
typedef vector<dlist> matrix;

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

    cout << setprecision(10) << fixed;

    int n;
    cin >> n;

    double vx[2], vy[2];
    vector<char> d(n);
    vector<int> x(n), y(n);
    for(int i = 0; i < n; ++i)
        cin >> x[i] >> y[i] >> d[i];

    auto move = [&](int idx, double t){
        double a = 1.0 * x[idx] + (d[idx] == 'R') * t - (d[idx] == 'L') * t;
        double b = 1.0 * y[idx] + (d[idx] == 'U') * t - (d[idx] == 'D') * t;
        return pair<double, double>(a, b);
    };

    auto calc = [&](double t){
        auto v = move(0, t);
        vx[0] = vx[1] = v.first;
        vy[0] = vy[1] = v.second;
        for(int i= 0; i < n; ++i){
            v = move(i, t);
            vx[0] = min(vx[0], v.first);
            vx[1] = max(vx[1], v.first);
            vy[0] = min(vy[0], v.second);
            vy[1] = max(vy[1], v.second);
        }
        return (vx[1] - vx[0]) * (vy[1] - vy[0]);
    };

    double lo = 0, hi = 1e11, m1, m2, step, v1, v2;
    for(int i = 0; i <= 150; ++i){
        step = (hi - lo) / 3;
        m1 = lo + step;
        m2 = hi - step;

        v1 = calc(m1);
        v2 = calc(m2); 
        if(v1 < v2)
            hi = m2;
        else
            lo = m1;
    }
    cout << calc(lo) << "\n";

    return 0;
}//RUL0

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

int main(){
  int block[5][4];
  int sx,sy;
  int x,y;
  string line;
  while(true){
    for(int i=0;i<20;i++)block[i%5][i/5] = 0;
    sx=sy=-1;
    for(y=0;y<8;y++){
      if (!(cin>>line))break;
      for(x=0;x<8;x++){
	if (line[x]=='1'){
	  if (sy==-1){sx=x-1;sy=y;}
	  block[x-sx][y-sy] = 1;
	}
      }
    }
    if (y<8)break;
    if(block[2][0]&&block[1][1]&&block[2][1])cout<<"A"<<endl;
    if(block[1][3])cout<<"B"<<endl;
    if(block[4][0])cout<<"C"<<endl;
    if(block[0][2])cout<<"D"<<endl;
    if(block[3][1])cout<<"E"<<endl;
    if(block[2][2])cout<<"F"<<endl;
    if(block[0][1]&&block[2][0])cout<<"G"<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>

int main(){
    long long N; std::cin >> N;
    std::vector<long long> A;
    long long tmp;
    for(long long i = 0; i < N; i++){
        std::cin >> tmp;
        A.push_back(tmp - i - 1);
    }
    std::sort(A.begin(), A.end());
    long long median;
    if((N % 2) == 0){
        median = (A[N / 2 - 1] + A[N / 2]) / 2;
    } else {
        median = A[(N + 1) / 2 - 1];
    }
    long long Sum = 0;
    for(long long i = 0; i < N; i++){
        Sum += std::abs(A[i] - median);
    }
    std::cout << Sum << std::endl;
}


Measured memory_bytes: 2420
#include <stdio.h>
#include <stdlib.h>
#define NOT_FOUND 0

int binarySearch(int* A, int n, int key){
  int l=0,m,r=n;
  while(l<r){
    m = (l+r) / 2;
    if(key == A[m]) return 1;
    if(key >  A[m]) l = m+1;
    else if(key < A[m]) r = m;
  }
  return NOT_FOUND;
}

int main(){
  int i,c=0,n,q;
  int *S;
  int *T;

  // input and allocation
  scanf("%d", &n);
  S = (int *)malloc(sizeof(int) * n);
  for(i=0; i<n; i++) scanf("%d ", &S[i]);
  scanf("%d", &q);
  T = (int *)malloc(sizeof(int) * q);
  for(i=0; i<q; i++) scanf("%d ", &T[i]);

  // search
  for(i=0; i<q; i++) c = c+binarySearch(S, n, T[i]);

  // output
  printf("%d\n", c);

  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false


signed main(void){
    int R;
    cin >> R;
    double Ans = 2*R;
    Ans *= PI;
    printf("%.8f\n",Ans);
    
    return 0;
}



Measured memory_bytes: 3752
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define RER(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin() v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, k, a[MAX_N];

int main(){
  cin >> n;
  bool win = false;
  REP(i, n){
    cin >> a[i];
    win |= (a[i] % 2 == 1);
    }
  
  if(win) cout << "first" << endl;
  else cout << "second" << endl;
  return 0;
  }
  

Measured memory_bytes: 1024
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int xcomp(pair<LL, LL>& a, pair<LL, LL>& b) {
	if (a.first == b.first) {
		return a.second<b.second;
	}
	return a.first < b.first;
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

int main() {
	LL X, Y;
	cin >> X >> Y;
	LL sum = 1;
	while (X * 2<= Y) {
		X *= 2;
		sum++;
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc042/tasks/arc058_a

n, k = map(int, input().split())

nums = list(set([i for i in range(10)]) - set([int(i) for i in input().split()]))


def dfs(nums, t, n, path):
    if int(t) >= n:
        path.append(int(t))
        return
    if len(t) > 7:
        return
    for num in nums:
        dfs(nums, t + str(num), n, path)
path = []
dfs(nums, '0', n, path)
path.sort()
ans = path[0]
print(ans)



Measured memory_bytes: 45020
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int N, K, arr[5000];

bool isPos[5000];

bool judge(int ex) {
    memset(isPos, false, sizeof isPos);
    isPos[0] = true;

    for(int i = 0; i < N; i++) {
        for(int v = K-1; v >= 0; v--){
            if(i != ex && v + arr[i] < K && isPos[v]) {
                isPos[v + arr[i]] = true;
                if(v + arr[i] >= K - arr[ex])
                    return true;
            }
        }
    }

    return arr[ex] >= K;
}

int main () {
    scanf("%d %d", &N, &K);
    for(int n = 0; n < N; n++) {
        scanf("%d", arr + n);
    }
    sort(arr, arr + N);

    int bot = -1, top = N;
    while(bot + 1 < top) {
        int mid = (bot + top) / 2;
//        printf("%d %d %d %d\n", bot, mid, top, judge(mid));
        if(judge(mid)) {
            top = mid;
        }
        else{
            bot = mid;
        }
    }

    printf("%d\n", bot+1);

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
int sub[10][10];
int num[10];
typedef struct qq{
    int cost;
    int num;
}qq;
qq change[10];
int cmp(const void*v1, const void*v2){
    return ((qq*)v1)->cost -((qq*)v2)->cost;
}
int main(void){
    int H, W;
    scanf("%d %d", &H, &W);
    for(int i = 0; i < 10; i++)
        for(int j = 0; j < 10; j++)
            scanf("%d", &sub[i][j]);

    for(int i = 0; i < H; i++)
        for(int j = 0; j < W; j++){
            int tmp;
            scanf("%d", &tmp);
            if(tmp == -1 && tmp == 1) continue;
            num[tmp]++;
        }

    for(int i = 0; i < 10; i++){
        change[i].cost = sub[i][1];
        change[i].num = i;
    }
    qsort(change, 10, sizeof(qq), cmp);

    for(int i = 1; i < 10; i++){
        int min = change[i].cost;
        for(int j = 0; j < 10; j++){
            if(sub[change[i].num][change[j].num] + change[j].cost < min)
                min = sub[change[i].num][change[j].num] + change[j].cost;
        }
        change[i].cost = min;
    }
    for(int i = 1; i < 10; i++){
        int min = change[i].cost;
        for(int j = 0; j < 10; j++){
            if(sub[change[i].num][change[j].num] + change[j].cost < min)
                min = sub[change[i].num][change[j].num] + change[j].cost;
        }
        change[i].cost = min;
    }
    for(int i = 1; i < 10; i++){
        int min = change[i].cost;
        for(int j = 0; j < 10; j++){
            if(sub[change[i].num][change[j].num] + change[j].cost < min)
                min = sub[change[i].num][change[j].num] + change[j].cost;
        }
        change[i].cost = min;
    }
    int sum = 0;
    for(int i = 0; i < 10; i++){
        if(i == 1) continue;
        int flag = 0;
        for(int j = 0; j < 10; j++){
            if(change[j].num == i){
                flag = change[j].cost;
                break;
            }
        }
        sum += num[i]*flag;
    }
    printf("%d", sum);
    return 0;
}


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

using namespace std;

int main()
{
  int x;
  cin >> x;
  
  int j,k,m,s;
  j = x/500;
  k = x%500;
  
  m = k/5;
  
  s = j*1000 + m *5;
  cout << s;
  
}


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(int i = 0; i < (n); ++i)
#define rep2(i, x, n) for(int i = x; i < (n); ++i)

int main()
{
    int x;
    int y = 0;
    cin >> x;
    cout << 10 - x/200 << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  string S; cin >> S;
  int result = 700;
  rep(i, 3) if (S[i]=='o') result += 100;
  cout << result << endl;
  return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N;
    cin >> N;
    int a[N];
    rep(i, N){cin >> a[i];}

    int cnt = 0;
    for (auto v : a){
        if (v == (cnt + 1)){cnt += 1;}
    }
    if (cnt > 0){cout << N - cnt << endl;} else {cout << -1 << endl;}
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int main()
{
    int a;
    cin >> a ;
    if (a < 1200){
        cout << "ABC" ;
    }
    else if (a < 2800){
        cout << "ARC" ;
    }
    else{
        cout << "AGC" ;
    }
    return 0;
}


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

using namespace std;

vector<vector<int>> factorization(int M){
	int sqrt_M = (int)sqrt(M);
	vector<vector<int>> fact;
	fact.push_back({});
	fact.push_back({});

	for (int m=2; m<=sqrt_M; m++){
		int num = 0;
		while (M % m == 0){
			num += 1;
			M = M / m;
		}
		if (num != 0){
			fact[0].push_back(num);
			fact[1].push_back(m);
		}
		if (M == 1){
			break;
		}
	}
	if (M != 1){
		fact[0].push_back(1);
		fact[1].push_back(M);
	}
	return fact;
}

int main(){
	int N;
	int M;
	int ans = 0;

	cin >> N >> M;

	vector<vector<int>> fact = factorization(M);

	int all_combi = 1;

	for (int i=0; i<fact[0].size(); i++){
		all_combi *= (1 + fact[0][i]);
	}

	// cout << all_combi;

	for (int a=0; a<all_combi; a++){
		vector<int> combi = {};
		int m=1;
		int next_a = a;
		for (int i=1; i<fact[0].size(); i++){
			int k = i;
			int dev = 1;
			while (k <= fact[0].size()){
				dev *= (fact[0][k] + 1);
				k += 1;
			}

			combi.push_back(next_a / dev);

			next_a = next_a % dev;
		}

		combi.push_back(next_a);

		for (int j=0; j<combi.size(); j++){
			for (int n=0; n<combi[j]; n++){
				m *= fact[1][j];
			}
		}

		if ((M/m >= N) && (ans < m)){
			ans = m;
		}

	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;

int main() {
  ll N, K;
  cin >> N >> K;
  vector<pair<ll, ll>> ab(N);
  for (ll i=0; i<N; i++) cin >> ab[i].first >> ab[i].second;
  sort(ab.begin(), ab.end());
  ll sum = 0; // 今までの登場回数の合計
  for (ll i=0; i<N; i++) {
    sum += ab[i].second;
    if (K<=sum) {
      cout << ab[i].first << endl;
      break;
    }
  }
}

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

#define ll long long
#define inf 1e18
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << #y << "=" << y << endl
#define sp(x, y) fixed << setprecision(y) << x;
#define em emplace_back
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define nl '\n'

typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

const int maxn = 1e6;
const int mod = 1e9 + 7;

void solve()
{
    int h, w, k, i, j;
    cin >> h >> w >> k;
    vector<vector<char>> a(h, vector<char>(w));
    fo(i, h)
    {
        fo(j, w)
        {
            cin >> a[i][j];
        }
    }
    int maskR, maskC;
    int ans = 0;
    fo(maskR, (1 << h))
    {
        fo(maskC, (1 << w))
        {
            int cnt = 0;
            fo(i, h)
            {
                fo(j, w)
                {
                    if ((a[i][j] == '#') && ((maskR >> i) & 1) && ((maskC >> j) & 1))
                    {
                        cnt++;
                    }
                }
            }
            if (cnt == k)
                ans++;
        }
    }
    cout << ans << nl;
}

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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int N;
  cin>>N;
  vector<int>A(N),B(N),C(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  for(int i=0;i<N;i++){
    cin>>B[i];
  }
  for(int i=0;i<N;i++){
    cin>>C[i];
  }
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  sort(C.begin(),C.end());
  int64_t ans=0;
  for(int i=0;i<N;i++){
    int a=lower_bound(A.begin(),A.end(),B[i])-A.begin();
    int c=upper_bound(C.begin(),C.end(),B[i])-C.begin();
    ans+=(int64_t)a*(N-c);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4580
import java.util.Scanner;

public class Main {
    void run() {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String[] N = new String[n];
        for (int i = 0; i < n; i++)
            N[i] = scan.next();
        int m = scan.nextInt();
        String[] M = new String[m];
        for (int i = 0; i < m; i++)
            M[i] = scan.next();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int sum = 0;
            for (int j = 0; j< n; j++) {
                if (N[i].equals(N[j]))
                    sum++;
            }
            for (int j = 0; j < m; j++) {
                if (N[i].equals(M[j]))
                    sum--;
            }
            ans = Math.max(sum, ans);
        }
        System.out.println(ans);
   }
    public static void main(String[] args) {
        new Main().run();
    }
}


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

int main() {
    int N;
    cin >> N;
    vector<int> num(N);

    rep(i, N) cin >> num[i];

    int count = 0;

    rep(i, N) {
        if((i + 1) % 2 != 0) {
            if(num[i] % 2 != 0) {
                count++;
            }
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3588
#include<iostream>

using namespace std;

int a[105][105], b[105];
int m, n;
int main(){
    cin >> m >> n;
    for(int i = 1; i <= m; ++i){
        for(int j = 1; j <= n; ++j){
            cin >> a[i][j];
        }
    }
    for(int i = 1; i <= n; ++i){
        cin >> b[i];
    }
    for(int i = 1; i <= m; ++i){
        long long int ans = 0;
        for(int j = 1; j <= n; ++j){
            ans += a[i][j] * b[j];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3140
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c)
{
	stack<int> S;
	S.push(r);
	color[r] = c;
	while(!S.empty())
	{
		int u = S.top();
		S.pop();
		for(int i = 0; i < G[u].size(); i++)
		{
			int v = G[u][i];
			if(color[v] == NIL)
			{
				color[v] = c;
				S.push(v);
			}
		}
	}
}

void assignColor()
{
	int id = 1;
	for(int i = 0; i < n; i++)
		color[i] = NIL;
	for(int u = 0; u < n; u++)
	{
		if(color[u] == NIL)
			dfs(u, id++);
	}
}


int main()
{
	int s, t, m, q;
	cin >> n >> m;
	
	for(int i = 0; i < m; i++)
	{
		cin >> s >> t;
		G[s].push_back(t);
		G[t].push_back(s);
	}
	
	assignColor();
	
	cin >> q;
	for(int i = 0; i < q; i++)
	{
		cin >> s >> t;
		if(color[s] == color[t])
		{
			cout << "yes" << endl;
			
		}
		else
		 cout << "no" << endl;
	}
}



Measured memory_bytes: 8976
#include<cstdio>
int main(){
    long long a,b,c;
    scanf("%lld%lld%lld",&a,&b,&c);
    if(c<=a+b){
        printf("%lld",b+c);
    }else{
        printf("%lld",b+(a+b)+1);
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

int n, p, q;

int solve(vector<pair<int, int> >grid) {
	vector<bool> used(n, false); used[0] = true;
	int usenum = 1, cnt = 1, now = 0;
	while (usenum < n) {
		for (int i = now + 1; i < n; ++i) {
			if (!used[i] && grid[i].first - grid[now].first == p && grid[i].second - grid[now].second == q) {
				used[i] = true; usenum++;
				if (usenum >= n) return cnt;
				now = i;
				continue;
			}
		}
		cnt++;
		int tmp = 0;
		while (tmp < n && used[tmp]) tmp++;
		now = tmp;
		used[now] = true; usenum++;
	}
	return cnt;
}

int main() {
	cin >> n;
	vector<pair<int, int> > grid(n);
	for (int i = 0; i < n; ++i) {
		int x, y; cin >> x >> y;
		grid[i] = make_pair(x, y);
	}
	int ans = n;
	sort(grid.begin(), grid.end());
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			p = grid[j].first - grid[i].first;
			q = grid[j].second - grid[i].second;
			ans = min(ans, solve(grid));
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

// vector print(debug or stdout)
template <class Iit>
void vout(const Iit &begin,const Iit &end,ostream &out) {
    for(auto it = begin; it != end; it++) {
        auto tmp = it;
        if (++tmp == end) out << *it << '\n';
        else out << *it << " ";
    }
}

int N, M, Q;
vector<vector<int>> all;

void dfs(vector<int> v,int x) {
    v.push_back(x);
    if (v.size() == N) {
        //vout(ALL(v),cerr);
        all.push_back(v);
        return;
    }
    FOR(i,x,M+1) {
        dfs(v,i);
    }
}


int main(void)
{
    IOS
    cin >> N >> M >> Q;
    FOR(i,1,M+1) dfs(vector<int>(0),i);
    
    vector<vector<int>> q;
    REP(i,Q) {
        vector<int> abcd(4);
        REP(j,4) cin >> abcd[j];
        abcd[0]--;
        abcd[1]--;
        q.push_back(abcd);
        //vout(ALL(abcd),cerr);
    }

    int ans = 0;
    REP(i,all.size()) {
        //vout(ALL(v),cerr);
        int tmp = 0;
        REP(j,Q) {
            if (all[i][q[j][1]] - all[i][q[j][0]] == q[j][2]) tmp += q[j][3];
        }
        ans = max(ans,tmp);

    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 9712
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b;
  cin>>a>>b;
  a--;
  if(a%2==0){
    if(a%4==0);
    else a=a+1;
  }else{
    if((a+1)%4==0){
      a=0;
    }else{
      a=1;
    }
  }
  if(b%2==0){
    if(b%4==0);
    else b=b+1;
  }else{
    if((b+1)%4==0){
      b=0;
    }else{
      b=1;
    }
  }
  cout<<(a^b)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 2000000
#define MOD 1000000007
#define INF 10000000000000000
using Graph=vector<vector<int>>;

int dfs(Graph &G,int v,vector<int> &length,vector<bool> &seen){
  if(seen.at(v)){
    return length.at(v);
  }
  seen.at(v)=true;
  int ans=0;
  for(auto nv:G.at(v)){
    ans=max(ans,dfs(G,nv,length,seen)+1);
  }
  return length.at(v)=ans;
}

int main(){
  int N,M;
  cin>>N>>M;
  Graph G(N);
  for(int i=0;i<M;i++){
    int x,y;
    cin>>x>>y;
    x--,y--;
    G.at(x).push_back(y);
  }

  vector<int> length(N,0);
  vector<bool> seen(N,false);
  for(int i=0;i<N;i++){
    dfs(G,i,length,seen);
  }

  int ans=0;
  for(int i=0;i<N;i++){
    ans=max(ans,length.at(i));
  }
  cout<<ans<<endl;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    double num1= a/0.08;
    while((num1*0.08)-a<1){
        double num2 = num1*0.1;
        if(num2-b<1 && num2>=b && ceil(num1) == num1){
            cout << num1;
            return 0;
        }
        if(ceil(num1) != num1){
            num1 = ceil(num1);
        }
        else{
            num1++;
        }
    }
    puts("-1");
    return 0;
}

Measured memory_bytes: 256
// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision; 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define REP(i,a,b) for(long long int i=a ; i<b ; i++)
#define mp make_pair
#define INF 1000000000000000000
#define mod 1000000007
#define pi pair<ll,ll>
#define pd pair<ld,ld>
#define vi vector<ll>
#define vd vector<ld>
#define vvi vector<vi>
#define vvd vector<vd>
#define vpi vector<pi>
#define vpd vector<pd>
#define us unordered_set<ll>
#define um unordered_map<ll,ll>
#define sortA(a) sort(a.begin(),a.end())
#define sortD(a) sort(a.begin(),a.end(),greater<ll>())
#define all(a) a.begin(),a.end()
#define N 100005


#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define in insert
#define fbo find_by_order
#define ook order_of_key


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 debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

ll powmod(ll x,ll y)
{
	if(x==0)
		return 0;
	if(y==0 || x==1)
		return 1;
	if(y%2==0)
		return powmod((x*x)%mod,y/2)%mod;
	return (x*powmod(x,y-1)%mod)%mod;
}
// void print1D(vi a)
// {
// 	for(ll i=0;i<a.size();++i)
// 	{
// 		cout<<a[i]<<" ";
// 	}
// 	cout<<endl;
// }
// void print2D(vector<vi> a)
// {
// 	for(ll i=0;i<a.size();++i)
// 	{
// 		for(ll j=0;j<a[i].size();++j)
// 		{
// 			cout<<a[i][j]<<" ";
// 		}
// 		cout<<endl;
// 	}
// }
void solve()
{
	ld n;
	cin>>n;
	ld p=3.14159265358;
	cout<<(2*p*n);
}
int main()
{
	ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
	ll t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 3800
#include <stdio.h>
int main() {
	int n;
	int a = 0, b = 0, cnt = 0;
	char s[101];
	scanf("%d%s", &n, s);
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') {
			cnt++;
		} else {
			if (cnt == 0) {
				a++;
			} else {
				cnt--;
			}
		}
	}
	cnt = 0;
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == ')') {
			cnt++;
		} else {
			if (cnt == 0) {
				b++;
			} else {
				cnt--;
			}
		}
	}
	for (int i = 0; i < a; i++) {
		printf("(");
	}
	printf("%s", s);
	for (int i = 0; i < b; i++) {
		printf(")");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 1732
taka,aoki,k = map(int,input().split())
#for i in range(k):
#    if taka >= 1:
#        taka -= 1
#    elif aoki >= 1:
#        aoki -= 1
if k>=taka:
    k -= taka
    taka = 0
    if k>=aoki:
        aoki = 0
    else:
        aoki -= k
else:
    taka -= k
print(taka,aoki)

Measured memory_bytes: 9084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int N;
    cin >> N;
    vector<int> cnt(100000, 0);
    int maxa = 0;
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        cnt.at(a)++;
        maxa = max(maxa, a);
    }
    int ans = 0;
    for (int X = 1; X < 99999; ++X) {
        int res = cnt.at(X - 1) + cnt.at(X) + cnt.at(X + 1);
        ans = max(ans, res);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>

#define N 50

int dp[N];

int fibonacci(int n) {
    if(n == 0 || n == 1) return dp[n] = 1;
    if(dp[n] != 0) return dp[n];
    return dp[n] = fibonacci(n-2) + fibonacci(n-1);
}

int main() {
    int n;
    std::cin>>n;
    std::cout << fibonacci(n) << std::endl;
}




Measured memory_bytes: 3116
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int int1 = sc.nextInt();
		int int2 = sc.nextInt();
		double hour = sc.nextInt();
		double minit = sc.nextInt();
		sc.close();

		double rad1 = (hour % 12 * 60 + minit * 1) / (6 * 60) * Math.PI;
		double rad2 = ((minit * 12) / (6 * 60)) * Math.PI;



		// 余弦定理
		double tmp = Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) + Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2);
		System.out.println(Math.sqrt(tmp));

	}

}


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

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

using P = pair<int,int>;
using ll = long long;

const long long INF = LLONG_MAX/3;

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

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[b]+=siz[a];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=998244353;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
int n,m;
int a[310][310];
signed main(){
	cin>>n>>m;
	rep(i,n){
		rep(j,m){
			cin>>a[i][j];
			a[i][j]--;
		}
	}
	int cnt[310]={};
	int use[310];
	rep(i,m)use[i]=true;
	int ind[310]={};
	bool fin=false;
	int re=INF;
	while(1){
		rep(i,n){
			rep(j,ind[i],m+1){
				if(j==m){
					fin=true;
					break;
				}
				if(use[a[i][j]]){
					ind[i]=j;
					cnt[a[i][j]]++;
					break;
				}
			}
			if(fin)break;
		}
		if(fin)break;
		int mx=0;
		rep(i,m)chmax(mx,cnt[i]);
		chmin(re,mx);
		rep(i,m){
			if(cnt[i]==mx)use[i]=false;
		}
		rep(i,m)cnt[i]=0;
	}
	cout<<re<<endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

vector<pair<int,int> > v;
int N,M;
int main (){
    cin >> N >> M;
    for(int i=0; i<N; i++) {
        int a,b;
        cin >> a >> b;
        v.push_back(make_pair(a,b));
    }
    sort(v.begin(), v.end());
    long long int ans = 0;
    int i=0;
    while(true) {
        if( M == 0 ) break;
        pair<int,int> P = v[i];
        int l = P.second;
        for(int j=0; j<l; j++) {
            if( M == 0 ) break;
            ans += P.first;
            M--;
        }
        i++;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    //入力
    int n;
    int a[100010];
    cin >> n;
    for (int i=1; i<=n; i++) cin >> a[i];
    //２のボタンが光っている状態をtrue、光っていない状態をfalseとする関数flagを定義する。
    bool flag = false;
    //１しか光っていない状態では１しか押せない。次には１を押して光るボタンを押すしかできない。
    int temp = 1; //光っているボタンの数字
    int ans = 0; //ボタンを押した回数
    for (int i=1; i<=n; i++) {
        if (a[temp]==2) { //２が光れば終わり
            flag=true;
            ans++;
            break;
        }
        else if (a[temp]==1 || a[temp]==temp) break;
        else { //次に光るボタンを押していく
            temp = a[temp];
            ans++;
        }
    }
    if (flag) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 640
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    K = int(readline())
    ans = 'ACL'*K
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9100