akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    string s;cin >> s;
    string ans = "";
    REP(i,s.size()){
        if(i%2==0) ans += s[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 592
#include <stdio.h>
int main(void){
	long n,a,b,sum;
	
	scanf("%ld %ld %ld", &n,&a,&b);
	
	sum = a+b;
	
	if(n%sum < a){
		printf("%ld",a*(n/sum)+(n%sum));
	}else{
		printf("%ld",a*(n/sum)+a);
	}
	
	return 0;
	
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % 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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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


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

  int N, P;
  cin >> N >> P;

  string s;
  cin >> s;

  reverse(s.begin(), s.end());

  vector<ll> cnt(P);

  rep(i, P) cnt[i] = 0;
  cnt[0]++;
  ll now_mod = 0;
  ll pow10modP = 1;

  vector<ll> cnt_rec(N);

  rep(i, s.length()){

    ll modP = (now_mod + pow10modP * int(s[i] - '0')) % P;

    cnt[modP]++;
    cnt_rec[i] = modP;

    pow10modP = (10 * pow10modP) % P;

    now_mod = modP;

  }

  // ll inv10P = modinv(10, P);

  // // ll T = int(s[0]-'0') % P;

  // ll T = 0;

  // ll pwP = 1;
  // ll ans = 0;
  // rep(i, s.length()){
    
  //   // cout << T << " " << cnt[T] << endl;
  //   ans += cnt[T];

  //   cnt[cnt_rec[i]]--;
    
  //   // T = ((T + 10 * P - int(s[i]-'0')) % P * inv10P) % P;

  //   pwP = (pwP * 10) % P;
  //   T = (T + pwP * int(s[i]-'0')) % P;

  // }

  ll ans = 0;
  rep(i, P){
    ans += cnt[i] * (cnt[i] - 1) /2;
  }

  if(P == 5 || P == 2){
    
    ans = 0;

    rep(i, s.length()){

      int num = s[i]-'0';

      if(num % P == 0){
        ans += s.length()-i;
      }
    }
  }

  cout << ans << endl;  

  return 0;
}


Measured memory_bytes: 2196
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	int x, y;
	cin >> x >> y;
	cout << (x + y / 2) << endl;
	return 0;
}
 

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
using namespace std;
typedef long long int lli;
int main(void)
{
    string s;
    cin >> s;
    int N = s.length();
    for (int i = 0; i < N - 1; i++)
    {
        if (s[i] == 'P' && s[i + 1] == '?')
        {
            s[i + 1] = 'D';
        }
    }
    for (int i = 0; i < N; i++)
    {
        if (s[i] == '?')
        {
            s[i] = 'D';
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3752
require 'set'
n, m = gets.split.map(&:to_i)
link = Array.new(n+1) { [] }
prev = [nil, 'Yes']
visited = Set.new([1])
m.times do
  a, b = gets.split.map(&:to_i)
  link[a] << b
  link[b] << a
end

q = [1]
until q.empty?
  c = q.shift

  link[c].each do |l|
    next if visited.include?(l)
    prev[l] = c
    visited.add(l)
    q << l
  end
end
if prev.compact.size != n
  puts 'No'
  exit 0
end
prev[1..n].each do |t|
  puts t
end

Measured memory_bytes: 37552
#include <iostream>
#include <string>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int n;

int main(void)
{
	cin >> n;
	if(n == 0){
		cout << 0 << endl;
		return 0;
	}
	
	string ans;
	while(n){
		if(abs(n)%2) ans += '1';
		else ans += '0';
		int t = n;
		t -= abs(t)%2;
		n = t / -2;
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from copy import deepcopy

N = int(input())
A = list(map(int,input().split()))

B = deepcopy(A)

for i in range(N-1):
    B[i+1] += B[i]

ans = 0

for i in range(N):
    ans += A[i]*(B[-1]-B[i])

print(ans%(10**9+7))

Measured memory_bytes: 31660
n=int(input())
a=list(map(int,input().split()))
a.insert(0,0)
a.append(0)
c=0
x=0
for i in range(n+1):
    c+=abs(a[i+1]-a[i])
for i in range(1,n+1):
    x=c
    x+=abs(a[i+1]-a[i-1])
    x-=abs(a[i+1]-a[i])
    x-=abs(a[i]-a[i-1])
    print(x)


Measured memory_bytes: 64620
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#include<iomanip>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

int main() {
	ll x;
	cin >> x;

	ll a = 100;
	ll cnt = 0;
	while (a < x) {
		a += a / 100;
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3624
a, b, c = list(map(int, input().split()))
# set
## print(len(set(map(int, input().split()))))
if a == b and b == c and c == a:
    print(1)
elif a != b and b != c and c == a:
    print(2)
elif a == b and b != c and c != a:
    print(2)
elif a != b and b == c and c != a:
    print(2)
else:
    print(3)



Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++);
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
    int N, A, B;
    cin >> N >> A >> B;
 
    int total_sum = 0;
    for (int i = 0; i <= N; ++i) {
        int number = i;
        int sum = 0;
 
        while (number != 0) {
            sum += number % 10;
            number = number / 10;
        }
 
        if (sum >= A && sum <= B) {
            total_sum += i;
    
        }
    }
    cout << total_sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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;}

int main(){
  ll n;
  cin >> n;
  vl p(n + 2);
  p[0] = 1;
  for (ll i = 1; i <= n; i++){
    cin >> p[i];
  }
  p[n + 1] = n;
  ll count = 0;
  for (ll i = 1; i <= n; i++){
    if(p[i]==i){
      swap(p[i], p[i + 1]);
      count++;
    }
  }
  print(count);
}


Measured memory_bytes: 4016
N, M = map(int, raw_input().split())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = [int(tmp) for tmp in raw_input().split()[1:]]

count = 0
for i in range(1, M + 1):
    flag = True
    for j in range(N):
        if i not in A[j]:
            flag = False
    if flag:
        count += 1
print str(count)

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

int h, w;
vector<vector<string>> s;

string solve();

int main() {
  cin >> h >> w;
  s.resize(h, vector<string>(w));
  for(int i = 0; i < h; ++i)
    for(int j = 0; j < w; ++j) cin >> s[i][j];
  cout << solve() << endl;
  return 0;
}

string solve() {
  for(int i = 0; i < h; ++i)
    for(int j = 0; j < w; ++j)
      if(s[i][j] == "snuke") {
        string ans;
        ans += 'A' + j;
        if(i <= 10)
          ans += '1' + i;
        else {
          ans += '0' + i / 10;
          ans += '1' + i % 10;
        }
        return ans;
      }
  assert(0);
}

Measured memory_bytes: 256
import numpy as np

def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    table = sorted(table)
    return table

def make_prime(U):
    is_prime = np.zeros(U,np.bool)
    is_prime[2] = 1
    is_prime[3::2] = 1
    M = int(U**.5)+1
    for p in range(3,M,2):
        if is_prime[p]:
            is_prime[p*p::p+p] = 0
    return is_prime, is_prime.nonzero()[0]
A, B = map(int, input().split())

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

A_list = set(divisor(A))
B_list = set(divisor(B))

list = A_list & B_list

#_, primes = make_prime(10**8)

cnt = 1

for i in list:
    if is_prime(i):
        cnt += 1

print(cnt)

Measured memory_bytes: 28760
# include <algorithm>
# include <iostream>
# include <cmath>
# include <string>
# include <vector>
#include <numeric>

// typedef long long int;

using namespace std;

int gcd(int a, int b){
    if(a==0) return b;
    if(b==0) return a;
    if(a>b) return gcd(a-(a/b)*b,b);
    return gcd(a,b-(b/a)*a);
}

int main() {
    int N,a;
    vector<int> A;
    cin >> N;
    for (int i=0; i<N; i++){
        cin >> a;
        A.push_back(a);
    }
    vector<int> gcd_from_left, gcd_from_right;

    int cur_from_left = A[0];
    gcd_from_left.push_back(cur_from_left);
    int cur_from_right = A[N-1];
    gcd_from_right.push_back(cur_from_right);

    // 左から
    bool coprime_from_left = false; // 互いに素
    for (int i=1; i<N; i++){
        if (coprime_from_left==true){
            gcd_from_left.push_back(1);
        }else{
            cur_from_left = gcd(cur_from_left, A[i]);
            if (cur_from_left == 1){
                coprime_from_left = true;
                gcd_from_left.push_back(1);
            }else{
                gcd_from_left.push_back(cur_from_left);
            }
        }
    }

    // 右から
    bool coprime_from_right = false; // 互いに素
    for (int i=1; i<N; i++){//i:右から何個めかをあらわす(0,1,2,...)
        if (coprime_from_right){
            gcd_from_right.push_back(1);
        }else{
            cur_from_right = gcd(cur_from_right, A[N-i-1]);
            if (cur_from_right == 1){
                coprime_from_right = true;
            }
            gcd_from_right.push_back(cur_from_right);
        }
    }

    int max=gcd_from_right[N-2];


    for (int i=1; i<N; i++){
        int max_candidate = gcd( gcd_from_left[i-1], gcd_from_right[N-2-i] );
        if (max_candidate > max){
            max = max_candidate;
        }
    }

    cout << max << endl;

    return 0;
}


Measured memory_bytes: 1784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for(int i=0; i<(int)(n); ++i)
ll dp[3005][3005];
const int M = 998244353;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  dp[0][0] = 1;
  rep(i, n) for (int j = 0; j <= s; ++j) {
    dp[i+1][j] = dp[i][j]*2%M;
    if (j >= a[i]) dp[i+1][j] = (dp[i+1][j]+dp[i][j-a[i]])%M;
  }
  cout << dp[n][s] << endl;
}

Measured memory_bytes: 74028
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=1,i##_len=(n); i<=i##_len; ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).end()
#define maxs(x,y) (x=max((x),(y)))
#define mins(x,y) (x=min((x),(y)))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x=max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T>>
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<P>;
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,sz(v))i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(sz(v))o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
template <class T> inline ll suma(const v(T)& a) 
{ ll res(0); for(auto&& x:a) res += x; return res;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
const int MX = 200005;
//----------------------------------------------------------------

#define fileio ifstream fio; if(argc>=2){fio.open(argv[1]); std::cin.rdbuf(fio.rdbuf());}
#define fastio ios_base::sync_with_stdio(false);
#define MOD 1000000007
//----------------------------------------------------------------

void Main(){
  int n,m;
  cin>>n>>m;
  cout<<(1900*m+100*(n-m))*(ll)pow(2,m)<<endl;

} int main(int argc,char* argv[]){ 
    fastio; fileio; Main();}

Measured memory_bytes: 512
'''
date +%Y.%m.%d

题解先咕着。
'''
def intinput():
    return [int(i) for i in input().split()]

n = intinput()[0]
a = intinput()
a.sort()
for i in range(1, n):
    a[i] = (a[i - 1] + a[i]) / 2
print(a[n - 1])


Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>

using namespace std;

static const int maxN = 100;

void swap(int* a, int* b)
{
  int p = *a;
  *a = *b;
  *b = p;
  return ;
}

void printarray(int* array,int length)
{
  for(int i = 0; i < length-1; i++)
  {
    printf("%d ",array[i]);
  }
  printf("%d\n",array[length-1]);
}

int bubblesort(int* A, int N)
{
  int sc = 0;
  for(int i = 0; i < N-1; i++)
  {
    //printarray(A,N);
    for (int j = N-1 ; j > i; j--)
    {
      if(A[j] < A[j-1])
      {
        swap(&A[j],&A[j-1]);
        sc++;
      }
    }
  }
  return sc;
}

int main()
{
  int N;
  int A[maxN];

  cin >> N;

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

  int swap_count = bubblesort(A,N);

  printarray(A,N);
  printf("%d\n",swap_count);

  return 0;
}



Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,k,q,a[100000],i,l[100000];
    cin >> n >> k >> q;
    for(i=0;i<q;i++)
    {
        cin >> a[i];
    }
    for(i=1;i<=n;i++)
    {
        l[i]=0;
    }
    for(i=0;i<q;i++)
    {
         {
             l[a[i]]+=1;
         }
    }
    for(i=1;i<=n;i++)
    {
        if(q-l[i]>=k)
        {
            cout << "No" << endl;
        }
        else
        {
            cout << "Yes" << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 5148
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define mp make_pair
#define fi first
#define se second

struct dijkstra
{
    struct edge{int to,cost,rev;};
    using Graph =vector<vector<edge>>;
    Graph graph;
    int V;
public:
    vector<int> dis;
    dijkstra(int n)
    {
        V=n;
        graph.resize(V);
        dis.resize(V,INF);
    }

    void add_edge(int from,int to,int cost) //戻り篇なし
    {
        graph[from].push_back((edge){to,cost,(int)graph[to].size()});
    }

    void run(int s)
    {
        dis[s]=0;
        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> que;
        que.push(mp(dis[s],s));
        int u,v;
        while (!que.empty())
        {
            u=que.top().se;
            que.pop();
            for (int i=0;i<graph[u].size();i++)
            {
                edge e=graph[u][i];
                if (dis[e.to]>dis[u]+e.cost)
                {
                    dis[e.to]=dis[u]+e.cost;
                    que.push(mp(dis[e.to],e.to));
                }
            }
        }
        return ;
    }
};

int main()
{
    int V,E,r;cin >> V >> E >> r;
    dijkstra solve(V);
    int s,t,d;
    for (int i=0;i<E;i++)
    {
        cin >>s >> t >> d;
        solve.add_edge(s,t,d);
    }
    solve.run(r);
    for (int i=0;i<V;i++)
    {
        if (solve.dis[i]==INF) cout << "INF" << endl;
        else cout << solve.dis[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 15508
n = int(input())
ansj = 0
ansb = 0
for i in range(n):
    x,u = input().split()
    if u == "JPY":
        ansj += int(x)
    else:
        ansb += float(x)
ansb*=380000
ansj = float(ansj)
print(ansj+ansb)

Measured memory_bytes: 61892
#define TST 0
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cctype>
#include <bits/stdc++.h>

using namespace std;
// for loop
#define F(i, L, R) for(long i = L; i < R; i++)
#define FE(i, L, R) for(long i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(long i = L; i > R; i--)
#define FRE(i, L, R) for(long i = L; i >= R; i--)

// data types
#define Int long
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]
#define pb push_back
#define InputV(a, n) F(i,0,n){long l; cin >> l; a.pb(l);}

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)
#define printM(a, n, m) F(i, 0, n){ FE(j, 0, m) cout << a[i][j] << (i==m?'\n':' ');}

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323

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

#define printMatrix(mat,n,m){ \
    F(i, 0, n){               \
        F(j, 0, m){           \
            cout << mat[i][j] << space;\
        }\
        cout << endl;\
    }\
}

bool binary_search(vector<ll> a, ll target){
    ll left = 0;
    ll right = a.size()-1;
    while(right-left > 1){
    ll mid = (left + right)/2;
    if(a[mid] == target)return true;
    if(a[mid] > target) right = mid-1;
    if(a[mid] < target) left = mid+1;
    }
    if(a[right] == target || a[left] == target)return true;
    else return false;
}

int main() {
#if TST==1
    ifstream in ("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    long n;
    cin >> n;
    vector< ll> s;
    F(i, 0, n){
        ll s_tmp;
        cin >> s_tmp;
        s.pb(s_tmp);
    }
    long q;
    cin >> q;
    vector < ll > t;
    F(i, 0, q){
        ll t_tmp;
        cin >> t_tmp;
        t.pb(t_tmp);
    }
    sort(t.begin(), t.end());

    ll ans = 0;
    // binary search
    ll left = 0;
    F(i, 0, q){
    ll target = t[i];
    ll right = s.size()-1;
        while(right-left > 1){
        ll mid = (left + right)/2;
        if(s[mid] == target) {
            left = mid;
            ans++;
            goto nextloop;
        }
        if(s[mid] > target) right = mid-1;
        if(s[mid] < target) left = mid+1;
        }
        if(s[right] == target || s[left] == target){ans++;}
nextloop:
        continue;
    }
    
#if TST==1
#endif
    cout << ans << endl;
}



Measured memory_bytes: 4544
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
int white[200000], black[200000];
int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (i > 0) {
			white[i] += white[i - 1];
			black[i] += black[i - 1];
		}
		if (S[i] == '#') black[i]++;
		else white[i]++;
	}
	int ans = 1 << 30;
	for (int i = 0; i < S.size(); i++) {
		ans = min(ans, black[i] + (white[S.size() - 1] - white[i]));
	}
	ans = min(ans, black[S.size() - 1]);
	ans = min(ans, white[S.size() - 1]);
	cout << ans << endl;
}

Measured memory_bytes: 2180
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) (flag)?1:0
#define yn(f) cout<<(f?"yes":"no")<<endl
#define Yn(f) cout<<(f?"Yes":"No")<<endl
#define YN(f) cout<<(f?"YES":"NO")<<endl
#define COUT(x) cout<<(x)<<endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

constexpr int MOD=1e9+7;

int main(void){
  int a,b,x; cin>>a>>b>>x;
  if(a>x) COUT("NO");
  else if(a+b<x) COUT("NO");
  else COUT("YES");
}













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

int main(){
    int N;
    cin >> N;
    string S[N];
    bool flag = true;
    for(int i = 0; i < N; i++){
        cin >> S[i];
        if(i != 0 && S[i-1][S[i-1].size()-1] != S[i][0]) flag = false;
        for(int j = 0; j < i; j++){
            if(S[i] == S[j]){
                flag = false;
                break;
            }
        }
    }
    if(flag) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String A = sc.next();
		String B = sc.next();

		String[] A1 = A.split("");
		String[] B1 = B.split("");

		int[] A2 = new int[A1.length];
		int[] B2 = new int[B1.length];
		
		
		for(int i=0; i<A1.length; i++){
			A2[i] = Integer.parseInt(A1[i]);
		}
		
		for(int i=0; i<B1.length; i++){
			B2[i] = Integer.parseInt(B1[i]);
		}
		
		int cnt = 0;

		if(A1.length>B1.length){
			System.out.print("GREATER");
		}else if(B1.length>A1.length){
			System.out.print("LESS");
		}else{
			for(int i=0; i<A2.length; i++){
				if(A2[i]>B2[i]){
					System.out.print("GREATER");
					break;
				}else if(B2[i]>A2[i]){
					System.out.print("LESS");
					break;
				}else{
					cnt++;
				}
			}
		}
		
		if(cnt==A2.length){
			System.out.print("EQUAL");
		}

	}

}


Measured memory_bytes: 21844
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		Integer a[] = new Integer[N];

		int Alice = 0;
		int Bob = 0;

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

		Arrays.sort(a, Collections.reverseOrder());

		for (int i = 0; i < a.length; i++) {
			if(i % 2 == 0) {
				Alice += a[i];
			}else {
				Bob += a[i];
			}
		}
		System.out.println(Alice - Bob);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
    double N,M,D;cin >> N >> M >> D;
    double ans = 0;
    if(N - D < D + 1 || D == 0){
        cout << (1/N)*(M-1) << endl;
    }
    else{
        ans += (2*D/N)*(1/N);
        ans += ((N-2*D)/N)*(2/N);
        cout << ans*(M-1) << endl;
    }
}

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

typedef long long ll;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;

#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define MOD 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n,m;
  cin >> n >> m;
  if (n == m) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void)
{
	int i=0,data1[100]={0},data2[100]={0},sum_price=0;
	double ave=0;
	while(scanf("%d , %d",&data1[i],&data2[i])!=EOF){
		sum_price+=data1[i]*data2[i];
		ave+=data2[i];
		i++;
	}
	ave=ave/i+0.5;
	printf("%d\n",sum_price);
	printf("%.0lf\n",ave);
	return 0;
}

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

void solve(int R, int C, int K, vector<int> r, vector<int> c, vector<int> v)
{
    vector<vector<int>> values(R, vector<int>(C));
    for (int i = 0; i < K; i++)
        values.at(r.at(i)).at(c.at(i)) = v.at(i);

    vector<vector<int64_t>> dp0(R, vector<int64_t>(C));
    vector<vector<int64_t>> dp1(R, vector<int64_t>(C));
    vector<vector<int64_t>> dp2(R, vector<int64_t>(C));
    vector<vector<int64_t>> dp3(R, vector<int64_t>(C));
    for (int i = 1; i < R; i++)
    {
        dp0.at(i).at(0) = dp0.at(i - 1).at(0) + values.at(i - 1).at(0);
    }
    for (int j = 1; j < C; j++)
    {
        dp0.at(0).at(j) = dp0.at(0).at(j - 1);
        dp1.at(0).at(j) = max(dp0.at(0).at(j - 1) + values.at(0).at(j - 1), dp1.at(0).at(j - 1));
        dp2.at(0).at(j) = max(dp1.at(0).at(j - 1) + values.at(0).at(j - 1), dp2.at(0).at(j - 1));
        dp3.at(0).at(j) = max(dp2.at(0).at(j - 1) + values.at(0).at(j - 1), dp3.at(0).at(j - 1));
    }
    for (int i = 1; i < R; i++)
    {
        for (int j = 1; j < C; j++)
        {
            dp0.at(i).at(j) = max(dp0.at(i).at(j - 1), dp3.at(i - 1).at(j));
            dp0.at(i).at(j) = max(dp0.at(i).at(j), dp0.at(i - 1).at(j) + values.at(i - 1).at(j));
            dp0.at(i).at(j) = max(dp0.at(i).at(j), dp1.at(i - 1).at(j) + values.at(i - 1).at(j));
            dp0.at(i).at(j) = max(dp0.at(i).at(j), dp2.at(i - 1).at(j) + values.at(i - 1).at(j));
            dp1.at(i).at(j) = max(dp0.at(i).at(j - 1) + values.at(i).at(j - 1), dp1.at(i).at(j - 1));
            dp2.at(i).at(j) = max(dp1.at(i).at(j - 1) + values.at(i).at(j - 1), dp2.at(i).at(j - 1));
            dp3.at(i).at(j) = max(dp2.at(i).at(j - 1) + values.at(i).at(j - 1), dp3.at(i).at(j - 1));
        }
    }
    int64_t res = 0;
    res = max(res, dp0.at(R - 1).at(C - 1) + values.at(R - 1).at(C - 1));
    res = max(res, dp1.at(R - 1).at(C - 1) + values.at(R - 1).at(C - 1));
    res = max(res, dp2.at(R - 1).at(C - 1) + values.at(R - 1).at(C - 1));
    res = max(res, dp3.at(R - 1).at(C - 1));
    cout << res << endl;
}

int main()
{
    int R;
    cin >> R;
    int C;
    cin >> C;
    int K;
    cin >> K;
    vector<int> r(K);
    vector<int> c(K);
    vector<int> v(K);
    for (int i = 0; i < K; i++)
    {
        cin >> r.at(i);
        cin >> c.at(i);
        cin >> v.at(i);
        r.at(i)--;
        c.at(i)--;
    }
    solve(R, C, K, move(r), move(c), move(v));
    return 0;
}


Measured memory_bytes: 322632
N=int(input())
s=[]
for i in range(N):
  ss=list(input())
  ss.sort()
  s.append(ss)
s.sort()
res=0

temp=1
for i in range(N-1):
  if s[i]==s[i+1]:
    temp+=1
    if i==N-2:
      res+=temp*(temp-1)//2
  else:
    res+=temp*(temp-1)//2
    temp=1
    
print(res)

Measured memory_bytes: 24652
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "A";} else {return "B";}}


