akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){
    vector<int> a(3);
    int ans;
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(),a.end());
    ans += (a[1]-a[0])/2;
    ans += (a[2]-a[1]);
    ans += a[1]%2==a[0]%2? 0:2;
    cout << ans << endl; 
}


Measured memory_bytes: 256
n, k = map(int, input().split())
*V, = map(int, input().split())
M = [v if v < 0 else 0 for v in V]
S = [0]
for i in range(1, min(k+1, n+1)):
    for j in range(i+1):
        s = sum(V[:i-j])+sum(V[n-j:])
        M_sub = sorted(M[:i-j]+M[n-j:])
        s -= sum(M_sub[:k-i])
        S += [s]
print(max(S))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
// #define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int N;
  cin >> N;
  if (N == 1) {
    cout << 1 << endl;
    return 0;
  }

  int ans = 0;
  int cnt = 0;
  for (int i = N; i > 0; --i) {
    if (i % 2) continue;
    int n = 0;
    int j = i;
    while (1) {
      if (j % 2) break;
      j /= 2;
      ++n;
    }
    if (cnt < n) {
      ans = i;
      cnt = n;
    }
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  string a, b;
  while (cin >> a >> b) {
    sort(a.begin(), a.end());
    sort(b.rbegin(), b.rend());
    if (a < b) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 256
/* マージソートの実装(安定か不安定かチェックするため) */

fn merge<T: Ord + Clone>(series: &mut Vec<T>, left: usize, mid: usize, right: usize) {
    let ls = series[left..mid].to_vec();
    let rs = series[mid..right].to_vec();

    let mut li = 0;
    let mut ri = 0;
    for i in left..right {
        if ls.len() <= li {
            series[i] = rs[ri].clone();
            ri += 1;            
        } else if rs.len() <= ri {
            series[i] = ls[li].clone();
            li += 1;
        } else if ls[li] > rs[ri] {
            series[i] = rs[ri].clone();
            ri += 1;
        } else {
            series[i] = ls[li].clone();
            li += 1;
        }
    }
}

fn merge_sort<T: Ord + Clone>(series: &mut Vec<T>, left: usize, right: usize) {
    if left + 1 < right {
        let mid = (left + right) / 2;
        merge_sort(series, left, mid);
        merge_sort(series, mid, right);
        merge(series, left, mid, right);
    }
}

/* partitionの実装 */

fn swap<T: Clone>(series: &mut Vec<T>, i: usize, j: usize) {
    let tmp = series[i].clone();
    series[i] = series[j].clone();
    series[j] = tmp;
}

fn partition<T: Ord + Clone>(series: &mut Vec<T>, p: usize, r: usize) -> usize {
    let x = series[r].clone();
    let mut i = p;
    for j in p..r {
        if series[j] <= x {
            swap(series, i, j);
            i += 1;
        }
    }
    swap(series, i, r);
    return i;
}

/* CardとそのOrd traitの実装 */

#[derive(Debug, Clone, Eq, PartialEq)]
struct Card {
    pub number: u32,
    pub design: String
}

impl Ord for Card {
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.number.cmp(&other.number)
    }
}

impl PartialOrd for Card {
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}

/* quick_sortの実装 */

fn quick_sort<T: Ord + Clone>(series: &mut Vec<T>, p: usize, r: usize) {
    if p < r {
        let q = partition(series, p, r);
        quick_sort(series, p, q-1);
        quick_sort(series, q+1, r);
    }
}

fn read_lines() -> Vec<String> {
    use std::io::Read;

    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    return buf.lines().map(|e| e.to_string()).collect::<Vec<_>>();
}

fn main() {
    let input = read_lines();
    let n: usize = input[0].parse().unwrap();
    let cards = input[1..n+1].iter().map(|line| {
        let es = line.split_whitespace().collect::<Vec<_>>();
        Card {
            number: es[1].parse().unwrap(),
            design: es[0].to_string()
        }
    }).collect::<Vec<_>>();
    let mut cards_quick = cards.clone();
    quick_sort(&mut cards_quick, 0, n-1);
    let mut cards_merge = cards.clone();
    merge_sort(&mut cards_merge, 0, n);

    if cards_quick == cards_merge {
        println!("Stable");
    } else {
        println!("Not stable");
    }

    for card in cards_quick {
        println!("{} {}", card.design, card.number);
    }
}


Measured memory_bytes: 30084
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> v;
    int a;
    while(cin >> a)
        v.push_back(a);
    cout << *min_element(v.begin(), v.end()) << " " << *max_element(v.begin(), v.end()) << " " << accumulate(v.begin(), v.end(), (long long)0) << "\n";
}

