akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  set<int> se;
  rep (i, m) {
    int tmp;
    cin >> tmp;
    se.insert(tmp);
  }

  ll ans = 0;
  ll dp[n + 11];
  rep (i, n + 11) {
    dp[i] = 0;
  }
  dp[0] = 1;
  auto itr = se.find(1);
  if (itr == se.end()) dp[1] = 1;
  for (int i = 2; i < n + 1; i++) {
    itr = se.find(i);
    if (itr == se.end()) dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
  }
  // rep (i, n + 1) {
  //   cout << i << " => " << dp[i] << endl;
  // }

  P(dp[n]);

  return 0;
}



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

bool LargeTrue(int data1, int data2);
bool Dircheck(int CntCircle, int radius, int Widhei);

int main(void)
{
	int W, h, x, y, r = 0;

	cin >> W >> h >> x >> y >> r;

	//x方向y方向両方Trueならば"Yes",以外"No"
	if (Dircheck(x, r, W) && Dircheck(y, r, h)) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}


	return 0;
}



bool LargeTrue(int data1, int data2) {
	if (data1 <= data2) {
		return true;
	}
	else {
		return false;
	}
}


bool Dircheck(int CntCircle,int radius,int WidHei) {
	if (WidHei > 0) {
		return LargeTrue(CntCircle + radius, WidHei) && 
			LargeTrue(0, CntCircle - radius);
	}
	else {
		return false;
	}
}






Measured memory_bytes: 3108
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;

