akhauriyash/Code-Regression huggingface dataset:
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem in C++
// MAIN IDEA   : combinatorics NCR
//============================================================================
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define rw freopen("graphs_as_a_service.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define rep(i,a) lp(i,0,a-1)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace __gnu_pbds;
using namespace std;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int N = 1e5 + 5, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
vi v;
int mx;
inline bool can(int n, int h) {
	int cnt = 0;
	for (auto u : v) {
		h -= u;
		cnt++;
		if (h <= 0)
			break;
	}
	h = max(h, 0);
	cnt += ((h + (mx - 1)) / mx);
	return (cnt <= n);
}
int main() {
#ifdef ONLINE_JUDGE
	FAST
#endif
	int n, h;
	cin >> n >> h;
	lp(i,1,n)
	{
		int x, y;
		cin >> x >> y;
		v.pb(y);
		mx = max(mx, x);
	}
	sort(allr(v));
	while (!v.empty() && v.back() <= mx)
		v.pop_back();
	int l = 1, r = h, best = -1;
	while (l <= r) {
		int mid = l + (r - l) / 2;
		if (can(mid, h)) {
			best = mid;
			r = mid - 1;
		} else
			l = mid + 1;
	}
	f(best);
	return 0;
}


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

int main(){
  int N,M;
  cin >> N >> M;
  int K[N];
  int A[M];
  int count[M];
  for(int i=0;i<M;i++){
    count[i] = 0;
  }
  for(int i=0;i<N;i++){
    cin >> K[i];
    for(int j=0;j<K[i];j++){
      cin >> A[j];
      count[A[j]-1]++;
    }
  }
  int ans=0;
  for(int i=0;i<M;i++){
    if(count[i]==N){
      ans++;
    }
  }

  cout << ans << endl;

}

Measured memory_bytes: 256
use std::io;
use std::collections::VecDeque;

fn main() {
    let mut input = Input::new();
    let n: usize = input.next();
    println!("{}",
             if (0..n).map(|_| input.next()).filter(|x| x % 2 == 1).count() % 2 == 0 {
                 "YES"
             } else {
                 "NO"
             });
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next<T>(&mut self) -> T
        where T: std::str::FromStr,
              T::Err: std::fmt::Debug
    {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap().parse::<T>().unwrap();
    }
}



Measured memory_bytes: 10492
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <climits>
#include <cmath>
#include <string>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep01(i, n) for(int i = 0; i < (n) + 1; i++)
#define rep10(i, n) for(int i = 1; i < (n); i++)
#define all(a) (a).begin(), (a).end()
typedef long long int ll;
using namespace std;

//ARC061A
int main()
{
    string s;
    cin >> s;

    ll totalsum = 0;
    for (ll bn = 0; bn < (1 << s.length() - 1); bn++) {
        ll sum = 0;
        string se = "";
        se += s[0];
        rep10(bit, s.length()) {
            if (bn & 1 << (bit - 1)) {
                sum += stoll(se);
                se = "";
            }
            se += s[bit];
        }
        sum += stoll(se);
        totalsum += sum;
    }
    
    cout << totalsum << endl;

    return 0;
}

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

int main () {
  int N, ans, x;
  cin >> N;
  vector<int> A(N);
  ans = 0;
  x = 0;
  
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.at(i) = a;
  }
  
  sort(A.begin(), A.end());
  
  for (int i = 0; i < N; i++) {
    if (x < A.at(i)) {
      ans++;
      x = A.at(i);
    }
  }
  cout << ans << endl;
}
    
  

  

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  vector<string> s(n);
  REP(i,n){
    string si;
    cin >> si;
    sort(si.begin(),si.end());
    s[i] = si;
  }
  sort(s.begin(),s.end());
  ll ans = 0;
  ll tmp = 1;
  REP(i,n){
    if(i==0) continue;
    if(s[i]==s[i-1]) tmp++;
    else{
      ans += tmp*(tmp-1)/2;
      tmp = 1;
    }
  }
      ans += tmp*(tmp-1)/2;
  cout << ans<< endl;
  return 0;
}