Measured memory_bytes: 3268
K = gets.to_i

def digitsum(num)
    ret = 0
    while num > 0
        ret += num % 10
        num /= 10
    end
    ret
end

last = 1
ans = [1]
while ans.length < K
    base = 1
    nextnum = nil
    min = 10**20
    while base <= last * 10
        cand = last + base
        cand_val = cand.to_f / digitsum(cand)
        if min > cand_val
            min = cand_val
            nextnum = cand
        end
        base *= 10
    end
    last = nextnum
    ans.push(nextnum)
end
puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a>b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD =1000000007;//1e9 + 7;





int main(){
    string a,b;
    int n;
    cin>>n>>a>>b;


	rep(i,n){
        cout<<a[i]<<b[i];
    }
    cout<<endl;

}

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

int main() {
	int n;
	cin >> n;
	ll l[n];
	for(int i=0; i<n; i++){
		cin >> l[i];
	}
	ll ans = 0;
	for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n-1; j++){
            for(int k=j+1; k<n; k++){
                if(l[i]!= l[j] && l[j]!= l[k] && l[i]!=l[k]){
                    if(l[i]+l[j] > l[k] && l[j]+l[k] > l[i] && l[i]+l[k] > l[j]){
                        ans++;
                    }
                }
            }
        }
	}
	cout << ans << endl;

	return 0;
}


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

int main() {
    long long n;
    cin>>n;
    long long a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    //cost size
    // pair<int, int> dp[n+1];
    // dp[0]={0, 0};
    // dp[1]={0, a[1]};
    // dp[2]={a[1]+a[2],a[1]+a[2]};
    // dp[3]={min(2*(a[1]+a[2])+a[3], 2*(a[2]+a[3])+a[1]) ,a[1]+a[2]+a[3]};
    // for(int i=4;i<=n;i++) {
    //     // combine ith with remaining i-1
    //     // size = dp[i-1].second+a[i]
    //     // cost = dp[i-1].first+(size)
    //     int opt1_size = dp[i-1].second+a[i];
    //     int opt1_cost = dp[i-1].first+opt1_size;
    //     // combine ith and i-1th and remaining
    //     int opt2_size = dp[i-2].second+a[i]+a[i-1];
    //     int opt2_cost = dp[i-2].first+a[i]+a[i-1]+opt2_size;
    //     bool flag=0;
    //     if(opt2_cost<opt1_cost)
    //         flag=1;
    //     if(flag)
    //         {dp[i].first=opt2_cost; dp[i].second=opt2_size;}
    //     else 
    //         {dp[i].first=opt1_cost; dp[i].second=opt1_size;}
    long long dp[n+1][n+1];
    long long prefix[n+1];
    prefix[0]=0;
    for(int i=0;i<=n;i++) {
        for(int j=0;j<=n;j++)
            dp[i][j]=LLONG_MAX;
    }
    for(int i=0;i<=n;i++) {
        dp[i][i]=0;
    }
    for(int i=1;i<=n;i++)
        prefix[i]=prefix[i-1]+a[i];
    for(int l=1;l<=n-1;l++) {
        for(int i=1;i<=n-l;i++) {
            int j=i+l;
            for(int k=i;k<=j-1;k++) {
                dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+prefix[j]-prefix[i-1]);
            }
        }
    }
    // for(int i=0;i<=n;i++) {
    //     for(int j=i;j<=n;j++) {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    cout<<dp[1][n]<<endl;
    return 0;
}

Measured memory_bytes: 4848
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)

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

int x[10], y[10];

int main() {
	cin >> x[0] >> y[0] >> x[1] >> y[1];
	int cos = x[1] - x[0];
	int sin = y[1] - y[0];
	x[2] = x[1] - sin, y[2] = y[1] + cos;
	x[3] = x[0] - sin, y[3] = y[0] + cos;
	cout << x[2] << " " << y[2] << " "
		<< x[3] << " " << y[3] << endl;
}

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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int N;
    array<array<int,15>,105> F;
    array<array<int,15>,105> P;
    cin >> N;
    for (int i = 0; i < N; i++){
        for (int k = 0; k < 10; k++){
            cin >> F[i][k];
        }
    }
    for (int i = 0; i < N; i++){
        for (int k = 0; k < 11; k++){
            cin >> P[i][k];
        }
    }
    ll ans = -(1<<30);
    for (int b = 1; b < (1<<10); b++){
        ll prof = 0;
        for (int i = 0; i < N; i++){
            int c = 0;
            for (int k = 0; k < 10; k++){
                if (b & (1<<k) && F[i][k]){
                    c++;
                }
            }
            prof += P[i][c];
        }
        ans = max(ans,prof);
    }
    cout << ans << endl;

                    


            




    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