int main()
{
  int r;
  cin >> r;
  if(r<1200)
    cout << "ABC";
  else if(r<2800)
    cout << "ARC";
  else
    cout << "AGC";

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;

int main() {
    int k; cin >> k;

    queue<int64_t> que;
    for (int i = 1; i <= 9; i++) {
        que.push(i);
    }

    int64_t ans;
    for (int i = 0; i < k; i++) {
        ans = que.front();
        que.pop();
        auto rem = ans % 10;
        if (rem != 0) {
            que.push(ans * 10 + rem - 1);
        }
        que.push(ans * 10 + rem);
        if (rem!= 9) {
            que.push(ans * 10 + rem + 1);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int main(){
    int n;
    cin>>n;
    vector<string> s(n);
    rep(i,n){
        cin>>s[i];
        sort(s[i].begin(),s[i].end());
    }
    sort(s.begin(),s.end());
    /*
    rep(i,n){
        cout<<s[i]<<endl;
    }
    */
    int64_t sum=0;
    int64_t j=1;
    int i=0;
    while(i<n-1){
        j=1;
        if(s[i]==s[i+1]){
            while(s[i]==s[i+j]){
                j++;
                if(i+j==n){
                    break;
                }
            }
            //同じのがj個⇒コンビネーション
            sum += j*(j-1)/2;
        }
        i = i+j;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 7296
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
        String str = sc.nextLine();
        String  bmi[] = str.split(",");

        int output =Integer.parseInt(bmi[0]);
            double wei = Double.parseDouble(bmi[1]);
            double hei = Double.parseDouble(bmi[2]);

            if (25.0<=wei/(hei*hei)){
                System.out.println(output);
            }
        }
    }
}

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

int main() {
    int N, K; cin >> N >> K;
    vector<long long> p(N);
    for (int i = 0; i < N; ++i) cin >> p[i], ++p[i]; // 1 足しておく

    // 累積和
    vector<long long> s(N+1, 0);
    for (int i = 0; i < N; ++i) s[i+1] = s[i] + p[i];

    // K 差を見ていく
    long long res = 0;
    for (int i = 0; i+K <= N; ++i) res = max(res, s[i+K] - s[i]);
    cout << fixed << setprecision(10) << (double)(res)/2 << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 998244353;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    vector<int> blen, bnum, cnt;
    for(int i = 3; i <= n; i += 2){
        if(n % i == 0){
            blen.push_back(n / i);
            bnum.push_back(i);
        }
    }
    reverse(blen.begin(), blen.end());
    reverse(bnum.begin(), bnum.end());
    int m = blen.size();
    cnt.resize(m);
    rep(i, 0, m){
        int tmp = 0;
        rep(j, 0, blen[i]){
            tmp = tmp * 2 + (s[j] - '0');
            tmp %= mod;
        }
        bool f = true;
        rep(j, 0, n){
            int c = s[j % blen[i]] - '0';
            int q = (j / blen[i]) % 2;
            if(q % 2) c = !c;
            if(c){
                if(s[j] == '0'){
                    f = false;
                    break;
                }
            }else{
                if(s[j] == '1'){
                    break;
                }
            }
        }
        if(f){
            tmp = (tmp + 1) % mod;
        }
        cnt[i] = tmp;
    }
    rep(i, 0, m){
        // cout << blen[i] << ' ' << bnum[i] << ' ' << cnt[i] << endl;
        rep(j, 0, i){
            if(blen[i] % blen[j] == 0){
                cnt[i] -= cnt[j];
                cnt[i] += mod;
                cnt[i] %= mod;
            }
        }
    }
    int xnum = 0;
    rep(i, 0, n) xnum = (xnum * 2 + (s[i] - '0')) % mod;
    xnum = (xnum + 1) % mod;
    rep(i, 0, m){
        // cout << i << ' ' << cnt[i] << endl;
        xnum = (xnum - cnt[i] + mod) % mod;
    }
    int ans = xnum * 2 * n % mod;
    rep(i, 0, m) ans = (ans + cnt[i] * 2 * blen[i] % mod) % mod;
    cout << ans << endl;
}

Measured memory_bytes: 720
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	string s;
	cin>>s;
	int n,i,pre=0,suf=0;
	n = s.size();
	for0(i,n){
		if(s[i]=='A') break;
		pre++;
		}
	for(i=n-1 ; i>=0 ; i--){
		if(s[i]=='Z') break;
		suf++;
		}
		
	cout<<n-(pre+suf)<<nw;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<limits>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>


using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define big ((ll)(1e9)+7)


int main()
{
  ll n,k,s;
  cin >> n >> k >> s;
  if(s != ((ll)(1e9)))
  {
    // cout << s << " ";
    for(ll i = 0;i < k;i++)
    {
      cout << s << " ";
    }
    // cout << s+1 << " ";
    for(ll i = 0;i < n-k;i++)
    {
      cout << s+1 << " ";
    }
    cout << endl;
  }
  else
  {
      for(ll i = 0;i < k;i++)
      {
        cout << s << " ";
      }
      for(ll i = 0;i < n-k;i++)
      {
        cout << 1 << " ";
      }
      cout << endl;
  }
}


Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {
	static boolean[][] islandFlag;
	static int[][] islandNum;
	static int ptr;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			islandFlag = new boolean[12][12];
			for (int i = 0; i < 12; i++) {
				String str = sc.next();
				for (int j = 0; j < 12; j++) {
					if (str.charAt(j) == '0') {
						islandFlag[i][j] = false;
					} else {
						islandFlag[i][j] = true;
					}
				}
			}
			islandNum = new int[12][12];
			ptr = 0;
			for (int i = 0; i < 12; i++) {
				for (int j = 0; j < 12; j++) {
					if (islandFlag[i][j] && islandNum[i][j] == 0) {
						ptr++;
						makeIsland(i, j);
					}
				}
			}
			System.out.println(ptr);
		}
	}

	static void makeIsland(int i, int j) {
		if (islandFlag[i][j] && islandNum[i][j] == 0) {
			islandNum[i][j] = ptr;
			if (i > 0) {
				makeIsland(i - 1, j);
			}
			if (j > 0) {
				makeIsland(i, j - 1);
			}
			if (i < 11) {
				makeIsland(i + 1, j);
			}
			if (j < 11) {
				makeIsland(i, j + 1);
			}
		}
	}
}

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

using namespace std;

/*

        Bismillahir Rahmanir Rahim
        Problem :
        Problem Link :
        Topics :
        Solver : Masud Parves
        I Love Code More than Sharks Love Blood <3
*/


#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define SZ(a)           (int)a.size()
#define all(a)  a.begin(), a.end()
#define allr(a)  a.rbegin(), a.rend()


#define sf(a)           scanf("%d",&a)
#define sff(a,b)        scanf("%d %d",&a,&b)
#define sfff(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++)
#define PRINT_CASE printf("Case %d: ",zz)
#define Debug(x)            cout<<#x " = "<<(x)<<endl
#define NOT_VISITED 0
#define IS_VISITED 1
#define WHITE 0
#define GRAY 1
#define BLACK 2



int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int Reset(int N,int pos){return N= N & ~(1<<pos);}
//bool Check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/


const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;

vector < pii > v;
int main() {
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);


    int n;
    cin >> n;

    f0(i,n){
        int a,b;
        cin >> a >> b;
        v.pb({b,a});
    }

    sort(all(v));

    ll sum=0LL;

    bool f=0;
    for(int i=0 ; i<n ; i++){
        //cout << v[i].ss <<" "<<v[i].ff << endl;
        sum+=v[i].ss;
        if(sum>v[i].ff){
            f=1;
            break;
        }

    }

    if(f) cout << "No" << endl;
    else cout << "Yes" << endl;

    return 0;
}