Measured memory_bytes: 5760
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll s;
    cin >> s;
    ll x1 = ((s-1)/INF)+1;
    ll y2 = INF;
    ll y1 = 1;
    ll x2 = x1*INF-s;
    printf("%lld %lld %lld %lld %lld %lld\n", 0LL, 0LL, x1, y1, x2, y2);
    return 0;
}

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

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll gcd(ll a,ll b){
  while(b!=0){
    a%=b;
    swap(a,b);
  }
  return a;
}

ll kaizyou(ll N){
  ll num=1;
  for(ll i=1;i<=N;i++){
  num*=i;
  }
  return num;
}

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

ll mod=1e9+7;

int main(){
  int N,M;
  cin >> N >> M;
  vector<pair<int,int>>sc(M);
  rep(i,M){
    int s,c;
    cin >> s >> c;
    sc[i]=make_pair(s,c);
  }
  vector<int>ans(N);
  rep(i,M){
    if(N>=2){
    if(sc[i].first==1&&sc[i].second==0){
      cout << "-1" << endl;
      return 0;
    }
    }
    if(ans[sc[i].first-1]!=0){
    if(ans[sc[i].first-1]!=sc[i].second){
      cout << "-1" << endl;
      return 0;
    }
    }
    ans[sc[i].first-1]=sc[i].second;
  }
  if(N>=2){
    if(ans[0]==0){
      ans[0]=1;
    }
  }
  rep(i,N){
    cout << ans[i];
  }
  cout << endl;
}
      
  
  
  

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


int maxPath(int nd, vector<int> g[], int dp[]){
    bool leaf = true;

    if(dp[nd] != -1){
        return dp[nd];
    }

    int res = 0;
    for(auto nbr : g[nd]){
        leaf = false;
        res = max(res, maxPath(nbr, g, dp));
    }

    return dp[nd] = (leaf ? 0 : res + 1);
}


void solve(){
    int n, m;
    cin >> n >> m;

    vector<int> g[n];
    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        x--, y--;
        g[x].push_back(y);
    }

    int dp[n];
    memset(dp, -1, sizeof(dp));

    int ans = 0;
    for(int i = 0; i < n; i++){
        ans = max(ans, maxPath(i, g, dp));
    }

    cout << ans;

}


int main(){
    solve();
}

