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

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  lint n; cin >> n;
  vector<lint> a(n);
  lint sum = 0;
  lint mi = INF;
  for (int i = 0; i < n; i++) {
    cin >> a[i]; 
    sum += a[i];
    mi = min(mi, a[i]);
  }
  sort(ALL(a));

  string ans = "";
  if (n % 2 == 1) {
    ans = (sum % 2 == 0) ? "Second" : "First";
  } else {
    ans = (sum % 2 == 0 and mi % 2 == 0) ? "Second" : "First";
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 4364
#include <stdio.h>

int main() {
  int a, b, c, x;

  scanf("%d %d %d", &a, &b, &c);
  if (a > b) {
    x = a;
    a = b;
    b = x;
  }
  if (b > c) {
    x = b;
    b = c;
    c = x;
  }
  if (a > b) {
    x = a;
    a = b;
    b = x;
  }
  printf("%d %d %d\n", a, b, c);

  return 0;
}

Measured memory_bytes: 596
class StationAndBus:
    def __init__(self):
        self.result = False
    
    def check_combination(self, str_list):
        if str_list.count(str_list[0]) == 0 or str_list.count(str_list[0])==3:
            self.result = False
        else:
            self.result = True
        return self.result

if __name__ == "__main__":
    S=list(input())
    sab = StationAndBus()
    result=sab.check_combination(S)
    if result:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 38384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	int a,b,x;
	cin>>a>>b>>x;
	if(a<=x&&x<=a+b)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int S, h, m, s;
    scanf("%d", &S);
    h=S/3600;
    S=S%3600;
    m=S/60;
    s=S%60;
    printf("%d:%d:%d\n", h, m, s);
    
    return 0;
}