Measured memory_bytes: 2420
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int N, K;
	static boolean[] ans;
	static char[] buf;
	static int ansC = 0;
	static Random rand = new Random();

	public static void main(String[] args) {
		N = sc.nextInt();
		K = sc.nextInt();
		if (N == K) {
			System.out.print("!1");
			for (int i = 2; i <= N; ++i) {
				System.out.print(" " + i);
			}
			System.out.println();
			System.out.flush();
			return;
		}
		ans = new boolean[N];
		buf = new char[N];
		while (ansC < K) {
			ArrayList<Integer> list = new ArrayList<Integer>();
			for (int i = 0; i < N; ++i) {
				if (!ans[i]) list.add(i);
			}
			solve(list, (K - ansC) % 2 == 0);
		}
		System.out.print("!");
		boolean first = true;
		for (int i = 0; i < N; ++i) {
			if (ans[i]) {
				if (!first) {
					System.out.print(" ");
				}
				System.out.print(i + 1);
				first = false;
			}
		}
		System.out.println();
		System.out.flush();
	}

	static void solve(ArrayList<Integer> list, boolean even) {
		if (ansC == K || list.isEmpty()) return;
		if (list.size() == 1) {
			ans[list.get(0)] = true;
			++ansC;
			return;
		}
		while (true) {
			ArrayList<Integer> one = new ArrayList<Integer>();
			ArrayList<Integer> zero = new ArrayList<Integer>();
			Arrays.fill(buf, '0');
			for (int i = 0; i < list.size(); ++i) {
				if (rand.nextBoolean()) {
					buf[list.get(i)] = '1';
					one.add(list.get(i));
				} else {
					zero.add(list.get(i));
				}
			}
			System.out.println("?" + String.valueOf(buf));
			System.out.flush();
			int res = sc.nextInt();
			if (res == 1) {
				solve(one, false);
				if (even) {
					solve(zero, false);
				}
				break;
			} else {
				if (!even) {
					solve(zero, false);
					break;
				}
			}
		}
	}

}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define INF 1145141919
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int ny, nx;
typedef long long int ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
////////////////////////////////////////////////////////////////////
int main()
{
    int N; cin >> N;

    vector<pair<pair<string,int>, int>> S(N);

    REP(i,N){
        string a;
        int b;
        cin >> a >> b;
        S[i]=make_pair(make_pair(a,-b),i+1);
    }

    sort(S.begin(),S.end());

    /*cout << endl;
    REP(i,N){
        cout << S[i].first.first << " " << S[i].first.second << endl;
    }*/

    REP(i,N){
        cout << S[i].second << endl;
    }

    return 0;
}


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

const int INF = 1e9;

int f(int n, int r) {
  int res = 0;

  while(n != 0) {
    res += n % r;
    n /= r;
  }

  return res;
}

int main () {
  int N;
  cin >> N;

  int ans = INF;
  for(int i = 0; i <= N; i++) {
    ans = min(ans, f(i, 6) + f(N-i, 9));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(long long i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl;
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; }

/*
hugaより小さい要素の個数を返す
lower_bound(hoge.begin(),hoge().end(),huga) - hoge.begin();

huga以上の要素の個数を返す
huga.end() - lower_bound(hoge.begin(),hoge().end(),huga);

huga以下の要素の個数を返す
upper_bound(hoge.begin(),hoge().end(),huga) - hoge.begin();

hugaより大きい要素の個数を返す
huga.end() - upper_bound(hoge.begin(),hoge().end(),huga);

特定の要素の個数を返す
//まず要素が存在するか確認する
if(binary_search(hoge.begin(),hoge.end(),huga)){
    //huga以下の要素数とhugaより小さい要素数の差
    int A = upper_bound(hoge.begin(),hoge().end(),huga) - hoge.begin();
    int B = lower_bound(hoge.begin(),hoge().end(),huga) - hoge.begin();
    int ans = B - A;
}

特定の区間に要素が存在するかどうか
hogeには区間の始点、hugaには区間の要素数、keyは調べたい要素
if(binary_search(hoge.begin() + hoge,hoge.begin() + hoge + huga,key));
*/

void ABC142D(){
    int N;
    cin >> N;
    vector<int> L(N);
    REP(i,N) cin >> L[i];
    sort ALL(L);
    int ans = 0;
    for(int i = 0 ; i < N ; ++i){
        for(int j = i+1; j < N;++j){
            int k = lower_bound(L.begin(),L.end(),L[i] + L[j]) - L.begin();
            ans += max(k - (j+1),0);
        }
    }
    cout << ans << endl;
}

signed main(){
    ABC142D();
    return 0;
}


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

int money(int i,int j)
{
    return 1000 * i + 5000 * j + 10000 * (N - i - j);
}


int main()
{
    int M;
    cin >> N >> M;
    
    vector<int> ans(3,-1);
    bool find = false;
    for(int i = 0;i<N + 1;i++)
    {
        for(int j = 0;j<N-i + 1;j++)
        {
            if(money(i,j) == M)
            {
                ans[0] = i;
                ans[1] = j;
                ans[2] = N-i-j;
                find = true;
                break;
            }
        }
        if(find)
        {
            break;
        }
    }
    
    cout << ans[2] << " " << ans[1] << " " << ans[0] << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);



ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    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;
    }
}


#define comuse Comuse()

ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //vll segtree(524287);
  //ll N=262144;
  ll n,l;
    cin>>n>>l;
  vst A(n);
  FOR(i,0,n){
    cin>>A[i];
  }
  SORT(A);
  FOR(i,0,n){
    cout<<A[i];
  }
  cout<<"\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,a,b;
	cin>>n>>a>>b;
	if(a>b) puts("0"),exit(0);
	if(n<1) puts("0"),exit(0);
	if(n==1&&a!=b) puts("0"),exit(0);
	cout<<(b-a)*(n-2)+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int r;
	cin >> r;
	cout << r * r;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(200000)
def f(x):
  if x<=2:
    if x==2 and S[0]==S[1]:
      return 1
    else:
      return x
  else:
    if S[x-1]==S[x-2]:
      return f(x-3)+2
    else:
      return f(x-1)+1
S=input()
print(f(len(S)))
  

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

const int DIM = 1e2 + 5;

char arr[DIM][DIM];
int dp[DIM][DIM][DIM][DIM], psm[DIM][DIM];

inline int sum( int x1, int y1, int x2, int y2 ) {
    return psm[x2][y2] - psm[x1 - 1][y2] - psm[x2][y1 - 1] + psm[x1 - 1][y1 - 1];
}