Measured memory_bytes: 12228
//#define _CRT_SECURE_NO_WARNINGS
//#include <bits/stdc++.h>
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	vector<int> v(n);
	rep(i, n) cin >> v[i];
	map<int, int> m_1;
	map<int, int> m_2;
	int ans = 0;
	rep(i, n) {
		int k1 = -v[i] + i;
		int k2 = v[i] + i;
		if (m_1.find(k2) != m_1.end())ans += m_1[k2];
		if (m_1.find(k1) == m_1.end()) m_1[k1] = 1;
		else m_1[k1]++;
	}
	rep(i, n) {
		int k1 = -v[i] - i;
		int k2 = v[i] - i;
		//cout << k1  << " "<< k2 << endl;
		if (m_2.find(k2) != m_2.end())ans += m_2[k2];
		if (m_2.find(k1) == m_2.end()) m_2[k1] = 1;
		else m_2[k1]++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 27952
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
using namespace std;
signed main()
{
	int a,b,c,d;scanf("%d%d%d%d",&a,&b,&c,&d);
	printf("%d",(max((a*b),(c*d))));
	return putchar(10),0;
}

Measured memory_bytes: 256
#include <iostream>


void call(int n){

	int x;
	for(int i=1; i<=n; i++){
		x=i;

		//check 3no baisuu
		if(x%3 == 0){
			std::cout << " " << i;
		}

		else{
		//check include 3
			for(;x!=0; x /= 10){
				if(x%10 == 3){
					std::cout << " " << i;
					break;
				}
			}
		}
	}
	std::cout << std::endl;
}

int main(){
	int n;
	std::cin >> n;
	call(n);
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

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

int check() {
	vector<int> d;
	rep(i, n) if (g[i].size() == 4) d.emplace_back(i);
	int start = d[0], end = d[1];
	int cnt_end = 0;
	vector<bool> used(n, 0);

	queue<int> que;
	que.push(start);
	used[start] = true;

	while(!que.empty()) {
		int u = que.front(); que.pop();
		// printf("u %d\n", u);
		for (auto v : g[u]) {
			if (v == end) {
				cnt_end++;
				continue;
			}
			// if (v == start) continue;
			if (used[v]) continue;
			used[v] = true;
			que.push(v);
		}
	}
	// printf("cnt_end %d\n", cnt_end);
	return cnt_end;
}

int main(int argc, char const *argv[])
{
	cin >> n >> m;
	vector<int> a(m), b(m);
	rep(i, m) cin >> a[i] >> b[i];
	rep(i, m) a[i]--, b[i]--;

	rep(i, m) g[a[i]].emplace_back(b[i]), g[b[i]].emplace_back(a[i]);

	int cnt2 = 0, cnt4 = 0, cnt6 = 0, other_odd = 0, other_even = 0;
	rep(i, n) {
		int d = g[i].size();
		// printf("d %d\n", d);
		if (d == 2) cnt2++;
		else if (d == 4) cnt4++;
		else if (d == 6) cnt6++;
		else if (d % 2 == 0) other_even++;
		else if (d % 2 == 1) other_odd++;
	}

	if (other_odd > 0) {
		printf("No\n");
		return 0;
	}

	if (cnt4 > 2 || cnt6 >= 1 || other_even >= 1) {
		printf("Yes\n");
	} else if (cnt4 == 2) {
		// assert(0);
		if (check() > 2) printf("No\n");
		else printf("Yes\n");
	} else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 6528
import java.util.*;
import java.lang.*;

public class Main {
    
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashSet<String> dictionary = new HashSet<>();

        for (int i = 0; i < n; i++) {
            char command = sc.next().charAt(0);
            if (command == 'i') {
                dictionary.add(sc.next());
            } else {
                System.out.println(dictionary.contains(sc.next()) ? "yes" : "no");
            }
        }
    }
}


Measured memory_bytes: 253656
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    if(N%2 == 0){
      System.out.println(N/2);
    } else if(N%2 != 0){
      System.out.println((N+1)/2);
    }
  }
}

Measured memory_bytes: 35684
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
	int n;
	cin >> n;
	vector<ll> a(n);
	int mxn = 0;
	rep(i, n){
		ll in;
		cin >> in;
		a.at(i) = in;
		int co = 1;
		while(in > 1){
			in /= 2;
			co++;
		}
		mxn = max(mxn, co);
	}
	mint ans = 0;
	rep(i, mxn){
		ll chk = 1LL << i;
		int c0, c1;
		c0 = c1 = 0;
		rep(j, n){
			if((a.at(j) & chk) == 0LL) c0++;
			else c1++;
		}
		mint add = (ll)c0*(ll)c1;
		// cerr << add.x << endl;
		add *= chk;
		ans += add;
	}
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	void run() {
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int d = sc.nextInt();

			int x = 1;
			while (true) {
				if (x == 1) {
					c -= b;
					if (c <= 0) {
						break;
					}
				} else {
					a -= d;
					if (a <= 0) {
						break;
					}
				}

				x *= -1;
			}

			System.out.println(x == 1 ? "Yes" : "No");
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

}


Measured memory_bytes: 35712
#include "bits/stdc++.h"
#include<algorithm>

