akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

ll n;
mat a(20,vec(2));
ll dfs(set<ll> odd, ll res, ll id) {
  ll ans=inf;
  if(id==n) {
    vector<pll> od,ev;
    for(ll i=0;i<n;i++) {
      if(odd.count(i)) {
        ll tmp=a[i][(i+1)%2];
        od.push_back({tmp,i});
      }
      else {
        ll tmp=a[i][i%2];
        ev.push_back({tmp,i});
      }
    }
    sort(od.begin(),od.end());
    sort(ev.begin(),ev.end());
    vector<pll> so;
    for(ll i=0;i<n;i++) {
      if(i%2) {
        so.push_back(od[i/2]);
      }
      else {
        so.push_back(ev[i/2]);
      }
    }
    ll f=0;
    for(ll i=0;i<n-1;i++) {
      if(so[i].first>so[i+1].first) f=1;
    }
    if(f) return ans;
    ans=0;
    vec num(n);
    for(ll i=0;i<n;i++) {
      num[i]=i;
    }
    for(ll i=0;i<n;i++) {
      ll tmp=i;
      while(num[tmp]!=so[i].second) {
        tmp++;
      }
      for(ll j=tmp;j-1>=i;j--) {
        ll ch=num[j];
        num[j]=num[j-1];
        num[j-1]=ch;
        ans++;
      }
    }
  }
  else {
    if(res<n-id) ans=min(ans,dfs(odd,res,id+1));
    if(res!=0) {
      odd.insert(id);
      res--;
      ans=min(ans,dfs(odd,res,id+1));
    }
  }
  return ans;
}
 
int main() {
  
  cin >> n;
  
  for(ll i=0;i<2;i++) for(ll j=0;j<n;j++) cin >> a[j][i];
  set<ll> b;
  ll ans=dfs(b,n/2,0);
  if(ans==inf) ans=-1;
  cout << ans << endl;
}

Measured memory_bytes: 384
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)

using namespace std;
const int size1=405;
int a[size1]={0};
int pref[size1]={0};
int dp[size1][size1];
int calc(int ini,int fin){
	if(dp[ini][fin]!=-1)
		return dp[ini][fin];
	if(ini+1==fin)
		return dp[ini][fin]=a[ini]+a[fin];
	if(ini==fin)
		return dp[ini][fin]=0;
	int mn=1e18+5;
	for(int i=ini;i<fin;i++){
		int ans=calc(ini,i)+calc(i+1,fin)+pref[fin]-pref[ini-1];
		mn=min(ans,mn);
	}
	dp[ini][fin]=mn;
	return dp[ini][fin];
}
int solve()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		pref[i]=pref[i-1]+a[i];
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++)
			dp[i][j]=-1;
	}
	cout<<calc(1,n);
	return 0;
}
signed main()
{
	fastio;
	solve();
}



Measured memory_bytes: 4976
#include<stdio.h>
#define MAX 100000

int parent(int i) { return i/2; }
int left(int i) { return 2*i; }
int right(int i) { return 2*i+1; }

int main()
{
  int H,A[MAX+1];
  int i;
  
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
      }

  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(A[parent(i)] != 0) printf("parent key = %d, ",A[parent(i)]);
    if(A[left(i)] != 0) printf("left key = %d, ",A[left(i)]);
    if(A[right(i)] != 0) printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2108
#include<stdio.h>

int LinearSearch(int [],int,int);

int main(){
  int i,n,A[10001],q,key,sum = 0;

  scanf("%d",&n);
  for(i = 0;i< n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i = 0;i < q;i++){
    scanf("%d",&key);
    if(LinearSearch(A,n,key))
      sum++;
  }
  printf("%d\n",sum);

  return 0;
}

int LinearSearch(int A[],int n,int key){
  int i = 0;
  A[n] = key;
  while(A[i] != key){
    i++;
  }
  return i != n;
 }




Measured memory_bytes: 2108
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> d;

    int temp = 0;
    rep(i, n) {
        cin >> temp;
        d.push_back(temp);
    }
    sort(d.begin(), d.end());
    /*
        rep(i, n) { cout << d[i] << ","; }
        cout << endl;
    */
    int center = (n / 2) - 1;
    int ans = d[center + 1] - d[center];
    // cout << center << endl;
    cout << ans << endl;
}

Measured memory_bytes: 892
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.StringTokenizer;
class Graph {
    private int v;
    private LinkedList<Integer>[] adj_lists;
    private int[] maxLens;
    //node starts from 1;
    Graph (int v){
        this.v = v;
        adj_lists = new LinkedList[v + 1];
        maxLens = new int[v + 1];
        for (int i = 1; i < v + 1; i++){
            adj_lists[i] = new LinkedList<Integer>();
            maxLens[i] = 0;
        }
    }

