akhauriyash/Code-Regression huggingface dataset:
/* 
   AOJ 1127
   Building a Space Station
*/

#include<stdio.h>
#include<math.h>
#define MAX_CELL 100
#define INF 1000000

typedef struct cell
{
  double x, y, z, r;
}cell;

cell cells[MAX_CELL];
double cost[MAX_CELL][MAX_CELL];
double mincost[MAX_CELL];
int used[MAX_CELL];


double calc_cost(int a, int b)
{
  double dis = sqrt(pow(cells[a].x - cells[b].x, 2.0) + pow(cells[a].y - cells[b].y, 2.0) + pow(cells[a].z - cells[b].z, 2.0));
  double r_dis = dis - (cells[a].r + cells[b].r);
  
  if(r_dis > 0)
    return r_dis;
  else
    return 0.0;
}

void make_edge(int n)
{
  int i, j;

  for(i = 0; i < n; i++)
    for(j = 0; j < n; j++)
      cost[i][j] = calc_cost(i, j);
}

double min(double a, double b)
{
  if(a < b)
    return a;
  else
    return b;
}

double prim(int n)
{
  int i;
  double res = 0.0;
  for(i = 0; i < n; i++)
    {
      mincost[i] = INF;
      used[i] = 0;
    }

  mincost[0] = 0;

  while(1)
    {
      int v = -1, u;
      for(u = 0; u < n; u++)
	if(!used[u] && (v == -1 || mincost[u] < mincost[v]))
	  v = u;
       
      if (v == -1) break;
      used[v] = 1;
      res += mincost[v];
      for(u = 0; u < n; u++)
	mincost[u] = min(mincost[u], cost[v][u]);
    }
  return res;
}

int main(void)
{
  int n, j, i;

  while(scanf("%d", &n), n != 0)
    {
      for(i = 0; i < n; i++)
	scanf("%lf %lf %lf %lf", &cells[i].x, &cells[i].y, &cells[i].z, &cells[i].r);

      make_edge(n);

      printf("%.3f\n", prim(n));
    }
  return 0;
}

Measured memory_bytes: 740
#include <bits/stdc++.h>
#ifdef _DEBUG
#include "../../../debug_print.hpp"
#else
#define debug(...)
#endif
#define sort_(a) sort(a.begin(), a.end())
#define rsort(a) sort(a.rbegin(), a.rend())
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; 0 <= i; i--)
#define for_(i, start, end) for (int i = start; i < end; i++)
#define rfor(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD53       = 998'244'353;
constexpr double PI       = 3.14159265358979323846;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

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

    int n, a, b;
    scan(n, a, b);
    int ans = min(n * a, b);
    print(ans);

    return 0;
}

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

int main(){
    int k;
    cin >> k;
    ll i=0;
    int cnt=0;
    vector<int> num;

    while (cnt < k){
        i++;
        ll tmp = i;
        num.clear();
        while(tmp>0){
            num.push_back(tmp%10);
            tmp /= 10;
        }
        int MSB = num.size();
        int now_col = MSB-1;
        int now, next;
        bool is_lunlun_flag = true;
        while(now_col>0){
            now = num[now_col];
            next = num[now_col-1];
            if (next>now) swap(now, next);
            if (now-next>1) {
                is_lunlun_flag = false;
                break;
            }
            now_col--;
        }
        if (is_lunlun_flag) cnt++;
        else i = i + pow(10, now_col-1) -1;
    }
    cout << i << endl;
    return 0;
}

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

vector<bool> eratos(1000001, true);
void sieve_of_eratosthenes(){
  eratos[0] = false;
  eratos[1] = false;
  for(int i = 2; i * i <= 100000; ++i){
    if(eratos[i]){
      for(int j = i * i; j <= 100000; j += i){
        eratos[j] = false;
      }
    }
  }
}
vector<long long> sum(100001, 0);
void cumsum(){
  for(int i = 3; i <= 100001; i+=2){
    if(eratos[i] && eratos[(i + 1) / 2]) sum[i]++; 
  }
  for(int i = 1; i <= 100001; ++i) sum[i] += sum[i - 1];
}

void solve(int l, int r){
  cout << sum[r] - sum[l - 1] << endl;
}
int main(){
  int q;
  cin >> q;
  sieve_of_eratosthenes();
  cumsum();
  for(int i = 0, l, r; i < q; ++i){
    cin >> l >> r;
    solve(l, r);    
  }
}

Measured memory_bytes: 1536
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;

#include <bits/stdc++.h>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace std;
const long long N=200005, INF=2000000000000000000;
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int k;
    cin>>k;
    string s;
    cin>>s;
    int n=s.size();
    if(n<=k)
    cout<<s;
    else
    {
        string ss="";
        for(int i=0;i<k;i++)
        ss+=s[i];
        ss+="...";
        cout<<ss;
    }
}

