akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (n,a,b) = get!(usize, usize, usize);
    println!("{}", min!(b,n*a));
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> a >> b;
    if (a + b >= 10) {
        MSG("error")
        exit(0);
    }

    MSG(a + b)
}


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=0;i<=(n);i++)

int main(){
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b) * h * 0.5 << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll a, p;
    cin >> a >> p;
    cout << (3*a+p)/2 << endl;
}

Measured memory_bytes: 256
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		int[] B = new int[N];
		sc.fill(A, B);

		long sum = 0;
		for (int i = 0; i < N; i++) {
			int index = N - i - 1;
			long mod = (sum + A[index]) % B[index];
			if (mod > 0) {
				sum += B[index] - mod;
			}
		}

		System.out.println(sum);
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}

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

using namespace std;

#define pb push_back
#define ff first
#define ss second

typedef long long ll;
const ll MAXN = 2e6 + 10, inf = 1e18, mod = 1e9 + 7;

struct pair_hash {
	template <class T1, class T2>
	std::size_t operator () (const std::pair<T1,T2> &p) const {
		auto h1 = std::hash<T1>{}(p.first);
		auto h2 = std::hash<T2>{}(p.second);

		return h1 ^ h2;  
	}
};

ll pw(ll te, ll tee) {
	if (tee == 0)	return 1;
	ll res = pw(te, tee / 2);
	return (tee % 2 ? te * res * res : res * res);
}

ll n, m;
set <ll> adj[MAXN];
ll mark[MAXN];

void Read_input() {
	cin >> n >> m;
	for (ll i = 1; i <= m; i++) {
		ll x, y;
		cin >> x >> y;
		adj[x].insert(y);
		adj[y].insert(x);
	}
}

bool dfs(ll v) {
	for (auto i : adj[v])
		if (adj[i].find(n) != adj[i].end())	return true;
	return false;
}

void Solve() {
	if (dfs(1))	cout << "POSSIBLE";
	else	cout << "IMPOSSIBLE";
}


int main() {

	ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0);
	//freopen("input.txt", "r", stdin),	freopen("output.txt", "w", stdout);

	Read_input(),	Solve();
	return 0;
}

Measured memory_bytes: 114048
a, b = map(int, input().split())

def count_bin(n, d):
    if n < 0:
        return 0
    div = (n+1)//2**(d+1)
    res = div*(2**d)
    remain = (n+1) - div*(2**(d+1))
    res += remain - 2**d if remain > 2**d else 0
    return res

ans = 0
for d in range(50):
    n_bin = count_bin(b, d) - count_bin(a-1, d)
    if n_bin%2 > 0:
        ans += 2**d
print(ans)


Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))
b = a[0]
count = 0
for i in range(n):
    if b < a[i]:
        b = a[i]
    if b-2 >= a[i]:
        count = 1
if count == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14224
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YY cout << "Yes" << endl;
#define NN cout << "No" << endl;
#define ve vector
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
// *max_element(all(d))
// priority_queue<int,vector<int>,greater<int>>
int solve(){
  string s;
  cin >> s;
  bool ans = true;
  int n = s.size();
  string a = s.substr(0,(n - 1) / 2),b = s.substr((n + 3) / 2 - 1,n - (n + 3) / 2 + 1);
  rep(i,n)if(s[i] != s[n - i - 1])ans = false;
  rep(i,a.size())if(a[i] != a[(int)a.size() - i - 1])ans = false;
  rep(i,b.size())if(b[i] != a[(int)a.size() - i - 1])ans = false;
  if(ans)cout << "Yes" << endl;
  else cout <<"No" << endl;
  return 0; 
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}

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

const int inf = 1e9;
const ll linf = 1e18;

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

template <typename T>
class SegTree
{
public:
    SegTree(const int n, const T &unity) : _unity(unity)
    {
        _n = 1 << __lg(2 * n - 1);
        _data.resize(2 * _n, unity);
    }

    SegTree(const vector<T> &v, const T &unity) : _unity(unity)
    {
        int n = v.size();
        _n = 1 << __lg(2 * n - 1);
        _data.resize(2 * _n, unity);

        // 最下段に要素をセット
        for (int i = 0; i < n; i++) this->set(i, v[i]);
        // セグメント木を構築
        this->build();
    }

    // k 番目の要素を最下段にセット
    void set(int k, const T &x) { _data[k + _n] = x; }