    public void addEdge(int source, int dest){
        adj_lists[source].add(dest);
        //adj_lists[dest].add(source);
    }

    public LinkedList<Integer> getAdjs(int node){
        return adj_lists[node];
    }


  
  
  
  //updates the maxLens list which sroes the longest path for ecahnode
    public void DFS(int node, int[] dp, boolean visited[]){
        visited[node] = true;
        for (int child : getAdjs(node)){
            if (!visited[child]) DFS(child, dp, visited);
            dp[node] = Math.max(dp[node], 1 + dp[child]);
        }
    }

    public int findLongestPath(){
        boolean[] visited = new boolean[v + 1];
        for (int i = 1; i <= v; i++){
            DFS(i, maxLens, visited);
        }

        int ans = 0;
        for (int max : maxLens){
            ans = Math.max(ans, max);
        }
        return ans;
    }

}

public class Main{




 public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
 
        st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
 
        Graph g = new Graph(n);
 
        for(int i=0 ; i<m ; i++) {
            st = new StringTokenizer(br.readLine());
            int u = Integer.parseInt(st.nextToken());
            int v = Integer.parseInt(st.nextToken());
            g.addEdge(u, v);
        }
 
        int ans = g.findLongestPath();
        pw.print(ans);
        
        
        
        
        
        
        
        pw.flush();
        pw.close();
    }

}


Measured memory_bytes: 61884
box_a = []
box_b = []
tate, yoko = map(int, input().split())
[box_a.append( list(map(int, input().split())) ) for i in range(tate)]
[box_b.append( int(input()) ) for i in range(yoko)]

for i in range(tate):
    stuck = []
    [stuck.append(box_a[i][j]*box_b[j]) for j in range(yoko)]
    #print("DBG:: i={0} box_a={1} - box_b={2}".format(i, box_a, box_b))
    print(sum(stuck))

Measured memory_bytes: 8024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

string s;
cin >> s;
int n = SZ(s);

rep(i,n) {
    if(s[i]=='?') s[i] = 'D';
}

cout << s << endl;
return 0;
}

Measured memory_bytes: 3696
#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;;
using ll = long long;

int main() {
	
	int N;
	cin >> N;
	if (N % 2 == 1) {
		cout << (N / 2) + 1 << endl;
	}
	else { cout << N / 2 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	ll a, b, n;
	cin>>a>>b>>n;
	n=min(n, b-1);
	cout<<a*n/b<<endl;
	return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <queue>
#include <vector>
using namespace std;
typedef pair<int,int>  pi;
#define F first
#define S second
#define PB push_back
const int N=1e3+10;
const int INF=1e9+10;
int main(){
    int n,m,s,l,r,c,cnt=0,dis[N];
    bool went[N];
    vector<pi> graph[N];
    pi nxt;
    queue<pi> q;
    scanf("%d%d%d",&n,&m,&s);
    for(int i=0;i<n;i++){
        went[i]=false;
        dis[i]=INF;
    }
    dis[s]=0;
    while(m--){
        scanf("%d%d%d",&l,&r,&c);
        graph[l].PB({r,c});
    }
    q.push({s,0});
    while(!q.empty()){
        if(cnt>N*N){
            printf("NEGATIVE CYCLE\n");
            return 0;
        }
        cnt++;
        nxt=q.front();
        q.pop();
        if(nxt.S>dis[nxt.F]||went[nxt.F])continue;
        went[nxt.F]=true;
        for(pi i:graph[nxt.F])if(nxt.S+i.S<dis[i.F]){
            dis[i.F]=nxt.S+i.S;
            went[i.F]=false;
            q.push({i.F,dis[i.F]});
        }
    }
    for(int i=0;i<n;i++){
        if(dis[i]==INF)printf("INF\n");
        else printf("%d\n",dis[i]);
    }
}


Measured memory_bytes: 2800
#include <iostream>
#include <string>
using namespace std;
string arr[100000];
int main()
{
    int n=0,ACs=0,TLEs=0,WAs=0,REs=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=0;i<n;i++){
        if(arr[i]=="AC") {ACs++;}
        else if(arr[i]=="TLE") {TLEs++;}
        else if(arr[i]=="WA") {WAs++;}
        else if(arr[i]=="RE") {REs++;}
    }
    cout<<"AC x "<<ACs<<"\n";
    cout<<"WA x "<<WAs<<"\n";
    cout<<"TLE x "<<TLEs<<"\n";
    cout<<"RE x "<<REs<<"\n";


    return 0;
}


Measured memory_bytes: 6732
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    string s;cin>>n>>s;
    int res=0;
    for(int i=0;i<n-2;i++){
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')res++;
    }
    cout<<res<<endl;
}


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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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_MAX	2,147,483,647 = 2*1.0e9