struct _line{ int p1, p2; };
typedef struct _line Line;

int main(void)
{
	int i, j, w, n;
	int currPos, ans[30];
	Line line[30];

	scanf("%d", &w);
	scanf("%d", &n);
	for(i=0; i<n; i++)
		scanf("%d,%d", &line[i].p1, &line[i].p2);

	for(i=0; i<w; i++)
	{
		currPos=i+1;
		for(j=0; j<n; j++)
		{
			if(currPos == line[j].p1)
				currPos=line[j].p2;
			else if(currPos == line[j].p2)
				currPos=line[j].p1;
		}
		ans[currPos-1] = i+1;
	}
	for(i=0; i<w; i++)
		printf("%d\n", ans[i]);

	return 0;
}

Measured memory_bytes: 596
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
using namespace std;
using ll = long long;
 
int main(){
    ll N,M;
    cin>>N>>M;
    vector<ll> P(M),Y(M);
    for(ll i=0;i<M;i++){
        cin>>P[i]>>Y[i];
        P[i]--;
    }
    vector<vector<ll>> vals(N);
    for(ll i=0;i<M;i++){
        vals[P[i]].push_back(Y[i]);
    }
    for(ll v=0;v<N;v++){
        sort(vals[v].begin(),vals[v].end());
    }
    for(ll i=0;i<M;i++){
        int v=P[i];
        printf("%06d",v+1);
        ll id = lower_bound(vals[v].begin(),vals[v].end(),Y[i])-vals[v].begin();
        printf("%06lld\n",id+1);
    }
}
 

Measured memory_bytes: 8576
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

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

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

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    vector<int> cnt(n);
    for (int i = 0; i < n; ++i) {
        cnt[v[i]-1]++;
    }
    sort(cnt.begin(),cnt.end());
    while(cnt.back() == 0) cnt.pop_back();
    vector<int> ans(n);
    int p = 0;
    int s = n;
    for (int k = 1; k <= n; ++k) {
        int x = k-p;
        while(!cnt.empty() && cnt.back() > s/x){
            s -= cnt.back();
            cnt.pop_back();
            p++;
            x--;
        }
        ans[k-1] = s / x;
    }
    for (int i = 0; i < n; ++i) {
        printf("%d\n", ans[i]);
    }
    return 0;
}

Measured memory_bytes: 4352
s = input()
s = s[::-1]
n = len(s)
s = '#' + s
MOD = 10**9+7
dp = [[0]*13 for _ in range(n+5)]
"""
dp[i][j] は i 桁目まで見たとき 13 で割ったあまりが j　となるようなものの個数
"""
dp[0][0] = 1
r = 1 
for i in range(1,n+1):
    for j in range(13):
        if s[i] != '?':
            dp[i][j] = dp[i-1][(j-r*int(s[i]))%13] % MOD
        if s[i] == '?':
            for k in range(10):
                dp[i][j] += dp[i-1][(j-r*k)%13]
            dp[i][j] %= MOD
    r = (r*10) % 13
print(dp[n][5])

Measured memory_bytes: 61532
#include<stdio.h>
#include<stdlib.h>
int a[105];
int main()
{
    int n,sum1,sum2;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    int o=1,p=n;
    sum1=a[1],sum2=a[n];
    for(int i=2;i<=n-1;i++){
        if(sum1<sum2)
        sum1+=a[++o];
        else
            sum2+=a[--p];
    }
    printf("%d\n",abs(sum1-sum2));
    return 0;
}


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

bool check1(string s)
{
  bool ret = true;
  for (int i = 0; i < s.size()/2; i++)
  {
    if (s.at(i) == s.at(s.size() - 1 - i)) continue;
    ret = false;
  }
  //if(ret)cout << "true" << endl;
  //else cout << "false" << endl;
  return ret;
}


bool check2(string s)
{
  string sub;
  sub = s.substr(0,(s.size()-1)/2);
  //cout << sub << endl;
  return check1(sub);
}

bool check3(string s){
  int n = s.size();
  string sub = s.substr((n+3)/2-1);
  //cout << sub << endl;
  return check1(sub);
}

int main(){
  string s; cin >> s;
  if(check1(s)&&check2(s)&&check3(s))cout<<"Yes"<<endl;
  else cout << "No" << endl;
  return 0;
}

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