    // セグメント木を構築
    void build(void) {
        for (int i = _n - 1; i > 0; i--) _data[i] = f(_data[2 * i], _data[2 * i + 1]);
    }

    // k番目の値をxに更新する
    void update(int k, const T &x)
    {
        k += _n; // 葉の節点に変換
        _data[k] = x;
        while (k >>= 1) _data[k] = f(_data[2 * k], _data[2 * k + 1]);
    }

    // 区間[a, b)に対してクエリ処理した結果を返す
    T query(int a, int b)
    {
        T left = _unity, right = _unity;
        a += _n, b += _n; // 葉の節点に変換
        for (; a < b; a >>= 1, b >>= 1) {
            if (a & 1) left  = f(left, _data[a++]);
            if (b & 1) right = f(_data[--b], right);
        }
        return f(left, right);
    }

    const T &operator[](size_t i) const { return _data[i + _n]; }
    T &operator[](size_t i) { return _data[i + _n]; }

private:
    int _n;          // 要素数
    vector<T> _data; // データを格納する配列
    T _unity;        // 単位元

    // クエリ処理用の関数
    T f(const T &a, const T &b) { return gcd(a, b); }
};

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

    int n; cin >> n;
    SegTree<int> seg(n, 0);

    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        seg.set(i, a);
    }
    seg.build();

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int left = seg.query(0, i);
        int right = seg.query(i + 1, n);
        ans = max(ans, gcd(left, right));
    }

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

Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
int m=0,ret=0;
for(int i=0;i<n;i++){
  int j;
  cin >> j;
  m=max(m,j);
  ret+=j;
}
  ret-=m/2;
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 256
a , b = map(int, input().split())

ans1 = a * b
ans2 = a* b * 2
ans3 = a * b* 3

if ans1%2 == 1:
    print('Yes')
    exit
elif ans2%2 ==1:
    print('Yes')
    exit
elif ans2%2 ==1:
    print('Yes')
    exit
else:
    print("No")