int main( void ) {
    
    int n, m;
    cin >> n >> m;
    
    int px = 0, py = 0;
    for( int i = 1; i <= n; i ++ ) {
        cin >> ( arr[i] + 1 );
    
        for( int j = 1; j <= m; j ++ ) {
            psm[i][j] = psm[i - 1][j] + psm[i][j - 1] - psm[i - 1][j - 1] + ( arr[i][j] == 'o' );
            
            if( arr[i][j] == 'E' ) {
                px = i;
                py = j;
            }
        }
    }
    
    for( int l = 0; l <= py - 1; l ++ ) {
    for( int r = 0; r <= m - py; r ++ ) {
    for( int u = 0; u <= px - 1; u ++ ) {
    for( int d = 0; d <= n - px; d ++ ) {
        dp[l + 1][r][u][d] = max( dp[l + 1][r][u][d], dp[l][r][u][d] + ( ( r + 1 <= py - l - 1 ) ? sum( max( px - u, d + 1 ), py - l - 1, min( px + d, n - u ), py - l - 1 ) : 0 ) );
        dp[l][r + 1][u][d] = max( dp[l][r + 1][u][d], dp[l][r][u][d] + ( ( py + r + 1 <= m - l ) ? sum( max( px - u, d + 1 ), py + r + 1, min( px + d, n - u ), py + r + 1 ) : 0 ) );
        dp[l][r][u + 1][d] = max( dp[l][r][u + 1][d], dp[l][r][u][d] + ( ( d + 1 <= px - u - 1 ) ? sum( px - u - 1, max( py - l, r + 1 ), px - u - 1, min( py + r, m - l ) ) : 0 ) );
        dp[l][r][u][d + 1] = max( dp[l][r][u][d + 1], dp[l][r][u][d] + ( ( px + d + 1 <= n - u ) ? sum( px + d + 1, max( py - l, r + 1 ), px + d + 1, min( py + r, m - l ) ) : 0 ) );
    } } } }
 
    cout << dp[py - 1][m - py][px - 1][n - px] << endl;
    return 0;
}

Measured memory_bytes: 241024
#include <bits/stdc++.h>
using namespace std;
long long n,m,i,j,dp[4005][4005],a[200005],b[200005],c[4005][4005],mod=1e9+7,ans;
int main(){
    cin>>n;
    for (i=1;i<=n;i++){
	cin>>a[i]>>b[i];
	dp[2000-a[i]][2000-b[i]]++;
    }
    c[0][0]=1;
    for (i=0;i<=4000;i++){
	for (j=0;j<=4000;j++){
	    if (i>0) (dp[i][j]+=dp[i-1][j])%=mod;
	    if (i>0) (c[i][j]+=c[i-1][j])%=mod;
	    if (j>0) (dp[i][j]+=dp[i][j-1])%=mod;
	    if (j>0) (c[i][j]+=c[i][j-1])%=mod;
	}
    }
    for (i=1;i<=n;i++){
	(ans+=dp[2000+a[i]][2000+b[i]])%=mod;
	(ans+=mod-c[a[i]*2][b[i]*2])%=mod;
    }
    cout<<((ans%mod+mod)%mod*((mod+1)/2)%mod+mod)%mod;
    return 0;
}


Measured memory_bytes: 253824
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
a3=list(map(int,input().split()))
n=int(input())
b=[]
for _ in range(n):
    b.append(int(input()))
an=[0,0,0,0,0,0,0,0,0]

for i in range(n):
    if b[i]==a1[0]:
        an[0]=1
    if b[i]==a1[1]:
        an[1]=1
    if b[i]==a1[2]:
        an[2]=1
    if b[i]==a2[0]:
        an[3]=1
    if b[i]==a2[1]:
        an[4]=1
    if b[i]==a2[2]:
        an[5]=1
    if b[i]==a3[0]:
        an[6]=1
    if b[i]==a3[1]:
        an[7]=1
    if b[i]==a3[2]:
        an[8]=1



if an[0]==1 and an[1]==1 and an[2]==1:
    print("Yes")
elif an[3]==1 and an[4]==1 and an[5]==1:
    print("Yes")
elif an[6]==1 and an[7]==1 and an[8]==1:
    print("Yes")
elif an[0]==1 and an[3]==1 and an[6]==1:
    print("Yes")
elif an[1]==1 and an[4]==1 and an[7]==1:
    print("Yes")
elif an[2]==1 and an[5]==1 and an[8]==1:
    print("Yes")
elif an[0]==1 and an[4]==1 and an[8]==1:
    print("Yes")
elif an[2]==1 and an[4]==1 and an[6]==1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      int maxLen = 0;
      int leftIdx = 0;
      Set<Character> set = new HashSet<>();
      set.add('A');
      set.add('C');
      set.add('G');
      set.add('T');
      for(int i = 0; i < s.length(); i++) {
        if(!set.contains(s.charAt(i))) {
          maxLen = Math.max(maxLen, i - leftIdx);
          leftIdx = i + 1;
        }
      }
      maxLen = Math.max(maxLen, s.length() - leftIdx);
      System.out.println(maxLen);
  }
}

Measured memory_bytes: 21844
n = int(input())
x = list(map(int,input().split()))