int main(){
	int X, A, B; 
	cin >> X >> A >> B;
	Cout(YES(abs(X-A) < abs(X - B)));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
// constexpr ll  MOD = (1e9+7);
// constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// constexpr int lcm(int a, int b) { return a / gcd(a, b) * 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;
}
// ll factorial(ll n, ll m=2) {
//     // calculate n!
//     m = max(2LL, m);
//     ll rtn = 1;
//     for (ll i=m; i<=n; i++) {
//         rtn = (rtn * i) % MOD;
//     }
//     return rtn;
// }
// ll modinv(ll a, ll m) {
//     ll b = m, u = 1, v = 0;
//     while (b) {
//         ll t = a / b;
//         a -= t * b;
//         swap(a, b);
//         u -= t * v;
//         swap(u, v);
//     }
//     u %= m;
//     if (u < 0) u += m;
//     return u;
// }
// ll modpow(ll a, ll n) {
//     ll res = 1;
//     while (n > 0) {
//         if (n & 1)
//             res = res * a % MOD;
//         a = a * a % MOD;
//         n >>= 1;
//     }
//     return res;
// }

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int check(int cx, int cy, vector<vector<int> > &graph) {
    bool b = false;
    rep(i, 4) {
        if (graph[cx+dx[i]][cy+dy[i]]) b = true;
    }
    return b;
}

