akhauriyash/Code-Regression huggingface dataset:
/*starting with the name of almighty ALLAH*/
/*solved by RAKIB JOY*/
// Practice is the only shortcut to improve
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define vc vector
#define vi vc<int>
#define vl vc<ll>
#define dbg(x) cout<<x<<endl;
#define mp(x,y) make_pair(x,y)
#define yes dbg("YES")
#define no dbg("NO")
#define tst int t;cin>>t;while(t--)
#define srt(v) sort(v.begin(),v.end());
#define rsrt(v) sort(v.begin(),v.end(),greater<int>());
#define rj ios::sync_with_stdio(false);cin.tie(0);
#define rvs(v) reverse(v.begin(),v.end());
#define F first
#define S second
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define PI 2*acos(0.0)
#define pii pair<int,int>
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define coutv(v) for(auto it:v)cout<<it<<' ';cout<<endl;
#define cinv(v) for(auto &it:v)cin>>it;
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using ordered_set =tree<T, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;
*/
//sieve bool b[1000005];void primenire(){int i, j;b[0]=true;b[1]=true;for(i=4; i<=1000000; i+=2){b[i]=true;}for(i=3; i<=1001; i+=2){if(!b[i]){for(j=i*i; j<=1000001; j+=2*i){b[j]=true;}}}}
//power ll power(ll a,ll b){if(b==0) return 1LL;if(b&1) return a*power(a,b-1);else return power(a,b/2)*power(a,b/2);}
//bigmod long long int m(long long int a,long long int b,long long int c){if(b==0)return 1;if(b%2==0){long long int  tmp=m(a,b/2,c);return ((tmp%c)*(tmp%c))%c;}elsereturn ((a%c)*(m(a,b-1,c)%c))%c;}
//MaxSubarraySum ll mss(vector<ll>v){ll mx=v[0];ll sz=v.size();for(int i=1;i<=sz;i++){ll t=v[i]+v[i-1];if(t>=v[i]) v[i]=t;mx=max(mx,v[i]*1LL);}return mx;}
//combination ll com[1001][1001];void combination(){com[1][1]=1;com[1][0]=1;for(ll i=2; i<=1000; i++){com[i][0]=1;for(ll j=1; j<=i; j++){com[i][j]=com[i-1][j]+com[i-1][j-1];}}}
///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------

void solve()
{
   ll a,b,c;
   cin>>a>>b>>c;
   if(a<=b*c) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
}
int main()
{
    rj
    solve();



    return 0;
}



Measured memory_bytes: 3604
#include <stdio.h>

int n, m, d, p, r[11];

int main()
{
    while(true)
    {
        scanf("%d", &n);
        scanf("%d", &m);
        
        if(n == 0 && m == 0) { break; }
        
        for(int i = 0; i < 11; i++)
        {
            r[i] = 0;
        }
        
        while(n--)
        {
            scanf("%d", &d);
            scanf("%d", &p);
            
            r[p] += d;
        }
        
        for(int i = 10; i >= 0; i--)
        {
            if(m >= r[i])
            {
                m -= r[i];
                
                r[i] = 0;
            }
            else
            {
                r[i] -= m;
                
                break;
            }
        }
        
        int sum = 0;
        
        for(int i = 0; i <= 10; i++)
        {
            sum += i * r[i];
        }
        
        printf("%d\n", sum);
    }
    
    return 0;
}

Measured memory_bytes: 2556
#include <bits/stdc++.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
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 long long INF = 1LL << 60;

int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}

int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}

int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}

int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main(){
  int n,m;
  cin>>n>>m;
  int tle=1900*m*pow(2,m);
  int ac=(n-m)*100*pow(2,m);
  cout<<tle+ac;
  
} 

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

using namespace std;

const int MX = 2000, md = 998244353;

char s[MX + 1];
int mn[2 * MX], mx[2 * MX];

void solve(bool inv) {
	static int cnt[MX + 1];
	int n = strlen(s), bal = 0;
	for (int i = 0; i < n; i++) cnt[i + 1] = s[i] - '0';
	for (int k = 2 * n; k > 0; k--) {
		cnt[0] = 0;
		for (int i = 1; i <= (k + 1) / 2; i++)
			if (cnt[i] > 0) {
				cnt[i]--;
				cnt[i - 1]++;
			}
		
		if (inv) cnt[0] ^= 1;
		
		bal += cnt[0];
		(inv ? mn : mx)[2 * n - k] = bal;
	}
}

int dp[2 * MX + 1][2 * MX + 1];