Measured memory_bytes: 3060
#include<iostream>
int main()
{
	int H_W[10000][2];
	int number;
	for(int i = 0;; i++)
	{
		for(int j = 0; j < 2; j++)
		{
			std::cin >> H_W[i][j];
		}
		if(H_W[i][0] == 0 && H_W[i][1] == 0)
		{
			number = i;
			break;
		}
	}
	for(int i = 0; i < number; i++)
	{
		for(int h = 0; h < H_W[i][0]; h++)
		{
			for(int w = 0; w < H_W[i][1]; w++)
			{
				std::cout << '#';
			}
			std::cout << std::endl;
		}
		std::cout << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
// #define int cpp_int
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
long dp[1<<17],mod=(long)1e9+7;
inline void solve(void){
  long N,M;
  in(N,M);
  long a;
  while(M--){
    in(a);
    dp[a]=-1;
  }
  dp[0]=1;
  rep(i,N){
    if(dp[i]==-1)continue;
    if(dp[i+1]!=-1)dp[i+1]+=dp[i],dp[i+1]%=mod;
    if(dp[i+2]!=-1)dp[i+2]+=dp[i],dp[i+2]%=mod;
  }
  out(dp[N]);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  ll N, H;
  cin >> N >> H;
  vector<ll>A(N);
  vector<ll>B(N);
  for(int i=0; i < N; i++){
    int a,b;
    cin >> a >> b;
    A[i] = a;
    B[i] = b;
  }
  sort(A.begin(), A.end(), greater<ll>());
  sort(B.begin(), B.end(), greater<ll>());
  ll ans = 0;
  int i=0;
  for(;;){
    if(i >= N){
      if(H%A[0] != 0)
	ans += H/A[0] + 1;
      else
	ans += H/A[0];
      break;
    }else if(B[i] >= A[0]){
      H -= B[i];
      i++;
      ans++;
    }else{
      if(H%A[0] != 0)
	ans += H/A[0] + 1;
      else
	ans += H/A[0];
      break;
    }
    if(H <= 0)
      break;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

#define MAX_N (100)

using namespace std;

int dp[MAX_N + 1][MAX_N + 1][4 * MAX_N + 1] = {};

int main(int argc, char *argv[]) {
  // read inputs
  int N, W, ws[MAX_N], vs[MAX_N];
  scanf("%d %d", &N, &W);
  for (int i = 0; i < N; i++) {
    scanf("%d %d", &ws[i], &vs[i]);
  }

  // subtract w1 from all wis
  const int w0 = ws[0];
  for (int i = 0; i < N; i++) {
    ws[i] -= w0;
  }

  // solve dp
  for (int n = 1; n <= N; n++) {
    for (int i = 0; i < N; i++) {
      const int w_i = ws[i], v_i = vs[i];
      for (int j = 0; j < w_i; j++) {
        dp[n][i + 1][j] = dp[n][i][j];
      }
      for (int j = w_i; j <= 3 * N; j++) {
        dp[n][i + 1][j] = max(dp[n][i][j], dp[n - 1][i][j - w_i] + v_i);
      }
    }
  }

  // print answer
  int ans = 0;
  for (int n = 1; n <= N && W - n * w0 >= 0; n++) {
    ans = max(ans, dp[n][N][min(W - n * w0, 3 * N)]);
  }
  printf("%d\n", ans);

  return 0;
}


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

int main() {
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    int half = n / 2;
    int x = a[half - 1], y = a[half];
    cout << y - x;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

bool check(vector<ll> p){
    rep(i, p.size()){
        if(i == 0) continue;
        if(p[i] < p[i-1]) return false;
    }
    return true;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N ; cin >> N ;
    vector<ll> p;
    
    rep(i, N){
        ll inp; cin >> inp;
        p.pb(inp);
    }
    
    rep(i, N)rep(j, N){
        vector<ll> tmp;
        rep(k, N){
            tmp.pb(p[k]);
        }
        
        swap(tmp[i], tmp[j]);
        if(check(tmp)){
            cout << "YES" << endl;
            return 0;
        }
    }
    
    cout << "NO" << endl;


    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] hon = new int[n + 1][n + 1];
        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= n; j++){
                hon[i][j] = -1;
            }
        }

        for(int i = 1; i <= n; i++){
            int num = sc.nextInt();
            for(int j = 0; j < num; j++){
                hon[i][sc.nextInt()] = sc.nextInt();
            }
        }

        int max = 0;
        for(int i = 0; i < (1 << n); i++){
            boolean bl = true;
            for(int j = 0; j < n; j++){
                if((i >> j & 1) == 1){
                    for(int k = 1; k <= n; k++){
                        if(hon[j + 1][k] != -1 && hon[j + 1][k] != (i >> k - 1 & 1)){
                            bl = false;
                            break;
                        }
                    }
                }
                if(!bl){
                    break;
                }
            }
            if(bl){
                max = Math.max(max, Integer.bitCount(i));
            }
        }

        System.out.println(max);
    }
}

Measured memory_bytes: 22736
#include<bits/stdc++.h>
using namespace std;
string s,b;
int main(){
    cin>>s;
    b=s;reverse(s.begin(),s.end());
    for(int i=0;i<s.size();i++)
        switch(s[i]){
            case 'b':s[i]='d';break;
            case 'd':s[i]='b';break;
            case 'p':s[i]='q';break;
            case 'q':s[i]='p';break;
        }
    s==b?puts("Yes"):puts("No");
    return 0;
}

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

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REP1(i, n) for(ll i = 1;i < n;i++)
#define REPR(i, n) for(ll i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())

#define ll long long
#define ALL(a)  (a).begin(),(a).end()

#define pb(a) push_back(a)

int now,a,b;


int main(){
  int ans=0;
  cin >> a >> b;
  if ((a>=0)&(a<=5)){
    cout<<(0)<<endl;
    return 0;
  }
  
  if ((a>=6)&(a<=12)){
    cout<<(b/2)<<endl;
    return 0;
  }
  
  if ((a>=13)&(a<=100)){
    cout<<b<<endl;
    return 0;
  }
  return 0;
}

Measured memory_bytes: 256
//*****************************believer******************************//
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;
typedef map<ll,ll> mi;
 
#define f first
#define ss second
#define ins insert
#define pb push_back
#define lb lower_bound 
#define ub upper_bound 
#define pq priority_queue
#define sqr(n) floor(sqrt(n))
#define sz(v) ((ll)(v.size()))
#define trav(a,x) for (auto& a: x)
#define all(v) (v).begin(),(v).end()
#define arl(v) (v).rbegin(),(v).rend()
#define mem(a) memset(a, -1, sizeof (a))
#define ssort(v) sort((v).begin(),(v).end())
#define rsort(v) sort((v).rbegin(),(v).rend())
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define vmn(a) (*min_element(a.begin(),a.end()))
#define vmx(a) (*max_element(a.begin(),a.end()))
#define foo(i,a,b) for (ll i = (a); i < (b); ++i)
#define foor(i,a,b) for (ll i = (a); i >= (b); --i)

const ll N=1e5+10;
vi c;
vi a;

ll solve(ll x)
{
    if(c[x]!=-1)
    return c[x];
    
    return c[x]=min(solve(x-1)+abs(a[x]-a[x-1]),solve(x-2)+abs(a[x]-a[x-2]));
}

int main()
{
        ll n;
        cin>>n;
        vi b(n);
        a=b;
        vi d(n+2,-1);
        c=d;
        foo(i,0,n)
        cin>>a[i];
        
        c[0]=0;
        c[1]=abs(a[1]-a[0]);
        ll ans=solve(n-1);
        cout<<ans<<"\n";
    
    return 0;
}


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

const int MOD = 1e9+7;
vector<ll> fac(300001);
vector<ll> ifac(300001);

ll modpow(ll x,ll n){
    ll ans=1;
    while(n!=0){
        if(n&1) ans=ans*x%MOD;
        x=x*x%MOD;
        n=n>>1; 
    }
    return ans;
}

ll comb(ll a, ll b){
    if(a==0&&b==0) return 1;
    if(a<b||a<0) return 0;
    ll tmp = ifac[a-b]*ifac[b] % MOD;
    return tmp*fac[a]%MOD;
}

ll modinv(ll a){
    return modpow(a,MOD-2);
}

void prepare(){
    fac[0]=1;ifac[0]=1;
    for(ll i=0;i<300000;i++){
        fac[i+1]=fac[i]*(i+1)%MOD;
        ifac[i+1]=ifac[i]*modpow(i+1,MOD-2)%MOD;
    }
}

int main(){
    prepare();
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans;
    ll a_up=1;
    ll a_down=1;
    ll b_up=1;
    ll b_down=1;
    rep(i,a){
        a_up = (a_up*(n-i))%MOD;
        a_down=(a_down*(i+1))%MOD;
    }
    rep(i,b){
        b_up = (b_up*(n-i))%MOD;
        b_down=(b_down*(i+1))%MOD;
    }
    ll comba,combb;
    comba = (a_up*modinv(a_down))%MOD;
    combb = (b_up*modinv(b_down))%MOD;

    ans = (ll)(modpow(2,n)-1-comba-combb+2*(1e9+7))%MOD;

    cout<<ans<<endl;
}


Measured memory_bytes: 4992
def myAnswer(a:int,b:int) -> str:
   ab=int(str(a)+str(b))
   number = 2
   while True:
      if(number**2 == ab): return "Yes"
      if(number**2 > ab): break
      number += 1
      
   return "No"


def modelAnswer():
   tmp=1
def main():
   a,b=map(int,input().split())
   print(myAnswer(a,b))

if __name__ == '__main__':
   main()

Measured memory_bytes: 3060
n, k = map(int,input().split())

plist = list(map(int,input().split()))

maxval = 0

temp = -1

def expectedval(inp):
	return (1 + inp) /2

for i in range(n-(k-1)):
	# print(i, k)
	summ = 0
	if temp == -1:
		for j in range (k):
			summ += expectedval(plist[i + j])
		temp = summ
	else:
		# print(plist[i-1], plist[i+k -1], expectedval(plist[i - 1]), expectedval(plist[i + k - 1]))
		summ = temp - expectedval(plist[i - 1]) + expectedval(plist[i + k - 1])
		temp = summ
	# print(summ)
	maxval = max(summ, maxval)

print(maxval)



Measured memory_bytes: 71792
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
pair<double,double> smul(pair<double,double> a,double k){
  return make_pair(a.first*k,a.second*k);
}
pair<double,double> sub2(pair<double,double> a,pair<double,double> b){
  return make_pair(a.first-b.first,a.second-b.second);
}
pair<double,double> mean2(pair<double,double> a,pair<double,double> b){
  return make_pair((a.first+b.first)/2,(a.second+b.second)/2);
}
double dist(pair<double,double> a,pair<double,double> b){
  return sqrt(pow(a.first-b.first,2)+pow(a.second-b.second,2));
}
int main(void)
{
  for(;;){
    int n;
    cin >> n;
    if(!n) return 0;
    vector<pair<double,double> > ps;
    ps.resize(n);
    REP(i,n) cin >> ps[i].first >> ps[i].second;
    vector<pair<double,double> > co;
    co.clear();
    REP(j,n) REP(i,j){
      if(dist(ps[i],ps[j])>2) continue;
      pair<double,double> m=mean2(ps[i],ps[j]);
      double k=sqrt(1-pow(dist(ps[i],ps[j])/2.0,2.0));
      pair<double,double> tmp=sub2(ps[i],ps[j]);
      tmp=smul(make_pair(tmp.second,-tmp.first),k/dist(ps[i],ps[j]));
      co.push_back(sub2(m,tmp));
      tmp=smul(tmp,-1.0);
      co.push_back(sub2(m,tmp));
    }
    int answer=1;
    for(auto x:co){
      int tmpans=0;
      REP(i,n) if(dist(x,ps[i])<1.000001) ++tmpans;
      answer=max(answer,tmpans);
    }
    cout << answer << endl;

  }
}

Measured memory_bytes: 3704
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

typedef struct Status{
  int p, d;
} St;

int head, tail;
St queue[1001];

void qpush(St v)
{
  queue[tail++] = v;
}

St qpop()
{
  return queue[head++];
}

bool qempty()
{
  return head == tail; 
}

int n;
bool a[101][101];
int d[101];

void bfs()
{
  head = tail = 0;
  St st, st2;
  int i;
  st.p = 1;
  d[1] = st.d = 0;

  qpush(st);
  while(!qempty()){
    st = qpop();

    for(i = 1; i <= n; ++i)
      if(d[i] == -1 && a[st.p][i]){
	st2.p = i;
	d[i] = st2.d = st.d + 1;
       qpush(st2);
      }
  }
}

int main()
{
  int i, u, k, v;

  while(scanf("%d", &n) != EOF){
    memset(a, false, sizeof(a));
    memset(d, -1, sizeof(d));

    for(i = 0; i < n; ++i){
      scanf("%d %d", &u, &k);

      while(0 < k--){
	scanf("%d", &v);
	a[u][v] = true;
      }
    }

    bfs();
    
    for(i = 1; i <= n; ++i)
      printf("%d %d\n", i, d[i]);
  }

  return 0;
}

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

int main() {
  ll  a , b , c , k ;
  cin >> a >> b >> c >> k ;
  
  if(k%2==1){
  cout << b-a << endl;
  }
  
  else {
  cout << a-b << endl;
  }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int r;
    cin>>r;
    if(r<1200){
        cout<<"ABC"<<endl;
    }
    else if(r>=1200&&r<2800){
        cout<<"ARC"<<endl;
    }
    else if(r>=2800){
        cout<<"AGC"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        k: usize,
        s: Chars,
    }

    if s.len() <= k {
        println!("{}", s.iter().collect::<String>());
    } else {
        println!("{}{}", s.iter().take(k).collect::<String>(), "...")
    }
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define fout(x) cout << fixed << setprecision(20) << x << endl
const int MOD = 1e9 + 7;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 1e-8;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

auto print = [](auto &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s;
  cin >> t;
  ll ans = 0;
  rep(i, s.size()) {
    if(s[i] != t[i]) ans++;
  }

  out(ans);
  return 0;
}


Measured memory_bytes: 3800
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
using namespace std;
int main(){   
   int N,k;
   cin>>N>>k;
   vector<int> a(N);
   rep(i,N){
      cin>>a[i];
   }
   sort(a.begin(),a.end());
   ll ans=0;
   rep(i,N-k){
      ans+=a[i];
   }
   cout<<ans;
   
   return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

int main() {
    init();

    int n; cin >> n;
    string s; cin >> s;
    int w = 0, r = 0, W = 0, R = 0;
    each(i, s) {
        if (i == 'W')++W;
        else ++R;
    }

    int ans = min(w, R) + w - min(w, R) + R - min(w, R);
    FOR(i, 0, n) {
        if (s[i] == 'W') {
            ++w;
            --W;
        }
        else {
            ++r;
            --R;
        }
        chmin(ans, min(w, R) + w - min(w, R) + R - min(w, R));
    }
    print(ans);

    return 0;
}

Measured memory_bytes: 3732
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<Pll> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define vec_max(V) *max_element(all(V))
#define vec_min(V) *min_element(all(V))
#define vec_sum(V) accumulate(all(V), 0LL)
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
  int a,b;
  cin >> a >> b;
  if(a >= 13) print(b);
  else if(a <= 5) print(0);
  else print(int(b/2));

 return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int leng = 3;
		String words[] = new String[leng];

		for(int i=0;i<leng;i++){
			words[i] = sc.next();
		}
		
		System.out.println(words[0].substring(0, 1)+""+words[1].substring(1, 2)+""+words[2].substring(2, 3));
	}
}

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

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

ll lcm(ll a, ll b) {
	return (a / gcd(a, b)) * b;
}
int main() {
	int n;
	cin>>n;
	ll ans = 1;
	for (int i = 0; i < n; i++) {
		ll a;
		cin>>a;
		ans = lcm(ans, a);
	}
	cout<<ans;
	return 0;
}

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

int main(){  
	int N;
	int A;
	int B;
	int miss = 0;
	int input;
	cin >> N >> A >> B;
	for(int i = 0; i < N; i++){
		cin >> input;
		if(input < A || input >= B){
			miss++;
		}
	}
	cout << miss << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Freed freopen ("0in.txt","r",stdin);
#define Fout freopen ("0out.txt","w",stdout);
#define TC int tt; cin >> tt; for(int t=0; t<tt; t++)
#define ll long long
#define pb push_back
#define Mod 1000000007
#define limit 2000008
using namespace std;

void solve(int t)
{
    int i,j,n,m,k;
    cin >> n;
    if(n>=30) cout <<"Yes\n";
    else cout <<"No\n";
}
int  main()
{
//    Fast
//    Freed
//    Fout
    int tt=1,t;
//    cin >> tt;
    for(t=1; t<=tt; t++)
        solve(t);
  return 0;
}




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

int main() {
	int n;
	vector<long long>lucas(87,0);
	lucas.at(0) = 2;
	lucas.at(1) = 1;

	cin >> n;

	for (int i = 2; i <= n; i++) {
		lucas.at(i) = lucas.at(i - 1) + lucas.at(i - 2);
	}
	cout << lucas.at(n) << endl;
}

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++)

int main() {
  ll n, k;
  cin >> n >> k;

  n = n % k;

  if (n < k) {
    cout << min(n, abs(n - k)) << endl;
    return 0;
  }

  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

vec d[200010];
ll a[200010];
bool used[200010];
ll Par[200010];
ll ans[200010];

void dfs(ll x){
    rep(i,d[x].size()) if(d[x][i]!=Par[x]) {
        Par[d[x][i]]=x;
        dfs(d[x][i]);
    }
    return;
}

vector<pair<ll,P>> STACK;
vec LIS(200010,INF);

ll Solve(ll x){
    if(used[x]) return ans[x];
    /*cout<<x<<':';
    rep(i,STACK.size()) cout<<STACK[i].first<<' ';
    cout<<endl;*/
    used[x]=true;
    while(true){
        ll a=STACK.back().first, b=STACK.back().second.first, c=STACK.back().second.second;
        if(a==Par[x]) break;
        LIS[b]=c;
        STACK.pop_back();
    }
    ll y=a[x];
    auto itr=lower_bound(ALL(LIS),y);
    ll moto=*itr;
    ll zahyo=itr-LIS.begin();
    STACK.pb(mp(x,mp(zahyo,moto)));
    //cout<<x<<' '<<zahyo<<' '<<moto<<' '<<y<<endl;
    LIS[zahyo]=y;
    ll count=upper_bound(ALL(LIS),INF-1)-LIS.begin();
    rep(i,d[x].size()) if(!used[d[x][i]]) {
        //cout<<x<<' '<<d[x][i]<<endl;
        Solve(d[x][i]);
        
    }
    return ans[x]=count;
}



int main(){
    rep(i,200010) used[i]=false;
    rep(i,200010) Par[i]=-1;
    ll N; cin>>N;
    rep(i,N) cin>>a[i];
    rep(i,N-1){
        ll a,b; cin>>a>>b;
        a--; b--;
        d[a].pb(b);
        d[b].pb(a);
    }
    dfs(0);
    STACK.pb(mp(-1,mp(0,INF)));
    rep(i,N) cout<<Solve(i)<<endl;

    







}

Measured memory_bytes: 39492
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> bi;
vector<vector<int>> dp;
ll def;
ll rec(int i,int j){

	ll ans=0;
	if(i==-1){
		return 1;
	}
	if(dp[i][j])return dp[i][j];
	if(j==0){
		if(bi[i]){
			ans+=rec(i-1,0)+rec(i-1,1);
		}else{
			ans+=rec(i-1,0);
		}
	}else if(j==1){
		if(bi[i]){
			ans+=rec(i-1,1)+2*rec(i-1,2);
		}else{
			ans+=rec(i-1,0)+rec(i-1,1)+rec(i-1,2);
		}
	}else{
		ans+=3*rec(i-1,2);
	}
	ans%=def;
//	cout<<i<<' '<<j<<' '<<ans<<endl;
	dp[i][j]=ans;
	return ans;
}
int main() {
	ll n;cin>>n;
	while(n){
		bi.push_back(n%2);
		n/=2;
	}
//	reverse(bi.begin(),bi.end());
	def=1;
	for(int i=0;i<9;i++)def*=10;
	def+=7;
	dp=vector<vector<int>>(bi.size(),vector<int>(3,0));
//	dp[bi.size()-1][0];
//	for(int i=bi.size()-2;i>=0;i--){
//
//	}

	ll ans=rec(bi.size()-1,0);
	ans%=def;
	cout<<ans<<endl;
	return 0;
}


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

	int main(void){
		int N, Y;
		int x, y, z;
		cin >> N >> Y;
		int flag = 1;
		int judge = 0;
		int i = 0;
		while(flag){
			x = N - i;
			for(int j = 0; j < i + 1; j++){
				y = j;
				z = N - x - y;
				if( (x * 10000 + y * 5000 + z * 1000) == Y){
					flag = 0;
					judge = 1;
					break;
				}		
			}
			if(i == N ){
				flag = 0;
			}
			i++;
		}
		if(judge){
			cout << x << " " << y << " " << z << endl;
		}else{
			cout << "-1 -1 -1" << endl; 
		}
		return 0;
	}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

#define xx first
#define yy second
#define $1 first
#define $2 second

bool isPalindrome(int s, int t, string& _s) {
	s--; t--;
	for (int i = 0; i <= t-s; i++) {
		//cout << i << " " << t - i << "\n";
		if (_s[s+i] != _s[t - i]) return false;
	}
	return true;
}

void solveCase() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	string s; cin >> s;
	int n = s.length();
	if (isPalindrome(1, (n - 1) / 2, s) && isPalindrome((n + 3) / 2, n, s) && isPalindrome(1, n, s)) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

}

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	solveCase();
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int a,b;
	cin>>a>>b;
	int ans[3];
	ans[0]=a+b;ans[1]=a-b;ans[2]=a*b;
	sort(ans,ans+3);
	cout<<ans[2];
}