Measured memory_bytes: 3616
#include<iostream>
#include<utility>
#include<vector>
#include<queue>
using namespace std;

const int INF= (int) 1e8;
const int MAX_V=101;

struct edge{
    int to;
    int cost;
    bool flag;
};

using P = pair<int,int>; // first: shortest distance, second: vertex number

int d[MAX_V];
int previous[MAX_V];
bool used[MAX_V][MAX_V];
vector<edge> G[MAX_V];

void dijkstra(int s, int N, int M){
    //cout << "start s= " << s << endl;
    fill( d, d+MAX_V, INF );
    fill( previous, previous+MAX_V, -1 );
    d[s] = 0;

    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0,s));

    while( !que.empty() ){
        P p = que.top();
        que.pop();
        int v = p.second;
        if( d[v] < p.first ){
            //cout << "continue" << endl;
            continue;
        }
        for( auto e: G[v] ){
            //cout << "v, e.to, e.cost  " << v << " " << e.to << " " << e.cost << endl;
            if( d[e.to] > d[v] + e.cost ){
                d[e.to] = d[v] + e.cost;
                previous[e.to] = v;
                //cout << " making route now, previous= " << e.to << " " << previous[e.to] << endl;
                que.push( P(d[e.to], e.to) );
            }
        }
    }

    for(int i=1; i<=N; i++){
        if( i==s ) continue;
        vector <int> route;
        for( int ii=i; ii!=-1; ii=previous[ii]  ){
            route.push_back(ii);
        }
        for( int ii=(int) route.size()-1; ii>0; ii-- ){
            //cout << "now prev = " << route[ii] << " " << route[ii-1] << endl;
            used[route[ii]][route[ii-1]]=true;
            used[route[ii-1]][route[ii]]=true;
        }
    }

    for( int i=1; i<=N; i++ ){
        for( auto& e: G[i] ){
            if( used[i][e.to] ){
                e.flag=true;
                //cout << "i to flag " << i << " " << e.to << " " << e.flag << endl;
            }
        }
    }
}

using namespace std;