int main() {
	ignore = scanf("%s", s);
	int n = strlen(s);
	
	solve(false);
	
	for (int i = 0; s[i] != 0; i++) s[i] = '2' - (s[i] - '0');
	
	solve(true);
	
	dp[0][0] = 1;
	for (int i = 0; i < 2 * n; i++)
		for (int j = 0; j <= i; j++)
			for (int d = 0; d < 2; d++)
				if (mn[i] <= j + d && j + d <= mx[i]) {
					dp[i + 1][j + d] += dp[i][j];
					dp[i + 1][j + d] %= md;
				}
	
	int ans = accumulate(dp[2 * n], dp[2 * n] + 2 * n + 1, 0ll) % md;
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 60544
#include<algorithm>
#include<functional>
#include<memory>
#include<numeric>
#include<queue>
#include<stack>
#include<vector>

using Weight = long long;
using Vertex = int;
struct Edge {Vertex from, to; Weight weight;};
using Graph = std::vector<std::vector<Edge>>;

// 比較演算子
// bool operator==(const Edge& lhs, const Edge& rhs) {return lhs.from==rhs.from && lhs.to==rhs.to && lhs.weight==rhs.weight;}

// 隣接行列 O(|V|^2 + |E|)
std::vector<std::vector<Vertex>> adjacent_matrix(const Graph& G) {
  std::vector<std::vector<Vertex>> A(G.size(), std::vector<Vertex>(G.size(), 0));
  for(const auto& list: G) for(const auto& e: list) ++A[e.from][e.to];
  return A;
}

// 逆辺 O(1)
Edge reverse(const Edge& e) {
  return {e.to, e.from, e.weight};
}

// 逆辺からなるグラフ O(|V| + |E|)
Graph reverse(const Graph& G) {
  Graph H(G.size());
  for(auto& list: G) for(auto& e: list) H[e.to].push_back({e.to, e.from, e.weight});
  return H;
}

// 帰りがけ順 O(|V| + |E|)
std::vector<Vertex> postorder(const Graph& G) {
  std::vector<bool> used(G.size());
  std::vector<Vertex> order;
  std::function<void(Vertex)> dfs = [&](Vertex v) {
    used[v] = true;
    for(const auto& e: G[v]) if(!used[e.to]) dfs(e.to);
    order.emplace_back(v);
  };
  for(Vertex v = 0; v < G.size(); ++v) if(!used[v]) dfs(v);
  return order;
}

// トポロジカルソート O(|V| + |E|)
//   逆辺にしてから帰りがけ順を求める
//   ※逆辺にせずに帰りがけ順を求めて, その結果を reverse しても良い O(|V| log |V| + |E|)
std::vector<Vertex> topological_order(const Graph& G) {
  return postorder(reverse(G));
}

// 連結成分ごとに分解 O(|V|)
std::vector<std::vector<Vertex>> connected_component(const Graph& G) {
  std::vector<std::vector<Vertex>> cc;
  std::vector<bool> used(G.size());
  std::function<void(int)> dfs = [&](int v) {
    cc.back().push_back(v);
    used[v] = true;
    for(const auto& e: G[v]) if(!used[e.to]) dfs(e.to);
  };
  for(Vertex v = 0; v < G.size(); ++v) if(!used[v]) {
    cc.push_back(std::vector<Vertex>());
    dfs(v);
  }
  return cc;
}

// すべての連結成分に対して関節点と橋を列挙 O(|V| + |E|)
// ※articulationには同じ頂点が複数個入る可能性があり、その個数は「分割後の成分数 - 1」個
void Tarjan(const Graph& G, std::vector<Vertex>& articulation, std::vector<Edge>& bridge) {
  std::vector<int> num(G.size()), low(G.size());
  int timer = 0;
  std::function<void(Vertex,Vertex)> dfs = [&](Vertex cur, Vertex pre) {
    num[cur] = low[cur] = ++timer;
    for(const auto& e: G[cur]) if(e.to != pre) {
      if(num[e.to]) {
        low[cur] = std::min(low[cur], num[e.to]);
      } else {
        dfs(e.to, cur);
        low[cur] = std::min(low[cur], low[e.to]);
        if(cur == pre) if(num[cur]+1 < num[e.to]) articulation.push_back(cur);
        if(cur != pre) if(num[cur] <= low[e.to])  articulation.push_back(cur);
        if(num[cur] < low[e.to])                  bridge.push_back(e);
      }
    }
  };
  for(Vertex v = 0; v < G.size(); ++v) if(!num[v]) dfs(v, v);
}


#include<bits/stdc++.h>
using namespace std;

int main() {
  int N,M;
  cin>>N>>M;
  Graph G(N);
  for(auto i=0;i<M;++i){
    int a,b;
    cin>>a>>b;
    --a;--b;
    G[a].push_back({a,b});
    G[b].push_back({b,a});
  }
  vector<int> a;
  vector<Edge> b;
  Tarjan(G,a,b);
  cout<<b.size()<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	int a,b;
	string op;
	while(1){
		cin >> a >> op >> b;
		if(op=="?") break;
		if(op=="+") cout << a+b << endl;
		else if(op=="-") cout << a-b << endl;
		else if(op=="/") cout << a/b << endl;
		else if(op=="*") cout << a*b << endl;
	}
}

Measured memory_bytes: 1204
use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let s = input.trim().chars().collect::<Vec<char>>();
    let ans = (0..s.len()).filter(|&i| s[i] != s[s.len() - 1 - i]).count() / 2;
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    double a = sc.nextDouble();
    double b = sc.nextDouble();
    double x = sc.nextDouble();

    double v = a * a * b;

    double d = 0;
    if (x <= v / 2) {
      double o = x; // occupied area
      double r = Math.PI / 2 - Math.atan2(2 * o, b * b * a);
      d = Math.toDegrees(r);
    } else {
      double e = v - x; // empty area
      double r = Math.atan2(2 * e, a * a * a);
      d = Math.toDegrees(r);
    }
    os.println(d);
  }

}

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }

  multiset<int> more;
  int ans = 0;
  long long need = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] < b[i]) {
      need += (b[i] - a[i]);
      ans++;
    } else {
      more.insert(b[i] - a[i]);
    }
  }

  while (more.size() && need > 0) {
    int num = -*more.begin();
    more.erase(more.begin());
    need -= num;
    ans++;
  }

  if (need > 0) ans = -1;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 5376
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define int long long
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 1e7 + 10 ;
const ll INF = 1e18 + 10 ;
double solve(int x){
    double ans = 0 ; 
    for(int i = 1; i <= x; i++){
        ans += (double)i * (1.0/x);
    }
    return ans ; 
}
signed main(){
    fastio
    int n , k ;
    cin >> n >> k ; 
    vector<int> v(n) ; 
    for(int &x : v){
        cin >> x ;
    }
    vector<int> sum(n + 1) ;
    for(int i = 0; i < n; i++){
        sum[i + 1] = sum[i] + v[i] ; 
    }
    int ans = 0 ; 
    int index = 0 ;
    for(int i = 1; i + k - 1 <= n; i++){
        int val = sum[i + k - 1] - sum[i - 1] ; 
        if ( val > ans ){
            ans = val ; 
            index = i - 1 ;
        }
    }
    double res = 0; 
    for(int i = 0; i < k; i++){
        debug() << imie(v[i + index]);
        res += solve(v[i + index]) ;
    }
    cout << fixed << setprecision(12) << res << endl;
    return 0; 
}

