akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair <ll, ll> l_l;
typedef pair<int, int> i_i;

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;
}

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

int N;
ll H[100010];

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> H[i];

    int ans = 0;
    int cur_ans = -1;
    ll cur = INF;
    for (int i = 0; i < N; ++i) {
        if (cur >= H[i]) {
            cur = H[i];
            cur_ans++;
        } else {
            cur = H[i];
            ans = max(ans, cur_ans);
            cur_ans = 0;
        }
    }
    ans = max(ans, cur_ans);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
from collections import deque
n = int(input())

txy = deque([list(map(int, input().split())) for _ in range(n)])

tn, xn, yn = 0, 0, 0
while txy:
    t, x, y = txy.popleft()
    if (abs(xn-x)+abs(yn-y)<=(t-tn)) and (abs(xn-x)+abs(yn-y))%2==(t-tn)%2:
        tn, xn, yn = t, x, y
    else:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 27832
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

struct Query {
  int i;
  int l, r;
};
bool operator<(const Query& a, const Query& b){
  return a.r < b.r;
}


struct FenwickTree{
  int n;
  vector<int> tree;
public:
  FenwickTree(int n_):tree((1<<21)+1, 0){
    n = n_;
  }
  void add(int i, int value){
    for(; i<n; i|=i+1) tree[i] += value;
  }
  int sum(int i){
    int s = 0;
    for(; i>=0; i=(i&i+1)-1) s += tree[i];
    return s;
  }
};
int lst[500005];



int main(){
  int N, Q;
  cin >> N >> Q;
  vector<int> v;

  rep(i,N){
    int a;
    cin >> a;
    v.push_back(a);
  }

  rep(i,500005) lst[i] = -1;

  vector<Query> w;
  rep(q,Q){
    Query query;
    query.i = q;
    cin >> query.l >> query.r;
    query.l--;
    query.r--;
    w.push_back(query);
  }
  sort(ALLOF(w));

  vector<int> ret(Q, -1);
  FenwickTree ft(N+5);
  int L = -1, R = -1;
  rep(i,Q){
    Query query = w[i];
    if(R < query.r){
      REP(j,R+1,query.r+1){
        if(lst[v[j]] != -1){
          ft.add(lst[v[j]], -1);
        }
        lst[v[j]] = j;
        ft.add(j, 1);
      }
      R = query.r;
    }
    ret[query.i] = ft.sum(query.r) - ft.sum(query.l-1);
  }
  
  rep(i,ret.size()){
    cout << ret[i] << endl;
  }
  
  return 0;
}


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

int main() {
  vector<int> a(4);
  for (int i = 0; i < 4; i ++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  string ans;
  if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) ans = "YES";
  else ans = "NO";

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n,k;
  cin>>n>>k;
  vi a(3);
  rep(i,3){
    cin>>a[i];
  }

  string s;
  cin>>s;
  vector<bool> b(n,false);

  int ans=0;
  rep(i,n){
    bool flag=false;
    if(i<k) flag=true;
    else if(s[i-k]!=s[i]||b[i-k]){
      flag=true;
    }

    if(flag){
      if(s[i]=='r') ans+=a[2];
      if(s[i]=='s') ans+=a[0];
      if(s[i]=='p') ans+=a[1];
    }else{
      b[i]=true;
    }
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
#define endl             "\n"
// -----------------<Container manipulation / traversal macros>------------------
#define mp                 make_pair
#define pb                 push_back
#define ff                 first
#define ss                 second
#define sz(x)             ((int)((x).size()))
#define all(x)             (x).begin(),(x).end()
#define rep(i,n)         for(ll (i)=0;(i)<(n);(i)++)
#define forn(i,a,b)     for(ll (i)=(a);(i)<=(b);(i)++)
#define fill(l,a)        memset((l) , (a) , sizeof(l))
// -----------------<Some common useful functions>------------------
#define maX(a,b)        ( (a) > (b) ? (a) : (b))
#define miN(a,b)        ( (a) < (b) ? (a) : (b))
#define checkbit(n,b)   ( (n >> b) & 1)
#define INDEX(arr,i)      ( lower_bound(all(arr),i)-arr.begin())
#define in(b,a)         ( (b).find(a) != (b).end())
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector< std::vector<ll> > matrix;
typedef map<ll,ll> mii;
typedef vector<pii> vpii;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}
ll lcm(ll a,ll b)
{
    return(a/gcd(a,b)*b);
}
/*ll power(ll a,ll b,ll p)
{
    ll res=1;
    a%=p;
    while(b>0)
    {
        if(b&1)
        res=res*a%p;
        a=a*a%p;
        b>>=1;
    }
    return(res);
}
ll modInverse(ll a, ll m)
{
    ll g = gcd(a, m);
    return(power(a,m-2,m));
}*/
/*ll b_search(ll arr[],ll n,ll s)
{
    ll l=0,r=n-1;
    while(l<=r)
    {
        ll mid=l+(r-l)/2;
        if(arr[mid]==s)
        return(mid);
        if(arr[mid]<s)
        l=mid+1;
        else
        r=mid-1;
    }
    return(-1);
}*/
bool isprime(ll x)
{
    if(x==1)
        return(false);
    for(ll i=2;i*i<=x;i++)
    {
        if(x%i==0)
            return(false);
    }
    return(true);
}
vector<ll> v[100005];
bool vis[100005]={false};
long combi(int n,int k)
{
    long ans=1;
    k=k>n-k?n-k:k;
    int j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}

void solve()
{
    ll a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}

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


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long a[] = new long[n];
        a[0] = sc.nextLong();
        for (int i = 1; i < n; i++) {
            a[i] = a[i - 1] + sc.nextLong();
        }
        List<Long> bubun = new ArrayList<Long>();
        for (int i = 0; i < n; i++) {
            bubun.add(a[i]);
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (j > i) {
                    bubun.add(a[j] - a[i]);
                }
            }
        }
        long max = 0;
        for (int i = 40; i >= 0; i--) {
            long bit = max + (long)Math.pow(2, i);
            int count = 0;
            for (int j = 0; j < bubun.size(); j++) {
                if ((bubun.get(j) & bit) == bit) {
                    count++;
                }
            }
            if (count >= k) {
                max += Math.pow(2, i);
            }
        }
        System.out.println(max);
    }

}

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

