akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define sc(x) cin >> x
#define sc2(x, y) cin >> x >> y
#define sc3(x, y, z) cin >> x >> y >> z
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

string s;
int sp;

int expr(void);

int nextin(void){
  int res = 0;
  for(;;sp++){
    if('0' > s[sp] || s[sp] > '9')break;
    res *= 10;
    res += (int)(s[sp] - '0');
  }
  return res;
}
int nextint(void){
  if(s[sp] == '-'){
    sp++;
    return -1 * nextin();
  }
  return nextin();
}

int term(void){
  int res = 0;
  if(s[sp] == '('){
    ++sp; res += expr(); ++sp;
  }else res += nextint();
  return res;
}

int factor(void){
  int res = term();
  for(;;){
    if(s[sp] == '*'){
      ++sp; res *= term();
    }else if(s[sp] == '/'){
      ++sp; res /= term();
    }else break;
  }
  return res;
}

int expr(void){
  int res = factor();
  for(;;){
    if(s[sp] == '+'){
      ++sp; res += factor();
    }else if(s[sp] == '-'){
      ++sp; res -= factor();
    }else break;
  }
  return res;
}

int solve(void){
  sp = 0;
  int res = expr();
  return res;
}

signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase < 1234567;testcase++){
    int(n);
    for(;n--;){
      sc(s);
      pri(solve());
      s.clear();
    }

/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 1228
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#include <unordered_map>
 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 200005
#define inf 2000000000
#define MOD 1000000007
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pr;
typedef pair<pair<int, int>, int> tup;
 
inline void solve()
{
    int n;
    cin >> n;
    vector<int> v(n);
    fore(i,0,n)
    cin >> v[i];
    
    int u = 1;
    int otv = 0;
    fore(i,0,n)
    {
        if (v[i] == u)
        u++;
        else
        otv++;
    }
    if (u == 1)
    cout << -1;
    else
    cout << otv;
}
 
int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

int main(){
    ll a,b,n;cin>>n>>a>>b;
    if(n==0||(n==1&&a!=b)){co(0);return 0;}
    if(n==1&&a==b){co(1);return 0;}
    co(max((ll)0, (n-2)*(b-a)+1));
}

Measured memory_bytes: 256
def is_good_num(n):
  """
  Arg:
    n (str) 
  Returns:
    bool
  """
  return (n[0] == n[1] and n[1] == n[2]) or (n[1] == n[2] and n[2] == n[3])
  


n = input()
print('Yes') if is_good_num(n) else print('No')


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000007
int main(){
  int h,n;
  cin>>h>>n;
  vector<int> a(n),b(n);
  for(int i=0;i<n;i++)
     cin>>a[i]>>b[i];
  
  long long dp[h+5];
  
  for(int i=0;i<=h;i++)
    dp[i]=inf;
  //for(int i=0;i<n;i++)
    // dp[a[i]]=b[i];
  dp[0]=0;   
  for(int i=0;i<=h;i++){
    for(int j=0;j<n;j++){
      if(i-a[j]>=0)
         dp[i]=min(dp[i],dp[i-a[j]]+b[j]);
      else
       dp[i]=min(dp[i],dp[0]+b[j]);   
    }
  }
  cout<<dp[h];
}


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

// int main() {
//     int ma = 1000*(1000-1)/2-1;
//     cout << 1000 << " " << ma << endl;
//     for (int i=0; i<ma; ++i) {
//         cout << (int)(1e9) << " ";
//     }
// }

int main() {
    int N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    vector<ll> k(600500);
    int cur = 0;
    map<ll, ll> mp;
    for (int l=0; l<N; ++l) {
        ll sum = A[l];
        k[cur++] = sum;
        for (int r=l+1; r<N; ++r) {
            sum += A[r];
            k[cur++] = sum;
        }
    }

    ll ng = 1000;
    while (cur > K) {
        map<ll, ll> mp;
        rep(i, cur) {
            for (int j=1; j<=60; ++j) {
                if (k[i] & (1LL<<j)) mp[j]++;
            }
        }
        ll ma = 0;
        for (auto tmp : mp) {
            if (ng > tmp.first and ma < tmp.first and tmp.second >= K) {
                ma = tmp.first;
            }
        }
        vector<ll> aaa;
        rep(i, cur) {
            if (k[i]&(1LL<<ma)) aaa.emplace_back(k[i]);
        }
        k = aaa;
        ng = ma;
        cur = aaa.size();
    }

    ll ans = k[0];
    for (int i=1; i<K; ++i) {
        ans &= k[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 6140
/*==============================================*\
Codeforces ID:    mdshihab
                                                  |
Name:     Md. Shihabul Minhaz                     |
Study:      CSE, JKKNIU                           |
Address:  Trishal, Mymensingh, Bangladesh         |
                                                  |
 mail:   mdshihabul20171@gmail.com                |
 FB  :   fb.com/mdshihabul.minhaz.7               |
 github: Shihabulminhaz                           |
stopstalk :  mdshihab                             |
                                                  |
@uthor   Md. Shihabul Minhaz (shihab)             |
\*===============================================*/


#include<bits/stdc++.h>
using namespace std;
#define fi(a) scanf("%d",&a);
#define fli(a) scanf("%ld",&a);
#define fll(a) scanf("%lld",&a);
#define pi(a) printf("%d\n",a);
#define ppi(i,a) printf("Case %d: %d\n",i,a);
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void FI()
{
#ifndef ONLINE_JUDGE
    freopen("C:\\Users\\SHIHAB\\Desktop\\input.in","r",stdin);
#endif // ONLINE_JUDGE
}

int main()
{
    fast
   // FI(); /// skip this line for compile
    int t,n,ac=0,wa=0,tle=0,re=0;
    string s;
    cin >> t;
    while(t--){
    cin >> s;

    if(s=="AC") ac++;
    else if(s=="WA") wa++;
    else if(s=="TLE") tle++;
    else re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define int long long
#undef int
#define pb push_back
#define mk make_pair
typedef long long ll;
typedef pair<int, int> pii;

int N;

signed main()
{
    cin >> N;
    if(N == 25){
        printf("Christmas\n");
    }
    if(N == 24){
        printf("Christmas Eve\n");
    }
    if(N == 23){
        printf("Christmas Eve Eve\n");
    }
    if(N == 22){
        printf("Christmas Eve Eve Eve\n");
    }



    return 0;
}
/*


*/


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

using namespace std;
using ll = long long;

int main() {
#ifdef LOCAL
    freopen("in1.txt", "r", stdin);
    freopen("out1.txt", "w", stdout);
#endif

    string s, t;
    cin >> s >> t;
    int ans = 10000;
    for(int i = 0 ; i <= s.size() - t.size(); i++){
        string tmp = s.substr(i, i + t.size());
        int num = 0;
        for(int j = 0; j < t.size(); j++){
            if(tmp[j] != t[j]) num ++;
        }
        ans = min(ans , num);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
program main;
const
  size = 8;

type
  sample = array [1..size] of longint;

var
  n, order : longint;
  p, q : sample;


  procedure input (var a : sample);
  var
    i : longint;

    begin
      for i := 1 to n do
        read(a[i]);
      readln;
    end;

  function code (var a : sample) : sample;
  var 
    i, j, c : longint;
  
    begin
      for i := 1 to n do
        a[i] := a[i] - 1;  //zero index
      for i := 1 to n do begin
        c := 0;
        for j := 1 to (i-1) do
          if (a[j] < a[i]) then inc(c);
        code[i] := a[i] - c;
      end;  //lehmer code
    end;

  function rank (a : sample) : longint;
  var
    i, t : longint;	

      function fact (n : longint) : longint;
        begin
          if (n = 0) or (n = 1) then fact := 1
          else fact := n * fact(n-1);
        end;
  
    begin
      t := 0;
      for i := 1 to n do begin
        t := t + a[i]*fact(n-i);
      end;  //lexicographic rank
	  inc(t);
	  rank := t;
    end;


begin
  readln(n);
  input(p);
  input(q);
  order := abs(rank(code(p))-rank(code(q)));
  writeln(order);
end.



Measured memory_bytes: 1384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=100000 +117;
const int MM=100000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
struct node{
	int l,r;
}a[NN]={};
int x[NN]={};
int y[NN]={};
int cnt=0;
int ls[NN]={};
int rs[NN]={};
bool cmp(node a,node b){
	return a.l==b.l?a.r>b.r:a.l<b.l;
}
int VAL=0;
void pre(){
	n=read();
	m=read();
	for(int i=1;i<=n;++i){
		x[i]=read();
	}
	for(int i=1;i<=m;++i){
		y[i]=read();
	}
	y[m+1]=2e9;
	for(int i=1;i<=n;++i){
		int pos=lower_bound(y+1,y+1+m+1,x[i])-y;
		if(pos!=1&&pos!=m+1){
			++cnt;
			ls[cnt]=a[cnt].l=x[i]-y[pos-1];
			rs[cnt]=a[cnt].r=y[pos]-x[i];
		}
	}
	sort(ls+1,ls+1+cnt);
	sort(rs+1,rs+1+cnt);
	int lcnt=unique(ls+1,ls+1+cnt)-ls-1;
	int rcnt=unique(rs+1,rs+1+cnt)-rs-1;
	VAL=1;
	for(int i=1;i<=cnt;++i){
		a[i].l=lower_bound(ls+1,ls+1+lcnt,a[i].l)-ls;
		a[i].r=lower_bound(rs+1,rs+1+rcnt,a[i].r)-rs+1;
		VAL=max(VAL,a[i].r);
	}
	sort(a+1,a+1+cnt,cmp);
}
LL bit[NN]={};
inline int lowbit(int x){
	return x&-x;
}
const int mod=1e9+7;
inline LL mo(LL &x,LL y){
	x=x+y>=mod?x+y-mod:x+y;
}
void add(int x,LL k){
	for(;x<=VAL;x+=lowbit(x)){
		mo(bit[x],k);
	}
}
LL query(int x){
	LL ret=0;
	for(;x;x-=lowbit(x)){
		mo(ret,bit[x]);
	}
	return ret;
}
void solve(){
	add(1,1);
	for(int i=1;i<=cnt;++i){
		if(a[i].l==a[i-1].l&&a[i].r==a[i-1].r)continue;
		LL ad=query(a[i].r-1);
		add(a[i].r,ad);
	}
}
int main(){
	//open();
	pre();
	solve();
	printf("%lld\n",query(VAL));

	close();
	return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    int n;
    string str;
    cin >> n >> str;
    int ans = 1;
    char c = str.at(0);
    for(int i = 1; i < n; i++){
        if(c == str.at(i)){
            continue;
        } else {
            ans++;
            c = str.at(i);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <utility>
#include <numeric>
#include <iomanip>
#include <locale>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>
#include <cmath>

using namespace std;

int read();
string think(int);
void write(string);

int main(int argc, char* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  auto input = read();
  auto output = think(input);
  write(output);

  return 0;
}

int read() {
  int n;

  cin >> n;
  return n;
}

string think(int input) {
  for (int i = 1; i <= 9; i++) {
    if (input % i == 0) {
      if (input / i <= 9) {
        return "Yes";
      }
    }
  }
  return "No";
}

void write(string output) {
  cout << output << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int A = scan.nextInt();
		int B = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();
		
		double jisin = (double)H /12 + (double)M / 60 / 12;
		double funsin = (double)M / 60;
		
		double kakudo = Math.PI * 2 * (jisin - funsin);
		double C = Math.sqrt(A*A+B*B-2*A*B*Math.cos(kakudo));
		
		System.out.println(C);

	}

}

Measured memory_bytes: 36044
class BellmanFord:
    def __init__(self, graph, num_v, start_point):
        """
        graph : [[a1,b1,c1],[a2,b2,c2],‥]みたいな3次元配列のリスト,a1からb1までのコストはc1
        num_v :頂点の数
        start_point :スタート地点(a1)
        """
        self.num_v = num_v
        self.graph = graph
        self.start_point = start_point
 
 
    def execute(self):
        dist = [-1*float("inf") for _ in range(self.num_v)]
        dist[self.start_point] = 0

        negative = [False for _ in range(self.num_v)]

        for i in range(self.num_v - 1):
            for start, end, cost in self.graph:
                if dist[end] < dist[start] + cost:
                    dist[end] = dist[start] + cost

        for i in range(self.num_v):
            for start, end, cost in self.graph:
                if dist[end] < dist[start] + cost:
                    dist[end] = dist[start] + cost
                    negative[end] = True
                if negative[start]:
                    negative[end] = True
        return dist, negative

N,M = map(int,input().split())
T = [[int(_) for _ in input().split()] for i in range(M)]
 
E = []
for a, b, c in T:
    E.append((a - 1, b - 1, c))

bellman = BellmanFord(E, N, 0)
result, negative = bellman.execute()
 
if negative[-1]:
    print("inf")
else:
    print(result[-1])

Measured memory_bytes: 3700
#include <stdio.h>

int main()
{
    long long int n, cnt, sum, i;
    scanf("%lld", &n);
    sum=100; cnt=0;
    for (i=1; ; i++) {
        sum+=sum/100;
        if (sum>=n) break;
    }
    printf("%lld\n", i);
    return 0;
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t <decltype (b), decltype (e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FORR(i,b,e) for (common_type_t <decltype (b), decltype (e)> i = (e), i ## __begin = (b); i -- > i ## __begin;)
#define rep(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)
#define ALL(x) begin (x), end (x)
using namespace std;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  size_t n, q;
  cin >> n >> q;

  vector <vector <size_t>> g (n);
  vector <int64_t> v (n);
  vector <int64_t> ans (n, 0);
  rep (i, n - 1)
  {
    size_t a, b;
    cin >> a >> b;
    -- a;
    -- b;
    g [a].push_back (b);
    g [b].push_back (a);
  }

  rep (j, q)
  {
    size_t x;
    int64_t p;
    cin >> x >> p;
    -- x;
    v [x] += p;
  }

  vector <bool> visited (n, false);
  auto f = [&] (auto self, auto now, auto t) -> void {
    visited [now] = true;
    t += v [now];
    ans [now] += t;
    for (auto && to : g [now])
    {
      if (! visited [to])
      {
        self (self, to, t);
      }
    }
  };
  f (f, size_t {0}, 0);
  copy (begin (ans), end (ans), ostream_iterator <iterator_traits <decltype (begin (ans))>::value_type> (cout, " "));
  cout << endl;
}



Measured memory_bytes: 23168
from operator import itemgetter
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
ab.sort(key=itemgetter(1))
b_min = ab[0][1]
cut = 1
for abi in ab:
    if abi[0] >= b_min:
        cut += 1
        b_min = abi[1]
    b_min = min(b_min ,abi[1])
print(cut)

Measured memory_bytes: 29152
#include<stdio.h>

int main(){
    int w, a, b;
    scanf("%d %d %d", &w, &a, &b);
    int x = b - (a+w), y = a - (b+w);
    if(x<0 && y<0){
        printf("0");
    }else{
        printf("%d", x<y?y:x);
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  string S;
  cin >> S;
  string key = "keyence";
  int ans = 0;
  REP(i, 7) {
    if (S[i] != key[i]) {
      break;
    }
    ans++;
  }
  for (int i = 0; i < 7;i++){
    char s = S[S.size() - 1], c = key[key.size() - 1];
    if(S[S.size()-i-1]!=key[key.size()-i-1]){
      break;
    }
    ans++;
  }
    if (7 <= ans) {
      puts("YES");
    } else {
      puts("NO");
    }
}

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

int main()
{
    int N;
    int count0=0;
    int count1=0;
    string S;
    cin >> S;
    N= (int)(S.length());
    for(int i=0;i<N;i++){
        char rev='0';
        if(i%2==0){
            rev='1';
        }
        if(S[i]==rev){
            count0++;
        }else{
            count1++;
        }
    }
    cout << min(count0,count1) <<endl;
    return 0;




}

Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



int K, X;

int main () {
  cin >> K >> X;

  if (500 * K >= X) {
    cout << "Yes" << "\n";
  } else {
    cout << "No" << "\n";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e9
#define INFLL 1ull<<60u
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    int N,K; cin >> N >> K;
    cout << ((N - K + K -2)/(K-1))+1 << endl;
}


int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3636
import java.util.*;
import java.util.stream.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        // programming
        int n = Util.getInputInteger(sc);
        int[] ls = {111,222,333,444,555,666,777,888,999};

        for (int l : ls) {
            if (n <= l) {
                Util.output(String.valueOf(l));
                break;
            }
        }
		
	}
}

// =========common=========
class Util {
	public static String getInputString(Scanner sc) {
		return sc.next();
	}

	public static int getInputInteger(Scanner sc) {
		return Integer.parseInt(sc.next());
	}

	public static void output(String... params) {
		boolean isInit = true;
		String str = "";
		for (String s : params) {
			if (!isInit) {
				str += " ";
			}
			str += s;
			isInit = false;
		}
		System.out.println(str);
	}

    public static int[] toIntegerList(String... ss) {
        return Stream.of(ss).mapToInt(Integer::parseInt).toArray();
    }

    public static String[] toList(String s) {
        String[] ret = s.split("");
        return ret;
    }

    public static int sum(int... vals) {
        int sum = 0;
        for (int val : vals) {
            sum += val;
        }
        return sum;
    }

    public static int[] sort(int[] vals, boolean isAsc) {
        Arrays.sort(vals);
		if (isAsc) {
			return vals;
		}
        int[] ret = new int[vals.length];
        for (int i = 0; i < vals.length; i++) {
            ret[vals.length - i - 1] = vals[i];
        }
		return ret;
	}

    public static void gc() {
        System.gc();
    }

	public static int diff(int a, int b) {
		return Math.abs(a - b);
	}

	public static int max(int... a) {
		int temp_max = Integer.MIN_VALUE;
		for (int v : a) {
			if (v > temp_max) {
				temp_max = v;
			}
		}
		return temp_max;
	}

	public static int min(int... a) {
		int temp_min = Integer.MAX_VALUE;
		for (int v : a) {
			if (v < temp_min) {
				temp_min = v;
			}
		}
		return temp_min;
	}
}

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

char X[223456];
int ans, flag = 0;

int main(void) {
	scanf("%s", &X);

	ans = strlen(X);
	for (int i = 0; i < strlen(X); ++i) {
		if (X[i] == 'S') {
			flag++;
		}
		if (X[i] == 'T'&&flag > 0) {
			ans -= 2;
			flag--;
		}
	}

	printf("%d\n", ans);

	return 0;
}

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

string getNumber( string& formula, int* index, int n )
{
	string ret;
	while( ( formula[ *index ] >= '0' && formula[ *index ] <= '9' ) || formula[ *index ] == 'X' ){
		if( formula[ *index ] == 'X' ){
			ret += ( n + '0' );
		}else{
			ret += formula[ *index ];
		}
		++*index;
	}
	return ret;
}

void advance( string& formula, int* index ){
	while( !( ( formula[ *index ] >= '0' && formula[ *index ] <= '9' ) || formula[ *index ] == 'X') ){
		++*index;
	}
}

bool compare( string& left, string& right, string& answer )
{
	string sum;
	int carry = 0;
	for( int l = left.size() - 1, r = right.size() - 1; l >= 0 || r >= 0; --l, --r ){
		char lc = '0';
		char rc = '0';
		if( l >= 0 ){
			lc = left[ l ];
		}
		if( r >= 0 ){
			rc = right[ r ];
		}
		int d = ( lc - '0' + rc - '0' + carry );
		sum = (char)( d % 10 + '0' ) + sum;
		carry = d / 10;
	}
	if( carry ){
		sum = (char)( carry + '0' ) + sum;
	}
	if( sum == answer ){
		return true;
	}
	return false;
}

int main()
{
	string formula;

	while( cin >> formula ){
		bool find = false;
		for( int i = 0; i < 10; ++i ){
			int index = 0;
			string left = getNumber( formula, &index, i );
			advance( formula, &index );
			string right = getNumber( formula, &index, i );
			advance( formula, &index );
			string answer = getNumber( formula, &index, i );
			if( ( left.size() > 1 && left[ 0 ] == '0' ) 
				|| ( right.size() > 1 && right[ 0 ] == '0' )
				|| ( left.size() > 1 &&  answer[ 0 ] == '0' ) ){
				continue;
			}
			if( compare( left, right, answer ) ){
				cout << i << endl;
				find = true;
				break;
			}
		}
		if( !find ){
			cout << "NA" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
if __name__ == '__main__':
    nmx = input().split()
    n = int(nmx[0])
    m = int(nmx[1])
    x = int(nmx[2])

    infos = []
    for i in range(n):
        info = input()
        infos.append(info)

    books_str = []
    values_str = []
    for i in range(len(infos)):
        book = []
        book = infos[i].split()
        values_str.append(book[0])
        books_str.append(book[1:])

    books = []
    values = []
    for i in range(n):
        values.append(int(values_str[i]))
        temp = []
        for j in range(m):
            temp.append(int(books_str[i][j]))
        books.append(temp)

    ans = 12345678
    all = 1 << n
    for i in range(all):
        level = [0]*m
        cost = 0
        for j in range(n):
            if (i>>j) & 1:
                cost += values[j]
                for k in range(m):
                    level[k] += books[j][k]
        ok = True
        for l in range(len(level)):
            if level[l] < x:
                ok = False
        if ok:
            ans = min(ans,cost)
    if ans == 12345678:
        print(-1)
    else:
        print(ans)

Measured memory_bytes: 9296
#define _GLIBCXX_DEBUG
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;

int P[10010];
void init(int n){
    for(int i=0;i<n;++i)P[i]=i;
}
int root(int a) {
    if(P[a]==a)return a;
    return (P[a]=root(P[a]));
}
bool is_same_set(int a,int b){
    return root(a) == root(b);//代表元を求める
}
void unite(int a,int b){
    P[root(a)]=root(b);
}//対set,グラフ？

double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }//内積
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }//外積
xy_t projection(xy_t p, xy_t b) { return b*dot_product(p,b)/norm(b); }//投影
//対図形

#define mod 1000000007
ll f[2001];
//int n,k とかしておく

ll pw(ll x, ll y){//euclidの互除法より
    ll a= 1;
    while(y){
        if(y&1){//奇数なら
            a = a*x%mod;
        }
        x = x*x%mod;
        y /= 2;
    }
    return a;
}

ll modinv(ll x){//逆元を求める
    return pw(x, mod - 2 );
}

ll comb(int n,int r){
    if(n<r){
        return 0;
    }
    return f[n] * modinv(f[r])%mod*modinv(f[n-r])%mod;
}//対combination//ただしfは用意してね

int main(){
    int n;
    cin >> n;
    int ans=0;
    rep2(i,n){
        int di=0;
        int m=i;
        while(m!=0){
            m=m/10;
            ++di;
        }
        if(di%2==1){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
a = [[j for j in input()] for i in range(h)]
for ki, k in enumerate(a):
    for ji, j in enumerate(k):
        if j == '#':
            print('#', end='')
        else:
            c = 0
            for m in range(3):
                for n in range(3):
                    if 0 <= ki - n + 1 < h and 0 <= ji - m + 1 < w:
                        if a[ki - n + 1][ji - m + 1] == '#':
                            c += 1
            print(c, end='')
    print()


Measured memory_bytes: 3444
<?php
$n=+fgets(STDIN);
$a=explode(" ",fgets(STDIN));
$b=explode(" ",fgets(STDIN));
$c=explode(" ",fgets(STDIN));
$s=0;
for($i=0;$i<$n;$i++)$s+=$b[$i];
for($i=0;$i+1<$n;$i++)if($a[$i]+1==$a[$i+1])$s+=$c[$a[$i]-1];
echo $s;

Measured memory_bytes: 3576
S = input()
N = len(S)

A = S[:int((N-1)/2)]
B = S[int((N+3)/2)-1:]
# print(S,A,B)
# def palindrome(string): return 
#     string.find(string[::-1])
def palindrome(string): return 1 if string==string[::-1] else 0

# print(palindrome(S),palindrome(A),palindrome(B))
if palindrome(S) and palindrome(A) and palindrome(B):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int>P;
#define PI 3.14159265359
#define MOD 1000000007
const int MAX = 510000;

int main(){
  int N;cin>>N;
  vector<int>a(N);
  rep(i,N){cin >>a[i];}
  ll ans=0;
  ll memo=0;
  rep(i,N){ans+=(a[i]-1);}
  cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;
    P list[N+3];
    for(int i = 1; i <= N; ++i){
        int tmp;
        cin >> tmp;
        list[i].first = tmp; 
        list[i].second = i;
    }
    sort(list + 1, list + (N + 1));
    /*
    for(int i = 1; i <= N; ++i) {
        cout << list[i].first << " " << list[i].second << endl;
    }
    */

    int ans[N+1];
    for(int i = 1; i <= N; ++i) {
        int j = list[i].second;
        if(i <= N/2) ans[j] = list[N/2 + 1].first;
        else ans[j] = list[N/2].first;
    }
    for(int i = 1; i <= N; ++i) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 4480
#include<cstdio>
#include<algorithm>

using namespace std;

const int MAX_N = 100;

int N;
int P[MAX_N];

int A, B;

int main(){
	scanf("%d", &N);
	scanf("%d%d", &A, &B);
	for(int i = 0; i < N; ++i) scanf("%d", P + i);
	int e = 0, m = 0, h = 0;
	for(int i = 0; i < N; ++i){
		if(P[i] <= A) e++;
		else if(P[i] <= B) m++;
		else h++;
	}
	int ans = min(min(e, m), h);
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long N;
    cin >> N;
    vector<long long> A(N);
    for (long long i = 0; i < N; i++){
        cin >> A[i];
    }
    long long Y = 0;
    long long r = N - 1;
    long long l = 0;
    long long L,R;
    L = A[l];
    R = A[r];
    for (long long i = 0; i < N; i++){
        
        if (r == l){
            break;
        }
        
        if (L >= R){
            r--;
            if (r == l){
            break;
        }
            R += A[r];
            if (R >= L){
            l++;
            if (r == l){
            break;
        }
            L += A[l];
            }
        }
        
        else if (L < R){
            l++;
            if (r == l){
            break;
        }
            L += A[l];
            if (L >= R){
            r--;
            if (r == l){
            break;
        }
            R += A[r];
            }
        }
        //cout << L << " " << R << endl;    
    }
    //cout << L << " " << R << endl;
    Y = L - R;
    if (Y < 0) {
        Y *= -1;
    }
    cout << Y << endl;
}

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

using namespace std;

int main()
{
	int t;
   t=1;
	while(t--)
	{
	   long long int n,i,j,k,a[200001];
	   
	   cin>>n;
	   
	   long long int z=0;
	   for(i=0;i<n;i++)
	   {
	   	 cin>>a[i];
	   	
	   	z=(z^a[i]);
	   }
	
	
	   for(i=0;i<n;i++)
	   {
	   	cout<<(a[i]^z)<<" ";
	   	
	   }
     	
     	cout<<endl;
	
	}



}


Measured memory_bytes: 5124
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=100000000000000000;

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll n;cin>>n;
    ll k;cin>>k;
    string s;cin>>s;
    ll c=1;
    for(ll i=1;i<s.size();i++){
        if(s[i]!=s[i-1]){
            c++;
        }
    }
    ll ans=0;
    if(c%2==0){
        if(c-2*k>=2){
            ans=c-2*k;
        }else{
            ans=1;
        }
    }
    if(c%2==1){
        if(c-2*k>=1){
            ans=c-2*k;
        }else{
            ans=1;
        }
    }
    cout<<n-ans<<endl;
    return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a); i > (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
ll mod=1000000007;
//ll mod=67280421310721;
//ll mod=998244353;
ll INF=1e18;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
//	cin>>test;
	while(test--)
	{
		long double a,b=6.28318530717958623200;
		cin>>a;
		cout<<fixed<<setprecision(10);
		cout<<a*b;
	}
	return 0;
}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define Task "C"

using namespace std;
int n, h[100005];

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 1; i<=n; ++i) cin >> h[i];
    int res = 0;
    h[n+1] = 2e9;
    for(int i = 1, cnt = 0; i<=n+1; ++i)
        if (h[i] <=h[i-1]) cnt++;
        else{
            res = max(res, cnt - 1);
            cnt = 1;
        }
    cout << res;
    return 0;
}


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


void solve(long long N, long long K, std::vector<long long> l){
    ll ans = 0;
    sort(l.begin(), l.end());
    for(ll i=0; i<K; i++){
        ans += l[N-i-1];
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> l(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&l[i]);
    }
    solve(N, K, std::move(l));
    return 0;
}


Measured memory_bytes: 256
import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv,
       std.format,
       std.math;

void main()
{
auto r = readln.chomp.to!double;
writefln("%.6f %.6f", r^^2*PI, r*2*PI);
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, K;
std::string S;

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

  std::cin >> N >> K >> S;

  int t = 0;

  for(int i=0,j=0;i<N;i=j){
      t += 1;

      while(j < N && S[j] == S[i]){
          j += 1;
      }
  }

  int res = std::min(N - t + 2 * K, N - 1);
  std::cout << res << std::endl;
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

int64 gcd(int64 a, int64 b)
{
    if (a % b == 0)
        return (b);
    else
        return (gcd(b, a % b));
}

int64 lcm(int64 a, int64 b)
{
    return a * b / gcd(a, b);
}

int main()
{
    int64 A, B;
    cin >> A >> B;
    cout << lcm(A, B) << endl;
    return 0;
}

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

namespace atbc_030
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] dataArr = Console.ReadLine().Split(' ');
            int a = int.Parse(dataArr[0]);
            int b = int.Parse(dataArr[1]);
            int c = int.Parse(dataArr[2]);

            int cnt = 0;

            while((0 < c)&&(0 < b))
            {
                cnt+=2;
                c--;
                b--;
            }

            while ((0 < c) && (0 < a))
            {
                cnt += 1;
                c--;
                a--;
            }

            if ((0 == c) && (0 < b))
            {
                cnt += b;
            }
            else if ((0 < c) && (0 == a) && (0 == b))
            {
                cnt++;
            }

            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 11092
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:] :
        phU.append(p)
        if isCLKWISE(phU) : continue
        while(True):
            del phU[-2]
            try:
                if isCLKWISE(phU) : break
            except IndexError : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1] :
        phL.append(p)
        if isCLKWISE(phL) : continue
        while(True):
            del phL[-2]
            try:
                if isCLKWISE(phL) : break
            except IndexError : break      
    ph = phU + phL[1:-1]
    return ph
  
n = range(int(input()))
P = [[int(x) for x in input().split()] for _ in n]
Q = ConvexHullScan(P)
Q.reverse()
print(len(Q))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(Q)])[2]
R = Q[idx:] + Q[:idx]
for r in R : print(r[0],r[1])

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

int main() {

  ll N , A , B  ;
  cin >> N >> A >> B ;
  if( A > B ){
    cout << 0 << endl;
    return 0 ;
  }
  ll ans = ( B*(N-1) + A ) - ( A*(N-1) + B ) + 1 ;
  if( ans < 0 ) ans = 0 ;
  cout << ans << endl;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;


const int maxn = 605;

int n, m;
vector<int> g[maxn];


double solve(int block) {
    vector<double> dp(n+10);
    dp[n] = 0;
    
    for (int at=n-1; at>=1; at--) {
	int outd = 0;
	double sum = 0;
	double hi = 0;
	for (int to: g[at]) {
	    outd++;
	    sum += dp[to];
	    hi = max(hi, dp[to]);
	}

	if (at == block && outd>=2) {
	    sum -= hi;
	    outd--;
	}

	dp[at] = 1 + sum/outd;
    }

    return dp[1];
}

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

    cin>>n>>m;
    for (int i=0; i<m; i++) {
	int u,v; cin>>u>>v;
	g[u].push_back(v);
	assert(u<v);
    }



    double res = 1e18;
    for (int i=0; i<=n-1; i++) {
	res = min(res, solve(i));
    }

    cout<<fixed<<setprecision(15)<<res<<endl;    
    return 0;
}


Measured memory_bytes: 4908
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    String ss[] = new String[s.length()];
    String tt[] = new String[t.length()];
    for(int i=0;i<s.length();i++){
      ss[i]=s.substring(i,i+1);
    }
    for(int i=0;i<t.length();i++){
      tt[i]=t.substring(i,i+1);
    }
    Arrays.sort(ss);
    Arrays.sort(tt);
    String smin ="";
    String tmax ="";
    for(int i=0;i<s.length();i++){
      smin=smin+ss[i];
    }
    for(int i=0;i<t.length();i++){
      tmax=tt[i]+tmax;
    }

    if(smin.compareTo(tmax)<0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
  

  
}

Measured memory_bytes: 23764
#include<stdio.h>
int main()
{
	long long sum=0;
	int h,n;
	scanf("%d %d",&h,&n);
	for(int i=0;i<n;i++)
	{
		int temp;
		scanf("%d",&temp);
		sum+=temp;
	}
	if(sum>=h)  printf("Yes\n");
	else printf("No\n"); 
	return 0;
} 

Measured memory_bytes: 128
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C: One-stroke Path
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 8;
const int NBITS = 1 << MAX_N;

/* typedef */

typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

/* global variables */

vi nbrs[MAX_N];
int dp[NBITS][MAX_N];

/* subroutines */

/* main */

int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    nbrs[a].push_back(b);
    nbrs[b].push_back(a);
  }

  int nbits = 1 << n;
  dp[1][0] = 1;

  for (int bits = 1; bits < nbits; bits++)
    for (int u = 0; u < n; u++)
      if (dp[bits][u] > 0) {
	vi &nbru = nbrs[u];
	for (vi::iterator vit = nbru.begin(); vit != nbru.end(); vit++) {
	  int &v = *vit, vb = 1 << v;
	  if (! (bits & vb)) dp[bits | vb][v] += dp[bits][u];
	}
      }

  int sum = 0;
  for (int i = 0; i < n; i++) sum += dp[nbits - 1][i];
  printf("%d\n", sum);
  return 0;
}


Measured memory_bytes: 384
S = input()
Q = int(input())
q = [[i for i in input().split()] for j in range(Q)]

f = ""
l = ""
count = 0
for i in range(Q):
    if q[i][0] == "1":
        count += 1
    elif q[i][0] == "2":
        if count % 2 == 0:
            if q[i][1] == "1":
                f = q[i][2] + f
            else:
                l = l + q[i][2]
        else:
            if q[i][1] == "1":
                l = l + q[i][2]
            else:
                f = q[i][2] + f
        
if count % 2 == 0:
    print(f+S+l)
else:
    print((f+S+l)[::-1])

Measured memory_bytes: 28040
import java.util.Scanner;
    import java.lang.Math;
    import java.math.BigDecimal;
     
    class Main{
     
        public static void main(String[] args){
     
            Scanner scanner = new Scanner(System.in);
            int r = scanner.nextInt();
            scanner.close();
            BigDecimal bd1 = new BigDecimal(2.0 * r);
            BigDecimal bd2 = new BigDecimal(Math.PI);
            BigDecimal result = bd1.multiply(bd2);
            System.out.println(result.setScale(2, BigDecimal.ROUND_HALF_UP));
     
        }
     
    }

Measured memory_bytes: 27268
# ABC118c
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))


def solve(l):
    m = min(l)
    nl = list()
    for i in l:
        if i % m != 0:
            nl.append(i % m)
    nl.append(m)
    # print(nl)
    if len(nl) == 1:
        return m
    return solve(nl)


print(solve(a))


Measured memory_bytes: 14252
//import java.lang.Math;
import java.util.*;
//import java.util.ListIterator;
//import java.util.Iterator;
//import java.util.LinkedList;
 
public class Main{
 
    @SuppressWarnings({ "unchecked", "rawtypes" })
	public static void main(String[] arg) {
 
        TreeSet<Integer> ht = new TreeSet<Integer>();
        Scanner sc = new Scanner(System.in);
        int cnt = sc.nextInt();
 
        for (int i = 0; i < cnt; i++) {
 
            int cmt = sc.nextInt();
 
            switch (cmt) {
 
            case 0:
                int num = sc.nextInt();
                if(!ht.contains(num)) ht.add(num);
                 
                 
                System.out.println(ht.size());
                 
                break;
            case 1:
                int num2 = sc.nextInt();
                int cnt2 = 0;
                if(ht.contains(num2)) cnt2=1;
                 
                System.out.println(cnt2);
                    break;
            case 2:
                int num3=sc.nextInt();
                ht.remove(num3);
                break;
            case 3:
            	
                int l=sc.nextInt();
                int r=sc.nextInt();
                TreeSet<Integer> treesubset = new TreeSet<Integer>();
                treesubset=(TreeSet) ht.subSet(l, true, r, true);
               for(Iterator<Integer> it=treesubset.iterator();it.hasNext();){
            	   int ll=it.next();
                 System.out.println(ll);
                 }
               
               break;
                }
                }
             
        }
    }



Measured memory_bytes: 181232
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 998244353;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }

int main(void) {
	char c;
	scanf("%c", &c);
	puts('a' <= c ? "a":"A");
	return 0;
}


Measured memory_bytes: 3656
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

N = int(input())
A = list(map(int, input().split()))
G = [[] for _ in range(N)]

for i in range(N-1):
  a,b = map(int, input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)

INF = 10**9+1

#a = [~0,0]
q = [0]    # ~0=-1なのだが、とにかく0を打ち消す方向をやるよ、と言うこと。うまい。
dp = [INF]*N  # LIS
ans = [0]*N   # iにおけるLISの長さ
lis_len = 0   # 持ち回ってるLIS長さ変数。dpをsearchしても求まるけど、安易に野郎
idx = [-1]*N  # iのときの操作したIDX
old = [-1]*N  # iのときに操作する前の値。Rollbackする時に使う
prev = [-1]*N # 自分の呼び出しもと。グラフの行ってこいを抑止するため。

ss = 0
from bisect import bisect_left
while q:
  now = q.pop()
  # 普通のdfs
  if now >= 0:
    a = A[now]
    # LIS管理のdpに今回操作する対象のIDXを探索
    idx[now] = bisect_left(dp,a)
    # 操作前の値とIDXを保存する
    iv = idx[now]
    old[now] = dp[idx[now]]
    x = old[now]
    # LIS管理dpのVALUEがINFだったら、今回で長さが伸びるってこと
    if x == INF:
      lis_len += 1
    dp[iv] = a
    ans[now] = lis_len

    for nxt in G[now]:
      if nxt == prev[now]:
        continue
      prev[nxt] = now
      #q.append(~nxt)
      #q.append(nxt)
      q.append((-1)*nxt)
      q.append(nxt)
  # nowがゼロ以下なので、DPを一つRollbackする動きをする。
  else:
    #v = ~v # ビット反転だが、これで元のNOWを復元する
    now = (-1)*now
    dp[idx[now]] = old[now]
    x = dp[idx[now]] 
    if x == INF:
      lis_len -= 1
    
#print(*ans,sep="\n")
for a in ans:
  print(a)


Measured memory_bytes: 70252
program main
implicit none
integer(8) :: i, j, l, m
integer(8) :: n, k

read(*,*) n, k
m = 0
do i = 1, n
   j = 0
   do while( i*2**j .lt.k )
      j = j + 1
   end do
   if( i == 1 ) then
      l = j
   end if
   m = m + 2**(l-j)
end do
write(*,*) dble(m)/(n*2**l)


end program main


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(i,j,k) for(int i=j;i<=k;i++) 
#define dec(i,j,k) for(int i=j;i>=k;i--)
const int mod = 1e9+7;
const int N = 2e5+1;
using namespace std;
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << " ";
	err(++it, args...);
}

typedef long long ll;
vector<pair<int,int>> v;
ll n,k,x,y;
ll ans;
ll arr[N];
ll binpow(ll  a , ll n)
{
	ll res = 1;
	while(n)
	{
		if(n&1)
			res*=a;
		a*=a;
		n/=2;
	}
	return res;
}
void solve()
{  ll a,b,c,d;
    cin>>a>>b>>c>>d;
	cout<<max({a*c,a*d,b*c,b*d});
   cout<<"\n";
   //cerr<<"\n";
}
int main()
{ 
//#ifndef ONLINE_JUDGE
//  freopen("fi.txt","r",stdin);
//  freopen("fo.txt","w",stdout); 
//  freopen("err.txt","w",stderr);
//#endif
  int t;
  t=1;
  //cin>>t;
  while(t--)
  {
	  solve();
  }
  return 0;
}

Measured memory_bytes: 3632