const double INF = 2e9;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    int sumt = 0;
    vector<int> t(n+2,0);
    for(int i = 1; i <= n; i++){
        cin >> t[i];
        sumt += t[i];
    }
    vector<int> v(n+2,0);
    for(int i = 1; i <= n; i++) cin >> v[i];
    
    vector<int> s(n+2, 0);
    vector<int> e(n+2, 0);

    for(int i = 1; i <= n+1; i++){
       s[i] = e[i-1];
       e[i] = s[i]+t[i];
    }

    vector<double> vmax(sumt*2+1, INF);
    for(int i = 0; i < sumt*2+1; i++){
        double curt = i * 0.5;
        for(int j = 0; j < n+2; j++){
            double lim;
            if(curt < s[j]) lim = v[j] + s[j]-curt;
            else if(curt > e[j]) lim = v[j] + curt - e[j];
            else lim = v[j];

            if(lim < vmax[i]) vmax[i] = lim;
        }
    }
    double ans = 0;
    for(int i = 0; i < sumt*2; i++){
        ans += (vmax[i] + vmax[i+1])/4.0;
    }

    printf("%.8f\n", ans);
    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long sum = 0;
        for (int i = 1; i <= n; i++) {
            if (i % 3 == 0)
                continue;
            if (i % 5 == 0)
                continue;
            sum += (long) i;
        }
        System.out.println(sum);
    }

}


Measured memory_bytes: 27204
#include <bits/stdc++.h>
#define ll long long
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
using namespace std;
ll modpow(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res=res*a;
        a=a*a;
        b/=2;
    }
    return res;
}
int max(int a,int b){
    if(a>b)return a;
    else return b;
}

int main() {
   fast
    int a,b;
    cin>>a>>b;
    cout<<a*b;
    return 0;
        
   
   
}

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

using namespace std;

int
main(void){
	int n, k; cin >> n >> k;
	map<int, int > mp;
	int a;
	for(int i = 0; i < n; i++){
		cin >> a;
		mp[a]++;
	}
	vector<int> vec;
	for(map<int, int>:: iterator it = mp.begin(); it != mp.end(); it++){
		vec.push_back(it->second);
	}
	int ans = 0;
	sort(vec.begin(), vec.end());
	for(int i = 0; i < (int)mp.size() - k; i++){
		ans += vec[i];
	}
	cout << ans;
} 

Measured memory_bytes: 10748
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
#include<numeric>
//AtCoderC++.cpp

using namespace std;


inline int ceileing(int a, int b) {return a % b == 0 ? a / b : a / b + 1;}
int main() {
	string S; cin >> S;
	int border = 0;
	char prev = S[0];
	for (size_t i = 1; i < S.length(); i++) {
		if (prev != S[i])++border;
		prev = S[i];
	}
	cout << border << endl;
}


Measured memory_bytes: 512
while (m, f, r = gets.split.map(&:to_i)) != [-1, -1, -1]
  if m==-1 || f==-1
    puts "F"
  elsif m+f>=80
    puts "A"
  elsif m+f>=65
    puts "B"
  elsif m+f>=50 || r >=50
    puts "C"
  elsif m+f>=30
    puts "D"
  else
    puts "F"
  end
end