int main() {
  	int H,n;
  	cin >>H>>n;
  	int A[1001],B[1001];
  	for(int i=1;i<=n;i++){cin >>A[i]>>B[i];}
	int dp[1001][20000];
	
	for(int j=1;j<=20000;j++){
    	dp[0][j]=100000000;
    }
    rep(i,n){dp[i][0]=0;}    
      
  	for(int i=1;i<=n;i++){
    	for(int j=1;j<=20000;j++){
        	if(A[i]<=j){dp[i][j]=min(dp[i-1][j],dp[i][j-A[i]]+B[i]);}
        	else{dp[i][j]=dp[i-1][j];}        	
        }
    }
  int ans=10000000011;
	for(int j=H;j<=19999;j++){
    	ans=min(ans,dp[n][j]);
    }
	cout <<ans<<endl;
}

Measured memory_bytes: 78464
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

ll add[3] = {-1, 0, 1};

void dfs(vector<ll> &nums, vector<ll> &ans) {
    if (nums.size() == 11) {
        return;
    }
    ll num = 0, tens = 0;
    for (int i = nums.size() - 1; i > -1; i--) {
        num += nums[i] * pow(10, tens);
        tens++;
    }
    ans.push_back(num);

    for (int i = 0; i < 3; i++) {
        ll can = nums.back() + add[i];
        if (can < 0 || can > 9)
            continue;
        nums.push_back(can);
        dfs(nums, ans);
        nums.pop_back();
    }
}

int main() {
    int K;
    cin >> K;
    vector<ll> ans;
    for (int i = 1; i < 10; i++) {
        vector<ll> nums;
        nums.push_back(i);
        dfs(nums, ans);
    }

    sort(all(ans));
    cout << ans[K - 1] << endl;
}

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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}


struct segtree{
    static const int SEG=1<<19;
    vint ma,put;
    segtree():ma(SEG*2),put(SEG*2){}
    inline void push(int k){
        ma[k]+=put[k];
        if(k<SEG-1){
            put[k*2+1]+=put[k];
            put[k*2+2]+=put[k];
        }
        put[k]=0;
    }
    void add(int a,int b,int x=0,int k=0,int l=0,int r=SEG){
        push(k);
        if(r<=a||b<=l)return;
        if(a<=l&&r<=b){
            put[k]+=x;
            push(k);
            return;
        }
        add(a,b,x,k*2+1,l,(l+r)/2);
        add(a,b,x,k*2+2,(l+r)/2,r);
        ma[k]=max(ma[k*2+1],ma[k*2+2]);
    }
    int get(int a,int b,int k=0,int l=0,int r=SEG){
        push(k);
        if(r<=a||b<=l)return LLONG_MIN;
        if(a<=l&&r<=b)return ma[k];
        return max(get(a,b,k*2+1,l,(l+r)/2),get(a,b,k*2+2,(l+r)/2,r));
    }
};

int N;
int A[555555];
segtree segA,segB;