using namespace std;
int main() {
    //freopen("input.txt", "r", stdin);	
    int N; cin >> N;
    int A, B;
    int P[N], Q[N];
    for(int i =0; i<N; i++)
        cin >> P[i];
    for(int i =0; i<N; i++)
        cin >> Q[i];
    vector<int> data(N);
    for(int i =0; i<N; i++)
        data[i] = i+1;
    int pos = 1;
    do {
        for(int i =0; i<N; i++) {
            if (P[i] != data[i]) goto badP;
        }
        A = pos;
        badP:;
        for(int i =0; i<N; i++) {
            if (Q[i] != data[i]) goto badQ;
        }
        B = pos;
        badQ:;
        pos++;
 
    } while (next_permutation(data.begin(), data.end()));
    cout << abs(A-B) << endl;
	return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let b = read::<String>();
  let mut ans = String::new();

  for i in b.chars() {
    if i == 'A' {
      ans.push('T');
    }
    if i == 'C' {
      ans.push('G');
    }
    if i == 'G' {
      ans.push('C');
    }
    if i == 'T' {
      ans.push('A');
    }
  }

  println!("{}", ans);
}



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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long N){
    if(N==1) {
        cout << 0 << endl;
        return;
    }

    LL ans = 0;
    for(LL i=1; i*i <= N; i++) {
        if(N % i == 0) {
            LL j = N / i - 1;

            if(i != 1 && i * i != N && N / (i-1) == N % (i-1)) {
                ans += (i-1);
            } 

            if(N / j == N % j) {
                ans += j;
            }
        }
    }

    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int i,n[99];int main(){for(n[1]=1,n[2]=2,n[3]=4,i=4;i-31;n[i]=n[i-1]+n[i-2]+n[i++-3]);for(;scanf("%d",&i)*i;printf("%d\n",n[i]/3650+(n[i]%3650?1:0)));}

Measured memory_bytes: 1028
int main(void) {
    char s[300];
    scanf("%s",s);
    s[strlen(s) - 1] = '\0';
    if (strlen(s) % 2 != 0) {
        s[strlen(s) - 1] = '\0';
    }
    for (int i = 0; i < strlen(s); i += 2) {
        unsigned long int l = strlen(s) - i;
        if (strncmp(s, s + l / 2, l / 2) == 0) {
            printf("%lu\n",l);
            goto end;
        }
    }
end:
    return 0;
}

Measured memory_bytes: 128
h = int(input())
T = [[h,1]]
s = 0

l = 10**6 + 3
A = [0] * l
A[1] = 1
for i in range(2, l):
    A[i] = 1 + A[i//2] * 2
a = 0
while s < len(T):
    if T[s][0] >= l:
        T.append([T[s][0]//2, T[s][1]*2])
        a += T[s][1]
        T[s] = [0,0]

    s += 1

# print(T)


for i in range(len(T)):
    a += A[T[i][0]] * T[i][1]
print(a)


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

int main() {
    int N,cnt;
    cin>>N;
    vector<int> P(100);
    for(int i=0;i<N;i++)cin>>P[i];
    sort(P.begin(), P.end());
    reverse(P.begin(), P.end());
   for(int i=N;i>=1;--i){
            cnt=0;
            for(int j=0;j<N;++j){
                if(i<=P[j]){
                    cnt+=1;
                }
            }
 
            if(cnt>=i){
                cout<<i<<endl;
                break;
            }
        }
    return 0;
}


Measured memory_bytes: 3140
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		String a = sc.next();
		String b = sc.next();
		int c = Integer.valueOf(a + b);

		for (int i = 3; i < 400; i++) {
			if (Math.sqrt(c) == i) {
				System.out.println("Yes");
				return;

			}
		}

		System.out.println("No");
	}
	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 21204
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost;
//using namespace multiprecision;  

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};
//}}}

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

    int n,a,b;
    cin >> n >> a >> b;

    int tmp = a + b,z = 0;
    cout << n / tmp * a + min(n % tmp, a) << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    int l[n];
    int r[n];
    int max1=INT_MIN;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        if(a[i]>max1)
        {
            l[i]=a[i];
            max1=l[i];
        } else
        {
            l[i]=max1;
        }
    }
    max1=INT_MIN;
    for(int i=n-1;i>=0;i--)
    {
        if(a[i]>max1)
        {
            r[i]=a[i];
            max1=r[i];
        } else
        {
            r[i]=max1;
        }
    }
    for(int i=0;i<n;i++)
    {
        if(i==0)
        {
            cout<<r[1]<<endl;
        }else if(i==n-1)
        {
            cout<<l[n-2]<<endl;
        } else
        {
            cout<<max(l[i-1],r[i+1])<<endl;
        }

    }

}

Measured memory_bytes: 3968
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int res=1;
        
        for(int i=2; i<100; i++){
            for(int j=2; j<11; j++){
                if(Math.pow(i,j)<=N){
                    res = (int)Math.max(res,Math.pow(i,j));
                }else{
                    break;
                }
            }

        }

        System.out.println(res);
        
        
        
        
        
        }
    }

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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
  return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
  return a / gcd(a, b) * b;
}