void solve(long long N, std::vector<long long> P){
    int ans = 0;
    long long int min;
    min = 100000000;
    for(int i = 0; i < N; i++) {
        if (P[i] <= min) {
            min = P[i];
        }
        if (min == P[i]) {
            ans++;
        }
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    solve(N, std::move(P));
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, X;
	int sum = 0, minimum = INF;
	
	cin>>N>>X;
	
	for(int i = 0; i < N; i++){
		int m;
		cin>>m;
		
		sum += m;
		
		minimum = min(minimum, m);
	}
	
	cout<<N + (X-sum)/minimum<<endl;
	
	return 0;
}

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

using namespace std;

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.first <<","<<P.second <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int N = 100005;

int n, m, disNo, a[N], b[N];

int main() {
    
    scanf("%d %d %d", &n, &m, &disNo);
    
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    
    for (int i = 1; i <= m; i++) {
        scanf("%d", &b[i]);
    }
    
    int ans = 1e9;
    for (int i = 1; i <= disNo; i++) {
        int x, y, c;
        scanf("%d %d %d", &x, &y, &c);
        ans = min(ans, a[x] + b[y] - c);
    }
    
    sort(a + 1, a + 1 + n);
    sort(b + 1, b + 1 + m);
    ans = min(ans, a[1] + b[1]);
    
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1024
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
  for j in range(k+1):
    dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
  
  
#print(dp)
print(dp[n-1])

Measured memory_bytes: 55776
using namespace std;
#include <iostream>
#include <cmath>
int main()
{
 	int n;cin>>n;
 	int sum=0;
 	int i=1;
 	while(pow(2,i)<=n) i++;
 	//cout<<pow(2,3)<<endl;
 	cout<<pow(2,i-1);
} 

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vpl = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;

const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define pb push_back
#define xx first
#define yy second
#define has(c,i) (c.find() != end(c))
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for (ll i=ll(b)-1; i>=(a); i--)

#define DBG 1
#define TR(X) ({ if(DBG) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios::sync_with_stdio(false);

	ll a;
	string b;
	cin >> a >> b;
	if(a >= 3200)
		cout << b;
	else
		cout << "red";
	cout << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        
        int b = scan.nextInt();
        
        System.out.print(a * b);
        
        System.out.print(" ");

        System.out.println(2 * (a + b));
    }
}


Measured memory_bytes: 26172
#include <iostream>

int main()
{
    int a, b, c;
    std::cin >> a >> b >> c;
    bool flag = (a + b == c) || (b + c == a) || (c + a == b);
    if (flag)
    {
        std::cout << "Yes";
    }
    else
    {
        std::cout << "No";
    }
    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 256
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    let b=read::<i32>();
    let c=read::<i32>();
    println!("{}",if b/a<c{b/a}else{c})
}

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

using namespace std;

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

#include "cpp-pyprint/pyprint.h"

#endif

map<ll, ll> prime_factorize(ll N) {
    map<ll, ll> res;
    for (ll i = 2; i * i <= N; ++i) {
        while (N % i == 0) {
            res[i]++;
            N /= i;
        }
    }
    if (N != 1) res[N] = 1;
    return res;
}

const int MAX = 1000005;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    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;
    }
}

// 二項係数計算
long long COM(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;
}

void Main() {
    ll N, M;
    cin >> N >> M;
    map<ll, ll> res = prime_factorize(M);
    COMinit();
    ll ans = 1;
    for (auto p : res) {
        ans *= COM(p.second + N - 1, p.second);
        ans %= MOD;
    }
    cout << ans % MOD << endl;
}

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


Measured memory_bytes: 23680
#include<stdio.h>