Measured memory_bytes: 3456
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


ll calc(ll n,vector<ll> cnt){
	ll res = 0;
	rep(i,cnt.size()){
		if(cnt[i] >= n) res++;
	}
	return res;
}

int main(){
	ll N; cin >> N;
	vector<ll> cnt(N+1);
	repr(i,1,N+1){
		ll d = i;
		repr(j,2,i+1){
			while(d % j == 0){
				d /= j;
				cnt[j]++;
			}
		}
	}
	ll ans = calc(74,cnt) + calc(24,cnt)*(calc(2,cnt)-1) + calc(14,cnt)*(calc(4,cnt)-1) + calc(4,cnt)*(calc(4,cnt)-1)*(calc(2,cnt)-2)/2;
	cout << ans << endl;
 	
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
typedef long long ll;
typedef double dd;
#define pb push_back
#define mp make_pair
#define endl "\n"
#define M 1000000007
#define pi acos(-1)
/*ll power(ll a,ll b)
{
    ll res = 1;
    while(b > 0)
    {
        if(b & 1)
            res = (res*a)%M;
        a = (a*a)%M;
        b = b >> 1;
    }
    return res;
}*/
/*ll modinv(ll a)
{
   return power(a,M - 2); 
}*/
/*vector<ll> primes(ll n)
{
    bool *sieve = new bool[n + 1];
    ll i,j;
    vector<ll> v;
    for(i = 3; i <= n; i+=2)
        sieve[i] = true;
    sieve[2] = true;
    for(i = 3; i*i <= n; i+=2)
    {
        if(sieve[i])
            for(j = i*i; j <= n; j+=i)
                sieve[j] = false;
    }
    if(n >= 2)
    {
        v.pb(2);
        for(i = 3; i <= n; i+=2)
        {
            if(sieve[i])
                v.pb(i);
        }
    }
    return v;
}*/

/*class graph{
public:
    vector<ll> *g;
    ll n;
    graph(ll v)
    {
        n = v + 1;
        g = new vector<ll> [n];
    }
    void addegde(ll f,ll s)
    {
        g[f].pb(s);
        g[s].pb(f);
    }
    void dfs(bool *visited,ll sv)
    {
        visited[sv] = true;
        for(auto x: g[sv])
        {
            if(!visited[x])
            {
                dfs(visited,x);
            }
        }
    }
    void bfs(ll sv){
       queue<ll> q;
       bool visited[n] = {};
       q.push(sv);
       visited[sv] = true;
       while(!q.empty())
       {
           ll node = q.front();
           q.pop();
           for(auto x : g[node])
           {
               if(!visited[x])
               {
                   visited[x] = true;
                   q.push(x);
               }
           }
       }
    }
};*/
int main()
{
    fast;
    string s;
    cin >> s;
    for(ll i = 0; i < s.length(); i++)
        cout<<"x";
    cout<<endl;
    return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <unordered_map>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 20;
const int MOD = 1e9 + 7;

void solve() {
    int l, r;
    cin >> l >> r;
    if (r - l + 1 >= 3019) {
        cout << 0;
        return;
    }

    int ans = 2019;
    for (int i = l; i < r; i++) {
        for (int j = i + 1; j <= r; j++) {
            ans = min(ans, i * j % 2019);
        }
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //int t;
    //cin >> t;
    int t = 1;
    while (t--) solve();
}

Measured memory_bytes: 256
N = int(input())
S = []
for _ in range(N):
    S.append(input())
AC_count = 0
WA_count = 0
TLE_count = 0
RE_count = 0
for i in range(N):
    if(S[i]=='AC'):
        AC_count += 1
    if(S[i]=='WA'):
        WA_count += 1
    if(S[i]=='TLE'):
        TLE_count += 1
    if(S[i]=='RE'):
        RE_count += 1
print('AC x ' + str(AC_count))
print('WA x ' + str(WA_count))
print('TLE x ' + str(TLE_count))
print('RE x ' + str(RE_count))

Measured memory_bytes: 16284
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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(){ 
  string s; cin >> s;
  string res = s.substr(0, 3);
  cout << res << ln;
}


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

using namespace std;
/*
int find(int x, vector<int> &p) {
if (p[x] == x)return x;
return p[x] = find(p[x], p);
}

void uni(int x, int y, vector<int> &p) {
x = find(x, p);
y = find(y, p);
p[x] = y;
}

int same(int x, int y, vector<int> p) {
if (find(x, p) == find(y, p))return 1;
return 0;
}
*/

//long long a[1002];

int main()
{
	long long N, cnt = 0, tmp, ans = 0;
	cin >> N;
	vector<long long> a(N);

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

	cout << ans;

	char qq;
	cin >> qq;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	//?????¢??¢?´¢?????¬???
	public static boolean search(int[] A, int n, int key) {
		A[n] = key;
		int i = 0;
		while(A[i] != key)i++;
		return i != n;
	}
	
	public static boolean binarySearch(int[] A, int n, int key) {
		int left = 0;
		int right = n;
		int mid = 0;
		while(left < right) {
			 mid = (left + right) / 2;
			if ( key == A[mid] ) return true;
			if ( key > A[mid] ) left = mid + 1;
			if ( key < A[mid] ) right = mid;
		}
	return false;
	}

	public static void main(String args[]) {

		Scanner scan = new Scanner(System.in);
		int[] arrayS = new int[100000]; //??°???S
		int[] arrayT = new int[50000];   //??°???T
		int count = 0;						 //?????°????¨???????????????°

		//????´??????°???????????????ArrayS?????°???S???????????????
		int sNum = scan.nextInt();
		for (int i = 0; i < sNum; i++)
			arrayS[i] = scan.nextInt();

		//????´??????°???????????????ArrayT?????°???T???????????????
		int tNum = scan.nextInt();
		for (int j = 0; j < tNum; j++)
			arrayT[j] = scan.nextInt();

		//??°???T???????´??????°???A????????????????????????????????????
		for (int j = 0; j < tNum; j++)
			if(binarySearch(arrayS, sNum, arrayT[j])) count++;

		System.out.println(count);
	}
}

Measured memory_bytes: 81124
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <typename T>
struct edge {
    int to; T cost, cost2;
    edge(int to, T cost, T cost2) : to(to), cost(cost), cost2(cost2) {}
};

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<edge<int>>> G(n);
    vector<int> deg(n), topo, ord(n);
    for (int i = 0; i < m; ++i) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--; b--;
        deg[b]++;
        G[a].emplace_back(b, c, d);
    }
    {
        queue<int> Q;
        Q.emplace(0);
        ord[0] = 0;
        int cur = 1;
        while(!Q.empty()){
            int i = Q.front(); Q.pop();
            topo.emplace_back(i);
            for (auto &&e : G[i]) {
                deg[e.to]--;
                if(!deg[e.to]) {
                    Q.emplace(e.to);
                    ord[e.to] = cur++;
                }
            }
        }
    }
    auto dp = make_v(n, n, INF<int>);
    dp[0][0] = 0;
    for (auto &&a : topo) {
        for (auto &&b : topo) {
            if(a == b) {
                for (auto &&i : G[a]) {
                    for (auto &&j : G[a]) {
                        if (i.to == j.to) {
                            chmin(dp[i.to][i.to], dp[a][b] + i.cost + i.cost2);
                        } else {
                            chmin(dp[i.to][j.to], dp[a][b] + i.cost + j.cost);
                        }
                    }
                }
            }else if(ord[a] < ord[b]){
                for (auto &&i : G[a]) {
                    chmin(dp[i.to][b], dp[a][b] + i.cost);
                }
            }else {
                for (auto &&i : G[b]) {
                    chmin(dp[a][i.to], dp[a][b] + i.cost);
                }
            }
        }
    }
    cout << dp.back().back() << "\n";
    return 0;
}


Measured memory_bytes: 6816
# -*- coding: utf-8 -*-

n,m = map(int,input().split())
a = [0] * n
b = [0] * n
c = [0] * m
d = [0] * m
for i in range(n):
    a[i],b[i] = map(int,input().split())
for j in range(m):
    c[j],d[j] = map(int,input().split())
check = []

for i in range(n):
    min_len = 10000000000
    min_id = 10000000000
    for j in range(m):
        length = abs(a[i] - c[j]) + abs(b[i] - d[j])
        if length < min_len:
            min_len = length
            min_id = j + 1
    check.append(min_id)

for i in range(len(check)):
    print(check[i])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> PP;

struct edge {
	int to,cost;
	edge(int t,ll c):to(t),cost(c) {}
};

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

ll mypow(ll x,ll n,ll m) {
	if(n==0) return 1;
	if(n%2==0) return mypow(x*x%m,n/2,m);
	else return x*mypow(x,n-1,m)%m;
}

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

string s;
deque<int> dq;

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

	cin>>s;
	int last=-1;
	REP(i,s.size()) {
		int now=(s[i]=='W'?0:1);
		if(now==last) continue;
		last=now;
		dq.pb(now);
	}

	cout<<dq.size()-1<<endl;

	return 0;
}