signed main(){
    scanf("%lld",&N);
    rep(i,N)scanf("%lld",&A[i]);

    rep(i,N/2){
        int d=A[i]-A[N-1-i];
        segA.add(i,i+1,d);
        segB.add(i,i+1,-d);
    }

    int Q;scanf("%lld",&Q);
    while(Q--){
        int l,r,x;
        scanf("%lld%lld%lld",&l,&r,&x);
        l--;
        if(l<=N/2-1&&N/2<r){
            int llen=N/2-l,rlen=r-N/2;
            if(llen<rlen){
                l=N/2+llen;
            }
            else if(llen>rlen){
                r=N/2-rlen;
            }
            else{
                l=r=0;
            }
        }
        if(N/2<=l){
            int ll=N-r;
            int rr=N-l;
            l=ll;r=rr;x*=-1;
        }
        segA.add(l,r,x);
        segB.add(l,r,-x);

        if(segA.get(0,N/2)==0&&segB.get(0,N/2)==0)puts("1");
        else puts("0");

        //rep(i,N/2)cout<<segA.get(i,i+1)<<" ";cout<<endl;
        //rep(i,N/2)cout<<segB.get(i,i+1)<<" ";cout<<endl;
    }
    return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a.at(i);
  }

  long long sum = 1000;

  for (int i = 1; i <= n - 1; i++) {
    long long stock_num = 0;
    if (a.at(i + 1) - a.at(i) > 0) stock_num = sum / a.at(i);
    sum += stock_num * (a.at(i + 1) - a.at(i));
  }
  cout << sum;
  return 0;
}


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

using namespace std;

typedef long long int64;

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

  for(int i = 1; i < 10000000; i++) {
    if(A * i % B == C) {
      cout << "YES" << endl;
      return (0);
    }
  }
  cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <cmath>

#define INF 100000000
#define MOD 1000000007
using namespace std;


int main(){
    int N;
    cin >> N;
    
    int A;
    cin >> A;
    
    long long num[N+1][2501]={};
    
    num[0][0]=1;
    
    for(int cnt=0; cnt<N; cnt++){
        int x;
        cin >> x;
        for(int maisu=N-1; maisu>=0; maisu--){
            for(int a=2450; a>=0; a--){
                num[maisu+1][a+x]+=num[maisu][a];
            }
        }
    }
    
    
    long long ans=0;
    for(int maisu=1; maisu<=N; maisu++){
        for(int a=0; a<=2500; a++){
            if(a==A*maisu){
                ans+=num[maisu][a];
            }
        }
    }

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


Measured memory_bytes: 1280
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <iostream>
#include <fstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <iterator>
#include <iomanip>
#include <unordered_map>

using namespace std;

#define ll long long int

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n;
    cin>>n;
    ll a[n],ans[n+1]={}, freq[n+1] = {}, sum=0,m=0, temp;
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
        ans[a[i]]++;
        freq[a[i]]++;
        m=max(m,a[i]);
    }
    for (int i = 1; i <=m; ++i)
    {
        temp=ans[i];
        ans[i]=temp*(temp-1)/2;
        sum+=ans[i];
    }
    for (int i = 0; i < n; ++i)
    {   
        int p=a[i];
        cout<<sum-ans[p]+(freq[p]-1)*(freq[p]-2)/2<<endl;
    }
    
 }


Measured memory_bytes: 7296
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;

int main(){
    int N,S,T;
    cin >> N >> S >> T;
    vector<int> ok(N+1,0);
    vector<vector<int>> dist(N+1,vector<int>(N+1,0));
    vector<P> v;
    for(int i=1;i<=N;i++){
        if(i==S) continue;
        cout << "? " << S << " " << i << endl;
        int res;
        cin >> res;
        dist[S][i] = res;
        dist[i][S] = res;
    }
    for(int i=1;i<=N;i++){
        if(i==T || i==S) continue;
        cout << "? " << i << " " << T << endl;
        int res;
        cin >> res;
        dist[i][T] = res;
        dist[T][i] = res;
    }
    vector<int> ans;
    for(int i=1;i<=N;i++){
        if(dist[S][i]+dist[i][T]==dist[S][T]) v.push_back({dist[S][i],i});
    }
    sort(v.begin(),v.end());
    ans.push_back(v[0].second);
    int now = v[0].second;
    int id = 0;
    while(now!=T){
        for(int i=id+1;i<v.size();i++){
            cout << "? " << now << " " << v[i].second << endl;
            int res;
            cin >> res;
            if(dist[S][now]+res==dist[S][v[i].second]){
                ans.push_back(v[i].second);
                now = v[i].second;
                id = i;
                break;
            }
        }
    }
    cout << "! ";
    int n = ans.size();
    for(int i=0;i<n;i++) cout << ans[i] << (i!=n-1? " ":"\n");
}


Measured memory_bytes: 4672
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

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

    cout << a*b << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <cstdio>