int ans = 0;
int n, m;

void dfs(int cnt, int cx, int cy, vector<vector<int> > &graph) {
    chmax(ans, cnt);
    graph[cx][cy] = 0;
    rep(i, 4) {
        if (cx+dx[i]<m && cx+dx[i]>=0 && cy+dy[i]<n && cy+dy[i]>=0 && graph[cx+dx[i]][cy+dy[i]]) {
            dfs(cnt+1, cx+dx[i], cy+dy[i], graph);
        }
    }
    graph[cx][cy] = 1;
    return;
}

int main() {
    // cin.tie(nullptr);
    // ios::sync_with_stdio(false);
    for (;;) {
        ans = 0;
        cin >> m >> n;
        if (!m && !n) return 0;
        vector< vector<int> > graph(m, vector<int>(n));
        rep(i, m) rep(j, n) cin >> graph[i][j];
        rep(i, m) rep(j, n) if (graph[i][j]) dfs(1, i, j, graph);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const int MOD=1e9+7;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

pair<int, int> x[100][100]; // idx, mask
int a[100];
int n;

int counter(int x) {
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}

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

  cin >> n;
  FOR(i, 1, n+1) {
    cin >> a[i];
    FOR(j, 1, a[i]+1) {
      cin >> x[i][j].first >> x[i][j].second;
      x[i][j].first--;
    }
  }

  int ans = 0;
  FOR(bit, 1, 1<<n) {
    bool ok = true;
    FOR(i, 1, n+1) {
      if(!(bit & 1<<(i-1))) continue;
      FOR(j, 1, a[i]+1) {
        if(((bit >> x[i][j].first) & 1) ^ x[i][j].second) ok = false;
      }  
    }
    if(ok) {
      ans = max(ans, counter(bit));
    }
  }
  cout << ans << endl;
  return 0;
}


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

struct VisitInfo {
    int t, x, y;
};

VisitInfo *info;

bool can_travel();

int main()
{
    if (can_travel()) printf("Yes\n");
    else printf("No\n");
    delete[] info;

    return 0;
}

bool can_travel()
{
    int n;
    scanf("%d", &n);
    info = new VisitInfo[n + 1];
    info[0].t = info[0].x = info[0].y = 0;
    for (int i = 1; i <= n; i++)
        scanf("%d%d%d", &info[i].t, &info[i].x, &info[i].y);
    std::sort(info, info + n + 1,
        [](const VisitInfo& a, const VisitInfo& b){ return a.t < b.t; }
    );

    for (int i = 0; i < n; i++)
    {
        int tmpt = info[i + 1].t - info[i].t, tmpd = std::abs(info[i + 1].x - info[i].x) + std::abs(info[i + 1].y - info[i].y);
        if (tmpt % 2 != tmpd % 2 || tmpt < tmpd) return false;
    }
    return true;
}

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

struct g{
	int p,t,e,ans;
};

g a[100];
int seat[17];

int main(){
	for(int i=0; i<17; i++)
		seat[i] = -1;
	for(int i=0; i<100; i++){
		a[i].p = 2;
		if(i%5 == 1)
			a[i].p += 3;
		a[i].t = i*5;
		a[i].e = 17*(i%2)+3*(i%3)+19;
	}
	int i=0;
	for(int tim=0;i<100;tim++){
		for(int k=0; k<17; k++){
			if(seat[k] != -1){
				if(a[seat[k]].ans+a[seat[k]].t+a[seat[k]].e <= tim)
					for(int j=0; j<a[seat[k]].p; j++)
						seat[j+k] = -1;
			}
		}
P:;
		if(a[i].t <= tim){
			bool flag = true;
			int tmp = -1;
			for(int j=0; j<=17-a[i].p; j++){
				for(int k=j; k<j+a[i].p; k++)
					if(seat[k]!=-1)
						flag = false;
				if(flag){
					tmp = j;
					break;
				}
				else
					flag = true;
			}
			if(tmp != -1){
				for(int j = 0; j<a[i].p; j++)
					seat[j+tmp] = i;
				a[i].ans = tim-a[i].t;
				i++;
				if(i<100)
					goto P;
			}
		}
	}
	int n;
	while(cin >> n)
		cout << a[n].ans << endl;
	return 0;
}

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

int main(){
    int n; cin >> n;
    int arr[n+7] = {0};
    arr[4] = 1, arr[7] = 1;
    for(int i = 4; i <= n; i++){
        if(arr[i] == 1){
            arr[i+4] = 1;
            arr[i+7] = 1;
        }
    }

    if(arr[n] == 1) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    vector<int> dp(n + 1, 1 << 20);

    dp[0] = 0;

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

        dp[i + 1] = min(dp[i + 1], dp[i] + 1);

        for(int j = 6; i + j <= n; j *= 6) {
            dp[i + j] = min(dp[i + j], dp[i] + 1);
        }

        for(int j = 9; i + j <= n; j *= 9) {
            dp[i + j] = min(dp[i + j], dp[i] + 1);
        }
    }

    cout << dp[n] << endl;
}

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