Measured memory_bytes: 720
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
using namespace std;
int main(){
    int n;
  cin>>n;
    long long int l[100]={};
    l[0]=2;
    l[1]=1;
    for(int i=2;i<=n;i++){
        l[i]=l[i-1]+l[i-2];
    }
    cout<<l[n]<<endl;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int aPrice  = sc.nextInt();
		int bPrice  = sc.nextInt();
		int abPrice  = sc.nextInt();
		int aHituyoSu = sc.nextInt();
		int bHituyoSu = sc.nextInt();
		int normalPrice = (aPrice * aHituyoSu) + (bPrice * bHituyoSu);
		int small= 0;
		int big= 0;
		boolean aBigFlg = false;
		if(aHituyoSu < bHituyoSu) {
			big = bHituyoSu;
			small = aHituyoSu;
		}else {
			big = aHituyoSu;
			small = bHituyoSu;
			aBigFlg = true;
		}
		int answer = normalPrice;
		for(int i =1;i <=big;i++) {
			int price = 0;
			if(i <= small) {
				price = normalPrice -((aPrice +bPrice) * i) + (abPrice* 2 * i);
			}else {
				if(aBigFlg) {
					price = (abPrice* 2 * i) + aPrice * (aHituyoSu -i);
				}else {
					price = (abPrice* 2 * i) + bPrice * (bHituyoSu -i);
				}
			}
			if(answer >price) {
				answer = price;
			}

		}

		System.out.println(answer);

	}
}

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