int main()
{
	int sx, sy, tx, ty;
	scanf("%d %d %d %d", &sx, &sy, &tx, &ty);
	tx -= sx;
	ty -= sy;
	for (int i = 0; i < ty; ++i)
		putchar('U');
	for (int i = 0; i < tx; ++i)
		putchar('R');
	for (int i = 0; i < ty; ++i)
		putchar('D');
	for (int i = 0; i < tx; ++i)
		putchar('L');
	putchar('L');
	for (int i = 0; i <= ty; ++i)
		putchar('U');
	for (int i = 0; i <= tx; ++i)
		putchar('R');
	putchar('D');
	putchar('R');
	for (int i = 0; i <= ty; ++i)
		putchar('D');
	for (int i = 0; i <= tx; ++i)
		putchar('L');
	putchar('U');
	putchar('\n');
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
long long solve(long long h)
  {if(h==0)
    return 0;
  if(h==1)
    return 1;
  else return 1+2*solve(h/2);
  
  
  }
int main()
  {
  long long h;
cin>>h;
  cout<<solve(h)<<endl;
  return 0;
  
  }

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,max=0,sum=0,i;
  scanf("%d",&n);
  int l[n+1];
  for(i=0;i<n;i++){
    scanf("%d",&l[i]);
    if(max<l[i]){
      sum+=max;
      max=l[i];
    }
    else
      sum+=l[i];
  }
  if(sum>max)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}


Measured memory_bytes: 128
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    speed = (v- w)
    dist = abs(b - a)
    if speed * t >= dist:
        print("YES")
        return
    else:
        print("NO")
        return




a , v = RA()
b , w = RA()
t = RN()
solve()


Measured memory_bytes: 64968
package main

import (
	"fmt"
)

func main() {
	var (
		a, b int
	)
	fmt.Scan(&a, &b)

	ret := a + b
	candidate := a - b
	if candidate > ret {
		ret = candidate
	}
	candidate = a * b
	if candidate > ret {
		ret = candidate
	}
	fmt.Println(ret)
}


Measured memory_bytes: 512
// 2011/02/17 Tazoe

#include <iostream>
#include <string>		// string^ðg¤½ßÉ
using namespace std;

int main()
{
	while(true){
		string r, a;		// stringi¶ñj^
		cin >> r >> a;
		if(r=="0"&&a=="0")
			break;

		int hit = 0;
		int blw = 0;
		for(int i=0; i<4; i++)
			for(int j=0; j<4; j++)		// ½è
				if(r[i]==a[j])		// ª¯¶ÈçÎ
					if(i==j)		// Êuà¯¶ÈçÎ
						hit++;
					else
						blw++;

		cout << hit << ' ' << blw << endl;
	}

	return 0;
}

Measured memory_bytes: 916
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define LOL cout<<'\n';
#define MOD 1000000007
#define sz(x) ((int)x.size())
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define deb(x) cout << "[" << #x << "=" << x << "]" << '\n'
#define deb2(x,y) cout << "[" << #x << "=" << x << "] [" << #y << "=" << y << "]" << '\n'
#define deb3(x,y,z) cout << "[" << #x << "=" << x << "] [" << #y << "=" << y << "] [" << #z << "=" << z << "]" << '\n'

void solve(){
	int n; cin>>n;
	int a[n];
	int cnt=0;
	int ans=0;
	for(int i=0 ; i<n ; i++) {
		cin>>a[i];
		if(a[i]%2==0){
			++cnt;
			if(a[i]%3==0 || a[i]%5==0){
				ans++;
			}
		}
	}
	if(cnt==ans){
		cout<<"APPROVED";LOL
	}
	else{
		cout<<"DENIED";LOL
	}

}

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  //int _;
  //for(cin>>_ ; _ ; --_){
    //cout<<"Case "<<_<<": ";
    solve();
  //}
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
 