int main(){
int n,b=100000,c,d,tmp;
double f=100000;
	cin>>n;
	for(int i=0;i<n;i++){
		f*=0.05;
		tmp=f;
		b=b+tmp;
		d=b;
		b/=1000;
		b*=1000;
		if(d-b>0)b+=1000;
		f=b;
	}
	cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 1156
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

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

 cout << std::fixed << std::setprecision(20) << a*2*M_PI << endl;
  
  
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
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;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll A,B,X;
    cin >>X>>A>>B;
    if(abs(A-X)<abs(B-X)){
        cout<<"A"<<endl;
    }else{
        cout<<"B"<<endl;
    }
    


    return 0;
    

}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int64_t p[m], y[m];
  vector<int64_t> a[n+1];
  for(int i=0; i<m; i++){
    cin >> p[i] >> y[i];
    a[p[i]].push_back(y[i]);
  }
  for(int i=1; i<n+1; i++)
    sort(a[i].begin(), a[i].end());
    
  for(int i=0; i<m; i++){
    int64_t tmp = p[i]*1000000+distance(a[p[i]].begin(),lower_bound(a[p[i]].begin(), a[p[i]].end(), y[i]))+1;
    cout << setfill('0') << right << setw(12);
    cout << tmp << endl;
  }
  return 0;
}


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