x = sorted(x)

sum = 0
for i in x:
    sum += i
p1 = sum // len(x)
p2 = p1+1

ans1 = 0
ans2 = 0
for num in x:
    ans1 += (num-p1)**2
    ans2 += (num-p2)**2
ans = min(ans1,ans2)

print(ans)


Measured memory_bytes: 3064
C = [100_0000,2,5,5,4,5,6,3,7,6]
N, M = gets.split.map(&:to_i)
A = gets.split.map(&:to_i).sort.reverse
dp = Array.new(N + 1, -10_000_000)
dp[0] = 0
A.each do |i|
  (C[i] .. N).each do |n|
    dp[n] = [ dp[n - C[i]] + 1, dp[n] ].max
  end
end
ans = Array.new(dp[N])
dp[N].times.inject(N) do |n, j|
  k = A.find do |i|
    dp[n - C[i]] + 1 == dp[n] if n - C[i] >= 0
  end
  ans[j] = k
  n - C[k]
end
puts ans.join



Measured memory_bytes: 1916
import numpy as np
N = int(input())
w = np.array(list(map(int, input().split())))
sum1 = np.empty(N-1)
for i in range(N-1):
    sum1[i] = abs(np.sum(w[:i+1])-np.sum(w[i+1:]))
ans = np.min(sum1)
print(int(ans))


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

using namespace std;

int main(){

	int a, b, c;

	cin>> a >> b >> c;

	if((a<c && c<b) || (b<c && c<a)){
		cout<< "Yes" << endl;
	}else{
		cout<< "No" << endl;
	}


}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    if(a==1)a+=13;
    if(b==1)b+=13;
    if(a>b){
        cout << "Alice" << endl;
    }else if(a<b){
        cout << "Bob" << endl;
    }else{
        cout << "Draw" << endl;
    }
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <iostream>

using namespace std;

struct point {
	double x, y;
}A, B, C;

struct circle {
	double r;
	point cen;
}cir;

void solve(point A, point B, point C) {
	double tmp1 = A.x * A.x - B.x * B.x + A.y * A.y - B.y * B.y;
	double tmp2 = A.x * A.x - C.x * C.x + A.y * A.y - C.y * C.y;
	cir.cen.x = (tmp1 * (A.y - C.y) - tmp2 * (A.y - B.y)) / (2 * (A.y - C.y) * (A.x - B.x) - 2 * (A.y - B.y) * (A.x - C.x));
	cir.cen.y = (tmp1 * (A.x - C.x) - tmp2 * (A.x - B.x)) / (2 * (A.y - B.y) * (A.x - C.x) - 2 * (A.y - C.y) * (A.x - B.x));
	double la = sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
	double lb = sqrt((B.x - C.x) * (B.x - C.x) + (B.y - C.y) * (B.y - C.y));
	double lc = sqrt((C.x - A.x) * (C.x - A.x) + (C.y - A.y) * (C.y - A.y));
	double p = (la + lb + lc) / 2.0;
	double s = sqrt(p * (p - la) * (p - lb) * (p - lc));
	cir.r = la * lb * lc / (4 * s);
}

int main() {
	int t;
	scanf ("%d", &t);
	while (t--) {
		scanf ("%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y);
		solve(A, B, C);
		printf ("%.3lf %.3lf %.3lf\n",cir.cen.x, cir.cen.y, cir.r);
	}
	return 0;
}

Measured memory_bytes: 0
// Problem : D - Friends
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long
#define db double
#define mod 1000000007
#define pb push_back
#define pp pair<int,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define maxn 200005
#define ss second
#define ff first
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
int inv(int a, int b){
 return 1<a ? b - inv(b%a,a)*b/a : 1;
}
int n,m,vis[maxn];
vector<int> g[maxn];
int cnt = 0;
void dfs(int c)
{
	cnt++;
	vis[c]=1;
	for(auto x:g[c])
		if(vis[x] == 0)
			dfs(x);
}
void solve()
{
	cin >> n >> m;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin >> a >> b;
		g[a].pb(b);
		g[b].pb(a);
	}
	vector<int> v;
	for(int i=1;i<=n;i++)
	{
		if(vis[i] == 0)
		{
			dfs(i);
			v.pb(cnt);
		}
		cnt=0;
	}
	int maxi = *max_element(all(v));
	cout << maxi;
}
signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--)
    solve();
    return 0;
}


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

#define rep(i,n) for(int i=0; i<n; i++)
#define reep(i,a,b) for(int i=a; i<b; i++)
#define MOD 1000000007
#define INFL 0x3f3f3f3f3f3f3f3f

using ll = long long;

// Mod int
// const int MOD = 1000000007;
struct mint{
    ll x;
    mint():x(0){}
    mint(ll x):x((x%MOD+MOD)%MOD){}
    mint operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
    mint operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
    mint operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
    mint operator+(const mint& a)const{ return mint(*this) += a;}
    mint operator-(const mint& a)const{ return mint(*this) -= a;}
    mint operator*(const mint& a)const{ return mint(*this) *= a;}
    bool operator==(const mint& a)const{ return x == a.x;}
    friend ostream& operator<<(ostream& os, const mint& mi)  
    {  
        os << mi.x;  
        return os;  
    }
};