int main(){
    int N,M;
    cin >> N >> M;
    int a,b,c;
    int ans;

    for(int i=0; i<M; i++){
        cin >> a >> b >> c;
        edge e = {b,c,false};
        G[a].push_back(e);
        e = {a, c, false};
        G[b].push_back(e);
    }


    for(int i=0; i<N; i++){
        dijkstra(i+1, N, M);
    }

    ans=0;
    for( int i=1; i<=N; i++ ){
        for( auto e: G[i] ){
            //cout << "i to flag " << i << " " << e.to << " " << e.flag << endl;
            if( e.flag==false ){
                //cout << "a b =  " << i << " " << e.to << endl; 
                ans++;
            }
        }
    }    

    ans=ans/2;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
    import numpy as np
    n = int(input())
    a = np.array(list(map(int, input().split())), dtype=np.int64)
    l1 = [0]*61
    mod = 10**9+7
    #n = 300000
    #a = np.array([2**60-i for i in range(n)])
    for cnt in range(61):
        b = a % 2
        l1[cnt] = np.nonzero(b)[0].size
        a = a // 2
    l0 = [n-i for i in l1]
    ans = 0
    for i in range(len(l1)):
        ans = (ans+l0[i]*l1[i]*pow(2, i, mod)) % mod
    print(ans)


main()


Measured memory_bytes: 48836
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int number[n];
	int maxn=0,a=0;
	for(int i=0;i<n;i++){
		cin>>number[i];
		a=a+number[i];
	}
	float b=0.25;
	float b1=b/m;
	float b2=b1*a;
	for(int i=0;i<n;i++){
		if(number[i]>=b2){
			maxn++;
		}
	}
	if(maxn>=m){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
----
-- B
local N = read.nl()
local S = read.l()
local h = S:sub(1, N//2)
if S == h..h then
    print("Yes")
else
    print("No")
end

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

//------------------------------------------------------

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

  ll n;
  cin >> n;
  vector<ll> a(5);
  rep(i,5) cin>>a[i];
  cout << CEIL(n, *min_element(all(a))) +4 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,k,a[105];
ll dp[105][100005];
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i];
	dp[0][0] = 1;
	for(int i=1;i<=n;i++){
		ll pre = 0;
		for(int j=0;j<=k;j++){
			//dp[i][j] <- dp[i-1][j-a[i]]....dp[i-1][j]
			pre += dp[i-1][j];
			if(j-a[i]-1 >= 0) pre -= dp[i-1][j-a[i]-1];
			pre = (pre%mod+mod)%mod;
			dp[i][j] = pre;
		}
	}
	cout<<dp[n][k]<<endl;
}

Measured memory_bytes: 79360
# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
// # pragma GCC optimize "-O3"
# define int long long
using namespace std;
  
const int N = 2 * 1e5 + 7;
const int mod = 1e9 + 7;

int used[N], cnt, a[N], x, dp[N], p[N];
vector < int > adj[N], vc;

void dfs( int v ) {
	used[v] = 1;
	dp[v] = cnt;
	cnt++;
	vc.push_back( v );
	// cout << v <<  '\n';

	for ( auto u: adj[v] ) {
		p[u] = v;
		if ( !used[u] ) {
			dfs( u );
		}
		else {
			x = u;
		}
	}
}


int32_t main() {
    speed;
    int n, k;
    cin >> n >> k;
    for ( int i = 1; i <= n; i++ ) {
    	cin >> a[i];
    	adj[i].push_back( a[i] );
    }
    dfs( 1 );
   	if ( k < cnt ) {
   		cout << vc[k];
   		return 0;
   	}
   	k -= dp[x];
   	k %= dp[p[x]] - dp[x] + 1;
   	cout << vc[k + dp[x]];
}


Measured memory_bytes: 34244
#include <bits/stdc++.h>
#define ll long long
#define L long
#define endl "\n"
#define _START_ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _END_ return 0;
using namespace std;

int main()
{   
    _START_

    int n;
    cin >> n;
    while (n != 0)
    {
        if (n % 10 == 7)
        {
            cout<< "Yes";
            return 0;
        }
        n /= 10;
    }
    cout<< "No";

    _END_
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

typedef unsigned long long ull;
const int MAX_LENGTH = 500000;
const ull MASK30 = (1ULL << 30) - 1;
const ull MASK31 = (1ULL << 31) - 1;
const ull MODrh = (1ULL << 61) - 1;
const ull POSITIVIZER = MODrh * ((1ULL << 3) - 1);
unsigned int Base;
vector<ull> powMemo(MAX_LENGTH + 1);

ull Mul(ull l, ull r) {
  ull lu = l >> 31;
  ull ld = l & MASK31;
  ull ru = r >> 31;
  ull rd = r & MASK31;
  ull middleBit = ld * ru + lu * rd;
  return ((lu * ru) << 1) + ld * rd + ((middleBit & MASK30) << 31) +
         (middleBit >> 30);
}

ull CalcMod(ull val) {
  val = (val & MODrh) + (val >> 61);
  if (val > MODrh)
    val -= MODrh;
  return val;
}

void init_RH() {
  srand(time(NULL));
  Base = rand() % RAND_MAX + 129;
  powMemo[0] = 1;
  repp(i, 1, sz(powMemo) - 1) {
    powMemo[i] = CalcMod(Mul(powMemo[i - 1], Base));
  }
}

struct RollingHash {
  vector<ull> hash;

  RollingHash(string s) {
    hash = vector<ull>(sz(s) + 1);
    rep(i, sz(s)) {
      hash[i + 1] = CalcMod(Mul(hash[i], Base) + s[i]);
    }
  }

  ull Slice(int begin, int length) {
    return CalcMod(hash[begin + length] + POSITIVIZER -
                   Mul(hash[begin], powMemo[length]));
  }
};



int main() {
  init_RH();
  int N;
  cin >> N;
  string S;
  cin >> S;

  RollingHash R(S);

  int ans = 0;
  rep(i, N) {
    repp(j, i, N - 1) {
      while ((ans < j - i) && (j + ans < N) &&
             R.Slice(i, ans + 1) == R.Slice(j, ans + 1))
        ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 4224
import sys
import collections

N, *A = map(int, open(0).read().split())

B = collections.Counter(A).most_common()
B.sort(key=lambda x: x[0])

ans = 0
for i in range(len(B)):
    count = B[i][1]
    if i+1 < len(B) and B[i+1][0] == B[i][0]+1:
        count += B[i+1][1]
        if i+2 < len(B) and B[i+2][0] == B[i][0]+2:
            count += B[i+2][1]
    ans = max(ans, count)
print(ans)

Measured memory_bytes: 21100
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      double x = (double) (a*b)/2;
      if(x == (a*b)/2 ) System.out.println("Even");
      else System.out.println("Odd");
    }
}


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

int main(){
  int n;cin>>n;
  for (int i = 0; i < n; i++){
    int k,p;
    cin>>k>>p;
    if (k % p) {
      cout << k % p << endl;
    }else{
      cout << p << endl;
    }
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

char s[5], t[7][5] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

int main() {
    scanf("%s", s);
    int idx = -1;
    for (int i = 0; i < 7; i++) {
        bool is = true;
        for (int j = 0; j < 3; j++) {
            if (s[j] != t[i][j]) {
                is = false;
                break;
            }
        }
        if (is) {
            idx = i;
            break;
        }
    }
    int cnt = 1;
    for (int i = (idx + 1) % 7, j = 0; j < 7 && i != 0; j++, i = (i + 1) % 7, cnt++);
    printf("%d", cnt);
    return 0;
}


Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
//#define num 1000000007
#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define vi vector<int>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define pb push_back
#define pob pop_back
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
#define all(x) x.begin(), x.end()
#define M_PI 3.14159265358979323846
#define epsilon (double)(0.00000000001)
#define watch(x) cout << (#x) << " is " << (x) << endl
//#define endl "\n"
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200001];
void SieveOfEratosthenes() 
{ 
    //memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
    return;
}
ll powe[200005];
void power()
{
    powe[0]=1;
    REP(i,1,200005)
    {
        powe[i]=mymod(2*powe[i-1],num);
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
}
map<pll,ll> edgeweight;
struct node
{
	vll adj;
    ll colour;
    ll subtree_size;
};
void dfs(node N[], bool vis[], ll i)
{
    vis[i]=true;
    N[i].subtree_size=1;
    for(auto x: N[i].adj)
    {
        if(!vis[x])
        {
            dfs(N,vis,x);
            N[i].subtree_size+=N[x].subtree_size;
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll fir = (c%b==0)?c/b : c/b + 1;
    ll sec = (a%d==0)?a/d : a/d + 1;
    if(sec>=fir)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 3010

ll inv[N], fac[N], finv[N];

void make()
{
	fac[0] = fac[1] = 1;
	inv[1] = 1;
	finv[1] = finv[0] = 1;
	for(int i = 2; i < N; ++i)
	{
		fac[i] = i * fac[i - 1] % MOD;
		inv[i] = MOD - MOD/i * inv[MOD % i] % MOD;
		finv[i] = inv[i] * finv[i - 1] % MOD;
	}
}

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

ll gcd(ll a, ll b)
{
	if(b == 0)
		return a;
	return gcd(b, a % b);
}
string s, t;
int n1, n2;
int dp[N][N];
int p[N][N];
int dpf(int i, int j)
{
	if(i == n1 || j == n2)
		return 0;
	if(dp[i][j] >= 0)
		return dp[i][j];
	if(s[i] == t[j])
	{
		dp[i][j] = 1 + dpf(i + 1, j + 1);
		p[i][j] = 2;
	}
	else
	{
		int k1, k2;
		dp[i][j] = max(k1 = dpf(i + 1, j), k2 = dpf(i, j + 1));
		if(dp[i][j] == k1)
			p[i][j] = 1;
		else
			p[i][j] = 3;
	}
	return dp[i][j];
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> s >> t;
	n1 = s.size(), n2 = t.size();

	int i = 0, j;
	for(;i < n1; ++i)		
		if(s[i] == t[0])
		{
			dp[i][0] = 1;p[i][0] = 2;
			break;
		}
	while(i < n1)
		dp[i][0] = 1, i++, p[i][0] = 2;
	for(i = 0; i < n2; ++i)
	{
		if(t[i] == s[0])
		{
			dp[0][i] = 1;p[0][i] = 2;
			break;
		}
	}
	while(i < n2)
		dp[0][i] = 1, i++, p[0][i] = 2;

	for(int i = 1; i < n1; ++i)
		for(int j = 1; j < n2; ++j)
		{
			if(s[i] == t[j])
				dp[i][j] = 1 + dp[i-1][j - 1], p[i][j] = 2;
			else
			{
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
				if(dp[i][j] == dp[i-1][j])
					p[i][j] = 1;
				else
					p[i][j] = 3;
			}
		}
	string an;
	i = n1 - 1, j = n2 - 1;
	while(i >= 0 && j >= 0)
	{
		if(p[i][j] == 1)
			i--;
		else if(p[i][j] == 2)
			an += s[i], i--, j--;
		else
			j--;
	}
	reverse(an.begin(), an.end());
	cout << an << "\n";
	return 0;
}

Measured memory_bytes: 70912
#include<iostream>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string.h>
#include<queue>
#include<stack>
#include<climits>
#include<cmath>
using namespace std;

int main(){
    int n,l;
    int a[100001];
    vector<int>b;
    cin>>n>>l;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=1;i<n;i++){
        if(a[i]+a[i-1]>=l){
            cout<<"Possible"<<endl;
            for(int j=1;j<i;j++)cout<<j<<endl;
            for(int j=n-1;j>i;j--)cout<<j<<endl;
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<"Impossible"<<endl;
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 3005;
int MOD;

int inv[MAX_N],fac[MAX_N],finv[MAX_N];

void make()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2;i<MAX_N;i++){
		inv[i] = MOD - (ll)inv[MOD%i] * (MOD/i) % MOD;
		fac[i] = (ll)fac[i-1] * i % MOD;
		finv[i] = (ll)finv[i-1] * inv[i] % MOD;
	}
}

int comb(int a,int b)
{
	if(a<b){
		return 0;
	}
	return fac[a] * ((ll)finv[b] * finv[a-b] % MOD) % MOD;
}

inline int add(int x,int y)
{
    return (x + y)%MOD;
}

inline int sub(int x,int y)
{
    return (x+MOD-y)%MOD;
}

inline int mul(int x,int y)
{
    return (ll)x*y%MOD;
}
int t[9000005];
int tt[3005];
int S[3005][3005];

void Stirling(int N)
{
    S[0][0] = 1;
    rep(i,N){
        rep(j,i+1){
            S[i+1][j+1] = add(S[i][j],mul(j+1,S[i][j+1]));
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n >> MOD;
    make();
    t[0] = 1;
    rep(i,n*n){
        t[i+1] = mul(t[i],2);
    }
    tt[0] = 2;
    rep(i,n){
        tt[i+1] = mul(tt[i],tt[i]);
    }
    Stirling(n+1);
    int ans = 0;
    rep(k,n+1){
        int cri = 0;
        rep(i,k+1){
            cri = add(cri,mul(t[i*(n-k)],S[k+1][i+1]));
        }
        if(k % 2){
            ans = sub(ans,mul(cri,mul(tt[n-k],comb(n,k))));
        }else{
            ans = add(ans,mul(cri,mul(tt[n-k],comb(n,k))));
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 69504
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,sum=0,l,j;
    char s[200000];
    scanf("%s",s);
    l=strlen(s);
    for(i=0;i<l;i++)
    {
        j=s[i]-48;
        sum=sum+j;
    }
    if(sum%9==0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3812
#include<iostream>
using namespace std;
int main()
{    int n,x,sum=0,sum1=1;
    cin >> n >> x;
    int l;
    for( int i=0;i<n;i++ ){
        cin >> l;
        sum+=l;
        if( sum <= x)sum1++;
    }
    cout << sum1 <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

signed main(){
	int H, W, N;
	cin >> H >> W >> N;
	vector<int> a(N);
	for(int i = 0; i < N; ++i) {
		cin >> a[i];
	}

	int p = 0;
	vector<vector<int>> f(H, vector<int>(W));
	for(int i = 0; i < N; ++i) {
		for(int j = 0; j < a[i]; ++j, ++p) {
			if((p / W) % 2 == 0) {
				f[p / W][p % W] = i + 1;
			} else {
				f[p / W][W - p % W - 1] = i + 1;
			}
		}
	}
	for(int i = 0; i < H; ++i) {
		for(int j = 0; j < W; ++j) {
			cout << f[i][j] << (j == W - 1 ? "\n":" ");
		}
	}
	return 0;
}


Measured memory_bytes: 476
/*
sonu_verma1
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(a) push_back(a)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{
    ll n,m;
    cin>>n>>m;
    ll a[n],s=0,i;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        s+=a[i];
    }
    ll b=4*m,c;
    c=s/b;
    if(s%b)
        c++;
    ll s1=0;
    for(i=0;i<n;i++)
    {
        if(a[i]>=c)
            s1++;
    }
    if(s1>=m)
        cout<<"Yes";
    else
        cout<<"No";

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

void OutputNo() {
  cout << "No\n";
  exit(0);
}

void OutputYes() {
  cout << "Yes\n";
  exit(0);
}

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  map<int, int> mp;
  for (int x : a) mp[x]++;
  if (mp.size() > 2) {
    OutputNo();
  }
  if (mp.size() == 1) {
    int k = a[0];
    if (n == k + 1) OutputYes();
    if (n >= 2 * k) OutputYes();
    OutputNo();
  }

  int k = mp.begin()->first;
  int l = mp[k];
  if (!mp.count(k + 1)) OutputNo();
  int r = mp[k + 1];
  if (l == k && r >= 2) OutputYes();
  if (l < k) {
    if (n >= k + 1 + k + 1 - l) OutputYes();
  }

  OutputNo();

  return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define min(a,b) (((a)>(b))?(b):(a))
#define max(a,b) (((a)>(b))?(a):(b))
#define pb push_back
#define mp make_pair
#define INF (1<<28)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int main(){
	int n;
	cin>>n;
	int x[n];
	int b[n];
	for(int i=0;i<n;i++){
		cin>>x[i];
	}
	for(int i=0;i<n;i++){
		b[i]=x[i];
	}
	sort(b,b+n);
	int t,s;
	t=b[n/2-1];
	s=b[(n/2)];
	for(int i=0;i<n;i++){
		if(x[i]>t)cout<<t<<endl;
		else cout<<s<<endl;
	}
	return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,temp,ans;
	int backE=0,backW=0,forwardE=0,forwardW=0;
	string s;

	cin >>n >>s;
	ans=n;
	for(int i=0;i<n;i++){
		if(s[i]=='E')backE++;
		else backW++;
	}
	for(int i=0;i<n;i++){
		if(s[i]=='W'){
			backW--;
			forwardW++;
			temp=forwardW+backE-1;
		}
		else {
			backE--;
			forwardE++;
			temp=forwardW+backE;
		}
		if(ans>temp&&temp>=0)ans=temp;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 900
N = int(input())
A = list(map(int,input().split()))

C = abs(A[0]-0)
for i in range(1,N):
    C += abs(A[i]-A[i-1])
C += abs(0-A[N-1])

B = [abs(0-A[1])-abs(0-A[0])-abs(A[0]-A[1])]
for i in range(1,N-1):
    B.append(abs(A[i-1]-A[i+1])-abs(A[i-1]-A[i])-abs(A[i]-A[i+1]))
B.append(abs(A[N-2]-0)-abs(A[N-2]-A[N-1])-abs(A[N-1]-0))

for b in B:
    print(C+b)


Measured memory_bytes: 14172
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next().toUpperCase();
        String b = sc.next().toUpperCase();
        String c = sc.next().toUpperCase();
        List<String> arya = new ArrayList<>(Arrays.asList(a.split("")));
        List<String> aryb = new ArrayList<>(Arrays.asList(b.split("")));
        List<String> aryc = new ArrayList<>(Arrays.asList(c.split("")));
        List<String> tempAry = arya;
        String temp = tempAry.get(0);
        while (temp != null) {
            if (temp.equals("A")) {
                tempAry = arya;
                if (tempAry.size() == 0) {
                    break;
                }
                temp = tempAry.get(0);
                arya.remove(0);
            } else if (temp.equals("B")) {
                tempAry = aryb;
                if (tempAry.size() == 0) {
                    break;
                }
                temp = tempAry.get(0);
                aryb.remove(0);
            } else if (temp.equals("C")) {
                tempAry = aryc;
                if (tempAry.size() == 0) {
                    break;
                }
                temp = tempAry.get(0);
                aryc.remove(0);
            }
        }
        System.out.println(temp);
    }
}

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

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

ll mod = (ll)(1e9+7);

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];

  ll ans = 0;
  rep(i,n){
    if(i%2==1){
      continue;
    }else if(a[i]%2==0){
      continue;
    }else{
      ans++;
    }
  }
  cout << ans <<endl;

  return 0;
}

Measured memory_bytes: 3600
#pragma GCC optimize("O3") 
#define TASK ""
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") 
#define __USE_MINGW_ANSI_STDIO 0
#include<bits/stdc++.h>                               
using namespace std;

#define PI acos(-1)
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(c) (c).begin(), (c).end()
#define TIMESTAMP fprintf(stderr, "Execution time: %.3lf s.\n", (double)clock()/CLOCKS_PER_SEC)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair <int, int> pii;
typedef vector <vi> vvi;
typedef vector <pii> vpii;
typedef vector<string> vs;

const int MAXN = 1e5 + 9;
const int MOD = (int)(1e9 + 7);
const int INF = 100500;

int n;

void input() {
	cin >> n;
	n *= 3;
	vll aa(n);
	for(int i = 0; i < n; i++) cin >> aa[i];
	sort(all(aa));
	for(int i = 0; i < n; i++) cerr << aa[i] << ' ';
	ll ans = 0;
	for(int i = n - 2; i >= n / 3; i -= 2) {
		ans += aa[i];
	}
	cout << ans;		
}

void solve() {

}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#ifdef LOCAL
	freopen("xxx.in", "r", stdin);
	freopen("xxx.out", "w", stdout);
#else
	//freopen(TASK".in", "r", stdin);
	//freopen(TASKa".out", "w", stdout);
#endif	
	input();
	solve();
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 1000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int kai(int x) {
	if (x == 0)return 1;
	return (kai(x - 1)*x) % moder;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
struct edge { int to, cost; };
int dx[5] = { 0,1,0,-1 }, dy[5] = { 1,0,-1,0 };
map<int, int>factor(int x) {
	map<int, int>res;
	for (int i = 2; i*i <= x; i++) {
		while (x%i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1)res[x]++;
	return res;
}
/*--------Library Zone!--------*/

int c[5];
signed main() {
	int a[5], b[5];
	cin >> a[0] >> b[0] >> a[1] >> b[1] >> a[2] >> b[2];
	c[a[0]]++;
	c[a[1]]++;
	c[a[2]]++;
	c[b[0]]++;
	c[b[1]]++;
	c[b[2]]++;
	if (c[1] == 3 || c[2] == 3 || c[3] == 3 || c[4] == 3)cout << "NO" << endl;
	else cout << "YES" << endl;
	endre;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <complex>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << "\n"
static const int INF = 1e+9+7;
static const ll INFL = 1e+18+7;
int n,m,l;
int p;
string s,t;
ll d[200010],dp[300][300];
char field[200][200];
char h[3] = {'+','-','0'};
 
void create(int a,int b,int c){
  string ans = "";
  ans += char(n + '0');
  ans += h[a];
  ans += char(m + '0');
  ans += h[b];
  ans += char(l + '0');
  ans += h[c];
  ans += char(p + '0');
  ans += "=7";
  print(ans);
}
 
int main(){
  cin >> s;
  n = s[0] - '0';
  m = s[1] - '0';
  l = s[2] - '0';
  p = s[3] - '0';
  rep(i,0,2){
    rep(j,0,2){
      rep(k,0,2){
        ll ans = n;
        if(i == 0)ans += m;
        else ans -= m;
        if(j == 0)ans += l;
        else ans -= l;
        if(k == 0)ans += p;
        else ans -= p;
        if(ans == 7){
          // cout << ans << endl;
          // cout << i << j << k << endl;
          create(i,j,k);
          return 0;
        }
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
a = list(input())
ans = []
for i in range(len(a)):
    if a[i] == '0':
        ans.append('0')
    elif a[i] == '1':
        ans.append('1')
    elif a[i] == 'B':
        if ans == []:
            continue
        else:
            ans.pop(-1)
print(''.join(ans))

Measured memory_bytes: 9116
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    int  s, t;
    s = abs(x - a) ;
    t = abs(x - b); 
    if(s - t > 0)
    {
        cout << "B" << endl;
    }
    if (s - t < 0)
    {
        cout << "A" <<endl;
    } 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(a, b) for (ll i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template<class T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
int main(){
    int h,w,n;
    cin >> h >> w >> n;
    if(h>w){
        if(n%h==0){
            cout << n/h << endl;
        }
        else{
            cout << n/h+1 << endl;
        }
    }
    else{
        if (n % w == 0)
        {
            cout << n / w << endl;
        }
        else
        {
            cout << n / w + 1 << endl;
        }
    }
}

Measured memory_bytes: 256
n=int(input())
s=[list(map(int, input().split()))  for i in range(n)]
x=[]
if n==1:
    print(1)
    exit(0)

for i in range(n):
    for j in range(n):
        if i==j:
            continue
        t=(s[i][0]-s[j][0],s[i][1]-s[j][1])
        x.append(t)
        
ans = [x.count(x[i]) for i in range(len(x))]
print(n-max(ans))


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

using namespace std;

const long long r = 1e9 + 7;

long long d[5001][5002];

long long f(long long a, long long p) {
	if (p == 1)
		return a;

	long long ret = f(a, p / 2);
	ret = ret * ret % r;
	if (p % 2 == 1)
		ret = ret * a % r;

	return ret;
}

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

	d[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		d[i][0] = (d[i - 1][0] + d[i - 1][1]) % r;
		for (int j = 1; j <= n; ++j)
			d[i][j] = (2 * d[i - 1][j - 1] + d[i - 1][j + 1]) % r;
	}

	long long tmp = 1;
	for (int i = 0; i < s.length(); ++i)
		tmp = tmp * 2 % r;

	printf("%lld", d[n][s.length()] * f(tmp, r - 2) % r);

	return 0;
}

Measured memory_bytes: 195712
#include <stdio.h>

int main(void){
	int w, h, x, y, r;
	scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);

	if (x-r>=0 && x+r<=w && y-r>=0 && y+r<=h) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 2640
import sys
input = sys.stdin.readline

mod = 2019
inv10 = 202
S = list(map(int, input()[:-1]))
N = len(S)
H = []
v = 0
d = 1
cusum = 0
M = [0] * mod
M[0] += 1
ans = 0
for c in S:
    h = c*d % mod
    d = d * inv10 % mod
    cusum = (cusum+h) % mod
    ans += M[cusum]
    M[cusum] += 1
print(ans)


Measured memory_bytes: 10944
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{

    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var result = Program.Prediction(s);
            Console.WriteLine(result ? "Yes" : "No");
        }
        private static bool Prediction(string s)
        {
            for(int i = 0; i < s.Length; i++)
            {
                if (i % 2 == 0 && s[i] == 'L') return false;
                if (i % 2 == 1 && s[i] == 'R') return false;
            }
            return true;
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

const int    INF = 1000000000;
const int    MOD = 1000000007;
const double EPS = 1e-8;

ull next(ull x){
    x ^= x << 13;
    x ^= x >> 7;
    x ^= x << 17;
    return x;
}

int main(){
    ull n, k, x0;
    while(cin >> n >> k >> x0){
        if(x0 == 0) {
            cout << 0 << endl;
            continue;
        }
        k--;
        const int B = 10; // 2^10

        ull cnt[1 << B] = {};
        ull x = x0;
        for(int i = 0; i < n; i++){
            cnt[x >> (64 - B) ^ (1 << (B - 1))]++;
            x = next(x);
        }
        ull A = 0;
        for(ull s = 0; s < 1 << B; s++){
            if(k < cnt[s]) {
                A = s ^ (1 << (B - 1));
                break;
            }
            k -= cnt[s];
        }

        vector<ll> v;
        x = x0;
        for(int i = 0; i < n; i++){
            if(x >> (64 - B) == A) v.push_back((ll)x);
            x = next(x);
        }
        sort(v.begin(), v.end());
        cout << v[k] << endl;
    }

    return 0;
}

Measured memory_bytes: 2072
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String str1 = scan.next();
        String str2 = scan.next();
        if(str1.equals(str2)){
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define MAX 100005
using Graph=vector<vector<int>>;

long long modpow(long long a,long long n,long long mod){
  long long res=1;
  while(n>0){
    if(n&1){       //nのbitと...00001を比較  nが2で割り切れるならtrue
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

long long modinv(long long a,long long mod){
  return modpow(a,mod-2,mod);
}

long long fac[MAX],finv[MAX],inv[MAX];

void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<MAX;i++){
    fac[i]=(fac[i-1]*i)%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}

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


int main(){
  int n;
  cin>>n;
  vector<int> a(n+1),count(n,0);
  for(int i=0;i<n+1;i++){
    cin>>a.at(i);
    count.at(a.at(i)-1)++;
  }
  COMinit();
  int k;
  for(int i=0;i<n;i++){
    if(count.at(i)==2){
      k=i;
    }
  }
  ll A,B;
  for(int i=0;i<n+1;i++){
    if(a.at(i)==k+1){
      A=(ll)i;
      break;
    }
  }
  for(int i=n;i>=0;i--){
    if(a.at(i)==k+1){
      B=(ll)i;
      break;
    }
  }
  for(ll i=0;i<n+1;i++){
    if(i==0){
      cout<<n<<endl;
      continue;
    }
    if(i==n){
      cout<<1<<endl;
      continue;
    }
    ll ans=COM(n-1,i+1)+COM(n-1,i-1);
    if(i>n+1-(B-A+1)){
      ans+=2*COM(n-1,i);
    }else{
      ans+=2*COM(n-1,i)-COM(n+1-(B-A+1),i);
    }
    ans+=2*MOD;
    cout<<ans%MOD<<endl;
  }
}


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

vector<vector<int>> G(2e5);
vector<int> ans(2e5,-1);
vector<bool> seen(2e5,false);

void bfs() {
  queue<int> Q;
  Q.push(1);
  seen[1]=true;
  int u;
  while(!Q.empty()) {
    u=Q.front(); Q.pop();
    for(int next:G[u]) {
      if(seen[next]==false) {
        Q.push(next);
        seen[next]=true;
        ans[next]=u;
      }
    }
  }
}

int main() {
  int n,m; cin>>n>>m;
  int a,b;
  rep(i,m) {
    cin>>a>>b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  bfs();
  cout<<"Yes\n";
  for(int i=2;i<=n;i++) {
    cout<<ans[i]<<endl;
  }
}


Measured memory_bytes: 12976
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <complex>
#include <map>
#include <set>


#define forin(i, f, t) for(ll i = f; i < t; i++)

using namespace std;
using ll = long long;
using ULL = unsigned long long;

const int MAX = 50;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++)
        cin >> b[i];
    
    auto connect = [=](ULL mask) {
        for (auto i = 0; i < n; i++) {
            vector<bool> reach(MAX + 1, false);
            reach[a[i]] = true;
            
            for (int f = 50; f > 0; f--) if (reach[f])
                for (int r = 1; r <= MAX; r++) if (mask >> r & 1ULL)
                    reach[f % r] = true;
            
            if (!reach[b[i]])
                return false;
        }
        
        return true;
    };
    
    ULL mask = (1ULL << (MAX + 1)) - 1 - 1;
    if (!connect(mask)) {
        cout << -1 << endl;
        return 0;
    }
    for (int i = MAX; i > 0; i--) if (connect(mask ^ (1ULL << i)))
            mask ^= 1ULL << i;
    
    cout << mask << endl;
    
}



Measured memory_bytes: 256
N = int(input())
MOD = 998244353

list_size = 10000010

f_list = [1] * list_size
f_r_list = [1] * list_size

for i in range(list_size - 1):
	f_list[i + 1] = int((f_list[i] * (i + 2)) % MOD)

f_r_list[-1] = pow(f_list[-1], MOD - 2, MOD)

for i in range(2, list_size + 1):
	f_r_list[-i] = int((f_r_list[-i + 1] * (list_size + 2 - i)) % MOD)


def comb(n,r):
    if r == 0:
        return 1
    return (((f_list[n - 1] * f_r_list[n - r - 1]) % MOD) * f_r_list[r - 1]) % MOD 

ans = 0
for i in range((N//2)):
    ans += comb(N,i) * pow(2,i,MOD)
    ans %= MOD

print((pow(3,N,MOD)-ans*2)%MOD)


Measured memory_bytes: 190616
N = int(input())
a = list(map(int,input().split()))
A = []
for b in a:
    A.append(b-1)
    A.append(b)
    A.append(b+1)

A.sort()
count = 1
maxcount =1
for i in range(1,len(A)):
    if A[i] == A[i-1]:
        count = count+1
    else:
        maxcount = max(maxcount,count)
        count = 1

print(maxcount)

Measured memory_bytes: 17532