def main():
    N, M = map(int, input().split())
    ps = []
    for i in range(M):
        p, s = input().split()
        ps.append((int(p), s))
    ac = [0]*(10**5)
    pena = [0]*(10**5)
    for p, s in ps:
        if s == "WA":
            if ac[p] == 0:
                pena[p] += 1
        if s == "AC":
            ac[p] = 1
    p = 0
    for i in range(len(ac)):
        if ac[i] == 1:
            p += pena[i]
    print(ac.count(1), p)


if __name__ == '__main__':
    main()


Measured memory_bytes: 20556
#include<iostream>

using namespace std;
int A, B, C, D;

int main()
{
    cin >> A >> B >> C >> D;
    if(A<=0) {
        cout << "No" << endl;
    }else if(C<=0){
        cout << "Yes" << endl;
    }else {
        while(A>0&&C>0) {
            C -= B;
            if(C<=0) {
                cout << "Yes" << endl;
                break;
            }
            A -= D;
            if(A<=0) {
                cout << "No" << endl;
                break;
            }
        }
    }


    return 0;

}


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

using namespace std;
const int N = 1e5 + 10;
int mark[N];
pair <int , int> A[N], B[N];
vector <int> g[N];
bool cmp(int i, int j) {return B[i] < B[j];}
bool cmp2(int i, int j) {return A[i] < A[j];}