int main(){
	ll n,m;
	cin>>n>>m;
	ll l = 0;
	ll r = INFL/n + 500;
	if(n==1){
		cout<<(m+1)%MOD<<endl;
		return 0;
	}
	while(r-l>1){
		ll mid = (r+l)/2;
		ll val = m-(n-1)*mid;
		if(val < 0) r = mid;
		else l = mid;
	}
	mint ans;
	l %= MOD;
	ans = mint((m+1)%MOD)*mint(l)*mint(2) - mint((n-1)%MOD)*mint(l)*mint(l+1);
	// cout<<ans<<endl;
	// ans *= mint(2);
	ans += mint(m%MOD+1);
	cout<<ans<<endl;
}

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

int func(char i, char j){
    if(i!='R' && j!= 'R') return 0;
    else if(i!='G' && j!= 'G') return 1;
    else if(i!='B' && j!= 'B') return 2; 
    cout << i << " " << j << endl;
    return 100;
}

int main(){
    int N; cin >> N;
    string s; cin >> s;

    vector<vector<int>> cusums(3, vector<int>(N, 0));
    for (int i = 0; i < N; i++)
    {
        if(s[i]=='R') cusums[0][i]++;
        if(s[i]=='G') cusums[1][i]++;
        if(s[i]=='B') cusums[2][i]++;
        for (int j = 0; j < 3; j++)
        {
            if(i!=0) cusums[j][i] += cusums[j][i-1];
        }
        
    }
    
    //for(auto i : cusums){
    //    for(int j: i){
    //        cout << j << " ";
    //    }
    //    cout << endl;
    //}

    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i+1; j < N; j++)
        {
            if(s[i]==s[j]) continue;
            int k = func(s[i],s[j]);
            ans += cusums[k][N-1] - cusums[k][j];
            //cout << ans << " ";
            if(2*j-i<N) ans -= (cusums[k][2*j-i]-cusums[k][2*j-i-1]);
        }
        //cout << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3648
import sys
X,N = map(int, input().split())
if N == 0:
  print(X)
  sys.exit()
P = list(map(int, input().split()))
P.sort()
score = P[0]-1
for n in range(P[0]-1,P[N-1]+2):
  flag = True
  for m in range(N):
    if P[m]==n:
      flag = False
  if flag and abs(X-n)<abs(X-score):
    score = n
print(score)



Measured memory_bytes: 9196
A, B, K = map(int, input().split())

# A to A + K - 1
# B - K + 1 to B 

candidate = []

for i in range(A, min(A+K, B+1)):
  candidate.append(i)
  
for i in range(B, max(B-K, A-1), -1):
  candidate.append(i)
  
candidate = set(candidate)

for num in sorted(candidate, reverse=False):
  print(num)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/
template<typename T>
vector<pair<T,long long>> RunLengthEncoder(vector<T> &v){
    vector<pair<T,long long>> RLE;
    long long cnt = 1;
    for(int i = 0; i < (int)v.size(); ++i){
        if(i == (int)v.size()-1){
            RLE.push_back(make_pair(v[i], cnt));
            continue;
        }
        if(v[i] == v[i+1])cnt++;
        else{
            RLE.push_back(make_pair(v[i],cnt));
            cnt = 1;
        }
    }
    return RLE;
}
signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N, M, V, P;
    cin >> N >> M >> V >> P;
    vector<ll> A(N);
    rep(i,N){
        cin>>A[i];
    }
    sort(all(A));
    reverse(all(A));
    auto v = RunLengthEncoder(A);
    int r = 0;
    for(auto p:v){
        r += p.second;
        if(r >= P)break;
    }
    r--;
    // M * V独立に選べる
    auto check = [&](int x){
        if(x <= r)return true;
        if(A[x] + M < A[r])return false;
        ll maxx = A[x] + M;
        ll res = 0;
        rep(i,N){
            //dump(i);dump(res);
            if(A[i] > A[r])res += M;
            else if(A[i] == A[r])res += min(M, maxx - A[i]);
            else if(A[i] > A[x]) res += min(M, maxx - A[i]);
            else if(A[x] >= A[i])res += M;
        }
        //dump(x);dump(res);
        return ll(M * V)<= res;
    };
    int ok = -1;
    int ng = N;
    while(ng - ok > 1){
        int mid = (ok + ng)>>1;
        if(check(mid))ok = mid;
        else ng = mid;
    }
    cout << ok+1 << endl;
}

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

static const long long MOD = 1000000007;
static const long long INF = 1<<31;

int ans = 1000000000;
int m, n, x, c[15], a[15][15];
int s[15];