Measured memory_bytes: 2100
/*Bismillahir Rahmanir Rahim*///{
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace std; using __gnu_cxx::power;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1; const double eps = 1e-6, ldeps = 1e-9;
struct Dbg { static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto o(C *x)->decltype(os << *x, 0);
template<class C> static char o(...);
template<class C> typename enable_if<sizeof o<C>(0)!=1,Dbg&>::type operator<<(const C &x) {os<<x; return *this;}
template<class C> Dbg &dump(C b, C e) {
    for (struct{C i;int j;} i={(*this<<"\n[",b),0}; i.i!=e and i.j<26; i.i++, i.j++) *this<<", "+2*(i.i==b)<<*i.i;
    return *this << ']';
}
template<class C> typename enable_if<sizeof o<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    return dump(begin(x), end(x));
}
template<class C, size_t X> typename enable_if<!is_same<C, const char>::value, Dbg&>::type operator<<(C (&x)[X]) {
    return dump(begin(x), end(x));
}
template<class B, class C> Dbg &operator<<(const pair<B, C> &x) {return *this<<'{'<<x.first<<", "<<x.second<<'}';}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(#args), args), dbg << endl
#define cbug(a, args...) if (a) bug(args);
#define ASSERT(a, o, b, args...) if (!((a)o(b))) bug(a, b, ##args), assert((a)o(b));
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int T, Q, cn;//}
const int inf = 1000000007, mxn = 10005;

int n, f[mxn];

signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout.precision(11), cout.setf(ios::fixed);
    cin >> n;
    for (int i = 1; i <= 100; i++) {
        for (int j = 1; j <= 100; j++) {
            for (int k = 1; k <= 100; k++) {
                int o = i*(i+j)+j*(j+k)+k*(k+i);
                if (o <= n) f[o]++;
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        cout << f[i] << '\n';
    }
}

Measured memory_bytes: 3612
import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*

class D

fun main( args: Array<String> ) {
    val br = BufferedReader( InputStreamReader( System.`in` ) )
//    while ( true ) {
        solve( br )
//    }
}

fun solve( br: BufferedReader ) {
    val s = ( "0" + br.readLine() + "0" ).toCharArray()
    val change = ArrayList<Int>()
    for ( i in 0 until s.lastIndex ) {
        if ( s[i] != s[i + 1] ) {
            change.add( i )
        }
    }
    var r = s.size - 2
    for ( c in change ) {
        r = Math.min( r, Math.max( c, s.size - 2 - c ) )
    }
    println( r )

//    val change0 = ArrayList<Int>()
//    change0.add( 0 )
//    change0.add( 0 )
//    change0.addAll( change )
//    val change1 = ArrayList<Int>()
//    change1.add( 0 )
//    change1.addAll( change )
//    change1.add( s.size - 2 )
//    var best = Math.max( getBest( s, change ), getBest( s, change0 ) )
//    change.add( s.size - 2 )
//    change.add( s.size - 2 )
//    change0.add( s.size - 2 )
//    change0.add( s.size - 2 )
//    best = Math.max( Math.max( best, getBest( s, change1 ) ), Math.max( getBest( s, change ), getBest( s, change0 ) ) )
//    println( getBest( s, change0 ) )
//    println( best )
}

private fun getBest( s: CharArray, change: ArrayList<Int>): Int {
    var best = s.size - 2
    for ( i in 0 until change.size / 2 ) {
        best = Math.min( best, change[i + change.size / 2] - change[i] )
    }
    return best


//    var l = 1
//    var r = s.size - 2
//    while ( l < r ) {
//        val m = ( l + r + 1 ) / 2
//        var good = true
//        for ( i in 0 until change.size / 2 ) {
//            good = good && ( ( change[i + change.size / 2] - change[i] ) >= m )
//        }
//        if ( good ) {
//            l = m
//        } else {
//            r = m - 1
//        }
//    }
//    return l
}

Measured memory_bytes: 36484
#include<iostream>

using namespace std;

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

	int N;
	cin >> N;

	if (N % 111 == 0) {
		cout << N << endl;
		return 0;
	}
	else {
		for (int i = N; i < 1000; i++)
		{
			if (i % 111 == 0) {
				cout << i << endl;
				return 0;
			}
		}
	}

	return 0;
}

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

int main(){
    
    while(1){

        int n, m; cin >> n >> m;
        if(!n) break;
        vector<int> a(m, 0);
        for(int i = 0; i < n; i++){
            int d, v; cin >> d >> v;
            d--;
            a[d] = max(a[d], v);
        }
        
        int ans = 0;
        for(int i = 0; i < m; i++) ans += a[i];
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
n, m = map(int, input().split())
A = set([int(input()) for i in range(m)])
dp = [0] * (n + 1)
dp[0] = 1
if 1 in A:
  dp[1] = 0
else:
  dp[1] = 1

for i in range(2, n+1):
  if i in A:
    dp[i] = 0
  else:
    dp[i] = (dp[i-1] + dp[i-2]) % (10**9 + 7)
print(dp[n])

Measured memory_bytes: 56664
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res

def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()

    return

#B
def B():
    n = I()

    return

#C
def C():
    def add(i):
        while i < len(bit):
            bit[i] += 1
            i += i&-i

    def sum(i):
        res = 0
        while i > 0:
            res += bit[i]
            i -= i&-i
        return res

    n,k = LI()
    a = IR(n)
    a.insert(0,0)
    for i in range(n+1):
        a[i] -= k
    for i in range(n):
        a[i+1] += a[i]
    b = list(set([a[i] for i in range(n+1)]))
    b.sort()
    for i in range(n+1):
        a[i] = bisect.bisect_right(b,a[i])
    bit = [0]*(max(a)+1)
    ans = 0
    for i in range(n+1):
        ans += sum(a[i])
        add(a[i])
    print(ans)
    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

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


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    string s;
    cin >> s;
    int n = s.size() + 1;

    vector<int> vr(n, 0), vl(n, 0);

    for (int i = n - 2; i >= 0; i--) {
        char c = s[i];
        if (c == '>') vr[i] = vr[i + 1] + 1;
    }
    for (int i = 0; i < n - 1; i++) {
        char c = s[i];
        if (c == '<') vl[i + 1] = vl[i] + 1;
    }

    vector<ll> v(n);
    rep(i, n) v[i] = max(vr[i], vl[i]);
    ll sum = accumulate(v.begin(), v.end(), 0ll);
    cout << sum << endl;

}


Measured memory_bytes: 8708
#include<iostream>
using namespace std;
const int maxn=0x3f3f3f;
int main()
{
	int n,m,l,r;
	cin>>n>>m;
	int maxl=0,minr=maxn;
	for(int i=1;i<=m;++i)
	{
		cin>>l>>r;
		if(r<maxl)
		{
			cout<<0<<endl;
			return 0;
		}
		if(l>minr)
		{
			cout<<0<<endl;
			return 0;
		}
		maxl=max(maxl,l);
		minr=min(minr,r);
	}
	if(n>=minr)
	 cout<<minr-maxl+1<<endl;
	else if(n<maxl)
	 cout<<0<<endl;
	else
	 cout<<n-maxl+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int findsum(int n) {
  int res = 0;
  while (n > 0) {
    res += n % 10;
    n /= 10;
  }
  return res;
}
int main() {
  int a;
  cin >> a;
  if (a % findsum(a) == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define endl '\n'
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int32_t main()
{
	IO_OP;
	
	string a, b;
	int ans = 0;
	cin >> a >> b;
	for(int i=0;i<3;i++)
		if(a[i] == b[i])
			ans++;
	cout << ans << endl;
	
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin>>n;
    vector<int> l(n),r(n);
    int sum=0;
    for(int i=0; i<n; i++){
        cin>>l.at(i)>>r.at(i);
        sum+=r.at(i)-l.at(i)+1;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())

dig_h = (((h * 60) + m) / (12 * 60)) * 360 
dig_m = (m / 60) * 360
if dig_h - dig_m < 0:
    ans = dig_m - dig_h
    if ans > 180:
        ans *= -1
        ans += 360
        #ans = 360 - ans
elif dig_h - dig_m > 180:
    ans = 360 - (dig_h - dig_m)
else:
    ans = dig_h - dig_m

if ans == 0:
    len = abs(a - b)
elif ans == 180:
    len = a + b
else :
    len = math.sqrt((a * a) + (b * b) - (2 * a * b * math.cos(math.radians(ans))))

print(float(len))


Measured memory_bytes: 9476
s=input()
k=int(input())

def decompose(s):
    l = []
    N = len(s)
    i = 1
    while i <= N:
        l.append(s[:i])
        i += 1
    l = list(set(l))
    l.sort()
    return l

def answer(slist,smin,k):
    indices = [i for i, x in enumerate(slist) if x == smin]
    ans = []
    for ind in indices:
        ans.extend(decompose(s[ind:min(ind+k,len(s))]))
    ans = list(set(ans))
    ans.sort()
    if len(ans) >= k:
        return ans[k-1]
    else:
        s_temp = slist.copy()
        k -= len(ans)
        for r in range(len(indices)):
            s_temp.remove(min(slist))
        smin = min(s_temp)
        j = answer(slist,smin,k)
        return j

s=answer(list(s),min(list(s)),k)
print(s)

Measured memory_bytes: 4468
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;

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

    using ll = long long;

    vector<vector<ll>> a(n, vector<ll>(n));

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

    vector<ll> c(1 << n);

    for (int i = 0; i < (1 << n); i++) {
        bitset<16> bs(i);

        for (int j = 0; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if (bs[j] && bs[k]) {
                    c[i] += a[j][k];
                }
            }
        }
    }

    const ll inf = 1LL << 60;

    vector<ll> dp(1 << n, -inf);

    dp[0] = 0;

    for (int i = 0; i < (1 << n); i++) {
        bitset<16> bsi(i);

        int v[16];
        int m = 0;

        for (int j = 0; j < n; j++) {
            if (!bsi[j]) {
                v[m++] = j;
            }
        }

        for (int j = 0; j < (1 << m); j++) {
            int T = 0;
            bitset<16> bsj(j);

            for (int k = 0; k < m; k++) {
                if (bsj[k]) {
                    T = T | (1 << v[k]);
                }
            }

            dp[i | T] = max(dp[i | T], dp[i] + c[T]);
        }
    }

    cout << dp[(1 << n) - 1] << endl;
}


Measured memory_bytes: 1280
#include<iostream>
#include<string>
using namespace std;
int n,m,k;
int main(){
  cin>>n>>m>>k;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=m;j++){
      if(i*j+(n-i)*(m-j)==k){
	cout<<"Yes"<<endl;return 0;
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define debug(x) cout << #x << " = " << x << '\n'
#define debug_arr(a , n) for(int i = 0 ; i < n ; i++)cout << a[i] << " "
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define inf 1000000000
#define mod 1000000007

const int max_n = 1e5 + 9;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
int main()
{
    int a[3] , k;
    for(int i = 0 ; i < 3 ; i++){
        cin >> a[i];
        if(i)a[i] += a[i-1];
    }
    cin >> k;

    if(k <= a[1]){
        cout << min(k , a[0]) << endl;
    }
    else{
        int num = k - a[1];
        cout << a[0] - num << endl;
    }
    return 0;
}

Measured memory_bytes: 3644
#include <string.h>
#include <iostream>
using namespace std;

typedef long long ll;
ll dp[51][51][2501];

int main()
{
  int n, a;
  int x[50];

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

  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;

  for(int i = 0; i < n; i++){
    for(int j = 0; j <= i; j++){
      for(int k = 0; k <= i * 50; k++){
        dp[i+1][j][k] += dp[i][j][k];
        dp[i+1][j+1][k+x[i]] += dp[i][j][k];
      }
    }
  }

  ll ans = 0;
  for(int j = 0; j <= n; j++){
    for(int k = 0; k <= 2500; k++){
      if(j != 0)
        if((k % j == 0) && (k / j == a)) ans += dp[n][j][k];
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 51072
N = gets.to_i
s_n = []
N.times do
  s_n << gets.split(' ')
end
s_n_sorted = s_n.sort do |a, b|
  b[1].to_i <=> a[1].to_i
end.sort do |a, b |
  a[0] <=> b[0]
end

ans = []
s_n_sorted.each do |e|
  s_n.each_with_index do |e2, i|
    if e[0] == e2[0] && e[1] == e2[1]
      ans << i + 1
      break
    end
  end
end

ans.each { |n| puts n }
 

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	dunk(n / 3);
	return 0;
}

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

int main(void) {
  //input
  int N;
  string S;
  cin >> N >> S;
  //calc
  int answer = 0;
  char pre_c = '_';
  char c;
  rep(i,N) {
    c = S.at(i);
    if ( c != pre_c ) {
      answer++;
    }
    pre_c = c;
  }
  //output
  cout << answer << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll Mod=1e9+7;
int n;
ll f[100010][2];
int cnt,head[100010],to[200010],nxt[200010];
void add(int x,int y)
{
	cnt++;
	to[cnt]=y;
	nxt[cnt]=head[x];
	head[x]=cnt;
}
void dfs(int x,int fa)
{
	f[x][0]=f[x][1]=1;
	for (int i=head[x];i;i=nxt[i])
	{
		int y=to[i];
		if (y==fa)
		{
			continue;
		}
		dfs(y,x);
		f[x][0]=f[x][0]*f[y][1]%Mod;
		f[x][1]=f[x][1]*(f[y][0]+f[y][1])%Mod;
	}
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	dfs(1,0);
	cout<<(f[1][0]+f[1][1])%Mod<<endl;
	return 0;
}


Measured memory_bytes: 9344
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#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) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	ll N;
	cin >> N;

	int sq = sqrt(N);

	ll saishou = 1e18;
	rep1(i, sq) {
		if (N % i == 0) {
			chmin(saishou, N / i + i);
		}
	}
	co(saishou - 2);

	Would you please return 0;
}

Measured memory_bytes: 256
/*
██████╗  ███████╗  
██╔══██╗ ██╔════╝ 
██████╔╝ ███████╗ 
██╔══██╗ ╚════██║  
██║  ██║ ███████║      
╚═╝  ╚═╝ ╚══════╝                                                                                                             
*/

#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define haha(j,a,n) for(int j=a;j<n;j++)
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define endl "\n"
#define bc(v) v.begin(),v.end()
#define vl vector<ll>
#define vi vector<int>
#define why 1000000007
#define NUM 100005
#define F first
#define S second
#define bhar(a) rep(i,a.size()) cin>>a[i];
#define show(a) rep(i,a.size()) cout<<a[i]<<" ";
#define sott(a) sort(bc(a))
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define mapp map<ll,ll>
#define dkac cout<<fixed<<setprecision(15);
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define yeah(n) while(n--)
ll gcd(int a, int b){if(b==0) return a; else return gcd(b,a%b);}
ll bitfun(ll x){
    return (x&(-x));
}
void solve(){
    dkac
    ll n; cin>>n;
    double p[n]; 
    rep(i,n) cin>>p[i];
    double dp[n+1][n+1];
    dp[0][0]=1.0;
    for(ll i=1;i<=n;i++)
        for(ll j=0;j<=i;j++){
            if(j==0) dp[i][j] = dp[i-1][j]*(1-p[i-1]);
            else dp[i][j] = dp[i-1][j-1]*p[i-1] + dp[i-1][j]*(1-p[i-1]);
        }
    double ans=0.0;
    for(int j=(n+1)/2;j<=n;j++) ans+=dp[n][j];
    cout<<ans;
}
int main(){
    ios
    int t=1; 
    //cin>>t;
    yeah(t){
        solve();
    }
}

Measured memory_bytes: 70144
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
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; }
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

// 二項係数計算
long long com(ll n){
    ll k = 2;
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return n*(n-1)/2;
}

int main()
{

    int N;
    cin >> N;
    vector<int> A;
    int same[200005] = {};
    int done[200005] = {};

    for(ll i=0; i<N; ++i)
    {
        ll tmp;
        cin >> tmp;
        A.push_back(tmp);
        ++same[tmp];
    }

    ll all = 0;
    for(ll i=0; i<N; ++i)
    {
        if(done[A[i]]==1) continue;
        else
        {
            done[A[i]] = 1;
            all += com(same[A[i]]);
        }
    }

    for(ll i=0; i<N; ++i)
    {
        cout << all - com(same[A[i]]) + com(same[A[i]]-1) << endl;
    }

    return 0;
}


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

int main(){
 long long N,ans,p,ansout;
  cin>>N;
  ans=0;
  ansout=0;
  char c;
 string S;
  cin>>S;
  vector<int>a(26);
for(int i=0;i<N;i++){
	for(int j=0;j<i+1;j++){
	  	c=S[j];
  		p=c-'a';
  		if(a[p]==0){
    		a[p]=1;
  		}
	}
	for(int j=i+1;j<N;j++){
  		c=S[j];
  		p=c-'a';
  		if(a[p]==1){
    		a[p]=2;
  		}
	}
 	for(int j=0;j<26;j++){
  		if(a[j]==2){
    		ans++;
  		}
   		a[j]=0;
	}
    ansout=max(ansout,ans);
    ans=0;      
}

  
    cout<<ansout<<endl;
    return 0;
}


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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll L;
    cin >> L;

    long double a = L / 3.0;
    cout << setprecision(10) << a*a*a << endl;

    return 0;
}

/*



*/

Measured memory_bytes: 256
using System;

namespace AOJ.intro
{
    namespace ITP_1_3_D
    {
        public static class HowManyDivisors
        {
            public static void Main()
            {
                string[] inputData = Console.ReadLine().Split();
                int startNum, endNum, totalNum;
                int count;
                startNum = int.Parse(inputData[0]);
                endNum   = int.Parse(inputData[1]);
                totalNum = int.Parse(inputData[2]);

                count = 0;

                for (int devideNum = startNum; devideNum <= endNum; ++devideNum)
                {
                    if (totalNum % devideNum == 0)
                    {
                        count++;
                    }
                }

                Console.WriteLine(count);
            }
        }
    }
}


Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int cnt=1;
  sort(a.begin(),a.end());
  long long sum=0;
  for(int i=0;i<n-1;i++){
    sum+=a[i];
    if(sum*2>=a[i+1]){
      cnt++;
    }
    else{
      cnt=1;
    }
  }
  cout << cnt << endl;
}

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

int main() {
    string s; cin >> s;
    int n = s.size();
    long long ans = 0;
    vector<int> cnt(n+1);
    for (size_t i = 0; i < s.size(); i++) {
        if (s[i] == 'A') cnt[i+1] = cnt[i]+1;
        else if (i && s[i-1] == 'B' && s[i] == 'C') {
            cnt[i+1] = cnt[i-1];
            ans += cnt[i+1];
        }
        else cnt[i+1] = 0;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1412
#!/usr/bin/env python
# coding: utf-8

# In[18]:


N = int(input())
H = list(map(int, input().split()))


# In[19]:


flag = True
mylist = list(reversed(H))
for i in range(1,N):
    if mylist[i] > mylist [i-1] + 1:
        flag = False
        break
    elif mylist[i] == mylist[i-1] + 1:
        mylist[i] = mylist[i]-1
if flag:
    print("Yes")
else:
    print("No")


# In[ ]:






Measured memory_bytes: 20840
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a,b,c;
  cin >> a >>b >>c;
  if(a.at(a.size()-1)==b.at(0) && b.at(b.size()-1) ==c.at(0)){
    cout << "YES" <<endl;
  }
  else{
    cout <<"NO" <<endl;
  }
}

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

int main(){
    int n,k;
    cin >> n >> k;
    vector<bool> A(n,false);

    rep(i,k){
        int d;
        cin >> d;
        rep(j,d) {
            int x;
            cin >> x;
            A.at(x - 1) = true;
        }
    }

    int ans = 0;
    for(bool y :A) if(!y) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		
		switch(n % 10){
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			System.out.println("hon");
			break;
		case 0:
		case 1:
		case 6:
		case 8:
			System.out.println("pon");
			break;
		default:
			System.out.println("bon");
		}
	}

}


Measured memory_bytes: 35764
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
 
int main(){
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;
  vector<long long> value;
  for(int c=0;c<=2*X|c<=2*Y;c++){
    int a=X-c;if(a<0) a=0;
    int b=Y-c;if(b<0) b=0;
    value.push_back(2*C*c+A*a+B*b);
  }
  sort(value.begin(),value.end());
  cout<<*(value.begin())<<endl;
  return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

int main(){
	
	int K;
	cin >> K;
	cout << (K / 2 * (K - K / 2)) << endl;
	
	
	
	
	
	
    return 0;
}

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

using ll=long long;

int main() {
  ll H,W; cin >>H >>W;
  cout <<(H==1 or W==1 ? 1:(H*W+1)/2) <<endl;
  return 0;
}


Measured memory_bytes: 3604
#include <cstdio>
#include <cmath>
#include <string>

#define rep( i, n, m ) for (int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for (int i = ( n ); i < ( m ); i--)

int main( void ){
	int num = 0, K, count = 0;
	char str[ 100 ];
	if (!scanf( "%s", &str[ 0 ] ))
		return -1;
	for(int i = 0; str[ i ] != '\0'; i++){
		if (i % 2 == 0){
			if (str[ i ] == 'L'){
				printf( "No\n" );
				return 0;
			}
		}
		else {
			if (str[ i ] == 'R'){
				printf( "No\n" );
				return 0;
			}

		}
	}
	printf("Yes\n");
	return 0;
}


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

const int d = 365;
int main() {
  vector<int> c(26);
  for (int i = 0; i < 26; i++) {
    cin >> c[i];
  }
  vector<vector<int>> s(d, vector<int>(26));
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s[i][j];
    }
  }

  vector<int> t(26);
  for (int i = 0; i < 26; i++) {
    t[i] = i + 1;
  }

  for (int i = 0; i < d; i++) {
    cout << t[rand() % 26] << endl;
  }

  return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int mod=998244353,N=305;
int dp[N][N][N];

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    string st;
    int k;
    cin >> st >> k;
    reverse(st.begin(),st.end());
    st+='0';
    vector <int> v;
    int c=0;
    v.push_back(-1);
    for(int i=0;i<st.size();i++){
        if(st[i]=='0'){
            v.push_back(c);
            c=0;
        }
        else c++;
    }
    k=min(k,(int)st.size());
    int m=(int)v.size()-1;
    dp[0][0][0]=1;
    for(int i=1;i<=m;i++){
        for(int x=0;x<N;x++){
            for(int j=N-2;j>=0;j--)
                dp[i][j][x]=(dp[i-1][j][x]+dp[i][j+1][x])%mod;
        }
        for(int y=1;y<=v[i];y++){
            for(int x=0;x<N;x++){
                for(int j=0;j<N;j++){
                    if(j-y<0 or x-y<0)continue;
                    dp[i][j][x]=(dp[i][j][x]+dp[i-1][j-y][x-y])%mod;
                }
            }
        }
    }
    int ans=0;
    for(int i=0;i<=k;i++)
        ans=(ans+dp[m][0][i])%mod;
    cout << ans;
}

Measured memory_bytes: 221600
#include<stdio.h>

int A[1000000],n;

int binarySearch(int key){
  int left = 0;
  int right = n;
  int mid;
 while(left < right){
  mid = (left + right) / 2;
  if(key == A[mid]) return 1;
  if(key > A[mid]) left = mid + 1;
  else if(key < A[mid]) right = mid;

}
  return 0;
}
 
int main(){
  int i,q,k,sum = 0;

  scanf("%d",&n);
  for(i = 0; i < n;i++){
  scanf("%d",&A[i]);
}
  scanf("%d",&q);
  for(i = 0; i < q;i++){
  scanf("%d",&k);
  if( binarySearch( k ) ) sum++;
}
  printf("%d\n", sum);
  
  return 0;
}

Measured memory_bytes: 2100
#!/usr/bin/env python3
import sys
import math
MOD = 1000000007  # type: int

def factorial(n):
    f = 1
    while n>0:
        f*=n
        f = f%MOD
        n-=1
    return f

def solve(X: int, Y: int):
    if X>2*Y or Y>2*X or (X+Y)%3!=0:
        print(0)
        return 
    
    N = (X+Y)//3 ##N階層め

    # N階層めの一番端のX
    left_x = 2*N
    r = left_x-X
    bunsi = factorial(N)
    bunbo = factorial(N-r)*factorial(r)
    bunbop = pow(bunbo,MOD-2,MOD)
    print(bunsi*bunbop%MOD)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
# -*- coding:utf-8 -*-

import sys

def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)

def lcm(a, b):
    return a * b / gcd(a, b)

array = []
for i in sys.stdin:
    array.append(i)

for i in range(len(array)):
    n, m = array[i].split()
    n, m = int(n), int(m)
    print(int(gcd(n, m)),int(lcm(n, m)))

Measured memory_bytes: 7652
/**
 * @author Finn Lidbetter
 */
import java.util.*;
import java.io.*;
import java.awt.geom.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();

    String[] s= br.readLine().split(" ");
    int n = Integer.parseInt(s[0]);
    int k = Integer.parseInt(s[1]);
    s = br.readLine().split(" ");
    int v1 = Integer.parseInt(s[0]);
    int gcd = v1;
    int max = v1;
    for (int i=1; i<n; i++) {
      int v = Integer.parseInt(s[i]);
      gcd = gcd(gcd, v);
      if (v>max)
        max = v;
    }
    if (k>max || k%gcd!=0) {
      System.out.println("IMPOSSIBLE");
    } else {
      System.out.println("POSSIBLE");
    }
  }
  static int gcd(int a, int b) {
    return (b==0) ? a : gcd(b, a%b);
  }
}


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

int main(){
  int a;
  
  string S;
  cin >> a >> S;
  int ans =0;
  for(int i=1;i<S.size();i++){
    if(S[i]!=S[i-1]) ans++;
  }
  cout << ans +1 << endl;
  return 0; 
}

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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;

int n,a,ans[200000];

signed main() {
    cin >> n;
    rep(i,n-1) cin >> a, ans[--a]++;
    rep(i,n) cout << ans[i] << endl;

}




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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int A = nextInt();
  int B = nextInt();
  cout << max({A+B, A-B, A*B}) << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

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

using namespace std;


int main(){
 string s;
  cin>>s;
  
  bool itti=false;
  for(int i=0;i<s.size();i++){
    for(int j=0;j<i;j++){
      if(s[j]==s[i]){
        itti=true;
      }
 
}
  }
    if(itti) cout<<"no"<<endl;
    else cout<<"yes"<<endl;
  }


Measured memory_bytes: 256
/***  بسم الله الرحمن ا لرحيم   ***/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl                         '\n'
#define Ceil(x,y)             ((x+y-1)/y)
#define sz(s)               (int)s.size()
#define RT(x)           return cout<<x,0;
#define mem(x,y)    memset(x,y,sizeof(x))
#define all(v) ((v).begin()), ((v).end())
#define watch(x) cout<<#x<<" = { "<<x<<" }\n"
#define test int t;cin>>t;while(t--)
const int dx[] = { 0, 1, 0, -1, 1, 1, -1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
const double PI = acos(-1), EPS = 1e-7;
const int OO = 0x3f3f3f3f, N = 2e5 + 5, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll x, ll y) { return (!y) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return ((x / gcd(x, y)) * y); }
void file() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int n,k;
ll memo[101][N];
vector<int>w,v;

ll dp(int i,int rem) {
	if (i == n)return 0;
	ll& ret = memo[i][rem];
	if (~ret)return ret;
	ret = dp(i + 1, rem);
	if(rem>=w[i])ret = max(ret, dp(i + 1, rem-w[i]) + v[i]) ;
	return ret;
	
}
void solve() {
	cin >> n>>k;
	v = vector<int>(n);
	w = vector<int>(n);
	for (int i = 0; i < n; i++)cin >> w[i] >> v[i];
	mem(memo, -1);
	cout << dp(0,k) << endl;

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


Measured memory_bytes: 161452
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int N;

int main() {
    cin >> N;
    vector<int> A(N);
    int a;
    for (int i = 0; i < N; i++) {
        cin >> a;
        A[i] = a - i - 1;
    }
    sort(A.begin(), A.end());
    
    int x = A[(N - 1) / 2];
    long long ans = 0;
    for (int i = 0; i < N; i++) {
        ans += 1ll * abs(x - A[i]);
    }
    cout << ans << endl;
}


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

int main(void) {
  long long N, M; 
  cin >> N >> M;

  long long res = 0;
  for (long mi = 0; mi < M; mi++) {
    long long tmp;
    cin >> tmp;
    res += tmp;
  }

  if (res > N) {
    cout << -1 << endl;
  } else {
    cout << N - res << endl;
  }

  return 0;
}


Measured memory_bytes: 3636
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    #endif
    // int T;cin>>T;while(T--) 
    {
        ll a;
        cin>>a;
        cout<<(a+(1ll*a*a)+(1ll*a*a*a))<<endl;
    }
    return 0;
}

Measured memory_bytes: 3648
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const (
	max = 10000
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	length, _ := strconv.Atoi(sc.Text())

	A := make([]int, length)
	B := make([]int, length)
	i := 0
	for sc.Scan() {
		A[i], _ = strconv.Atoi(sc.Text())
		i++
	}

	C := make([]int, max)
	for i = 0; i < len(A); i++ {
		C[A[i]]++
	}

	for i = 1; i < max; i++ {
		C[i] = C[i] + C[i-1]
	}

	for i = length - 1; i >= 0; i-- {
		B[C[A[i]]-1] = A[i]
		C[A[i]]--
	}

	fmt.Println(strings.Trim(strings.Join(strings.Fields(fmt.Sprint(B)), " "), "[]"))
}



Measured memory_bytes: 115816
#include"bits/stdc++.h"
using namespace std;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    long long ans = 0;
    for (int i = 1; i <= N; i++) {
        string s = to_string(i);
        int sum = 0;
        for (char c : s) {
            sum += c - '0';
        }
        if (A <= sum && sum <= B) {
            ans += i;
        }
    }
    cout << ans << endl;
}

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

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k,a,b;
    cin >> k >> a >> b;
    if(a<=(b/k)*k) cout << "OK" << "\n";
    else           cout << "NG" << "\n";
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0; i < n; i++)
#define REPR(i, n) for(long long i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(long long i = m; i <= n; i++)
#define FORR(i, m, n) for(long long i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;