int dfs(int v)
{
    mark[v] = 1;
    for (int u : g[v]) if (!mark[u]) dfs(u);
}

int main()
{
    int n; cin >> n;
    for (int i = 0; i < n; i ++) cin >> A[i].first, A[i].second = i;
    for (int i = 0; i < n; i ++) cin >> B[i].first, B[i].second = i;
    sort(B, B + n);
    sort(A, A + n);
    for (int i = 0; i < n; i ++) if (A[i].first > B[i].first) return cout << "No\n", 0;
    for (int i = 0; i < n - 1; i ++) if (A[i + 1].first <= B[i].first) return cout << "Yes\n", 0;
    for (int i = 0; i < n; i ++) g[A[i].second].push_back(B[i].second);
    int cnt = 0;
    for (int i = 0; i < n; i ++) if (!mark[i]) dfs(i), cnt++;
    if (cnt > 1) return cout << "Yes\n", 0;
    return cout << "No\n", 0;
}


Measured memory_bytes: 10752
#include<stdio.h>
#include<stdlib.h>
#define MAX 20000  // スタックの最大値

typedef struct{
  int top;         // スタックポインタ(一番上の位置)
  int S[MAX];
}Stack;


// スタック st の初期化
void initialize(Stack *st)
{
  st->top = 0;
  st->S[st->top] = 0;
}