int main(void) {
    cin >> n >> m >> x;

    rep(i, 0, n) {
        scanf("%d", &c[i]);
        rep(j, 0, m) scanf("%d", &a[i][j]);
    }

    for (int i=0; i<(1<<n); i++) {
        int sum = 0;
        rep(j, 0, n) s[j] = 0;
        
        for (int j=0; j<n; j++) if ((i>>j) & 1) {
            sum += c[j];
            rep(k, 0, m) s[k] += a[j][k];
        }

        bool ok = true;
        rep(j, 0, m) if (s[j]<x) ok = false;

        if (ok) ans = min(ans, sum);

    }

    

    if (ans==1000000000) puts("-1");
    else cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3656
n,m=map(int,raw_input().split())
a=[]
b=[]
c=0

for i in range(n):
	a.append(map(int,raw_input().split()))
		
for i in range(m):
	b.append(input())

for i in range(n):
	c=0
	for j in range(m):
		c += a[i][j]*b[j]			
	print c	

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

int main() {
  int N;
  cin>>N;
  vector<string> Blue(N);
  for(int i=0;i<N;i++) cin>>Blue.at(i);
  
  int M;
  cin>>M;
  vector<string> Red(M);
  for(int i=0;i<M;i++) cin>>Red.at(i);
  
  int answer=0;
  
  for(int i=0;i<N;i++){
    if (answer>N-i) break;
    
    int x=1;
    
    for (int j=1+i;j<N;j++){
      if (Blue.at(i)==Blue.at(j)) x+=1;
    }
    
    if (x<=answer) break;
    
    for (int k=0;k<M;k++){
      if (Blue.at(i)==Red.at(k)) x-=1;
    }
    
    if (x>answer) answer=x;
  }
  
  cout<<answer<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
using namespace std;
#define X real()
#define Y imag()
typedef complex<double> P;
typedef vector<P> VP;
const double EPS = 1e-8;
const double INF = 1e12;

int main(){
    int n;
    cin >> n;
    VP p(n);
    for(int i=0; i<n; i++){
        double x,y;
        cin >> x >> y;
        p[i] = P(x, y);
    }

    VP cp;
    vector<double> rad;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            for(int k=j+1; k<n; k++){
                double a = abs(p[i] - p[j]);
                double b = abs(p[j] - p[k]);
                double c = abs(p[k] - p[i]);
                P A = p[k];
                P B = p[i];
                P C = p[j];
                P center = a*a*(b*b+c*c-a*a)*A + b*b*(c*c+a*a-b*b)*B + c*c*(a*a+b*b-c*c)*C;
                center /= a*a*(b*b+c*c-a*a) + b*b*(c*c+a*a-b*b) + c*c*(a*a+b*b-c*c);
                double r = (a*b*c) / sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
                cp.push_back(center);
                rad.push_back(r);
            }
            P mid = (p[i] +p[j]) /2.0;
            double r = abs(p[i] -p[j])/2;
            cp.push_back(mid);
            rad.push_back(r);
        }
    }
    double ans = INF;
    for(int i=0; i<(int)cp.size(); i++){
        bool ok = true;
        for(int j=0; j<n; j++){
            if(abs(cp[i] -p[j]) > rad[i] +EPS){
                ok = false;
                break;
            }
        }
        if(ok){
            ans = min(ans, rad[i]);
        }
    }
    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
n = int(input())
a = [int(x) for x in input().split()]
s = []
# start = a[0]
down = True
for i in range(1,n):    
    if down and a[i-1] < a[i]:
        s.append(a[i-1])
        down = False
    elif down == False and a[i-1] > a[i]:
        s.append(a[i-1])
        down = True
if len(s)%2!=0:
    s.append(a[-1])
# print(s)
start = 1000
for i in range(0,len(s),2):
    start = (start//s[i])*s[i+1] + start%s[i]

print(start)



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

using namespace std;

int main()
{
    int n;
    cin>>n;

    vector<int>v(n);
    vector<int>cnt(1001);

    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }

    sort(v.begin(),v.end());

    int ans=0;

    for(int i=0;i<n-2;i++)      
    {
      int k=i+2;

      for(int j=i+1;j<n;j++)
      {
            while(k<n&&(v[k]<(v[i]+v[j])))
                ++k;
            if(k>j)ans+=k-j-1;
      }

    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
n, k, c = map(int, input().split())
s = " " + input()
work_fw = [0]*k
work_bw = [0]*k
i = 1
now_k = 0
while i <= n and now_k < k:
    if s[i] == 'o':
        work_fw[now_k] = i
        now_k += 1
        i += c
    i += 1
if now_k != k:
    print("")
else:
    i = n
    now_k = k - 1
    while i > 0 and now_k >= 0:
        if s[i] == 'o':
            work_bw[now_k] = i
            now_k -= 1
            i -= c
        i -= 1
    # print(work_fw)
    # print(work_bw)
    for i in range(k):
        if work_fw[i] == work_bw[i]:
            print(work_fw[i] )


Measured memory_bytes: 20548
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,ans=0;
  string s;
  cin>>s;
  if(s[0]=='S')cout<<"Cloudy"<<endl;
  if(s[0]=='C')cout<<"Rainy"<<endl;
  if(s[0]=='R')cout<<"Sunny"<<endl;
}


Measured memory_bytes: 256
n,k,q = gets.split.map(&:to_i)
hito = Array.new(n,k-q)
q.times do
  g = gets.to_i
  hito[g - 1] += 1
end

hito.each do |a|
  if a > 0
    puts :Yes
  else
    puts :No
  end
end

Measured memory_bytes: 3196
#include<bits/stdc++.h>
#define re register
#define inc(i,j,k) for(re int i=j;i<=k;i++)
#define ll long long
using namespace std;
const int N=305;
const int mod=1e9+7;
inline int read(){
	int x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while('0'<=ch&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x;
}
int n,m;
int lim[N][4];
ll f[N][N][N],ans;
int main(){
	n=read(),m=read();
	inc(i,1,m){
		int x=read(),y=read(),c=read()-1;
		if(!c){
			if(!lim[y][0]) lim[y][0]=x;
			else lim[y][0]=min(lim[y][0],x);
		}
		if(c==1){
			if(!lim[y][1]) lim[y][1]=x;
			else lim[y][1]=min(lim[y][1],x);
			if(!lim[y][2]) lim[y][2]=x;
			else lim[y][2]=max(lim[y][2],x);
		} 
		if(c==2){
			if(!lim[y][3]) lim[y][3]=x;
			else lim[y][3]=max(lim[y][3],x);
		}
	}
	f[0][0][0]=1;
	inc(i,0,n){
		inc(j,0,max(0,i-1)){
			inc(k,0,max(0,i-2)){
				 if(lim[i][0]&&(j>=lim[i][0]||k>=lim[i][0])) f[i][j][k]=0;
				 if(lim[i][1]&&j>=lim[i][1]&&k>=lim[i][1]) f[i][j][k]=0;
				 if(lim[i][2]&&j<lim[i][2]&&k<lim[i][2]) f[i][j][k]=0;
				 if(lim[i][3]&&(j<lim[i][3]||k<lim[i][3])) f[i][j][k]=0;
				 (f[i+1][j][k]+=f[i][j][k])%=mod;
				 (f[i+1][i][k]+=f[i][j][k])%=mod;
				 (f[i+1][i][j]+=f[i][j][k])%=mod;
			}
		}
	}
	inc(j,0,n-1){
		inc(k,0,n-2) (ans+=f[n][j][k])%=mod;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 219392
#include<bits/stdc++.h>
using namespace std;
int n,a[13];
void dfs(int x,int maxx)
{
	if(x==n+1)
	{
		for(int i=1;i<=n;i++)
			cout<<(char)(a[i]+'a'-1);
		cout<<endl;
		return;
	}
	for(int i=1;i<=maxx+1;i++)
	{
		a[x]=i;
		dfs(x+1,max(maxx,i));
	}
}
int main()
{
	cin>>n;
	dfs(1,0);
	return 0;
}


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

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 200111, inf = 1000111222;

vector<int> v[max_n];
pair<int, int> e[max_n];
int col[max_n];

void dfs(int cur) {
    for (int to : v[cur]) {
        if (col[to] != 0) {
            if (col[to] == col[cur]) {
                exit(228);
            }
            continue;
        }
        col[to] = col[cur] == 1 ? 2 : 1;
        dfs(to);
    }
}
vector<int> v1, v2;
vector<int> num1, num2, num0;
int ans[max_n];

int main()
{
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    for (int i = 0; i + 1 < n; ++i) {
        int a, b;
        scanf("%d%d", &a, &b);
        --a, --b;
        e[i].F = a;
        e[i].S = b;
        v[a].PB(b);
        v[b].PB(a);
    }
    if (n == 2) {
        cout << "1 2" << endl;
        return 0;
    }
    int cmn = -1;
    if (e[0].F == e[1].F) cmn = e[0].F;
    if (e[0].F == e[1].S) cmn = e[0].F;
    if (e[0].S == e[1].F) cmn = e[0].S;
    if (e[0].S == e[1].S) cmn = e[0].S;
    bool snez = 1;
    for (int i =0 ; i +1 < n; ++i) {
        if (e[i].F != cmn && e[i].S != cmn) {
            snez = 0;
            break;
        }
    }
    if (snez) {
        for (int i = 0; i < n ;++i) {
            printf("%d ", i + 1);
        }
        cout << endl;
        return 0;
    }
    col[0] = 1;
    dfs(0);
    for (int i = 0; i < n; ++i) {
        if (col[i] == 0) {
            exit(228);
        }
        if (col[i] == 1) {
            v1.PB(i);
        }
        if (col[i] == 2) {
            v2.PB(i);
        }
    }
    for (int i = 1; i <= n; ++i) {
        if (i % 3 == 1) {
            num1.PB(i);
        } else if (i % 3 == 2) {
            num2.PB(i);
        } else {
            num0.PB(i);
        }
    }
    if (v1.size() < v2.size()) {
        swap(v1, v2);
    }
    if (num1.size() <= v1.size() && num2.size() <= v2.size()) {
        for (int a : num1) {
            ans[v1.back()] = a;
            v1.pop_back();
        }
        for (int a : num2) {
            ans[v2.back()] = a;
            v2.pop_back();
        }
        for (int i = 0; i < n; ++i) {
            if (ans[i] == 0) {
                ans[i] = num0.back();
                num0.pop_back();
            }
        }
    } else if (num1.size() + num2.size() <= v1.size()) {
        for (int a : num1) {
            ans[v1.back()] = a;
            v1.pop_back();
        }
        for (int a : num2) {
            ans[v1.back()] = a;
            v1.pop_back();
        }
        for (int i = 0; i < n; ++i) {
            if (ans[i] == 0) {
                ans[i] = num0.back();
                num0.pop_back();
            }
        }
    } else {
        cout << -1 <<endl;
        return 0;
    }
    for (int i = 0; i < n; ++i) {
        cout << ans[i] << ' ';
    }
    cout << endl;

    return 0;
}




Measured memory_bytes: 19700