llint cnt = 0;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int main()
{
  int n, i;
  ci >> n >> i;

  co << n - i + 1 << en;
  
  return 0;
}


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

int main()
{ int a,b,c;
int sum1,sum2,sum3;
cin>>a>>b>>c;
sum1=a+b;
sum2=a+c;
sum3=b+c;
 if(sum1==c)
    cout<<"Yes"<<endl;

 else if( sum2==b )
    cout<<"Yes"<<endl;

else if (sum3==a)
    cout<<"Yes";

else
    cout<<"No";
    return 0;
}



Measured memory_bytes: 3624
#include <iostream>
    #include <vector>
     
    int main(){
        int N;
        long long K;
        std::cin>>N>>K;
        long long Z[100001]={};
        for(int i=0;i<N;++i){
            int a,b;
            std::cin>>a>>b;
            Z[a]+=b;
        }
        long long ans=0;
        for(int i=1;i<100001;++i){
            ans+=Z[i];
            if(ans>=K){
                std::cout<<i<<std::endl;
                break;
            }
        }
    }
    

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

#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vpii        vector< pii >
#define vi          vector<ll>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			1'010'000'000'000'000'017LL
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define sz(x)       (ll)x.size()
#define rep(i,a,b)	for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )

using namespace std;

template<class T>
bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>
bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
ll DivisorCount(ll x) {
	ll ans = 1;
	for (int i = 2; i <= sqrt(x); i++) {
		int cnt = 0;
		while (x % i == 0) {
			cnt++;
			x /= i;
		}
		ans *= (cnt + 1);
		if (x == 1) break;
	}
	if (x != 1) ans *= 2;
	return ans;
}

void Main() {
	ll A, B, C, K;
	cin >> A >> B >> C >> K;

	bool result = false;
	rep(i, 0, K) {
		if (A >= B) { 
			B *= 2;
			continue;
		}
		if (B >= C) {
			C *= 2;
			continue;
		}
	}
	if (A < B && B < C) result = true;
	cout << (result ? "Yes" : "No") << endl;

}




int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	Main();
	return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    int l[n];
    rep(i,0,n-1) cin>>l[i];
    sort(l,l+n);
    int ans=0;
    drep(i,n-1,n-k){
        ans += l[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{
    lli n;
    cin>>n;
    ld ans = 0;
    ld a, b, c;
    a = (ld)n / 3;
    ans = a * a * a;
    cout<<fixed<<setprecision(10);
    cout<<ans;
    cout<<'\n';
    return ;
}



/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


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

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0)break;
		
		int ans=0;
		
		for(int i=2;i<=(n/2)+1;i++){
			if(i%2==0){
				if(n%i==i/2){
					if(n/i-(i/2)>-1){
						ans++;
						//cout<<i<<endl;
					}
				}
			}else{
				if(n%i==0){
					if(n/i-(i/2)>0){
						ans++;
						//cout<<i<<endl;
					}
				}
			}
		}
		
		cout<<ans<<endl;
	}
	return 0;
}

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

using lint = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    vector<pair<double,double>> stuff(n);
    for (int i = 0; i < n; ++i) 
    	cin >> stuff[i].first >> stuff[i].second;
    sort(stuff.begin(), stuff.end());
    double result = 0.;
    do {
    	double delta = 0;
    	for (int i = 1; i < n; ++i) {
    		double cur;
    		cur = (stuff[i].first-stuff[i-1].first)*(stuff[i].first-stuff[i-1].first) +
    		(stuff[i].second-stuff[i-1].second)*(stuff[i].second-stuff[i-1].second);
    		delta += sqrt(cur);
    	}
    	result += delta;
    } while(next_permutation(stuff.begin(), stuff.end()));
    int d = n-1;
    while(d) {
    	n *= d;
    	--d; 
    }
    cout << setprecision(10) << fixed << result/n << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"POSSIBLE"<<endl;}else{cout<<"IMPOSSIBLE"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	int N, M;
	cin >> N >> M;
	vector<vector<int>> G(N + 1,VI(1,0));
	REP(i, M) {
		int a, b;
		cin >> a >> b;
		G.at(a).push_back(b);
	}
	bool ok=false;
	FOR(i, 0, N) {sort(ALL(G.at(i)));}
	for (auto v : G[1]) {
		if(G[v].back()==N)ok=true;
	}
	YesNo(ok)






	return 0;
}