// スタック st が空かどうかを確認
int isEmpty(Stack *st)
{
  return st->top == 0;
}

// スタック st が一杯かどうかを確認
int isFull(Stack *st)
{  
  return st->top >= MAX - 1;
}

// スタック st に要素 x をプッシュ(一番上に要素を追加)
void push(int x, Stack *st)
{
  if (isFull(st)) 
    exit(1);

  st->top++;
  st->S[st->top] = x;
}

// スタック st から要素をポップ(一番上の要素を取り出す)
int pop(Stack *st) {
  if (isEmpty(st)) 
    exit(1);

  st->top--;
  return st->S[st->top+1];
}


int main(void)
{
  Stack st1;     // '\' の開始位置を格納するスタック
  Stack st2_j;   // 各水たまりの最も左の'\' の位置を格納するスタック
  Stack st2_a;   // 各水たまりの水量を格納するスタック

  // スタック初期化
  initialize(&st1);
  initialize(&st2_j);
  initialize(&st2_a);

  char c;
  int sum = 0;  // 水たまりの総水量
	int j;

  // 地形を読み込み，各水たまりの水量を計算
  for (int i = 0; (c = getchar()) != EOF; i++) {
    if (c == '\\') {                                 // '\' が出た時の処理
      push(i,&st1);// 位置 i を st1 にプッシュ(write your code)
       
    }else if (!isEmpty(&st1) && c == '/') {          // '/' が出た時の処理
      // 水たまりの総水量 sum を更新(write your code)
    	j=pop(&st1);
    	sum=sum+i-j;
      // st2_j と st2_a を用いて水たまりの水量を更新 
      int a = i - j;   // 更新する水たまりの水量を a に格納していく
      while (!isEmpty(&st2_j) && st2_j.S[st2_j.top] > j) {  // 最も左の '\' の位置が j よりも大きい場合，以下を繰り返す
      	pop(&st2_j);
      	a+=pop(&st2_a);
        // 水たまりの水量を求めていく (write your code)
      }
      push(j,&st2_j);
    push(a,&st2_a);// 更新した水たまりの「最も左の'\' の位置」および「水量」を更新 (write your code)
    }
  }

  printf("%d\n", sum);       // 水たまりの総水量を出力
  printf("%d", st2_a.top);   // 水たまりの個数を出力

  // 各水たまりの水量を断面図の左から出力(スタックの底から出力)
  for (int i = 1; i <= st2_a.top; i++) 
    printf(" %d", st2_a.S[i]);  
  printf("\n");

  return 0;
}