Measured memory_bytes: 6872
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE BangPatterns          #-}
{-# LANGUAGE CPP                   #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE RecordWildCards       #-}
{-# LANGUAGE TupleSections         #-}
{-# LANGUAGE TypeFamilies          #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import qualified Data.Foldable               as F
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    [n, m] <- map read.words <$> getLine :: IO [Int]
    digits <- U.unfoldrN m (B.readInt.B.dropWhile isSpace) <$> B.getLine
    print $ solve n digits

solve :: Int -> U.Vector Int -> Integer
solve n digits = memo V.! n
  where
    !score = U.accumulate max (U.replicate 10 minBound)
        . U.map (\d -> (cost U.! d, d))
        $ digits
    memo = V.generate (n + 1) $ \i -> do
        V.maximum $ V.map (\d -> f i d) $ U.convert digits
    f 0 _ = 0
    f rest d
      | cost U.! d <= rest = case memo V.! (rest - cost U.! d) of
          -1 -> -1
          x -> 10 * x + fromIntegral d
      | otherwise = -1

cost :: U.Vector Int
cost = U.fromList [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]

Measured memory_bytes: 16764
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;
map<string, int> msi;

int main() {
	cin >> n;
	rep(i, n) {
		string s, t;
		cin >> s >> t;
		if(s=="insert")msi[t] = 1;
		else {
			if (msi.find(t) == msi.end())cout << "no" << endl;
			else cout << "yes" << endl;
		}
	}
}

Measured memory_bytes: 36464
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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 P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  ll h, w;
  cin >> h >> w;

  if (h == 1 || w == 1) {
    cout << 1 << endl;
    return 0;
  }

  if ((h * w) % 2 == 0) {
    cout << (h * w) / 2 << endl;
  } else {
    cout << ((h * w) / 2) + 1 << endl;
  }
  return 0;
}


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

int main(){

cout<<fixed<<setprecision(12);
double a,b,C,h;
cin>>a>>b>>C;
C=C*acos(-1)/180;
h=b*sin(C);
double c=sqrt(a*a+b*b-2*a*b*cos(C));

cout<<a*h/2<<endl<<a+b+c<<endl<<h<<endl;


return 0;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll mod = 1e9 + 7;

ll mod_exp(ll a, ll b){
	if(b == 0)
		return 1ll;
	if(b % 2 == 0){
		ll t = mod_exp(a, b / 2) % mod;
		return t * t % mod;
	}
	return a * mod_exp(a, b - 1) % mod;
}

const int maxn = 2e5 + 5;

ll f[maxn];

ll inv(ll x){
	return mod_exp(x, mod - 2) % mod;
}

ll n_k(ll n, ll k){
	
	ll num = 1;
	for(ll i = n - k + 1; i <= n; i++)
		num = (num * i) % mod;
	ll den = 1;
	for(ll i = 1; i <= k; i++)
		den = (den * i) % mod;
	return num * inv(den) % mod;
	
}

ll get(ll n, ll x){
	return n_k(n, x);
}

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	f[0] = 1ll;
	for(ll i = 1; i < maxn; i++)
		f[i] = (f[i - 1] * i) % mod;
	
	
	ll n, a, b;
	cin >> n >> a >> b;
	
	ll total = (mod_exp(2ll, n) + mod - 1) % mod;
	
	//cout << total << endl;
	
	total = (total + mod - get(n, a)) % mod;
	total = (total + mod - get(n, b)) % mod;
	
	cout << total << endl;

	return 0;
}


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

struct node{
    struct node *right;
    struct node *left;
    struct node *parent;
    int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

void insert(int k){
    Node y = NIL;
    Node x = root;
    Node z;

    z = malloc(sizeof(struct node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while(x!=NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }
        else{
            x = x->right;
        }
    }
    z->parent = y;
    if(y == NIL){
        root = z;
    }
    else{
        if(z->key < y->key){
            y->left = z;
        }
        else{
            y->right = z;
        }
    }
}

void inorder(Node u){
    if(u == NIL){
        return;
    }
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}

void preorder(Node u){
    if(u == NIL){
        return;
    }
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n,i,x;
    char com[20];
    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%s",com);
        if(com[0] == 'i'){
            scanf("%d",&x);
            insert(x);
        }
        else if(com[0] == 'p'){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


Measured memory_bytes: 25140
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = Integer.parseInt(sc.next());
		int[] a = new int[N];
		int first = 0;
		int second = 0;
		int loc = 0;
		for (int i = 0; i < N; i++) {
			int k = Integer.parseInt(sc.next());
			if(second <= k) {
				if(first <= k) {
					second = first;
					first = k;
					loc = i;
				} else {
					second = k;
				}
			}
		}
		for (int j = 0; j < N; j++) {
			if(j == loc) {
				System.out.println(second);
			} else {
				System.out.println(first);
			}
		}
	}

}


Measured memory_bytes: 72608
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	lli N,M;
	cin>>N>>M;
	
	lli ans=0;
	if(N==1&&M==1) ans=1;
	else if(N==1) ans=M-2;
	else if(M==1) ans=N-2;
	else ans=(N-2)*(M-2);
	
	cout<<ans;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

    ll n,k,ans=0;
	cin >> n;

	for(ll i=1;i<n;i++){
		ans+=i;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
S=list(input())

numE=S.count('E')
numW=S.count('W')
ans=numE
tmp=numE
for i in range(N):
    if S[i]=='E':
        tmp = tmp-1
    elif S[i]=='W':
        tmp = tmp+1
    ans = min(tmp,ans)

print(ans)

Measured memory_bytes: 6048
n = int(input())
d = {}
for i in range(n):
  key = input()
  if key in d:
    d[key] += 1
  else:
    d[key] = 1

d_sort = sorted(d.items())
max_val = max(d.values())

for s, val in d_sort:
  if val==max_val:print(s)


Measured memory_bytes: 44124
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const [n, m] = input[0].split(" ").map((x: string): number => +x);

let sep = Math.floor(n / 2) + (n % 2 === 1 && ((n - 1) / 2) % 2 === 1 ? 1 : 0);

let cnt = 0;

let l_right = sep - 1;
if (l_right % 2 === 0) l_right -= 1;
for (let i = 0; i < l_right - i && cnt < m; i++) {
  console.log(`${i + 1} ${l_right - i + 1}`);
  cnt++;
}

let r_left = sep;
let r_right = n - 1;
if ((r_right - r_left) % 2 === 1) r_right -= 1;

for (let i = 0; r_left + i < r_right - i && cnt < m; i++) {
  console.log(`${r_left + i + 1} ${r_right - i + 1}`);
  cnt++;
}


Measured memory_bytes: 41232
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
a = LIST()

tmp1 = []
tmp2 = []

for i, a in enumerate(a):
    if i%2 == 0:
        tmp1.append(a)
    else:
        tmp2.append(a)
if n%2 == 0:
    print(*(tmp2[::-1]+tmp1))
else:
    print(*(tmp1[::-1]+tmp2))


Measured memory_bytes: 27328
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
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;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
const int INF=1e6;
const ll int MOD=998244353;

main(){
    int a=in(),b=in();
    if(a==1)a+=13;
    if(b==1)b+=13;
    if(a<b)cout<<"Bob";
    else if(a==b)cout<<"Draw";
    else cout<<"Alice";
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var r int
	fmt.Scan(&r)
	if r < 1200 {
		fmt.Println("ABC")
	} else if (1200 <= r) && (r < 2800) {
		fmt.Println("ARC")
	} else {
		fmt.Println("AGC")
	}
}


Measured memory_bytes: 512
S = input()
K = int(input())
anslist = []
for i in range(0, len(S)):
	now = ''
	for j in range(i, len(S)):
		now = now + str(S[j])
		flag = True
		if len(anslist) != K and now not in anslist:
			flag = False
			anslist.append(now)
		elif len(anslist) == K and now < anslist[-1] and now not in anslist:
			flag = False
			anslist[-1] = now
		elif now in anslist:
			flag = False
		anslist.sort()
		if flag:
			break
print(anslist[-1])

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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define Rep(i,n) for(ll i = 0; i <= n; i++)
#define REp(i,n) for(ll i = 1; i < n; i++)
#define REP(i,n) for(ll i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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 n;
  cin >> n;
  V<int> a(n);
  int mx = 0;
  rep(i,n) {
    cin >> a[i];
    chmax(mx, a[i]);
  }
  sort(all(a));
  int d = mx;
  double mid = (double)mx/2;
  P ans;
  rep(i,n) {
    if(abs(mid - (double)a[i]) < d) {
      ans = make_pair(mx, a[i]);
      d = abs(mid - (double)a[i]);
    }
  }
  cout << ans.fi << " " << ans.se << endl;
}

Measured memory_bytes: 3696
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scanner=new Scanner(System.in);
        int N=scanner.nextInt();
        List<Integer> cList=new ArrayList();
        List<Integer> sList=new ArrayList();
        List<Integer> fList=new ArrayList();
        for(int i=0;i<N-1;i++){
            cList.add(scanner.nextInt());
            sList.add(scanner.nextInt());
            fList.add(scanner.nextInt());
        }
        for(int i=0;i<N-1;i++){
            int result=cList.get(i)+sList.get(i);
            for(int j=1+i;j<N-1;j++){
                int k=calNextStartTime(result,sList.get(j),fList.get(j));
                result=k;
                result+=cList.get(j);
            }
            
            System.out.println(result);
        }
        System.out.println(0);
    }
    public static int calNextStartTime(int currentTime, int startTime, int termTime){
        if(currentTime<=startTime){
            return startTime;
        }else{
            if((currentTime-startTime)%termTime==0){
                return startTime+termTime*((currentTime-startTime)/termTime);
            }else{
                return startTime+termTime*((currentTime-startTime)/termTime+1);
            }
        }
    }
}


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

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

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}

use std::cmp::{max, min};

fn main() {
    let n: i64 = read();
    let mut p = vec![];
    for i in 0..n {
        let a: i64 = read();
        let b: i64 = read();
        p.push((a, b))
    }
    let mut ans = 0.0;

    for i in 0..n {
        for j in 0..n {
            if i != j {
                let a = p[i as usize].0;
                let b = p[i as usize].1;
                let c = p[j as usize].0;
                let d = p[j as usize].1;
                ans += ((a - c).pow(2) as f64 + (b - d).pow(2) as f64).sqrt();
            }
        }
    }
    println!("{}", ans / n as f64);
}


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

int main(){
    int n,a;
    int count=INFINITY,tmp=0;

    cin >> n;

    for(int i=0; i<n; i++){
        cin >> a;
        tmp = 0;
        while(a % 2 == 0){
            a /= 2;
            tmp++;
        }
        count = min(count, tmp);
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 2e5 + 10;
vector<ii> a[N];
struct Node {
  int a, b;
  Node *left, *right;
  int64 maxv;
  int64 delta;
  void update(int64 C) {
    delta += C;
    maxv += C;
  }
  void pushdown() {
    if (!delta) return;
    left->update(delta);
    right->update(delta);
    delta = 0;
  }
  void pushup() {
    maxv = max(left->maxv, right->maxv);
  }
};
Node pool[N << 1], *last = pool;

Node* new_node(int a, int b) {
  Node* cur = last++;
  cur->a = a;
  cur->b = b;
  cur->maxv = cur->delta = 0;
  return cur;
}

Node* build(int a, int b) {
  Node* cur = new_node(a, b);
  if (a + 1 == b) return cur;
  cur->left = build(a, (a + b) / 2);
  cur->right = build((a + b) / 2, b);
  return cur;
}

int A, B;
int64 C;
void update(Node* cur) {
  if (cur->a >= A && cur->b <= B) {
    cur->update(C);
    return;
  }
  cur->pushdown();
  if ((cur->a + cur->b) / 2 > A) update(cur->left);
  if ((cur->a + cur->b) / 2 < B) update(cur->right);
  cur->pushup();
}

int64 query(Node* cur) {
  if (cur->a >= A && cur->b <= B) {
    return cur->maxv;
  }
  int64 ret = -(1LL << 60);
  cur->pushdown();
  if ((cur->a + cur->b) / 2 > A) ret = max(ret, query(cur->left));
  if ((cur->a + cur->b) / 2 < B) ret = max(ret, query(cur->right));
  return ret;
}

int64 dp[N];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  while (m--) {
    int L, R, V;
    scanf("%d%d%d", &L, &R, &V);
    a[L].push_back({V, L});
    a[R + 1].push_back({-V, L});
  }
  Node* root = build(0, n + 1);
  for (int i = 1; i <= n; ++i) {
    for (auto& it : a[i]) {
      A = 0; B = it.second; C = it.first;
      update(root);
    }
    A = 0; B = i;
    dp[i] = query(root);
    A = i; B = A + 1; C = dp[i];
    update(root);
  }
  int64 ret = 0;
  for (int i = 1; i <= n; ++i) {
    ret = max(ret, dp[i]);
  }
  printf("%lld\n", ret);
  return 0;
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved

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

    long long a[n];
    rep(i,n)cin>>a[i];

    long long second[46];
    second[0]=1;
    long long sum[50];
    sum[0]=0;
    rep2(i,45){
        second[i]=second[i-1]*2;
        sum[i]=sum[i-1]+second[i-1];
        //cout<<sum[i]<<" ";
    }
    //cout<<endl;
    long long right=1e9;
    long long left=0;

    while(left+1<right){

        long long mid=(right+left)/2;

        long long cnt=0;
        //cout<<mid<<endl;
        rep(i,n){
            
            //if(a[i]<=mid)continue;

            cnt+=ceil(((double)a[i]/mid))-1;
            //cnt+=(a[i]+mid-1)/mid-1;
            
        }
        

        if(cnt>k){
            left=mid;
        }
        else{
            right=mid;
        }
    }
    //cout<<endl;

    cout<<right<<endl;
    return 0;

}
/*


*/


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

#define rep(i, a) for (int i = 0; i < (a); i++ )
#define FOR(i, m, n) for(int i = m; i < n; i++)
 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);


void bfs(vector<vector<int>> &G, vector<int> &d, vector<int> &C) {
    int cnt = 1;
    d[0] = C[C.size()-1];
    queue<int> q;
    q.push(0);  
    while(!q.size()==0) {
        int s;
        s = q.front();
        q.pop();
        for (auto v: G[s]) {
            if (d[v]==-1) { 
                q.push(v);
                d[v] = C[C.size()-1-cnt];
                cnt ++;
            }
        }
    }
}

int main(){    
    int N;
    cin >> N;

    vector<vector<int>> G(N);
    rep(i,N-1) {
        int a,b;
        cin >> a >> b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    vector<int> C;
    rep(i,N) {
        int c;
        cin >> c;
        C.push_back(c);
    }
    sort(C.begin(),C.end());

    vector<int> d(N,-1);

    bfs(G,d,C);

    int ans;
    ans = 0;
    rep(i,N-1) {
        ans+=C[i];
    }
    cout << ans << endl;
    rep(i,N) {
        //ans = C[N-1-d[i]];
        cout << d[i] << " ";
        //cout << ans << " ";
    }
    cout << endl;

    
}


Measured memory_bytes: 4052
import java.util.*;
import java.util.regex.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    scanner.nextLine();
    for (int ii = 0; ii < n; ii++) {
      String str = scanner.nextLine();
      Pattern pa = Pattern.compile("^>'(=+)#\\1~$");
      Pattern pb = Pattern.compile("^>\\^(?:Q=)+(?:~~)$");
      Matcher ma = pa.matcher(str);
      Matcher mb = pb.matcher(str);
      if (ma.find()) {
        System.out.println("A");
      } else if (mb.find()) {
        System.out.println("B");
      } else {
        System.out.println("NA");
      }
    }
  }
}

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