Measured memory_bytes: 14740
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub, itemgetter, attrgetter


import sys
# sys.setrecursionlimit(10**6)
# readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def ep(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()

        ep(e - s, 'sec')
        return ret

    return wrap


class Bisect:
    def __init__(self, func):
        self.__func = func

    def bisect_left(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if self.__func(mid) < x:
                lo = mid+1
            else:
                hi = mid
        return lo

    def bisect_right(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if x < self.__func(mid):
                hi = mid
            else:
                lo = mid+1
        return lo

@mt
def slv(N, A, B, H):
    c = A-B
    def f(n):
        m = n
        for h in H:
            h -= n * B
            if h > 0:
                m -= -(-h // c)
        return 1 if m >= 0 else 0

    return Bisect(f).bisect_left(1, 0, 10**9)



def main():
    N, A, B = read_int_n()
    H = [read_int() for _ in range(N)]
    print(slv(N, A, B, H))


if __name__ == '__main__':
    main()


Measured memory_bytes: 87360
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double 
#define pb push_back
#define pii pair<ll,ll>
ll M = 1e9+7;

ll power(ll a,ll b,ll c=M){
    ll res=1;
    a%=c;
    while(b>0){
        if(b%2)res= (res*a)%c;
        a = (a*a)%c;
        b/=2;
    }
    return res;
}

int main () {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n+1],b[n+1],c[n+1];
    for(int i=0;i<n;++i)
        cin>>a[i];
    for(int i=0;i<n;++i)
        cin>>b[i];
    for(int i=0;i<n-1;++i)
        cin>>c[i];

    ll ans=0;
    for(int i=0;i<n;++i)
        ans+=b[a[i]-1];
    for(int i=0;i<n-1;++i)
        if(a[i]==a[i+1]-1)ans+=c[a[i]-1];

    cout << ans << '\n';
    return 0;
}

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

int main() {
	while (1) {
		map<int, int>s;
		int a;
		cin >> a;
		if (a == 0)break;
		for (int b = 0; b < a; b++) {
			int c, d, e, f, g, h, i, j, k;
			cin >> c >> d >> e >> f >> g >> h >> i >> j >> k;
			s.insert(pair<int, int>((d + f + h + j) * 60 + e + g + i + k, c));
		}
		auto u = s.begin();
		cout << u->second << endl;
		u++;
		cout << u->second << endl;
		u = s.end();
		u--;
		u--;
		cout << u->second << endl;
	}
}

Measured memory_bytes: 3260
A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい


# print(compute_range)


def h(x):
    return int(int((A * x) / B) - A * int(x / B))


max_num = h(min(B - 1, N))
print(max_num)


Measured memory_bytes: 61844
#include<iostream>

using namespace std;

int main() {

	int H, N;
	cin >> H >> N;

	int* A = new int[N];
	for (int i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	int X = 0;
	for (int i = 0; i < N; ++i)
	{
		X += A[i];
	}

	if (X >= H) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 640
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException e){
			e.printStackTrace();
		}
	}
	
	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		List<Integer> data = new ArrayList<Integer>();
		String line;
		
		while((line = in.readLine()) != null){
			int n = Integer.parseInt(line);
			if(n==0) break;
			data.add(n);
		}
		
		int max = -1;
		for(int i=0; i<data.size(); i++){
			if(max < data.get(i)){
				max = data.get(i);
			}
		}
		
		int[] primes = get_prime(max);
		for(int i=0; i<data.size(); i++){
			int n = data.get(i);
			for(int j=n; j>=5; j--){
				if(primes[j]==1 && primes[j-2]==1){
					System.out.println(Integer.toString(j-2) + " " + Integer.toString(j));
					break;
				}
			}
		}
	}
	
	public int[] get_prime(int max){
		int[] prime = new int[max+1];
		for(int i=2; i<=max; i++){
			int is_prime = 0;
			for(int j=2; j<=i/2; j++){
				if(prime[j]==1){
					if(i%j==0){
						is_prime = 1;
						break;
					}
				}
			}
			if(is_prime==0){
				prime[i]=1;
			}
		}
		
		return prime;
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
//#include <atcoder/all>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
//using namespace atcoder;
typedef long long ll;
const int MOD = 1000000007;
//const int MOD =  998244353;
 
const ll INF = 1LL<<60;
const int IINF = 1000000000;
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; }

int main(){
    int K; cin >> K;
    string acl = "ACL";
    string ans = "";
    rep(i,K) ans += acl;

    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int C[12], A[12][12], R[12];

int main()
{
	int N, M, X, FMAX;
	int ans = 100000000;

	cin >> N >> M >> X;
	rep(i, N) {
		cin >> C[i];
		rep(j, M) cin >> A[i][j];
	}

	FMAX = (1 << N);

	rep(bs, FMAX) {
		int SHIFT = 0, cost = 0;
		bool ok = true;

		rep(i, M) R[i] = 0;

		rep(i, N) {
			if (((bs >> SHIFT) & 0x01) == 0x01) {
				rep(j, M) {
					R[j] += A[i][j];
				}
				cost += C[i];
			}
			SHIFT++;
		}

		rep(i, M) if (R[i] < X) ok = false;

		if (ok) ans = min(ans, cost);
	}

	cout << (ans == 100000000 ? -1 : ans) << endl;

	return 0;
}


Measured memory_bytes: 3608
Sp=list(input())
Tp=list(input())
L=len(Sp)
K=len(Tp)
for i in reversed(range(L-K+1)):
  for j in range(K):
    a=Sp[i+j]
    b=Tp[j]
    if a!='?' and a!=b:
      break
  else:
    for j in range(K):
      Sp[i+j]=Tp[j]
    break
else:
  print('UNRESTORABLE')
  exit()
for i in range(L):
  if Sp[i]=='?':
    Sp[i]='a'
print(''.join(Sp))

Measured memory_bytes: 61844
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int A, B;
    cin >> A >> B;
    cout << 6 - A - B << endl;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define cincout ios::sync_with_stdio(false)
#define mp make_pair
#define fi first
#define se second
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef map<int, int> mii;

int a,b,t;

int main(){
	cin >> a >> b >> t;
	int di = t/a;
	cout << di*b <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
const int maxn=2e5+10;
int main() {
	int n;
	cin>>n;
	string s;
	cin>>s;
	if(n&1){
		printf("No\n");
		return 0;
	}
	for(int i=0;i<n/2;i++){
		if(s[i]!=s[i+n/2]){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int const mxn = 1e5+90;


int mark[mxn],dis[mxn];
vector <int > adj[mxn];



void dfs(int v){
	if (mark[v]) 
		return;
	mark[v]=1;
	for (auto u : adj[v]){
		dfs(u);
		dis[v] = max(dis[v],dis[u]+1);
		
	}	
}
int  ans ; 
int main(){
	int n,m;
	cin>>n>>m;
	for (int i =1;i<=m;i++){
		int a,b;
		cin>>a>>b;
		adj[a].push_back(b);
	}
	for (int i =1;i<=n;i++)
		adj[0].push_back(i);
	for (int i = 1;i<=n;i++){
		dfs(i);
	}
	for (int i =1;i<=n;i++)
		ans = max ( ans , dis[i] );
	cout<<ans;
	
}

Measured memory_bytes: 9080
import Control.Monad
import Data.List

main = do
    [n,m,c] <- map read . words <$> getLine :: IO [Int]
    bs <- map read . words <$> getLine :: IO [Int]
    ass <- map ((map read) . words) . lines <$> getContents :: IO [[Int]]
    let ans = length . filter (> (-c)) $ map (sum . zipWith (*) bs) ass
    print ans

Measured memory_bytes: 4988
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
#define MAX_VAL 100000
#define INF 4123456789123456

typedef long long ll;
typedef pair<ll,ll> P;

struct edge{ll to, cost;};

vector<edge> G[MAX_VAL];
ll d[MAX_VAL], V;

void dijkstra(ll s){
	priority_queue<P,vector<P>,greater<P>> q;
	fill(d,d+V, INF);
	
	d[s] = 0;
	q.push(P(0,s));
	
	while(!q.empty()){
		P p = q.top();q.pop();
		ll v = p.second;
		
		if(d[v] < p.first) continue;
		
		for(edge e : G[v]){
			if(d[e.to] > d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				q.push(P(d[e.to],e.to));
			}
		}
	}
	
	
}

int main(){
	struct edge e;
	ll E, r, s;
	
	cin>>V>>E>>r;
	
	for(int i = 1; i <= E; i++){
		cin>>s>>e.to>>e.cost;
		G[s].push_back(e);
	}
	
	dijkstra(r);
	
	for(int i = 0; i < V; i++)
		cout<<(d[i]==INF?"INF":to_string(d[i]))<<endl;
	
	return 0;
}


Measured memory_bytes: 19400
#include <iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&a==c)
	{
		cout<<1;
	}
	else if((a==b&&a!=c)||(a==c&&a!=b)||(c==b&&a!=c))
	{
		cout<<2;
	}
	else
	{
		cout<<3;
	}
	return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	 public static void main(String args[]){
		 Scanner std = new Scanner(System.in);
		 int n = std.nextInt();
		 int k = std.nextInt();
		 String s = std.next();
		 String[] si = s.split("");
		 for (int i=0;i<n;i++) {
			 if(i==k-1) {
				 if(Character.isUpperCase( si[i].charAt( 0 ) )) {
					 si[i]=si[i].toLowerCase();
				 }
				 else {
					 si[i] = si[i].toUpperCase();
				 }
			 }
		 }
		 for(int i=0;i<n;i++) {
			 System.out.print(si[i]);
		 }
	 }
}


Measured memory_bytes: 21332
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,m,v,p;

int main(){
  ll ans=-1;
  cin >> n >> m>>v>>p;
  vi a(n),sm(n);
  REP(i,n)cin>>a[i];
  
  sort(a.begin(), a.end());
  REP(i,n){
    if (i==0){
      sm[0]=a[0]; 
    }else{
      sm[i]=sm[i-1]+a[i];
    }
  }

  ll pmonmescore;
  pmonmescore=a[n-p];
  ll lastm=n-p;
  ll tmp=0;
  REP(i,lastm){
    if (pmonmescore==a[i]){
      tmp++;
    }
  }
  
  lastm-=tmp;
  //ここでlastmはありうる問題を含めた最低番号
  if (lastm==0){
    cout<<n<<endl;
    return 0;
  }
  //cout<<lastm<<endl;

  ll canusep=n-lastm;
  ll menseki=m*v;//使える面積

  //cout<<"lastm"<<lastm<<endl;

  REP(i,lastm){
    ll ii=lastm-i-1;
    if (a[ii]+m<pmonmescore){
      ans=ii;//ありえない番号をいれてbreak
      break;
    }

    ll maxscore=a[ii]+m;
    //auto Iter2 = upper_bound(a.begin(),a.end()-p+1, maxscore-1);
    //1,2,2,3・・のときl=3なら2が返る
    //ll henlen=Iter2-a.begin();
    //cout<<henlen<<endl;
    ll henlen=n-p+1;

    //使わないといけない面積計算
    menseki=m*(v-(p-1)-ii-1);
    if (menseki<0)
      menseki=-10000000;
    //
    ll umemen//埋めないといけない面積
    =(henlen-1-ii)*(maxscore);
    umemen-=sm[henlen-1]-sm[ii];
    if (umemen<0)
      umemen=-2;
    //cout<<"ume"<<umemen<<endl;


    if (umemen<menseki){//であれば不可能。==までは大丈夫
      ans=ii;//ありえない番号をいれてbreak
      break;
    }

  }

//cout<<endl;
  cout<<(n-ans-1)<<endl;
  return 0;
}
/*
6 1 5 1
0 0 0 0 0 0
*/

Measured memory_bytes: 1792