int main(){FIN

    ll a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k;
    if (e-a<=k){
        cout<<"Yay!";
        return 0;
    }
    cout<<":(";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

typedef long long LL;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    LL ans1=(LL)a*c;
    LL ans2=(LL)a*d;
    LL ans3=(LL)b*c;
    LL ans4=(LL)b*d;
    //cout<<ans1<<" "<<ans2<<" "<<ans3<<" "<<ans4<<endl;
    LL ans=max(ans1,ans2);
    ans=max(ans,max(ans3,ans4));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3604
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int main(void){
    int X; cin >> X;
    map<int, int> appered;
    int now = 0;
    for (int i = 0; ; ++i){
        if (appered[now]){
            cout << i << endl;
            break;
        }
        appered[now] = 1;
        now = (now + X) % 360;
    }
    return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  while (cin >> n, n) {
    vector<vector<int>> a(n, vector<int>(n));
    int y = n / 2 + 1, x = n / 2;
    for (int i = 1; i <= n * n; i++) {
      if (a[y][x] > 0) {
        (y += 1) %= n;
        (x += 1) %= n;
        if (a[y][x] > 0) {
          (y += 1) %= n;
          (x += n - 1) %= n;
        }
      }
      a[y][x] = i;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cout << setw(4) << a[i][j];
      }
      cout << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3048
// #pragma comment(linker, "/STACK:1024000000,1024000000")
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <fstream>
#include <list>
#include <iomanip>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(s) memset(s, 0, sizeof(s))
const int inf = 0x3f3f3f3f;
#define LOCAL
const int maxn = 1e6 + 7;
int read(){
    int x = 0; int zf = 1; char ch = ' ';
    while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
    if (ch == '-') zf = -1, ch = getchar();
    while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar(); return x * zf;
}

int main(int argc, char * argv[]) 
{
	long long n, m = 1;
	cin >> n;
	int sqr = sqrt(n);
	//cout << sqr << endl;
	for (long long i = 1; i <= sqr; i++){
		if (n % i == 0){
			m = max(m, i);
		}
	}
	long long ans = m + n / m - 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    string s;
    cin >> s;
    ll n = s.size();

    vvl dp(n+1, vl(4));  // dp[i+1][j] : s[i]までで"ABC"のj文字目まで丸をつける方法の数
    dp[0][0] = 1;
    rep(i, n) {
        exrep(j, 0, 3) {
            if(s[i] == '?') {
                dp[i+1][j] += 3*dp[i][j];
                if(j < 3) {
                    dp[i+1][j+1] += dp[i][j];
                }
            }
            else {
                dp[i+1][j] += dp[i][j];
                if(j < 3 && "ABC"[j] == s[i]) {
                    dp[i+1][j+1] += dp[i][j];
                }
            }
            dp[i+1][j] %= mod;
            dp[i+1][j+1] %= mod;
        }
    }

    out(dp[n][3]);
    re0;
}

Measured memory_bytes: 7424
import java.util.*;

public class Main {

    private static final int _0 = 0;
    private static final int _10 = 10;

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

        int x = sc.nextInt();
        int a = sc.nextInt();

        if (x < a) {
            System.out.println(_0);
        } else {
            System.out.println(_10);
        }

        sc.close();
    }
} 

Measured memory_bytes: 23124
S = gets.chomp
MOD = 10 ** 9 + 7

T = []
10.times{|j|
  t = []
  13.times{|k|
    t << (10 * k + j) % 13
  }
  T << t
}

bef = Array.new(13, 0)
bef[0] = 1
(0...S.size).each{|i|
  nxt = Array.new(13, 0)
  if S[i] == '?' then
    10.times{|j|
      t = T[j]
      13.times{|k|
        nxt[t[k]] += bef[k]
      }
    }
  else
    t = T[S[i].to_i]
    13.times{|k|
      nxt[t[k]] += bef[k]
    }
  end
  nxt.each_with_index{|n, i|
    bef[i] = n % MOD
  }
}

puts bef[5]


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

int main()
{
	int N,K;
	cin >> N >> K;
	int ans = 0;
	while(N != 0)
	{
		ans++;
		N /= K;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int list[] = new int[X-1];
		for (int i = 0; i < X-1; i++) {
			list[i] = sc.nextInt();
		}
		int ans[] = new int[X];
		for (int i = 0; i < X-1; i++) {
			ans[list[i]-1]++;
		}

		for (int i = 0; i < X; i++) {
			System.out.println(ans[i]);
		}

	}
}

Measured memory_bytes: 61512
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<n; ++i)
#define all(x) begin(perm),end(perm)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    ll n,a,b; cin>>n>>a>>b;
    ll gap = b-a-1;
    if(gap%2==1){
        cout<<(gap+1LL)/2LL<<endl;
    }else{
        cout<<min(a-1LL,n-b)+1+gap/2<<endl;
    }
}


Measured memory_bytes: 256