int main() {
  string s ;
  cin >> s ;
  int m  ;
  cin >> m ;
  vector<char> T ;
  vector<string> U ;
  int n = s.size() ;
  map<char,int> mp ;
  map<string,int> mp2 ;
  rep(i,n) mp[s[i]]++ ;
  int ans = 0 ;
  for(auto p : mp ){
    int q = p.second ;
    if( q > 0 ) {
      T.push_back(p.first) ;
      ans++ ;
    }
  }
  //rep(i,ans) cout << T[i] << endl ;
  ans = 0 ;
  for(int i = 0 ; i < n ; i++ ){
    for(int j = 1 ; j < 6 ; j++ ){
      //cout << s.substr(0,3) << endl;
      mp2[s.substr(i,j)]++ ;
    }
  }
  for(auto p : mp2 ){
    int q = p.second ;
    if( q > 0 ) {
      U.push_back(p.first) ;
      ans++ ;
    }
  }
  cout << U[m-1] << endl ;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    int a[n][m];
    int b[m];
    int c[n];
    for (int i = 0; i < n; i++) {
        c[i] = 0;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            c[i] += a[i][j] * b[j];
        }
    }
    for (int i = 0; i < n; i++) {
        cout << c[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 3136
import sys
n = int(input())
yetlist = []
for i in range(n):
    word = input()
    if word in yetlist:
        print("No")
        sys.exit()
    if yetlist:
        if word[0] != yetlist[-1][-1]:
            print("No")
            sys.exit()
    yetlist.append(word)
print("Yes")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b+1;i++)
#define Per(i,b,a) for(int i=b;i>=a;i--)
int main(){
    int N;
    string S;
    cin>>N;
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    rep(i,N){
        cin>>S;
        if(S[0]=='A') ac++;
        if(S[0]=='W') wa++;
        if(S[0]=='T') tle++;
        if(S[0]=='R') re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
    return 0;
}

Measured memory_bytes: 3600
# -*- coding: utf-8 -*-
N = int(input())
p_list = list(map(int, input().split()))

wrong_counter = 0
for i in range(N):
    if p_list[i] != i + 1:
        wrong_counter += 1

if wrong_counter == 0 or wrong_counter == 2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<iomanip>
#include<algorithm>

using namespace std;
bool issqr(int n)
{
	double x = sqrt(n);
	double y = floor(x);
	if (x == y)
		return true;
	else
		return false;
}
int main()
{
	int a[3], t;
	cin >> a[0] >> a[1] >> a[2] >> t;
	sort(a, a + 3);
	for (int i = 0; i < t; ++i)
	{
		a[2] *= 2;
	}
	cout << a[2]+ a[0] + a[1];
	
}

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

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

int main(){
    int n, start, x;
    cin >> n >> start >> x;
    int ans = abs(start-x);

    for(int i = 1; i < n; i++){
        cin >> x;
        ans = gcd(ans, abs(start-x));
    }

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

Measured memory_bytes: 256
n = int(input())

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

def f(a, b, c):
    if a < b and b < c:
        return True
    if c < b and b < a:
        return True
    return False


ans = 0
for i in range(len(p) - 2):
    if f(p[i], p[i+1], p[i+2]):
        ans += 1

print(ans)

Measured memory_bytes: 3060
using System;
using System.Linq;

class Program
{
	static void Main()
	{
		var abcd = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));

		var answer = false;
		if (Math.Abs(abcd[0] - abcd[2]) <= abcd[3]) {
			answer = true;
		}

		if (Math.Abs(abcd[0] - abcd[1]) <= abcd[3] && Math.Abs(abcd[1] - abcd[2]) <= abcd[3]) {
			answer = true;
		}


		Console.WriteLine(answer ? "Yes" : "No");
	}
}


Measured memory_bytes: 13140
include Math
define_method :max, -> (a,b) { a > b ? a : b }
define_method :min, -> (a,b) { a < b ?  a : b }
define_method :swap, -> (a,b) { a, b = b, a }
define_method :rep, -> (num, &block) { num.times do |i| block.call(i) end }
define_method :repl, -> (st,en, &block) { st.upto en-1 do |i| block.call(i) end }
define_method :array, -> (size,init = nil) { Array.new(size){init} }
define_method :darray, -> (size1, size2, init = nil) { Array.new(size1){Array.new(size2){init}} }
define_method :gi, -> () { gets.split.map(&:to_i) }
define_method :gs, -> () { gets.chomp }
define_method :putall, -> (obj) { obj.each do |o| puts o end }


n = gi
ans = 0
if n[1] >= 2*n[0]
	ans = n[0]
n[1] -= 2*n[0]
ans += n[1]/4
else
	ans = n[1]/2
end
puts ans

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

int main(){
	int n;
  	cin>>n;
    int t = n%10;
    if(t==0 || t==1||t==6||t==8)
      cout<<"pon"<<endl;
    else if(t==3)
      cout<<"bon"<<endl;
  	else
      cout<<"hon"<<endl;

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
vector<int> s(100009);

int main(){
  long long N,M;
  cin >> N >> M;
  vector<long long> A(N),B(M),C(M);
  for(int i=0;i<N;i++)cin >> A[i];
  for(int i=0;i<M;i++)cin >> B[i] >> C[i];
  sort(A.begin(),A.end());
  vector<pair<long long,long long>> p(M);
  for(int i=0;i<M;i++)p[i]=make_pair(C[i],B[i]);
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  long long cnt=0;
  for(int i=0;i<M;i++){
    for(int j=0;j<p[i].second;j++){
      if(cnt>=N){goto abc;}
      else if(A[cnt]>=p[i].first){goto abc;}
      else{
        A[cnt]=p[i].first;
        cnt++;
      }
    }
  }
  abc:
  long long sum=0;
  for(int i=0;i<N;i++)sum+=A[i];
  cout << sum << endl;
}

Measured memory_bytes: 4608
#include <iostream>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl

int main() {
  string s;
  cin >> s;
  int g = 0;
  int ans = 0;
  for (const auto& e : s) {
    if (e == 'p') {
      if (g > 0)
        --g;
      else {
        ++g;
        --ans;
      }
    } else {
      if (g > 0) {
        --g;
        ++ans;
      } else
        ++g;
    }
  }
  OUT(ans);

  return 0;
}


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

constexpr long long INFLL = 1e18;

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

int main()
{

    int n;
    ll d;
    cin >> n >> d;

    ll a, b;
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a >> b;
        if (d * d >= a * a + b * b)
        {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}

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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()

using ll = long long;
using vint = vector<int>;

void Main() {
    int k, x;
    cin >> k >> x;
    int min_pos = max(x - (k - 1), -1000000);
    int max_pos = min(x + (k - 1), 1000000);
    for (int i = min_pos; i <= max_pos; ++i) {
        cout << i << " ";
    }
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
#define tl 1'000'000'007
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REREP(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
#define REFOR(i, n, a) for (ll i = n; i >= a; i--)
struct pref{
    int num,p,y;
};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false); 
    ll x,a,b;
    cin >> x >> a >> b;
    int f;
    if(b-a<=0) f= 1;
    else if(b-a<=x) f= 0;
    else f= -1;
    cout << ((f==1)?"delicious":((f==0)?"safe":"dangerous")) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
int main(){
  int N=0, A=0;
	std::cin >> N >> A;
  int amari = 0;
  amari = N % 500;
  if(A<amari) std::cout << "No" << std::endl;
  else std::cout << "Yes" << std::endl;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int n;
  cin >> n;
  for(int i = 0; n - i * 7 >= 0; ++i)
  {
    if ((n - i * 7) % 4 == 0)
    {
      cout << "Yes";
      return;
    }
  }
  cout << "No";
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3604
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int T = Integer.parseInt(sc.next());
        int A = Integer.parseInt(sc.next());
        int[] h = new int[N];
        double min = 10000000.0;
        int idx = 0;
        double t = 0.0;
        double dif = 0.0;
        for(int i=0; i<N; i++) {
            h[i] = Integer.parseInt(sc.next());
            t = (double)T - h[i]*0.006;
            if(t >= A) dif = t - A;
            else dif = A - t;
            if(min > dif) {
                min = dif;
                idx = i;
            }
        }
        System.out.println(idx+1);
    }
    
}

Measured memory_bytes: 23764
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		double x1,y1,x2,y2,x3,y3;
		scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
		double a1 = 2*(x2 - x1), b1 = 2*(y2 - y1);
		double c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
		double a2 = 2*(x3-x1), b2 = 2*(y3-y1);
		double c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
		double x = (b1*c2 - b2*c1)/(a1*b2 - a2*b1);
		double y = (c1*a2 - c2*a1)/(a1*b2 - a2*b1);
		double r = hypot(x-x1,y-y1);
		printf("%.3lf %.3lf %.3lf\n",x,y,r);
	}
}



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

// 0: 下、1: 右、2: 上、3: 左、4: 右下、5: 右上、6: 左上、7: 左下
vector<int> dx = {1, 0, -1, 0, 1, -1, -1, 1};
vector<int> dy = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
    // H x W の盤面を入力
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for (int i = 0; i < H; ++i) cin >> S[i];

    // 各マス (i, j) を順に処理
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            // 空きマス以外はそのまま
            if (S[i][j] != '.') continue;

            // 周囲 8 マスを順に見ていく
            int counter = 0;
            for (int d = 0; d < 8; ++d) {
                int ni = i + dx[d], nj = j + dy[d];
                if (ni < 0 || ni >= H || nj < 0 || nj >= W) continue;
                if (S[ni][nj] == '#') ++counter;
            }

            // マス (i, j) に個数を char 型に変換して記録
            S[i][j] = (char)('0' + counter);
        }
    }

    // 出力
    for (int i = 0; i < H; ++i) cout << S[i] << endl;
}