Measured memory_bytes: 2108
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    int N;
    cin>>N;
    vector<ll> A(N);
    bool ok=true;
    ll ans=0;
    REP(i,N){
        cin>>A[i];
    }

    REP(i,N){
        if(i>0&&A[i]-A[i-1]>=2) ok=false;
        
        if(A[i]!=0) ans++;

        if(i>0&&A[i]!=(A[i-1]+1)){
            ll tmp=max(0LL,A[i]-1LL);
            ans+=tmp;
        }
    }

    if(A[0]!=0) ok=false;
    if(!ok){
        cout<<-1<<endl;
    }else{
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 4848
import functools
N, A, B = map(int, input().split())
MOD = 10 ** 9 + 7

def modpow(x, n):
    ret = 1
    while n:
        if n & 1:
            ret = ret * x % MOD
        x = x * x % MOD
        n >>= 1
    return ret

@functools.lru_cache(maxsize=None)
def modinv(x):
    return modpow(x, MOD - 2)

def modcomb(n, r):
    ret = 1
    for i in range(n, n - r, -1):
        ret *= i
        ret %= MOD
    for i in range(r, 1, -1):
        ret *= modinv(i)
        ret %= MOD
    return ret

total = modpow(2, N) - 1
ans = total - (modcomb(N, A) + modcomb(N, B))
ans %= MOD
print(ans)


Measured memory_bytes: 96660
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;

int n;
int a[N];

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]);
    sort(a + 1, a + n + 1);
    cout << a[n / 2 + 1] - a[n / 2] << endl;
    return 0;
}


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

int main(){
	int n, p;
	while( cin >> n >> p , n || p ){
		vector<int> v(n, 0);
		int M = p, k = 0, ans;
		while( true ){
			if( p ){
				p--;
				v[k]++;
				if( p == 0 && v[k] == M ){
					ans = k;
					break;
				}
			}else{
				p += v[k];
				v[k] = 0;
			}
			k++;
			if( k == n ) k = 0;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1196
using System;

namespace ABC058_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var o = Console.ReadLine();
            var e = Console.ReadLine();
            for(var i=0;i<e.Length;i++)
            {
                Console.Write(o[i]);
                Console.Write(e[i]);
            }
            if(o.Length != e.Length) { Console.WriteLine(o[o.Length - 1]); }
        }
    }
}


Measured memory_bytes: 13140
//   https://atcoder.jp/contests/abc084/tasks/abc084_b


#include<stdio.h>         //AA06( 31/ 07/ 20) If u see my code, Have a Good Day! (^_^)
#define String_Length 11

int main()
{
    int A, B, i;

    char S[String_Length];

    scanf("%d%d%s", &A, &B, S);

    for(i = 0; i < A; ++i) {

        if(S[i] < '0' || S[i] > '9') {

            printf("No\n");

            return 0;

        }

    }

    if(S[i] != '-') {

        printf("No\n");

        return 0;
    }

    for(i = A + 1; i <= A + B; ++i) {

        if(S[i] < '0' || S[i] > '9') {

            printf("No\n");

            return 0;

        }
    }

    printf("Yes\n");

    return 0;
}


Measured memory_bytes: 1660