akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll x, n;
    cin >> x >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    ll ans = -LLONG_MAX;

    sort(ALL(a));

    ll d = 0;

    while (true)
    {
        if (find(ALL(a), x - d) == a.end())
        {
            cout << x - d << endl;
            break;
        }
        if (find(ALL(a), x + d) == a.end())
        {
            cout << x + d << endl;
            break;
        }
        d++;
    }
}

Measured memory_bytes: 3628
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Yes[2] = {"No", "Yes"};
string YES[2] = {"NO", "YES"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin >> x;
    cout << 800 * x - 200 * (x / 15);
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


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

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

    string ans;
    for(auto s : S){
        if(s=='0'){
            ans.push_back('0');
        }else if(s=='1'){
            ans.push_back('1');            
        }else if(s=='B' && ans.size()>0){
            ans.pop_back();
        }
    }
    cout<< ans <<endl;
    return 0;
}

Measured memory_bytes: 3624
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

//not accepted

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

//ll ncr(ll n,ll r){ll ans=1;r=min(r,n-r);for (int i=1;i<=r;i++){ans*=(n-r+i);ans/=i;}return ans;}

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI=3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

#define bip(n) __builtin_popcount(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctz(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clz(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffs(n)//index of first one bit!!

typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;

typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ld> vd;
typedef vector<ll> vl;

//#define fi1 ifstream fin("input.txt")
//#define of1 ofstream fout("output.txt")
//typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
#define int long long
#define fi first
#define se second

ll ss=0;

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  priority_queue<ll,vector<ll>,greater<ll> > upper;
    priority_queue<ll> lower;
  ll q;
  cin>>q;
  ll sum=0;
  ll tot=0;
  ll count=0;
  while(q--)
  {
    ll st;
    cin>>st;
    if(st==1)
    {
      ll a,b;
      cin>>a>>b;
      sum+=b;
      tot+=a;
      count++;
      if(lower.empty())
      {
        lower.push(a);
        ss+=a;
      }
      else
      {
        if(a<=lower.top())
        {
          lower.push(a);
          ss+=a;
        }
        else
        {
          upper.push(a);
        }
        if(lower.size()-upper.size()==2)
        { 
          upper.push(lower.top());               
          ss-=(lower.top());
          lower.pop();                     
        }
        if(upper.size()-lower.size()==1)
        {
          lower.push(upper.top());  
          ss+=(upper.top());
          upper.pop(); 
        }
      }
    }
    else
    {
      ll val=lower.top();
      ll pp=tot+sum+val-2*ss;
      if(!(count&1))
          pp=pp-val;
      cout<<val<<" "<<pp<<"\n";
    }
  }
    return 0;
}

Measured memory_bytes: 3828
#include<stdio.h>
#include<string.h>
char a[1000000];
int main()
{
	gets(a);
	int len=strlen(a);
	int b_cnt=0;
	long long sum=0;
	for(int i=0;i<len;i++)
	{
		if(a[i]=='B')
		{
			b_cnt++;
		}
		if(a[i]=='W')
		{
			sum+=b_cnt;
		}
	}
	printf("%lld",sum);
 } 

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main() {
	int a,b;
	cin>>a>>b;
  if(a+b==24)
    cout<<"0"<<endl;
	else if(a+b>24)
		cout<<(a+b-24)<<endl;
		else 
		cout<<a+b<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,m,l;
    cin>>n>>m>>l;
    int A[n][m];
    int B[m][l];
    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++){
        for(int j=0;j<l;j++){
            cin>>B[i][j];
        }
    }
    long long C[n][l];
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            long long c=0;
            for(int k=0;k<m;k++){
                c=c+A[i][k]*B[k][j];
                if(k==m-1){
                    C[i][j]=c;  
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            if(j==l-1){
                cout<<C[i][j]<<endl;
            }
            else{
                cout<<C[i][j]<<" ";
            }
        }
    }
}



Measured memory_bytes: 3212
import Foundation

let nm = readLine()!.split(separator:" ").map{Int($0)!}
let hill = readLine()!.split(separator:" ").map{Int($0)!}
var ans: Set<Int> = []
for _ in 1...nm[1]{
  let bridge = readLine()!.split(separator:" ").map{Int($0)!}
  if (hill[bridge[0] - 1] > hill[bridge[1] - 1]){
    ans.insert(bridge[1])
  }else if (hill[bridge[0] - 1] < hill[bridge[1] - 1]) {
    ans.insert(bridge[0])
  }else{
    ans.insert(bridge[0])
    ans.insert(bridge[1])
  }
}
print(nm[0] - ans.count)