Measured memory_bytes: 3644
import heapq

x, y, z, k = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

e = []

for va in a:
    for vb in b:
        e.append(va+vb)

e.sort(reverse=True)
e = e[:k]

d = []
for ve in e:
    for vc in c:
        heapq.heappush(d, -(ve+vc))

for i in range(k):
    print(-heapq.heappop(d))


Measured memory_bytes: 147544
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	/** 最大値 */
	private static final int INF = Integer.MAX_VALUE >> 1;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), maxT = scanner.nextInt();
			int min = IntStream.range(0, n).map(i -> {
				int c = scanner.nextInt(), t = scanner.nextInt();
				return (t <= maxT) ? c : INF;
			}).min().getAsInt();
			System.out.println((INF == min) ? "TLE" : min);
		}
	}
}


Measured memory_bytes: 36376
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/**
*   author: j o s e m a g o
*   user: m a m i s a k i
**/
using namespace std;

/***PLANTILLA***/

using namespace __gnu_pbds; //*st.find_by_order(1);  st.order_of_key(p);
#pragma GCC optimize ("Ofast")
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mset(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define sz(x) ((int)(x).size())
#define rsz resize
#define ln "\n"
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef double dbl;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const ld PI = 2*acos(0.0);
const int MOD = 1000000007;

string tostring(auto a){
    stringstream ss;ss<<a;string s = ss.str();
    return s;
}

/**Mi Debug**/
#define var(x) cout<<#x<<" = ";
#define db(x) cout<<#x<<" = "<<x<<"\n";
void dbvector(vector<auto>&v){
    int c = -1;
    for(auto i: v){
        c++;cout<<"["<<c<<":"<<i<<"] ";
    }cout<<"\n";
}
void dbmapa(map<auto,auto>mp){
   for(auto x : mp) cout<<"{"<<x.first<<":"<<x.second<<"} ";cout<<"\n";
}
void dbstring(string v){
    int c = -1;
    for(auto i: v){
        c++;cout<<"["<<c<<":"<<i<<"] ";
    }cout<<"\n";
}

/***********Code***************/

const int JJJ = 100100;










int main(){

  //freopen("input.in","r",stdin);
  //freopen("input.out","w",stdout);

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

    int n;
    cin >> n;
    string s;
    cin >> s;
    int i = 0;
    int cont = 0;
    for(;i < n;){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
            cont++;
            i+=3;
        }
        else{
            i++;
        }
    }

    cout<<cont<<"\n";




    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class Problem {
    public static void Combination(int n, int x, int s, int t, int l, ref int c) {
        for (var i = s + 1; i <= n; i++) {
            if (l != 3) Combination(n, x, i, t + i, l + 1, ref c);
            else c += t + i == x ? 1 : 0;
        }
    }
    
    public static void Main() {
        var str = "";
        while ((str = Console.ReadLine()) != "0 0") {
            var data = str.Split().Select(int.Parse).ToArray();
            var count = 0;
            Combination(data[0], data[1], 0, 0, 1, ref count);
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 9568
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll N = 1e5+5;
ll x,y;
vi s(3);
vvi d(3,vi ());
int solve()
{	
	cin>>x>>y;

	rep(i,0,3) cin>>s[i];
	vi ans;
	rep(i,0,3) 
	{
		d[i].assign(s[i],-1);
		rep(j,0,s[i]) cin>>d[i][j];
		sort(d[i].begin(), d[i].end(),greater<ll> ());
		if(i==0) rep(j,0,x) ans.pb(d[i][j]);
		if(i==1) rep(j,0,y) ans.pb(d[i][j]);
		if(i==2) rep(j,0,min(x+y,s[i])) ans.pb(d[i][j]);
	}

	sort(ans.begin(), ans.end(),greater<ll> ());
	ll sum=0;
	rep(i,0,x+y) sum+=ans[i];
	cout<<sum<<"\n";



	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 8432
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
                                                                                                
  
int main(){
                                                                                                
   
    int n, i;

    char m;

         
    cin >> n;


    for( i = 0 ; i < n ; i = i + 1 ){

         cin >> m;

         if( m == 'Y'){

             cout << "Four" << endl;

             return 0;

             }

         }


    cout << "Three" << endl;


    return 0;
                                                          
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int a, b;
	cin >> a >> b;
	double db = (double)a / (double)b;
	cout << (a/b) << " " << (a%b) << " ";
	printf("%5lf\n",db);
	return 0;
}

Measured memory_bytes: 1244
import math
while True:
  try:
    n = int(input())
    primes = [1] * (n+1)
    for i in range(2, int(math.sqrt(n))+1):
      if primes[i] == 1:
        for j in range(i*i, n+1, i):
          primes[j] = 0
    print(sum(primes)-2) 
  except EOFError:
    break


Measured memory_bytes: 22156
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

typedef long long lint;
int main(){
    int x,y,n;
    cin >> n;
    cin >> x;
    cin >> y;
    vector<int> des((n * (n - 1)) / 2);
    int a,b,c;
    vector<int> cnt(n - 1);
    FOR(i,1,n + 1){
        FOR(j,i + 1,n + 1){
                a = abs(x - i) + 1 + abs(y - j);
                b= abs(y - i) + 1 + abs(x - j);
                c = j - i;
            //cout <<  << endl;
            cnt[min({a,b,c}) - 1]++;
        }
    }
    
    REP(i,n - 1){
        cout << cnt[i] << endl;
    }
}

Measured memory_bytes: 8064
S = input()
ACGT_str = 'ACGT'

res = 0
max_res = 0
for i in range(len(S)):
  flag = 0
  for j in range(len(ACGT_str)):
    if S[i] == ACGT_str[j]:
      flag = 1
  
  if flag == 1:
    res += 1
  else:
    if res > max_res:
      max_res = res
    res = 0

if res > max_res:
  max_res = res

print(max_res)


Measured memory_bytes: 38384
n=int(input())
print(n-1)
base=input()
def srh(n,t, str):
    print(((n - 1) // 2) + t)
    point = input()
    if point == 'Vacant':
        return
    if n % 4 == 1:
        if point == str:
            srh((n // 2) + 1, t, point)
        else:
            srh((n // 2) + 1, t + (n // 2), str)
    else:
        if point == str:
            srh(n // 2, t + (n // 2) + 1, str)
        else:
            if point == 'Male':
                srh(n // 2, t, 'Female')
            else:
                srh(n // 2, t, 'Male')
srh(n, 0, base)


Measured memory_bytes: 9208
#include <stdio.h>
#define MAX 100

int BubbleSort(int A[],int N){

  int flag =1;
  int i;
  int cnt=0;
  
  while(flag){
    flag =0;
    for(i=N-1; i>0; i--){
      if(A[i] < A[i-1]){
        int tmp;
        tmp = A[i];
        A[i] = A[i-1];
        A[i-1] = tmp;
        cnt++;
        flag=1;
      }
    }
  }
  return cnt;
}


int main(){
  int N;
  int A[MAX];
  int ans,i;

  scanf("%d",&N);
  for(i=0; i<N; i++) scanf("%d",&A[i]);

  ans = BubbleSort(A,N);
  for(i=0; i<N; i++){
    if(i !=0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",ans);

  return 0;
}



Measured memory_bytes: 2728
import java.lang.StringBuilder
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (0 until n).map { sc.next().toInt() }
    println(problem142c(n, a))
}

fun problem142c(n: Int, a: List<Int>): String {
    val dp = (0 until n).toMutableList()
    for (i in 0 until n) {
        dp[a[i] - 1] = i + 1
    }
    val sb = StringBuilder()
    dp.forEachIndexed { index, num ->
        sb.append(num)
        if (index != dp.size - 1) sb.append(" ")
    }
    return sb.toString()
}

Measured memory_bytes: 48664
void main()
{
    long a, b, c, k;
    rdVals(a, b, c, k);

    long total;
    long n = min(a, k);
    total += n;
    k -= n;
    n = min(b, k);
    k -= n;
    total -= k;

    total.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 2724
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>
#include <map>
#include <time.h>
using namespace std;

int main(){ 
	string S;
	int ans = 1e9;

	cin >> S;

	for (int i = 0; i < S.size() - 2; ++i){
		int tmp = (S[i + 0] - '0') * 100 + (S[i + 1] - '0') * 10 + (S[i + 2] - '0');
		if (ans > abs(753 - tmp)){
			ans = abs(753 - tmp);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
a = []
b = []

for _ in range(N):
    a.append(input())
for _ in range(M):
    b.append(input())
flg = True
for i in range(N):
    for j in range(N-M+1):
        #print(a[i][j:j+(M-1)])
        if a[i][j:j+M] == b[0]:
            if M == 1:
                print('Yes')
                exit()
            else:
                for k in range(1,M):
                    if a[k][j:j+M] != b[k]:
                        flg = False
                        break
                if flg:
                    print('Yes')
                    exit()
                else:
                    flg = True
print('No')

Measured memory_bytes: 9188
#include<stdio.h>
#include<math.h>
int fun(int n)
{
	if(n==1||n==0)
	return 0; 
	return ((n-1)+fun(n-1));
}
int main()
{
	int n,m,s;
	scanf("%d %d",&n,&m);
	s=fun(n)+fun(m);
	printf("%d",s); 
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];

    deque<ll> dq;    
    for(int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            dq.push_back(a[i]);
        } else {
            dq.push_front(a[i]);
        }
    }

    for(int i = 0; i < n; i++) {
        ll t;
        if (n % 2 == 0) {
            t = dq.front();
            dq.pop_front();
        } else {
            t = dq.back();
            dq.pop_back();
        }
        cout << t;
        if (i != n-1) cout << " ";
        else cout << endl;
        
        
    }

    return 0;
}

Measured memory_bytes: 6388
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <algorithm>
#include <iomanip>
int main()
{
	int X;
	std::cin >> X;
	std::cout << (X / 500) * 1000 + (X % 500) / 5 * 5 << std::endl;
	return 0;
}

Measured memory_bytes: 3620
N=gets.to_i
as=gets.split.map(&:to_i)
num_odd=0
num_4=0
num_2=0
as.each do |a|
  if a.odd?
    num_odd += 1
  else
    a % 4 == 0 ? num_4 += 1 : num_2 += 1
  end
end

if num_4 >= num_odd
  puts 'Yes'
elsif num_4 == num_odd-1
  puts num_2 == 0 ? 'Yes' : 'No'
else
  puts 'No'
end

Measured memory_bytes: 8452
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    string str;
    cin>>str;
    sort(str.begin(),str.end());
    if(str[0]==str[1] && str[2]==str[3] && str[1]!=str[3])
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256