const int MAX = 510000;
const int mod = 1e9 + 7;

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

void COMinit() {
    fac[0] = fac[1] = 1;
    inv[1] = 1;
    finv[0] = finv[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;
    }
    return;
}

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, M;
    cin >> N >> M;
    vector<int> b;
    for (int i = 2; i * i <= M; ++i) {
        int cnt = 0;
        while (M % i == 0) {
            M /= i;
            ++cnt;
        }
        if (cnt) b.push_back(cnt);
    }
    if (M > 1) b.push_back(1);
    long long ans = 1;
    COMinit();
    for (int i = 0; i < b.size(); ++i) {
        (ans *= COM(b[i] + N - 1, b[i])) %= mod;
    }
    cout << ans << endl;

    return 0;
}

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


int main() {
	vector<int> a(3);
	for (int i = 0; i < 3; i++) cin >> a[i];

	sort(a.begin(), a.end());

	if (a[0] + a[1] == a[2]) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
from collections import deque
n = int(input())
a = list(input().split())
q = deque()
for i in range(n):
    if n&1:
        if i&1:
            q.append(a[i])
        else:
            q.appendleft(a[i])
    else:
        if i&1:
            q.appendleft(a[i])
        else:
            q.append(a[i])

for i in q:
    print(i,end=" ")

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

int main(){
  string str;
  cin >> str;
  ll i;
  ll count0 = 0, count1 = 0;  
  for(i = 0; i < str.size(); i++){
    if(str[i] == '0')
      count0++;
    else
      count1++;
    
  }
  ll result;
  result = 2 * min(count0, count1); 
  cout << result << endl;

  return 0;
}

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

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

	string s; cin >> s;
	int N = s.length();
	for (int i = 0; i < N - 2; i++) {
		if (s[i] == s[i + 2]) {
			cout << i + 1 << " " << i + 3;
			return 0;
		}
	}
	for (int i = 0; i < N - 1; i++) {
		if (s[i] == s[i + 1]) {
			cout << i + 1 << " " << i + 2;
			return 0;
		}
	}
	cout << -1 << " " << -1;
}