Measured memory_bytes: 19032
A, B, C, X, Y = map(int, input().split())

cost = 0
if (A+B) < 2*C:
  cost += (A * X + B * Y)
elif (A+B) >= 2*C:
  cost += (C * min(X, Y) * 2)
  if max(X, Y) == X:
    if A < 2*C:
      cost += (A * abs(X-Y))
    else:
      cost += (2 * C * abs(X-Y))
  else:
    if B < 2*C:
      cost += (B * abs(X-Y))
    else:
      cost += (2 * C * abs(X-Y))
print(cost)
  

Measured memory_bytes: 3064
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

#define INF 99999999
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;

int main(void){
    int64_t n_s,n_c;
    
    cin >> n_s >> n_c;
    
    int64_t ret = 0;
    
    if( n_c - n_s * 2 < 0 ){
        ret = n_c/2;
    }else{
        ret += n_s;
        n_c -= n_s*2;
        
        ret += n_c/4;
    }
    
    cout << ret << endl;
    
    
    return 0;
}


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

ans = 0
for i in range(N-1):
    a = A[i]+A[i+1]
    if a > x:
        m = min(a-x,A[i+1])
        A[i+1] -= m
        ans += m
    a = A[i]+A[i+1]
    if a > x:
        A[i] -= a-x
        ans += a-x
print(ans)


Measured memory_bytes: 14052
a,b,c,d,e,f = gets.chomp.split.map(&:to_i)
x = []
y = []
0.upto(f) do |i|
  0.upto(f) do |j|
    x << 100*a*i + 100*b*j if 100*a*i + 100*b*j <= f
    y << c*i + d*j if c*i + d*j <= f
  end
end
x.sort!.uniq!
y.sort!.uniq!
ans_q = 0
ans_s = 0
max_c = 0
x.each do |w|
  y.each do |s|
    if w+s != 0 && s + w <= f && w >= 100*s/e && s.to_f/(w+s) >= max_c
      ans_q = w+s
      ans_s = s
      max_c = s.to_f/(w+s)
    end
  end
end
puts "#{ans_q} #{ans_s}"


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

using namespace std;