Measured memory_bytes: 3552
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cmath>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define ALL(x) x.begin(), x.end()
#define INF (1001000000)
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i:c)
#define EXIST(cs,v) (find(ALL(cs),(v))!=cs.end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define UNIQ(c) (c).erase(unique((c).begin(),(c).end()), (c).end());
#define P(p) cout<<(p)<<endl;

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

    int x, y;
    cin >> x >> y;
    P(x + y/2);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int n , m = 0;
const int maxn = 1000 + 20;
int a[maxn];
int main()
{
	cin >> n;
 	for(int i = 0; i < (2 * n); i++){
 		cin >> a[i];
	}
	sort( a , a + ( 2 * n));
	for(int i = 0; i < (2 * n); i+=2){
	 	m += a[i];
	}
	cout << m;
}


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

int main(){
     int A,B,C,K;
    cin>>A>>B>>C>>K;

if(A>=K){
    cout<<K<<endl;
}
else if(A+B>=K){
    cout<<A<<endl;
}
else if(A+B<K){
     cout<<A-(K-A-B)<<endl;
}

}

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

struct WarshallFloyd{
    int n;
    const int INF = 1e15;
    vector<vector<int> > d;
    WarshallFloyd(int _n){
        n = _n;
        d.resize(n, vector<int>(n));
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                d[i][j] = INF;
            }
            d[i][i] = 0;
        }
    }
    void build(){
        for(int k = 0; k < n; k++){
            for(int i = 0; i < n; i++){
                for(int j = 0; j < n; j++){
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }
    }
    // 負の閉路を検出すると true を返す
    bool negative_cycle(){
        for(int i = 0; i < n; i++) if(d[i][i] != 0) return true;
        return false;
    }
};

signed main(){
    int n, m;
    cin >> n >> m;
    WarshallFloyd wf(n);
    for(int i = 0; i < m; i++){
        int u, v, c;
        cin >> u >> v >> c;
        wf.d[u][v] = c;
    }
    wf.build();
    if(wf.negative_cycle()){
        cout << "NEGATIVE CYCLE" << endl;
    }else{
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n;j++){
                if(j) cout << " ";
                if(wf.d[i][j] > wf.INF / 2) cout << "INF";
                else cout << wf.d[i][j];
            }
            cout << endl;
        }
    }
}