Measured memory_bytes: 512
import java.util.*;

class Main {
    public static void main(final String[] args) {
      Scanner sc = new Scanner(System.in);
      int s = sc.nextInt();
      int f = s/100;
      int b = s%100;

      if (f == 0 && b == 0) {
        System.out.println("NA");
        System.exit(0);
      }
      if ((f >= 1 && f <= 12) && (b >= 1 && b <= 12)) {
        System.out.println("AMBIGUOUS");
        System.exit(0);
      }
      if (f >= 1 && f <= 12) {
        System.out.println("MMYY");
        System.exit(0);
      } else {
        if (b >= 1 && b <= 12) {
          System.out.println("YYMM");
          System.exit(0);
        }
      }
      System.out.println("NA");
      System.exit(0);
    }
}

Measured memory_bytes: 21844
cards = {
        'S': [r for r in range(1,13+1)],
        'H': [r for r in range(1,13+1)],
        'C': [r for r in range(1,13+1)],
        'D': [r for r in range(1,13+1)],
        }
  
n = int(input())
for nc in range(n):
    (s, r) = input().split()
    index = cards[s].index(int(r))
    del cards[s][index]
  
for s in ['S', 'H', 'C', 'D']:
    for r in cards[s]:
        print(s, r)

Measured memory_bytes: 6724
#include <stdio.h>
#include <stdlib.h>