int main()
{
	int64_t n, m;
	cin >> n >> m;
	vector<int64_t> as(n), bs(n);
	for (int64_t i = 0; i < n; i++)
	{
		cin >> as[i] >> bs[i];
	}

	vector<pair<int64_t, int64_t>> ps(n);
	for (int64_t i = 0; i < n; i++)
	{
		ps[i] = {as[i], bs[i]};
	}
	sort(ps.begin(), ps.end());

	priority_queue<int64_t> pq;

	int64_t ans = 0;

	for (int64_t i = m, j = 0; 0 <= i; i--)
	{
		while (j < n && ps[j].first <= m - i)
		{
			pq.push(ps[j].second);
			j++;
		}

		if (pq.empty())
		{
			continue;
		}

		ans += pq.top();
		pq.pop();
	}

	cout << ans << endl;

	return 0;
}

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

int main()
{
  int N, c = 1;
  cin >> N;
  vector<char> s(N);
  for (int i = 0; i < s.size(); i++)
  {
    char tmp;
    cin >> tmp;
    s.at(i) = tmp;

    for (int j = 0; j < i; j++)
    {
      if (tmp == s.at(j))
      {
        break;
      }
      else if (i == j + 1)
      {
        c++;
      }
    }
  }

  if (c == 3)
  {
    cout << "Three" << endl;
  }
  else
  {
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 256
let () =
  let (h, w) = Scanf.scanf "%d %d\n" (fun a b -> (a, b)) in
  let queue = Queue.create () in
  let dp = Array.make_matrix h w 0 in
  let field = Array.init h @@ fun j -> Array.init (w+1) @@
    fun i -> Scanf.scanf "%c"
      (fun c -> if c == '#' then Queue.push (j,i) queue; c)
  in
  let count = ref 0 in
  while not @@ Queue.is_empty queue do
    let (j, i) = Queue.pop queue in
    List.iter (fun (y, x) ->
        count := dp.(j).(i) + 1;
        dp.(y).(x) <- !count;
        Queue.push (y,x) queue;
        field.(y).(x) <- '#'
      ) @@
    List.filter (fun (y, x) -> y >= 0 && y < h && x >= 0 && x < w && field.(y).(x) == '.') [(j+1,i);(j-1,i);(j,i+1);(j,i-1)];
  done;
  Printf.printf "%d\n" !count

Measured memory_bytes: 69824
A = int(input())
B = int(input())
C = int(input())
X = int(input())
a = list(map(lambda x: x * 500, range(A + 1)))
b = list(map(lambda x: x * 100, range(B + 1)))
c = list(map(lambda x: x * 50, range(C + 1)))

counter = 0

for i in a:
    for p in b:
        for o in c:
            if (i + p + o) == X:
                counter += 1

print(counter)

Measured memory_bytes: 3064
getInts = do
    x <- getLine
    let y = map (read::String->Integer) (words x) 
    return y

main::IO()
main=do
    [a,b] <- getInts
    let (x,y) = ((a+11)`mod`13,(b+11)`mod`13)
    putStrLn$if x==y then "Draw" else if x>y then "Alice" else "Bob"


Measured memory_bytes: 508
n = int(input())
v = list(map(int,input().split()))

d = [{-1: 0},{-1: 0}]
for i in range(n):
    d[i%2][v[i]] = d[i%2].get(v[i],0)+1

odd_max = max(d[0], key=d[0].get)
even_max = max(d[1],key=d[1].get)

if odd_max != even_max:
    ans = n - d[0][odd_max] - d[1][even_max]
else:
    odd_max_num = d[0].pop(odd_max)
    odd_second_num = max(d[0].values())
    even_max_num = d[1].pop(even_max)
    even_second_num = max(d[1].values())
    ans = n - max(odd_max_num+even_second_num,odd_second_num+even_max_num)

print(ans)


Measured memory_bytes: 17056
#include<iostream>
#include<algorithm>
using namespace std;
int h,w;
bool vis[50][50];
bool canw[50][50];
bool canh[50][50];
int qx[100000],qy[100000],ql[100000];
int head,tail;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
int ans;
bool bend;
void BFS(int x,int y,int len){
	if(x==w-1&&y==h-1){
		ans=len;
		bend=true;
	}
	for(int i=0;i<4;i++){
		if(x+dx[i]>=0&&x+dx[i]<w&&y+dy[i]>=0&&y+dy[i]<h){
			bool ok=false;
			if(i==0&&!canh[y][x])ok=true;
			if(i==1&&!canw[y][x])ok=true;
			if(i==2&&!canh[y-1][x])ok=true;
			if(i==3&&!canw[y][x-1])ok=true;
			if(ok&&vis[y+dy[i]][x+dx[i]]==false){
				vis[y+dy[i]][x+dx[i]]=true;
				qx[tail]=x+dx[i],qy[tail]=y+dy[i],ql[tail]=len+1;
				tail++;
			}
		}
	}
}
int main(){
	while(true){
	cin>>w>>h;
	if(w==0&&h==0)break;
	for(int i=0;i<h-1;i++){
		for(int j=0;j<w-1;j++)cin>>canw[i][j];
		for(int j=0;j<w;j++)cin>>canh[i][j];
	}
	for(int j=0;j<w-1;j++)cin>>canw[h-1][j];

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			vis[i][j]=false;
		}
	}
	qx[0]=0,qy[0]=0,ql[0]=1;
	head=0,tail=1;
	ans=0;
	bend=false;
	while(true){
		if(head==tail)break;
		BFS(qx[head],qy[head],ql[head]);
		if(bend)break;
		head++;
	}
	cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1192
import numpy as np


def main():
    H, W = list(map(int, input().split(' ')))
    field = np.array([list(input()) for _ in range(H)])
    field = np.where(field == '#', 0, 1)
    left, right, up, down = [np.zeros((H, W)) for _ in range(4)]
    for w in range(W):
        left[:, w] = (left[:, w-1] + 1) * field[:, w]
        right[:, -w-1] = (right[:, -w] + 1) * field[:, -w-1]
    for h in range(H):
        up[h, :] = (up[h-1, :] + 1) * field[h, :]
        down[-h-1, :] = (down[-h, :] + 1) * field[-h-1, :]
    s = left + right + up + down - 3
    print(int(np.max(s)))


if __name__ == '__main__':
    main()

Measured memory_bytes: 250944
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,T,c,t,C=1001;cin>>N>>T;
  for(int i=0;i<N;i++){
    cin>>c>>t;if(t<=T)C=min(C,c);
  }
  if(C==1001)cout<<"TLE"<<endl;
  else cout<<C<<endl;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	cout << (n - 1) * (m - 1);
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

まず、植木算よりn本の通りには通りに囲まれた領域がn-1個ある
同様にm本の通りには通りに囲まれた領域がm-1個ある
よって、街区は(n-1)(m-1)個あるよね
*/

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

int main(){

	int N, tmp;
	vector<int> C;
	vector<int> V;

	cin >> N;
	
	for (int i = 0 ; i < N; i++){
		cin >> tmp;
		V.push_back(tmp);
	}
	for (int i = 0 ; i < N; i++){
		cin >> tmp;
		C.push_back(tmp);
	}
	int value = 0;
	for (int i = 0 ; i < N; i++){
		if (V[i]-C[i]>0){
			value += V[i]-C[i];
		}	
	}
	cout << value << endl;

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
int vc[5],k,i;
for (i=0;i<5;i++)
scanf("%d", &vc[i]);
scanf("%d", &k);

if (vc[4]-vc[0]<=k)
printf("Yay!\n");
else
printf(":(\n");
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int a,b,c;cin >> a >> b >> c;
  int cnt = 0;
  map<int,int> mp;
  mp[a]++;mp[b]++;mp[c]++;
  for(auto w:mp) cnt++;
  cout << cnt << "\n";
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	int count = 0;
	for (int i = 0; i < N; i++) {
		int h;
		cin >> h;
		if (h >= K) count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3596
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
#print(primes(1000))
x = int(input())
for i in primes(10**6):
    if i>=x:
        print(i)
        exit()

Measured memory_bytes: 51696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  double n;
  cin >> n;
  cout << fixed << setprecision(16);
  cout << 2*n*M_PI << endl;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define pb push_back
#define mp make_pair
typedef pair<ll,ll> P;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};


ll dfs(ll N, ll K){
    ll a=N/K, b=N%K;
    if(N<K) return 0;
    if(b%(a+1)==0) return a;
    b%=(a+1);
    b-=(a+1);
    return dfs(a*K+b,K);
}

int main(){
    ll N; cin>>N;
    ll Grundy=0;
    vec x(N);
    rep(i,N){
        ll A,K; cin>>A>>K;
        x.at(i)=dfs(A,K);     
        Grundy^=x.at(i);
    }
    //rep(i,N) cout<<x.at(i)<<endl;
    if(Grundy) cout<<"Takahashi"<<endl;
    else cout<<"Aoki"<<endl;
}

Measured memory_bytes: 256
//AtCoder ABC042 A - 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition)
#include <bits/stdc++.h>
using namespace std;
using lli=int64_t;

int main() {
	vector<int> abc(3);
    cin>>abc[0]>>abc[1]>>abc[2];
    sort(abc.begin(),abc.end());
    if(abc[0]==5 && abc[1]==5&& abc[2]==7){
        cout<<"YES"<<endl;
    } else{
		cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int count5=0,count7=0;
	for(int i=0;i<3;i++){
		int a;
		cin>>a;
		if(a==5)count5++;
		if(a==7)count7++;		
	}
	
	if(count5==2 && count7==1)cout<<"YES";
	else cout<<"NO";
	
	
	return 0;
	
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>
#include <cassert>
#include<cmath>
using namespace std;
int main() {
	int i;
	int j;
	int N;
	int flag = 0;
	char S[200];

	cin >> N;
	for (i = 0; i < N; ++i) {
		cin >> S[i];
	}
	for (i = 0; i < N; ++i) {
		if (S[i] == 'Y') {
			++flag;
		}
	}

	if (flag >= 1) {
		cout << "Four" << endl;

	}
	else {
		cout << "Three" << endl;
	}

}

Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<list>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back

#define ll __int64
#define P pair<ll,ll>
#define __int64 long long
int n;
ll t[212121];
ll r[212121];
ll ans;
set<int>x;
set<int>y;
int z[212121];
int main(){	
	cin>>n;
	rep(i,n)cin>>t[i];
	rep(i,n)z[t[i]-1]=i;

	

	rep(i,n){
		ll l,r;
		set<int>::iterator it1,it2;

		if(x.empty()){
			l=0;
			r=n-1;
		}
		else{
			it1=x.lower_bound(z[i]);
			it2=y.lower_bound(-z[i]);
			if(it1==x.end())r=n-1;
			else r=(*it1)-1;

			if(it2==y.end())l=0;
			else l=-(*it2)+1;
		}

		//cout<<i+1<<" "<<l<<" "<<r<<" "<<(r-z[i]+1)*(z[i]-l+1)*(i+1)<<endl;

		ans+=(r-z[i]+1)*(z[i]-l+1)*(i+1);
		x.insert(z[i]);
		y.insert(-z[i]);
	}

	cout<<ans<<endl;
	return 0;

}


Measured memory_bytes: 21888
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
int n, m, map[16][16];
ll in[1 << 16], f[1 << 16][16];
int main()
{
	scanf("%d%d", &n, &m);
	int x, y;
	for (int i = 1; i <= m; i++)
	{
		scanf("%d%d", &x, &y);
		x--, y--;
		scanf("%d", &map[x][y]);
		map[y][x] = map[x][y];
	}
	for (int i = 0; i < (1 << n); i++)
		for (int j = 0; j < n; j++)
			if (i & (1 << j))
				for (int k = j + 1; k < n; k++)
					if (i & (1 << k))
						in[i] += map[j][k];
	memset(f, -0x3f, sizeof(f));
	f[1][0] = 0;
	for (int i = 1; i < (1 << n); i++)
		for (int j = 0; j < n; j++)
			if (i & (1 << j))
			{
				int x = i ^ (1 << j);
				for (int k = 0; k < n; k++)
					if (i & (1 << k) && map[k][j])
						f[i][j] = max(f[i][j], f[x][k] + map[k][j]);
				for (int k = x; k; k = (k - 1) & x)
					f[i][j] = max(f[i][j], f[i ^ k][j] + in[1 << j ^ k]);
			}
	printf("%lld\n", in[(1 << n) - 1] - f[(1 << n) - 1][n - 1]);
}

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

int memo[50];
int fib(int n){
    if(~memo[n]) return memo[n];
    if(n == 0 || n == 1) return 1;
    else {
        return memo[n] = fib(n - 1) + fib(n - 2);
    }
}

int main(){
    int n;
    cin >> n;
    memset(memo, -1, sizeof(memo));
    cout << fib(n) << endl;
    return 0;
}


Measured memory_bytes: 3108
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	S := nextBytes()
	c := 0

	l := len(S) / 2
	for i := 0; i < l; i++ {
		j := len(S) - 1 - i
		if S[i] != S[j] {
			c++
		}
	}
	fmt.Println(c)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N; cin>>N;
  vi A(N);
  rep(i,0,N) cin>>A[i];
  int ans=0;
  map<int,int,greater<int>> M;
  rep(i,0,N) M[A[i]]++;
  for(auto p:M){
    int X=p.first;
    REP(i,1,60){
      int P=(1ll<<60-i);
      if(M.count(P-X)){
        if(P-X==X){
          ans+=M[X]/2;
          M[X]%=2;
        }
        else{
          int Q=min(M[P-X],M[X]);
          ans+=Q;
          M[P-X]-=Q;
          M[X]-=Q;
        }
      }
    }
  }
  cout<<ans<<endl;
  }



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

int main(){
    int N;
    cin >> N;
    long long A[N];
    long long s=0;
    for(int i = 0; i < N; ++i){
        cin >> A[i];
        if(i==0) continue;
        if(A[i-1]>A[i]){
            s+=(A[i-1]-A[i]);
            A[i]+=(A[i-1]-A[i]);
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

int main() {
    int n;
    cin>>n;
    unordered_map<string, ll> freq;
    while(n--)
    {
        string temp;
        cin>>temp;
        sort(temp.begin(), temp.end());
        freq[temp]++;
    }
    ll sum = 0;
    for (auto x : freq)
    {
        if(x.second >= 2)
            sum += (x.second*(x.second - 1))/2;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 10660
#include<cstdio>
#include<algorithm>
using namespace std;

#define ll long long

ll i,t,j;
ll n,a,b;

int main(){
	scanf("%lld%lld",&a,&b);
	
	printf("%lld\n",a*b/__gcd(a,b));
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin>>a.at(i);
  if(n%2==0){
    int64_t s=0;
    vector<int64_t> m(n+1,0);
    for(int i=2;i<=n;i+=2){
      m[i]=m[i-2]+a.at(i-1);
      s+=a.at(i-2);
      m[i]=max(m[i],s);
    }
    cout<<m[n]<<endl;
  }
  else{
    int64_t sl=0;
    vector<int64_t> ml(n,0);
    for(int i=2;i<n;i+=2){
      ml[i]=ml[i-2]+a.at(i-1);
      sl+=a.at(i-2);
      ml[i]=max(ml[i],sl);
    }
    int64_t sr=0;
    vector<int64_t> mr(n,0);
    for(int i=n-3;i>=0;i-=2){
      mr[i]=mr[i+2]+a.at(i+1);
      sr+=a.at(i+2);
      mr[i]=max(mr[i],sr);
    }
    int64_t m;
    for(int i=0;i<n;i+=2)
      m=(i==0?ml[i]+mr[i]:max(m,ml[i]+mr[i]));
    cout<<m<<endl;
  }
}

Measured memory_bytes: 7128
//Om Sree Sai Ram
#include "bits/stdc++.h"
using namespace std;


int main() 
{

unordered_set<string> st;
int n;
cin>>n;
for(int i=0;i<n;i++)
{
  string s;
  cin>>s;
  st.insert(s);
}
cout<<st.size()<<endl;
// for(auto c:st)
// {
//   cout<<c<<endl;
// }
}


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

#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m);i>=(int)(n);--i)
#define debug(x) cout << #x << "=" << (x) << endl;

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;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
  int num;
  cin >> num;
  int f[num+1];
  f[0]=1;
  f[1]=1;
  for(int i=2;i<=num;i++)
    f[i]=f[i-1]+f[i-2];
  cout << f[num] << endl;
}

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



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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)

typedef long long ll;
typedef pair<int, string> point;

const int MAXN = 2e5 + 5;

int n, m;
vector <int> E[MAXN];
bool bio[MAXN];
deque <int> sol;

void dfs(int x, bool ok = false){
  for(auto e : E[x]){
    if(!bio[e]){
      bio[e] = true;
      if(!ok) sol.push_back(e);
      else sol.push_front(e);
      dfs(e, ok);
      break;
    }
  }
}

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

  cin >> n >> m;
  REP(i, m){
    int a, b; cin >> a >> b;
    E[a].pb(b); E[b].pb(a);
  }
  sol.push_back(1);
  bio[1] = true;
  dfs(1, 0); dfs(1, 1);
  cout << sz(sol) << "\n";
  for(auto it : sol)
    cout << it << " ";
}


Measured memory_bytes: 13440
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
double p[maxn],dp[3004][3004],ans;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    rep(i,1,n)cin>>p[i];
    dp[0][0]=1;
    rep(i,1,n)rep(j,0,i){
        
        dp[i][j]=dp[i-1][j]*(1-p[i])+(j>0?dp[i-1][j-1]*p[i]:0);
        //debug(i),debug(dp[i][j]);
    }
    rep(j,0,n){
        if(j>n-j)ans+=dp[n][j];
    }
    //cout<<ans<<endl;
    printf("%.20lf",ans);
}
/* 
3
0.30 0.60 0.80
head>tail 的概率
dp[i][#head] dp[i][j]=dp[i-1][j] dp[i-1][j-1]
O(1)计算
最后求和
 */

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

void solve(long long N, long long K, std::string S)
{
    if (S[K - 1] == 'A')
    {
        S[K - 1] = 'a';
    }
    else if (S[K - 1] == 'B')
    {
        S[K - 1] = 'b';
    }
    else
    {
        S[K - 1] = 'c';
    }
    cout << S << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    std::string S;
    std::cin >> S;
    solve(N, K, S);
    return 0;
}


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

typedef long long ll;
const int N = 1e5 + 100;

int n, ans, a[N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	cout << a[n >> 1] - a[(n >> 1) - 1];
	return 0;
}

Measured memory_bytes: 640
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    cin >> s;
    bool ok = true;
    map<char, int> mp;
    int n = SZ(s);
    for(int i = 1; i <= n; i++){
        mp[s[i - 1]]++;
        if(i == 0) ok &= (s[i - 1] == 'A');
        if(s[i - 1] == 'C') ok &= (i >= 3 && i <= n - 1);
    }
    ok &= (mp['A'] == 1);
    ok &= (mp['C'] == 1);
    for(auto x : mp){
        if(x.F != 'A' && x.F != 'C') ok &= (x.F >= 'a' && x.F <= 'z');
    }
    if(ok){
        cout << "AC";
    }else{
        cout << "WA";
    }
    return 0;
}


Measured memory_bytes: 256
a = input(str())

# print(a[-1])

hon = ['2', '4', '5', '7', '9']
pon = ['0', '1', '6', '8']

for h in hon:
    if a[-1] == h:
        print('hon')

for p in pon:
    if a[-1] == p:
        print('pon')

if a[-1] == '3':
    print('bon')

Measured memory_bytes: 9064