Measured memory_bytes: 3248
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line1 = sc.nextLine();
		line1 += line1;
		String line2 = sc.nextLine();

		if(line1.indexOf(line2) >= 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 26240
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
using namespace std;

int main() {
  int N, K; cin >> N >> K;
  vector<int> d(K);
  map<int, int> ans;
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      ans[a] += 1;
    }
  }
  cout << N - ans.size() << endl;
}


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

int main()
{
    vector <string> v;
    v.push_back("Sunny");
    v.push_back("Cloudy");
    v.push_back("Rainy");
    string S;
    cin>>S;
    for(int i=0 ; i<v.size() ; i++)
    {
        if(S==v[i]&&i!=v.size()-1)
        {
            cout<<v[i+1]<<endl;
            break;
        }
        else if(S==v[i]&&i==v.size()-1)
        {
            cout<<v[0]<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
h = [int(x) for x in input().split()]
max = 0
step = 0
for i in range(N-1):
    if h[i] >= h[i+1]:
        step+=1
        if i == N-2:
            if step > max:
                max = step

    else:
        if step > max:
            max = step
        step=0
print(max)

Measured memory_bytes: 14228
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let m: usize = itr.next().unwrap().parse().unwrap();

    let mut g = vec![Vec::new(); n];
    for _ in 0..m {
        let a: usize = itr.next().unwrap().parse::<usize>().unwrap() - 1;
        let b: usize = itr.next().unwrap().parse::<usize>().unwrap() - 1;
        g[a].push(b);
        g[b].push(a);
    }

    let mut dp = vec![vec![0; 1 << n + 1]; n + 1];
    dp[0][1] = 1;
    for bit in 1..1 << n {
        for i in 0..n {
            for &j in g[i].iter() {
                if bit >> j & 1 == 0 && bit >> i & 1 == 1 {
                    dp[j][bit ^ (1 << j)] += dp[i][bit];
                }
            }
        }
    }

    let mut ans = 0;
    for i in 0..n {
        ans += dp[i][(1 << n) - 1];
    }
    println!("{}", ans);
}


Measured memory_bytes: 2100
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def comb(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

n,m = map(int, input().split())

ans1=comb(n,2)
ans2=comb(m,2)

if n<=1:
    ans1=0
if m<=1:
    ans2=0

print(ans1+ans2)

Measured memory_bytes: 3064
#include <stdio.h>
#include <utility>
#include <vector>
#include <algorithm>

typedef long long int llint;

int n,m;
llint a[100000];
llint b[100000];

using namespace std;

int main()
{
    scanf("%d %d",&n,&m);
    vector<pair<llint,llint>>pairs(n);
    for(int i=0;i<n;i++)
    {
        scanf("%lld %lld",&a[i],&b[i]);
        pairs[i]=make_pair(a[i],b[i]);
    }
    sort(pairs.begin(),pairs.end());
    long long int ans=0;
    for(int i=0;m>0;i++)
    {
        // printf("%d %d\n",pairs[i].first,pairs[i].second);
        if(m-pairs[i].second>=0)
        {
            ans+=pairs[i].first*pairs[i].second;
            m-=pairs[i].second;
            // printf("m=%d ans=%d\n",m,ans);
        }
        else
        {
            ans+=pairs[i].first*m;
            m=0;
            // printf("m=%d ans=%d\n",m,ans);
        }
    }
    printf("%lld\n",ans);


}

Measured memory_bytes: 3328