typedef long long ll;

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

    map<string,ll> ans;
    for (int i=0;i<N;i++) {
        sort(s[i].begin(), s[i].end());
        ans[s[i]]++;
    }

    ll sum=0;
    for (auto& i : ans) {
        sum += i.second * (i.second - 1) / 2;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 18176
#include<stdio.h>
int main()
{
	int A,B,C,d,s;
	scanf("%d%d%d",&A,&B,&C);
	d=B+C;
	s=A-d;
	if(s>0)
	{
		printf("0");
	}
	else
	{
		printf("%d",B+C-A);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }
 
 
 
int main(int argc, char const *argv[]) {
  int a,b;
  cin >> a >> b;
  if(a>=13) cout << b << endl;
  else if(a>=6) cout << b/2 << endl;
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
n, m = map( int, input().split() )
p = []
s = []
for _ in range( m ):
    p_i, s_i = input().split()
    p.append( int( p_i ) )
    s.append( str( s_i ) )

aced = [ False for _ in range( n ) ]
wa_cnt = [ 0 for _ in range( n ) ]

for i in range( m ):
    if s[ i ] == "AC":
        aced[ p[ i ] - 1 ] = True
    elif aced[ p[ i ] - 1 ] == False:
        wa_cnt[ p[ i ] - 1 ] += 1

ac_cnt = 0
penalty = 0

for i in range( n ):
    if aced[ i ] == True:
        ac_cnt += 1
        penalty += wa_cnt[ i ]

print( ac_cnt, penalty )

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

typedef long long ll;
const int INF = 1e9;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin>>n;
	cout<<n/2+n%2<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ (*istream_iterator<int>(cin))
#define em emplace

using namespace std;
const int N = 1e5+10;

set<int> g[N];
int deg[N];

int dfs(int u, int p, int s, int t) {
    if(u == s && u != p) return -1;
    if(u == t) return 1;
    for(auto i=g[u].begin(); i!=g[u].end();) {
        int v = *i;
        i = g[u].erase(i);
        if(v == p) continue;
        int d = dfs(v, u, s, t);
        if(d) return d;
    }
    return 0;
}

int main() {
    int n = _;
    int m = _;
    for(; m--;){
        int u = _, v = _;
        g[u].em(v);
        g[v].em(u);
        deg[u]++;
        deg[v]++;
    }
    int d6 = 0, d1 = 0, d4 = 0, a = 0, b;
    for(int i=1; i<=n; i++) {
        if(deg[i] >= 6) d6++;
        if(deg[i] == 4) d4++, (a ? b : a) = i;
        if(deg[i]&1) d1++;
    }
    if(d1) {
        cout << "No";
        return 0;
    }
    if(d6) {
        cout << "Yes";
        return 0;
    }
    if(d4 > 2) {
        cout << "Yes";
        return 0;
    }
    if(d4 < 2) {
        cout << "No";
        return 0;
    }
    if(dfs(a, a, a, b) + dfs(a, a, a, b) + dfs(a, a, a ,b) == 1) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 16640
from bisect import bisect_left
N = int(input())
L = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        a = L[i]
        b = L[j]
        ind = bisect_left(L,a+b)
        cnt += ind-j-1
print(cnt)

Measured memory_bytes: 74612
import qualified Data.ByteString.Char8 as BC
import qualified Data.IntMap as M
import Data.Maybe (fromJust)
import Data.List

main = do
  [n, t] <- map read . words <$> getLine :: IO [Int]
  (a:as) <- getIntListBC
  let diff = solve as a a
      ans = reverse . group . sort $ diff
  print $ length $ head ans

bsToInt :: BC.ByteString -> Int
bsToInt = fst . fromJust . BC.readInt

getIntListBC :: IO [Int]
getIntListBC = map bsToInt . BC.words <$> BC.getLine

solve :: [Int] -> Int -> Int -> [Int]
solve []     _   _   = []
solve (x:xs) min max
  | x <= min = solve xs x x
  | x >= max = (x - min) : (solve xs min x)
  | otherwise = solve xs min max


Measured memory_bytes: 18300
#include <bits/stdc++.h>
using namespace std;
//#define int long long
typedef pair<int,int> ii;
typedef tuple<int,int,int> iii;
#define ll long long
#define miniiPQ priority_queue<ii,vector<ii>,greater<ii> >
#define minPQ priority_queue<int,vector<int>,greater<int> >
#define PQ priority_queue<int>
#define iiPQ priority_queue<ii>
#define US unordered_set<int>
#define UMS unordered_multiset<int>
#define UM unordered_map<int>
#define ST stack<int>
 
void m1(){
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  if(a == 0) cout << 1;
  else if(b == 0) cout << 2;
  else if(c == 0) cout << 3;
  else if(d == 0) cout << 4;
  else cout << 5;
}
 
/*
void m2(){
  int t; cin >> t;
  while(t--) m1();
}
*/
 
int main(){
  //freopen("in.txt","r",stdin);
  m1();
  //m2();
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
long long pd[110];
long long GCD(long long a,long long b)
{
    if(a<b)
    {
        long long c;
        c=a;
        a=b;
        b=c;
    }
    return b==0?a:GCD(b,a%b);
}
int main()
{
    int n;
    while(cin>>n)
    {
        long long mn,sum=1;
        cin>>pd[0];
        mn=pd[0];
        for(int i=1;i<n;i++)
        {
            long long c;
            cin>>pd[i];
            if(GCD(pd[i],mn)==1)mn=mn*pd[i];
            else {
                c=GCD(pd[i],mn);
                mn=mn/c*pd[i];
            }
 
        }
 
        cout<<mn<<endl;

 
    }
    return 0;
	}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import *

N, X, M = map(int, input().split())
now = X
l = [X]
s = set()
s.add(X)

for i in range(N-1):
    now = now*now%M
    
    if now in s:
        for i in range(len(l)):
            if l[i]==now:
                mark = i
                break
        
        ans = sum(l[:mark])
        siz = len(l)-mark
        tot = sum(l[mark:])
        ans += (N-mark)//siz*tot
        ama = (N-mark)%siz
        
        for i in range(mark, mark+ama):
            ans += l[i]
        
        print(ans)
        exit()
    
    l.append(now)
    s.add(now)

print(sum(l))

Measured memory_bytes: 78112
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

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

  // vector<int> h;
  // for (int i = 0; i < N; ++i) {
  //   int hin;
  //   cin >> hin;
  //   h.push_back(hin);
  // }


  cout << N * (N - 1) / 2;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int h,w,n;
int main()
{
	//freopen("1.in","r",stdin);
	cin>>h>>w>>n;
	int c=max(h,w);
	if(n%c==0) cout<<n/c;
	else       cout<<n/c+1;
	return 0;
}

Measured memory_bytes: 384
#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;

int main()
{

    //freopen("input.txt", "r", stdin); // for getting input from input.txt
    //freopen("output.txt", "w", stdout);// for writing output to output.txt

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, cycle_length, acyclic_steps;
    long long int k;
    vector<int> path; //a vector containing all the cities we will visit in order of visit
    
    cin>>n>>k;

    int cities[n+1]={}, visited[n+1]={};

    for (int i = 1; i < n+1; ++i)
    {
        cin>>cities[i];
    }

    path.push_back(1);

    int curr=1; //current city being visited
    visited[1]++; //we start off with visiting the first city

    while(visited[curr]<2) //as long as a city haven't been visited more than once...
    {
        path.push_back(cities[curr]); //add the next city we will visit to our path of cities visited
        visited[cities[curr]]++; //add to visit count of the next city
        curr = cities[curr]; //update the current city address to the next city
    }

    //at the end of the previous while() loop, curr contains the last visited city, which was basically the city at the start and the end of the loop.

    /*for (int i = 0; i < path.size(); ++i)
    {
        cout<<path[i]; //see which cities you have visited in order of visit
    }
    cout<<endl;*/

    for (int i = 0; i < path.size()-1; ++i)
    {
        if(path[i]==curr) //if the ith visited city matches the city at the end of the loop, it must be the start of the loop
        {
            cycle_length = (path.size()-1) -i; 
            acyclic_steps = (path.size()-1) - cycle_length;
            break;
        }
    }

    //cout<<endl<<acyclic_steps<<" "<<cycle_length<<endl;

    if(k<n) //if the steps to be taken ends before the cycle even begins
        cout<<path[k]; //the kth city in order of visit is the one the king will end up on
    else
        cout<<path[(k - acyclic_steps)%cycle_length + acyclic_steps];

        //first few steps will be taken to visit the acyclic cities, the rest of the steps will go around in circles among
        //the cyclic cities. So the k-acyclic_steps will be taken to taken n rounds which brings us to the start of the cycle again
        //and the remainder takes us away from the start
}

Measured memory_bytes: 5768
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
typedef long long int ll;
int n, ans;
int num[111111];
int after[111111];
pair<int, int> loc[111111];
int main(void)
{
	scanf("%d",&n);
	int i;
	for(i=1 ; i<=n ; i++)
	{
		scanf("%d",&num[i]);
		after[i]=num[i];
		loc[i].first=i;
	}
	sort(after+1,after+n+1);
	for(i=1 ; i<=n ; i++)
	{
		loc[i].second=lower_bound(after+1,after+n+1,num[i])-after;
	}
	for(i=1 ; i<=n ; i++)
	{
		if(loc[i].first%2==1 && loc[i].second%2==0)
		{
			ans++;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if (a>b) {
      printf("a > b\n");
    } else if (a<b) {
      printf("a < b\n");
    } else {
      printf("a == b\n");
    }
    return 0;
    }



Measured memory_bytes: 2040
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int X,A; cin >> X >> A;
    if(X<A) cout << 0 << endl;
    else cout << 10 << endl;
    return 0;
}


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

typedef long long i64;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}

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

  int a, b;
  while(cin >> a >> b, !cin.eof()) cout << gcd(a, b) << " " << lcm(a, b) << endl;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define rt return 0
#define endln "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (lli)(x.size())
const lli MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
// cout << fixed << setprecision(0) << pi <<endl;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// for multiset
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

void solve() {
    lli h, w, k;
    cin >> h >> w >> k;
    vector<string> store;
    string st;

    for (lli i = 0; i < h; i++) {
        cin >> st;
        store.pb(st);
    }

    lli ans = 0;
    lli a = pow(2, h);
    lli b = pow(2, w);

    for (lli i = 0; i < a; i++) {
        lli no = i, cnt = 0;
        vector<lli> rows;
        while (no > 0) {
            lli rem = no % 2;
            if (rem == 1) {
                rows.pb(cnt);
            }
            no /= 2;
            cnt++;
        }
        for (lli j = 0; j < b; j++) {
            vector<string> tmp = store;
            lli no = j, cnt = 0;
            vector<lli> cols;
            while (no > 0) {
                lli rem = no % 2;
                if (rem == 1) {
                    cols.pb(cnt);
                }
                no /= 2;
                cnt++;
            }

            for (auto val1 : rows) {
                for (int p = 0; p < w; p++) {
                    tmp[val1][p] = '.';
                }
            }
            for (lli p = 0; p < h; p++) {
                for (auto val2 : cols) {
                    tmp[p][val2] = '.';
                }
            }

            lli check = 0;
            for (lli ii = 0; ii < h; ii++) {
                for (lli jj = 0; jj < w; jj++) {
                    if (tmp[ii][jj] == '#') {
                        check++;
                    }
                }
            }
            if (check == k) {
                ans++;
            }
        }
    }

    cout << ans << endl;
}

int main(void) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // lli t; cin >> t; while(t--)
    solve();
    rt;
}

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

int main() {
  string N; cin >> N;
  int a; 
  a=N.size()-1;
  if (N.at(a)=='1') cout << "pon" << endl;
   if (N.at(a)=='2') cout << "hon" << endl;
   if (N.at(a)=='3') cout << "bon" << endl;
   if (N.at(a)=='4') cout << "hon" << endl;
   if (N.at(a)=='5') cout << "hon" << endl;
   if (N.at(a)=='6') cout << "pon" << endl;
   if (N.at(a)=='7') cout << "hon" << endl;
   if (N.at(a)=='8') cout << "pon" << endl;
   if (N.at(a)=='9') cout << "hon" << endl;
   if (N.at(a)=='0') cout << "pon" << endl;
}

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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */

signed main() 
{
  int n;
  cin >> n;
  print(24-n+24);
  return 0;
}

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


int main()
{
  int n;
  cin>>n;
  int ac=0,tle=0,wa=0,re=0;
  while(n--)
  {
    string s;
    cin>>s;
    if(s=="AC")
      ac++;
    if(s=="TLE")
      tle++;
    if(s=="RE")
      re++;
    if(s=="WA")
      wa++;
  }
  cout<<"AC x "<<ac<<endl;
  cout<<"WA x "<<wa<<endl;
  cout<<"TLE x "<<tle<<endl;
  cout<<"RE x "<<re<<endl;
}

Measured memory_bytes: 3608
#include<cstdio>
const int MaxN=300010;
const long long inf=1ll<<61;
int N,L,x[MaxN],t[MaxN];
bool ty[MaxN][2];
void cmin(long long&a,long long b){b<a?a=b:1;}
int main(){
	scanf("%d%d",&N,&L);
	for(int i=1;i<=N;i++)scanf("%d",x+i);
	long long ans=1;
	for(int i=1;i<=N;i++){
		scanf("%d",t+i);
		ans+=--t[i]/(2*L)+1;
		t[i]%=2*L;
		if(t[i]<2*x[i])ty[i][0]=1;
		if(t[i]<2*(L-x[i]))ty[i][1]=1;
		if(i==N&&ty[i][1])--ans;
	}
	int c0=0,c1=0,c2=0;
	for(int i=1;i<N;i++){
		if(ty[i][0]){
			++c0;
			if(ty[i][1])++c2;
		}
		else if(ty[i][1])++c1;
		while(c2&&c0-c1-c2*2<0)--c2;
		while(c1&&c0-c1<0)--c1;
	}
	ans-=c1+c2;
	printf("%lld\n",ans*2*L);
}

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

using namespace std;

#define ll long long

signed main() {
	int n; cin >> n;
	priority_queue<double, vector<double>, greater < double > > q;
	for (int i = 0; i < n; ++i) {
		double vi; cin >> vi;
		q.push(vi);
	}
	while (q.size() >= 2) {
		double v1 = q.top();
		q.pop();
		double v2 = q.top();
		q.pop();
		q.push((v1 + v2) / 2);
	}

	cout << setprecision(11) << q.top() << endl;

	return 0;
}

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

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

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

    int p[N];

    REP(i, N)
    {
        cin >> p[i];
    }

    sort(p, p+N);

    int sum=p[N-1]/2;

    REP(i, N-1)
    {
        sum += p[i];
    }

    cout << sum << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#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(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll INFS=1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);

int main() {
  string s;
  cin>>s;
  int n = len(s);
  int ans = INF;
  for (char c = 'a'; c <= 'z'; ++c) {
    vi a(n);
    rep(i,n) {
      a[i] = s[i] == c;
    }
    while (a != vi(sz(a),1)) {
      vi p(sz(a)-1); swap(a,p);
      rep(i,sz(a)){
        a[i] = p[i]||p[i+1];
      }
    }
    mins(ans, n-sz(a));
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3608
#include<iostream>

using namespace std;
int main(){
	int N;
	int ans;
	cin>>N;
	if(N<10){
		ans=N;
	}else if(N<100){
		ans=9;
	}else if(N<1000){
		ans=9+N-99;
	}else if(N<10000){
		ans=9+999-99;
	}else if(N<100000){
		ans=9+999-99+N-9999;
	}else{
		ans=9+999-99+99999-9999;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
  vector<char> symbol(4);
  for(int i=0; i<4; i++){
    cin >> symbol[i];
  }
  
  int p=0;
  int n=0;
  
  for(int i=0; i<4; i++){
    if(symbol[i] == '+'){
      p++;
    }
    else{
      n++;
    }
  }
  
  cout << p-n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1e+9;

int main()
{
	int x, y = 0;
	cin >> x >> y;

	cout << x + (y / 2) << "\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N, K, X, Y;
		N = in.nextInt();
		K = in.nextInt();
		X = in.nextInt();
		Y = in.nextInt();
		
		if (N > K) {
			int temp = N - K;
			System.out.println((X*K)+(Y*temp));
		} else {
			System.out.println((X*N));
		}
	}
}


Measured memory_bytes: 9428
#include <cstdio>

using namespace std;

#define MOD 1000000007

int N;
long long A[300005];
long long sum;

int main()
{
    scanf("%d\n", &N);
    for (int i = 0; i < N; i++) scanf("%lld", &A[i]);
    for (int k = 0; k <= 60; k++)
    {
        int nZero = 0, nOne = 0;
        for (int i = 0; i < N; i++)
        {
            if (A[i] & ((long long) 1 << k)) nOne++;
            else nZero++;
        }
        //printf("zero: %d; one: %d; 1 << %d: %lld\n", nZero, nOne, k, (long long) 1 << k);
        sum += (nZero * (nOne * (((long long) 1 << k) % MOD) % MOD) % MOD) % MOD;
        sum %= MOD;

    }
    printf("%lld\n", sum);
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
map<int,int> mope[51];
signed main(){
	int n,a;
	cin>>n>>a;
	vector<int> x(n);
	for(int i=0;i<n;i++){
		cin>>x[i];
		x[i] -= a;
	}
	mope[0][0] = 1;
	for(int i=1;i<=n;i++){
		int cur = x[i-1];
		for(int j = -3000; j<=3000; j++){
			mope[i][j+cur] += mope[i-1][j];
			mope[i][j] += mope[i-1][j];
		}
	}
	cout<<mope[n][0]-1<<endl;
	return 0;
}

Measured memory_bytes: 19584
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

int main(){
	
	ll N;
	cin >> N;
	ll ma = 0;
	for(ll i = 0;i * i <= N; i++) ma = i;
	
	cout << ma * ma << endl;
	
	
	
    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
s = N.times.map{ gets }
M = gets.to_i
t = M.times.map{ gets }
u = s.uniq
ans = []

u.length.times do |i|
  ans << s.count(u[i]) - t.count(u[i])
end

puts ans.max < 0 ? 0 : ans.max

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

typedef long long ll;

int main(void) {
    ll x;
    cin >> x;
    int i = 0;
    while (true) {
        if (2 * x <= i * (i+1)) {
            cout << i << endl;
            return 0;
        }
        i++;
    }
}


Measured memory_bytes: 256
N = input()
n = list(raw_input().split())
b = list(n)
for i in range(N-1):
	for j in range(N-i-1):
		if b[j][1] > b[j+1][1]:
			w = b[j]
			b[j] = b[j+1]
			b[j+1] = w
print " ".join(b[i] for i in range(N))
print "Stable"
for i in range(N-1):
	m = i
	for j in range(i+1,N):
		if n[m][1] > n[j][1]:
			m = j
	if m != i:
		w = n[i]
		n[i] = n[m]
		n[m] = w
print " ".join(n[i] for i in range(N))
if b == n:
	print "Stable"
else:
	print "Not stable"

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

 bool is_prime(int x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
int main() {
  int n;
  cin >>n;
  int count=0;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(is_prime(a))count++;
  }
  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
#define MAX 2000000
#define NIL -1
int A[MAX+1],H;
int left(int i){ return 2*i;}
int right(int i){ return 2*i+1;}
int parent(int i){ return i/2;}

/*void print(int u){
  printf("node %d: key = %d, ",u,A[u]);
  if(u>1) printf("parent key = %d, ",A[parent(u)]);
  if(left(u)<=n) printf("left key = %d, ",A[left(u)]);
  if(right(u)<=n) printf("right key = %d, ",A[right(u)]);
  printf("\n");
}*/

void maxHeapify(int i){
  int l,r,largest,tmp;
  l=left(i);
  r=right(i);

  if(A[i]<A[l]&&l<=H) largest=l;
  else largest=i;
  if(A[largest]<A[r]&&r<=H) largest=r;

  if(largest!=i){
    tmp=A[i]; A[i]=A[largest]; A[largest]=tmp;
    maxHeapify(largest);
  }
}
/*void buildMaxHeap(void){
  int i;
  for(i=n/2;i>0;i--) maxHeapify(i);
  }*/
void heapincreaseKey(int i,int key){
  int tmp;
  A[i]=key;
  while(i>1 && A[parent(i)]<A[i]){
    tmp=A[i]; A[i]=A[parent(i)]; A[parent(i)]=tmp;
    i=parent(i);
  }
}
void insert(int key){
  H++;
  A[H]=NIL;
  heapincreaseKey(H,key);
}

int extract(void){
  int max=A[1];
  A[1]=A[H--];
  maxHeapify(1);
  return max;
}
int main(){
  int i,key;
  char com[10];
  while(1){
    scanf("%s",com);
    if(com[0]=='i'){
      scanf("%d",&key);
      insert(key);
    }else if(strcmp(com,"extract")==0){
      printf("%d\n",extract());
    }else break;
  }
  return 0;
}




Measured memory_bytes: 5648
N, K, C = map(int, input().split())
S = input()

l = []
r = []

i = 0
j = N-1

while i < N and len(l) < K:
    if S[i] == 'o':
        l.append(i)
        i += C
    i += 1

while j >= 0 and len(r) < K:
    if S[j] == 'o':
        r.append(j)
        j -= C
    j -= 1

r.reverse()

for i in range(K):
    if l[i] == r[i]:
        print(l[i]+1)



Measured memory_bytes: 83208
#include<bits/stdc++.h>
using namespace std;
int main(){
  int q1, b, c1, c2, q2;
  while(cin >> q1, q1){
    cin >> b >> c1 >> c2 >> q2;

    int jibard = min( q2, b / c1);
    b -= jibard * c1;

    int nobard = b / c2;
    b -= nobard * c2;

    while( jibard && jibard + nobard < q1){
      jibard--;
      b += c1;
      int nextnb = b / c2;
      nobard += nextnb;
      b -= nextnb * c2;
    }

    if(jibard) cout << jibard << " " << nobard << endl;
    else cout << "NA" << endl;
  }
}

Measured memory_bytes: 1156
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

#ifdef DEBUG
#define dprintf      printf
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(1){}else
#define drep(i,n)    if(1){}else
#define dstop()      if(1){}else
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__);
#define array(T,id,n) T id[n]; rep(i,n)cin>>id[i];

//#define int long long;
#ifndef int
#define INF (0x7fffffff)
#else
#define INF (0x7fffffffffffffff)
#endif

typedef  long long           ll;
typedef  unsigned            ui;
typedef  unsigned long long  ull;
typedef  pair<int,int>       i_i;
typedef  pair<ll,int>        ll_i;
typedef  pair<ll,ll>         ll_ll;
typedef  pair<double,int>    d_i;
typedef  pair<double,double> d_d;

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  in(int,n);
  cout<<"ABC"<<n<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

const int INF = 1e9 + 10;

string S;

int main() {
    cin >> S;
    int pref = (S[0] - '0')*10 + (S[1] - '0');
    int suff = (S[2] - '0')*10 + (S[3] - '0');
    if (0 < pref && pref <= 12 && 0 < suff && suff <= 12) {
        cout << "AMBIGUOUS" << endl;
        return 0;
    }
    if (0 < pref && pref <= 12) {
        cout << "MMYY" << endl;
        return 0;
    }
    if (0 < suff && suff <= 12) {
        cout << "YYMM" << endl;
        return 0;
    }
    cout << "NA" << endl; 
}

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

using namespace std;

int first_start(int n, int a[]) {
    return a[n-1] - a[0];
}

int max_between(int n, int k, int a[]) {
    int i, tmp = 0, max = 0, start_house = 0;
    for(i = 0; i < n-1; i++) {
        tmp = a[i+1] - a[i];
        if(max < tmp) {
            max = tmp;
            start_house = i+1;
        }
    }
    return k - a[start_house] + a[start_house-1];
}

int main() {
    int k, n;
    cin >> k >> n;
    int a[n], i;
    for(i = 0; i < n; i++) {
        cin >> a[i];
    }
    cout << min(first_start(n, a), max_between(n, k, a)) << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <numeric>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <thread>
#include <tuple>
#include <limits>

using namespace std;

int main() {
  int n;
  long long K;
  scanf("%d%lld", &n, &K);
  vector<int> dat(n);
  for (int i = 0; i < n; i++) { scanf("%d", &dat[i]); }
  long long ans = 0;
  const int mod = 1'000'000'007;
  const long long c1 = K*(K + 1) / 2 % mod;
  const long long c2 = K*(K - 1) / 2 % mod;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      if (dat[j] > dat[i]) {
        ans += c1;
      }
    }
    for (int j = i + 1; j < n; j++) {
      if (dat[j] > dat[i]) {
        ans += c2;
      }
    }
    ans %= mod;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal
from argparse import ArgumentParser

args=ArgumentParser()
args.add_argument('-loc', '--local', type=bool,default=False)
LOCAL=args.parse_args().local

def input(): 
    x=sys.stdin.readline(); 
    if x[-1]=="\n": 
        return x.rstrip() 
    return x
    
def printe(*x):_=print("## ",*x,file=sys.stderr) if LOCAL else 0
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): #xは64bit整数
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f

def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    #N = int(input())
    a,b = input().split()
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    l=[a,b]

    print(l[1]+l[0])



if __name__ == "__main__":
    main()

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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

const string Yes = "Yes";
const string NO = "No";

void solve(std::vector<std::vector<long long>> A, long long N,
           std::vector<long long> b) {
    set<int> S;
    for (int i = 0; i < N; i++) {
        S.insert(b[i]);
    }
    for (int i = 0; i < 3; i++) {
        if( S.count(A[i][0]) && S.count(A[i][1]) && S.count(A[i][2]) ){
            cout << "Yes" << endl;
            return;
        }
        if( S.count(A[0][i]) && S.count(A[1][i]) && S.count(A[2][i]) ){
            cout << "Yes" << endl;
            return;
        }
    }
    if( S.count(A[0][0]) && S.count(A[1][1]) && S.count(A[2][2]) ){
        cout << "Yes" << endl;
        return;
    }
    if( S.count(A[0][2]) && S.count(A[1][1]) && S.count(A[2][0]) ){
        cout << "Yes" << endl;
        return;
    }
    cout << "No" << endl;

}

int main() {
    std::vector<std::vector<long long>> A(3, std::vector<long long>(3));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            scanf("%lld", &A[i][j]);
        }
    }
    long long N;
    scanf("%lld", &N);
    std::vector<long long> b(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &b[i]);
    }
    solve(std::move(A), N, std::move(b));
    return 0;
}


Measured memory_bytes: 256
import * as fs from 'fs';

const [a, b, c]: string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split(' ');

if (a.substring(a.length - 1) === (b.substring(0, 1))
    && b.substring(b.length - 1) === (c.substring(0, 1))) {
    console.log('YES');
} else{
    console.log('NO');
}

Measured memory_bytes: 11340