int main() 
{
	int n,k,q,i,j;
	scanf("%d%d%d",&n,&k,&q);
	int a[q],s[n];
	for(i=0;i<n;i++)
	{
		s[i]=k;
	}
	for(i=0;i<q;i++)
	{
		scanf("%d",&a[i]);
	}
	for(j=0;j<q;j++)
	{
		i=a[j];
		s[i-1]=s[i-1]+1;
		
	}
	for(i=0;i<n;i++)
	{
		if(s[i]-q>0)
		{
			printf("Yes\n");
		}
		else 
		{
			printf("No\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1280
# 16:00 - 16:09
N = int(input())

MAXA = 55555
P = []
X = [True]*(MAXA+1)
X[0] = X[1] = False
for i in range(MAXA+1):
    if X[i]:
        P.append(i)
        X[i::i] = [False]*(MAXA//i)
X = []
for p in P:
    if p%5==1:
        X.append(p)
print(*X[:N])

Measured memory_bytes: 3900
#include <stdio.h>

int main(){

  int a,b;
  char op;

  while(1){
    scanf("%d %c %d",&a,&op,&b);
    if(op=='?') break;
    if(op=='+') printf("%d",a+b);
    if(op=='-') printf("%d",a-b);
    if(op=='*') printf("%d",a*b);
    if(op=='/') printf("%d",a/b);
    printf("\n");
  }


  return 0;
}


Measured memory_bytes: 2700
#include<iostream>

using namespace std;

int main()
{
  string N;
  char c[1];
  int n;
  cin >> N;
  for(int i = 0 ; i < 3 ; i++)
  {
    c[0] = N[i];
    n = atoi(c);
    if( n == 7 )
    {
        cout << "Yes";
        break;
    }
    else if( n!= 7 && i==2)
      cout <<"No";
  }
  return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less 
#define pf printf
#define sc scanf
#define sf(xx) scanf("%lld",&xx)
#define INF (1<<30)-1+(1<<30)
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;

// a new data structure defined. Please refer below
// GNU link : https://goo.gl/WVDL6g
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

#define fast()    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
template<class T1> void deb(T1 e1)
{
	cout << e1 << endl;
}
template<class T1, class T2> void deb(T1 e1, T2 e2)
{
	cout << e1 << " " << e2 << endl;
}
template<class T1, class T2, class T3> void deb(T1 e1, T2 e2, T3 e3)
{
	cout << e1 << " " << e2 << " " << e3 << endl;
}
#define bug(x) cerr<<#x<<" is "<<x<<endl
#define all(x) (x).begin(), (x).end()
#define unik(v) (v).erase(unique(all(v)), v.end())
#define sz(x) ((ll) (x).size())
const ll MOD = 1000000007;
int main()
{

	ll t, n, m, x, y, b, sum = 0, x1 = 0, c = 0, x2 = 0, mx = 0, u = 1, mn = 1e9;
	cin >> x >> y;
	if (y % x == 0) deb(x + y);
	else deb(y - x);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define db double
#define iosks std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=3e5+10,M=3e4+10;
const ll inf=INT_MAX,mod=1e9+7;
const db pi=atan(1)*4;
ll pow2(ll a,ll b) {ll s=1; while(b) {if(b&1) s=(s*a)%mod; a=(a*a)%mod; b/=2; } return s;}
ll lcm(ll a,ll b) {return a/__gcd(a,b)*b; }
int read()
{
    int s=0,f=1; char ch=getchar();
    while(ch<'0'&&ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') {s=s*10+ch-'0'; ch=getchar();} return s*f;
}


int main()
{
    iosks;
    int a;
    cin>>a;
    if(a>=30) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}
/**
23
3 2 1
3 2 1

*/


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

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
#define tc int tt=1;cin>>tt;while(tt--)

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr<<name<<" : "<<arg1<<nl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble
    ll x;
    cin>>x;
    ll a=100;
    ll ans=0;
    while(a<x){
        a+=a/100;
        ans++;
    }
    cout<<ans<<nl;
    return 0;
}


Measured memory_bytes: 3612
import qualified Data.ByteString.Char8 as C
import Data.Maybe (isJust, fromJust)
import Control.Monad (replicateM)
import Data.List (sort, drop, length, filter, take)
import qualified Data.Vector.Unboxed as U

cReadLn :: IO Int
cReadLn = fst . fromJust . C.readInt <$> C.getLine

getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [n,c,k] <- getParms -- passengers, maximum num in a bus, and limit time
  ts <- (U.fromList . sort) <$> replicateM n cReadLn -- i-th passenger's arrival time
  print $ f c k ts

f :: Int -> Int -> U.Vector Int -> Int
f c k ts = solver c k ts 0
  where
    solver :: Int -> Int -> U.Vector Int -> Int -> Int
    solver _ _ ts n 
      | U.null ts = n
    solver c k ts n = solver c k qs (n+1)
      where p  = inABus c k ts
            qs = U.drop p ts

overWrap :: Int -> Int -> Int -> Int
overWrap k t0 t1 = (t0+k - t1)

inABus 
  :: Int -> Int -> U.Vector Int -> Int
inABus c k tt = U.length . U.filter (0<=) . U.map (overWrap k t) . U.take c $ tt
  where
    t = U.head tt

Measured memory_bytes: 30972