int main(){
	int i,N,t,lowest=11110;
	int C;
	int T;
	
	scanf("%d",&N);
	scanf("%d",&t);
	
	for(i=0;i<N;i++)
	{
	scanf("%d %d",&C,&T);

	if(T<=t && C<=lowest)
	{
		lowest=C;
	}	
	}
	
	
	if(lowest<11110){
	printf("%d",lowest);
	}else{
	printf("TLE\n");
	}

return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
using ll=long long;
const ll MOD=1e9+7;
const int INF=1<<30;

int main(){
  int x;
  cin >> x;
  cout << x*x*x << endl;
}


Measured memory_bytes: 3120
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;
const int N = 110;

//建物 = 1, 内包 = 0, 外 = 2
int field[N][N];
int mx_odd[] = {1, 1, 1, 0, -1, 0};
int mx_even[] = {0, 1, 0, -1, -1, -1};
int my[] = {-1, 0, 1, 1, 0, -1};
int h, w;

bool CanMove(int y, int x){
    if(x < 1) return false;
    if(y < 1) return false;
    if(x > w) return false;
    if(y > h) return false;
    return true;
}

void Set2(int y, int x){
    field[y][x] = 2;
    REP(i, 6){
        int ny = y + my[i], nx;
        if(y % 2 == 0) nx = x + mx_even[i];
        if(y % 2 == 1) nx = x + mx_odd[i];

        if(CanMove(ny, nx) && field[ny][nx] == 0) Set2(ny, nx);
    }
}

int Cnt2(int y, int x, bool is_odd){
    int ret = 0;
    REP(i, 6){
        int nx, ny = y + my[i];
        if(is_odd) nx = x + mx_odd[i];
        else nx = x + mx_even[i];
        if(!CanMove(ny, nx)) ret++;
        else if(field[ny][nx] == 2) ret++;
    }
    return ret;
}

int main(){
    cin >>w >>h;
    FOR(i, 1, h + 1){
        FOR(j, 1, w + 1){
            cin >>field[i][j];
        }
    }

    FOR(i, 1, w + 1){
        if(field[1][i] == 0) Set2(1, i);
        if(field[h][i] == 0) Set2(h, i);
    }

    FOR(i, 1, h + 1){
        if(field[i][1] == 0) Set2(i, 1);
        if(field[i][w] == 0) Set2(i, w);
    }

    int ans = 0;
    FOR(i, 1, h + 1){
        FOR(j, 1, w + 1){
            if(field[i][j] == 1){
                if(i % 2 == 0) ans += Cnt2(i, j, false);
                if(i % 2 == 1) ans += Cnt2(i, j, true);
            }
        }
    }
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 1580
import sys

N, K = map(int, input().split())
A = list(map(int, input().split()))

cnt = 0
current = 0
roads = []
reached = [-1 for _ in range(N)]

while True:
    if reached[current] >= 0:
        initial = reached[current]
        mod = cnt - initial
        if K <= initial:
            print(roads[K]+1)
        else:
            k = (K-initial) % mod
            print(roads[initial:][k]+1)
        sys.exit()
    roads.append(current)
    reached[current] = cnt
    cnt += 1
    current = A[current] - 1

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

using namespace std;


int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    long long n ; 
    cin >>  n; 

    long long   tot = 0;
    long long  m ;
    for(long long i = 2; i <= sqrt(n) ; ++i){
        
       
       if (n % i == 0){
        //    cout << "i is " << i << "\n";
           m  = i - 1;
        //    cout << "m is " << m << "\n";
           if (n / m ==  n % m){
               tot += m;
           }
           if (i ==  n / i) 
                continue;
           m = n/i - 1;
           if(n / m ==  n % m){
               tot +=  m;
           }
       }
    }
    m = n- 1;
    if (m > 0)
    if (n % m  == n / m){
        tot += m;
    }

  
    cout << tot << "\n";
    
  
    return 0;
}

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

struct TCard{
	int Number;
	char Mark;
    bool operator<(const TCard &Y) const;
    bool operator==(const TCard &Y) const;	
};

bool TCard::operator<(const TCard &Y) const
{
	return Number < Y.Number;
}

bool TCard::operator==(const TCard &Y) const
{
	return Mark == Y.Mark;
}

int Partition(vector<TCard>& A, int p, int r)
{
	int i = p-1;
	for(int j = p; j < r; j++){
		if(A[j].Number <= A[r].Number){
			i++;
			swap(A[i], A[j]);
		}
	}
	swap(A[i+1], A[r]);
	return i+1;
}

void QuickSort(vector<TCard>& A, int p, int r){
	if(p < r){
		int q = Partition(A, p, r);
		QuickSort(A, p, q-1);
		QuickSort(A, q+1, r);
	}
}

int main()
{
	int n;
	cin >> n;
	vector<TCard> A(n);
	for(int i = 0; i < n; i++){
		cin >> A[i].Mark >> A[i].Number;
	}
	vector<TCard> B = A;
	std::stable_sort(B.begin(), B.end());
	QuickSort(A, 0, n-1);
	if(A == B){
		cout << "Stable" << endl;
	}else{
		cout << "Not stable" << endl;
	}
	for(int i = 0; i < n; i++){
		cout << A[i].Mark << ' ' << A[i].Number << endl;
	}
	return 0;
}

Measured memory_bytes: 4608
n = input()
X = map(int, raw_input().split())

MOD = 10**9+7

ans = 1
res = 0
for i in xrange(n):
    while 2*res+1 > X[i]:
        ans = (ans * (res+1)) % MOD
        res -= 1
    res += 1
while res:
    ans = (ans * res) % MOD
    res -= 1
print ans


Measured memory_bytes: 11328
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
#define MOD 1000000007
typedef long long ll;
using namespace std;
int main()
{
	ll N, M, sum = 0; cin >> N >> M;
  	priority_queue<ll> A;
  	for (int i = 0; i < N; i++) {
    	ll a; cin >> a;
      	A.push(a);
    }
  	for (int i = 0; i < M; i++) {
      	ll max = A.top();
      	A.pop();
      	max /= 2;
      	A.push(max);
    }
  	for (int i = 0; i < N; i++) {
    	sum += A.top();
      	A.pop();
    }
  	cout << sum << endl;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long           ll;
typedef vector<int>         vi;
typedef pair<int,int>       pii;

#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define sf                  scanf
#define pf                  printf
#define SQR(x)              ((x)*(x))
#define loop(i, y)          for(int i=0; i<int(y); i++)
#define FOR(i, x, y)        for(int i=int(x); i<int(y); i++)
#define ROF(i, x, y)        for(int i=int(x); i>=int(y); i--)
#define all(c)              c.begin(), c.end()
#define sz(c)               int(c.size())
#define clr(x, y)           memset(x, y, sizeof(x))
#define si(x)               scanf("%d", &x)
#define sii(x, y)           scanf("%d %d", &x, &y)
#define siii(x, y, z)       scanf("%d %d %d", &x, &y, &z)
#define sl(x)               scanf("%lld", &x)
#define sll(x, y)           scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       scanf("%lld %lld %lld", &x, &y, &z)

#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************

/// Constants
#define MAX                 62
#define MOD                 1000000007
#define eps                 1e-9
#define INF                 0x3f3f3f3f3f3f3f3f // 4,557,430,888,798,830,399
#define inf                 0x3f3f3f3f // 1,061,109,567
#define PI                  acos(-1.0)  // 3.1415926535897932
#define VT                  int

int cnt[2][MAX];

int main(){
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int n; si(n);
    ll res = 0;
    FOR(i, 0, n){
        ll x; sl(x);
        FOR(j, 0, MAX){
            ll now = (x>>j)&1;
            res += (1LL<<j) % MOD * cnt[!now][j] % MOD;
            res %= MOD;
            cnt[now][j]++;
        }
    }
    cout<<res<<endl;


    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}

Measured memory_bytes: 256
using System;
public class Lesson{
    public static void Main(){
        // Here your code !
        
        string[] in_str = Console.ReadLine().Split(' ');
        string out_str = "";
        int[] in_int = new int[3];
        for(int i=0; i<in_str.Length; i++){
            in_int[i] = int.Parse(in_str[i]);
        }    

        Array.Sort(in_int);
        for (int j=0; j<in_int.Length; j++){
            out_str = out_str + in_int[j] + " ";
            
        }
        
        System.Console.WriteLine(out_str.TrimEnd());
    }
}

Measured memory_bytes: 9312
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
k=0
c=0
ab.sort()
for i in range(n):
    if k+ab[i][1]>=m:
        c+=ab[i][0]*(m-k)
        #k+=m-k
        print(c)
        exit()
    else:
        k+=ab[i][1]
        c+=ab[i][0]*ab[i][1]

Measured memory_bytes: 27884
#include<stdio.h>
int main(){
    int n,i;
    char data[21],sd[21];
    scanf("%s",data);
    for (n=0;data[n] != '\0';n++);
    for (i=n-1;i >=0;i--)printf("%c",data[i]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 524
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

map<int, int> cnt;
int main() {
	cin >> N;
	bool flag = false;
	rep(i, N) {
		cin >> A;
		if (cnt.find(A) == cnt.end()) cnt[A] = 1;
		else cnt[A]++;
	}
	ll ind = 0;
	for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
		if (itr->second == 1) {
			if (flag) {
				cout << "0";
				return 0;
			}
			if (N % 2 == 0) {
				cout << "0";
				return 0;
			}
			else {
				if (itr->first != 0) {
					cout << "0";
					return 0;
				}
			}
			flag = true;
		}
		else {
			if (itr->second != 2) {
				cout << "0";
				return 0;
			}
			ind++;
		}
	}
	ll ans = 1;
	rep(i, ind) {
		ans = (ans * 2) % MOD;
	}
	cout << ans;
}



Measured memory_bytes: 3200
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */


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

class AAirConditioner {
public:
	void solve(std::istream& in, std::ostream& out) {
        int x;
        in >> x;
        if(x>=30){
            out << "Yes" << endl;
        }else{
            out << "No" << endl;
        }
	}
};


int main() {
	AAirConditioner solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3592
// MOHIT KUMAR
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pin;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

#define ff(i, a, b) for ( ll i=a; i<(b); i++)
#define ffd(i, a, b) for ( ll i=a; i<= b; i++)
#define fr(i, a, b) for ( ll i = (b)-1; i >= a; i--)
#define ffr(i, a, b) for ( ll i = b ; i >= a; i--)
#define vl vector < ll >
#define vp vector < pl >
#define endl "\n"
#define sz(x) (ll)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const ld pi = acos(-1) ;
const ll maxn = 5e5 + 5 ;
const int mod = 1e9 + 7 ;
const ll INF = 1e18 ;
const int MX = 2000000001 ; // check the limits, dummy

int main() {
  ios_base::sync_with_stdio(0) , cin.tie(0);
  ll t, q, n, a, b, c, d, k, l, m, r,  x = 0, y = 0, z = 0 , sum = 0, sans = 0, temp = 0, res = 0 ;
  ld dis, tm, sp ;
  cin >> dis >> tm >> sp ;
  if (tm >= (dis / sp)) cout << "Yes\n" ;
  else cout << "No\n" ;
}

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

using namespace std;


int main()
{
    int N,L;
    cin >>N>>L;
    string S[100];
    for(int i = 0;i<N;i++)
        cin >>S[i];
    sort(&S[0], &S[N]);
    for(int i = 0;i<N;i++)
        cout <<S[i];
    cout <<endl;

    return 0;
}


Measured memory_bytes: 256
while True:
    string = input()
    if string == "-":
        break

    cards = []
    for c in string:
        cards.append(c)

    m = int(input())
    for x in range(m):
        h = int(input())
        tmp = cards[:h]
        cards[:h] = []
        cards += tmp

    for c in cards:
        print(c, end="")
    print()



Measured memory_bytes: 5620
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;
int main(){
  ll n; cin >> n;
  vector<ll> a(n);
  ll sum = 0,ans = INFL;

  rep(i,n){
    cin >> a.at(i);
    sum += a.at(i);
  }

  ll x = 0;
  rep(i,n){
    x += a.at(i);
    if(i+1<n) ans = min(ans,abs(sum-2*x));
  }

  cout << ans << endl;
}

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

#define all(s) s.begin(), s.end()
#define vi vector<int>
#define pb push_back
#define ii pair<int, int>
#define x first
#define y second

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n;
    string s;
    cin >> n >> s;
    for (auto u : s) {
        int t = u - 'A';
        t = (t + n) % 26;
        cout << (char) ('A' + t);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::string s){
  int r=0,b=0;
  for (size_t i = 0; i < N; i++) {
    if(s[i] == 'R')r++;
    if(s[i] == 'B')b++;
  }
  cout << (r <= b ? "No":"Yes") << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::string s;
    std::cin >> s;
    solve(N, s);
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long n;
	cin>>n;
	long long x;
	x=ceil(n/1.08);
	if(floor(x*1.08)==n){
		cout<<x<<"\n";
	}else{
		cout<<":("<<"\n";
	}
	
	

	



	


 
	
	
	
	
	return 0;
}

Measured memory_bytes: 3692
program main;
var a, b, c, d : integer;
begin
  readln(a, b, c, d);

  while (a > 0) and (c > 0) do begin
    c := c - b;
    if c > 0 then
      a := a - d;
  end;

  if c <= 0 then
    writeln('Yes')
  else
    writeln('No');

end.

Measured memory_bytes: 1388
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using Enu = System.Linq.Enumerable;

public class Program
{
    public void Solve()
    {
        int N = Reader.Int();
        var A = Reader.IntArray(N);
        Array.Sort(A, (a, b) => b - a);
        int L = Enu.Range(0, N).First(i => i + 1 == N || A[i + 1] <= i + 1);
        int R = Enu.Range(L, N).First(i => i + 1 == N || A[i + 1] <= L);
        bool win = (A[L] - L) % 2 == 0 || (R - L) % 2 == 1;
        Console.WriteLine(win ? "First" : "Second");
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    public static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string[] Split(string s) { return s.Split(separator, op); }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

Measured memory_bytes: 17616
import java.util.*;
import java.lang.*;
import java.io.*;



/* Name of the class has to be "Main" only if the class is public. */



public class Main
{
     
     
     
   
    
public static void main (String[] args) throws java.lang.Exception
{Scanner scn = new Scanner(System.in) ;
  int n = scn.nextInt() ;
 int a = 0 ; int t = 0 ; int r= 0 ; int w =  0;
 for(int k = 1; k <= n ; k++ )
 {
   String str =  scn.next() ;
   
   if(str.equals("AC"))
      {
        a++ ;
      }
   else if(str.equals("WA"))
      {
        w++ ;
      }
      else if(str.equals("TLE"))
      {
        t++ ;
      }
        
      else         
      {
        r++ ;
      }
   
 }
 
 System.out.println("AC x " + a ) ;
System.out.println("WA x " + w) ;
System.out.println("TLE x " + t) ; 
System.out.println("RE x " + r) ;
              
              
}
}




              
             

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

int main() {
	
	int n, k; cin >> n >> k;
	string ans = "NO";
	if (n % 2 == 0) {
		if (k <= n / 2) ans = "YES";
	}
	else {
		if (k <= n / 2 + 1) ans = "YES";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3568
#include <iostream>
using namespace std;
int main()
{
  string S;
  cin >> S;
  int ans = 0;
  for (int i = 0; i < S.length(); i++)
  {
    int len = 0;
    for (int j = i; j < S.length(); j++)
    {
      if (!(S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T'))
        break;
      len++;
    }
    if (ans < len)
      ans = len;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int ans = -1000000000, data1[100][15], data2[100][15], data[15], n;

void calc_score(void){
    int index = 0, score = 0, cnt = 0;
    for(int i = 0; i < 10; i++){
        if(data[i] == 0){
            cnt ++;
        }
    }
    if(cnt == 10){
        return ;
    }
    for(int i = 0; i < n; i++){
        index = 0;
        for(int j = 0; j < 10; j++){
            if(data1[i][j] ==1 && data[j] == 1){
                index += 1;
            }
        }
        score += data2[i][index];
    }

    if(score > ans){
        ans = score;
    }
}

void set_data(int pos){
    if(pos == 10){
        calc_score();
        return ;
    }
    if(pos != 10){
        data[pos] = 0;
        set_data(pos + 1);
        data[pos] = 1;
        set_data(pos + 1);
    }
}

int main(void){
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 10; j++){
            scanf("%d", &data1[i][j]);
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 11; j++){
            scanf("%d", &data2[i][j]);
        }
    }
    set_data(0);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    string s = "";
    while(n > 26){
        s += (char)('a'+(n-1)%26);
        if(n%26 == 0)   n -= 26;
        n /= 26;
    }
    s += (char)('a'+(n-1));
    reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3628
n = int(raw_input())
b = map(int, raw_input().split())
ans = []
for i in xrange(n):
    p = 0
    for j, x in enumerate(b):
        if j + 1 == x:
            p = x
    if not p:
        print -1
        quit()
    ans.append(p)
    b.pop(p - 1)
for x in reversed(ans):
    print x


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

int main() {
    int N, M; cin >> N >> M;
    for (int i=0; i<M; i++) {
        int a; cin >> a;
        N -= a;
    }
    if (N < 0) N = -1;
    cout << N << endl;
}

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

int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	char c[101];
	int flag=0;
	for(int i=1;i<=n;i++) 
	{
		cin >> c[i];
		if(c[i]=='Y') flag=1;
	}
	if(flag) cout << "Four";
	else cout << "Three";
	return 0;
}


Measured memory_bytes: 256
K = int(input())
a, roop = K % 50, K // 50
if roop >= 1:
    Ans = [50 + roop] * a + [50 - a + roop - 1] * (50-a)
else:
    Ans = [100 - a] * a + [49 - a] * (50 - a)
print(50)
print(" ".join(map(str, Ans)))

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  char c; cin >> c;
  switch(c) {
    case 'A':
      cout << 'T' << endl;
      break;
    case 'T':
      cout << 'A' << endl;
      break;
    case 'C':
      cout << 'G' << endl;
      break;
    case 'G':
      cout << 'C' << endl;
      break;
    default:
      cout << "wow!" << endl;
      break;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



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

    int n;
    cin>>n;
    cout<<n*n*n<<endl;

//////////////////////////////////////////////////////
return 0;}



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

int main() {
 int n,s=0;cin>>n; int p[n];for(int i=0 ;i<n;i++) cin>>p[i];sort(p,p+n);
  
  
 
    
  for(int i=0;i<n-1;i++){
    s+=p[i]; //cout<<s<<endl;
  }
   s+= p[n-1]/2;
  
   cout<<s<<endl;
}


Measured memory_bytes: 256
package main

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

var stdin = initStdin()
 
func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func scanInt() int {
	stdin.Scan()
	i, _ := strconv.Atoi(stdin.Text())
	return i
}

func scanStr() string {
	stdin.Scan()
	return stdin.Text()
}

type ia []int

func (ia ia)Len() int {
	return len(ia)
}
func (ia ia)Swap(i, j int) {
	ia[i], ia[j] = ia[j], ia[i]
}
func (ia ia)Less(i, j int) bool {
	return ia[i] < ia[j]
}

func main() {
	s := scanStr()
	ans := "Yes"
	for i := 0; i < 4; i++ {
		sb := string(s[i])
		cnt := strings.Count(s, sb)
		if cnt != 2 {
			ans = "No"
			break
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 640