akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
using namespace std;
#define ll long long
const ll linf = 1e15;
struct edge{
    int to;
    ll cost;
};

struct node{
    int from;
    ll cost;
    bool operator<(const node &n1) const {
        return n1.cost < cost;
    }
};

int N, M, S, T, U, V;
vector<edge> G[100010];
ll DU[100010], DV[100010], DS[100010], dp[3][100010];
bool used[100010];

void dijk(int s, ll* D){
    fill(D, D + N + 1, linf);
    priority_queue<node> pq;
    pq.push(node{s, 0});
    D[s] = 0;
    while(!pq.empty()){
        node n1 = pq.top();
        pq.pop();
        if(D[n1.from] < n1.cost) continue;
        for(auto u : G[n1.from]){
            ll cost = u.cost + n1.cost;
            if(cost < D[u.to]){
                D[u.to] = cost;
                pq.push(node{u.to, cost});
            }
        }
    }
}

ll solve(){
    dijk(U, DU), dijk(V, DV), dijk(S, DS);
    for(int i = 1; i <= N ; i++){
        dp[0][i] = DU[i];
        dp[1][i] = DV[i];
        dp[2][i] = linf;
    }

    priority_queue<node> pq;
    pq.push(node{S, 0});
    while(!pq.empty()){
        node n1 = pq.top();
        pq.pop();
        for(auto u : G[n1.from]){
            ll cost = u.cost + n1.cost;
            if(DS[u.to] < cost) continue;
            
            dp[0][u.to] = min(dp[0][u.to], dp[0][n1.from]);
            dp[1][u.to] = min(dp[1][u.to], dp[1][n1.from]);
            
            if(!used[u.to]){
                used[u.to] = true;
                pq.push(node{u.to, DS[u.to]});
            }
        }
    }

    for(int i = 1; i <= N; i++){
        dp[2][i] = min(dp[0][i] + DV[i], dp[1][i] + DU[i]);
    }
    fill(used, used + N + 1, false);

    pq.push(node{S, 0});
    while(!pq.empty()){
        node n1 = pq.top();
        pq.pop();
        for(auto u : G[n1.from]){
            ll cost = u.cost + n1.cost;
            if(DS[u.to] < cost) continue;
            
            dp[2][u.to] = min(dp[2][u.to], dp[2][n1.from]);
            
            if(!used[u.to]){
                used[u.to] = true;
                pq.push(node{u.to, DS[u.to]});
            }
        }
    }

    return min(dp[2][T], DU[V]);
}

void init(){
    cin >> N >> M >> S >> T >> U >> V;
    for(int i = 0; i < M; i++){
        int A, B;
        ll C;
        cin >> A >> B >> C;
        G[A].push_back(edge{B, C});
        G[B].push_back(edge{A, C});
    }
}

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


Measured memory_bytes: 22720
#include<iostream>
#include<string>
using namespace std;
int main()
{
  int N;
  string S;
  cin >> N;
  cin >> S;

  bool flg=false;
  int ans=0;
  for(int i=0; i<N; i++){
    if(S[i]=='A' && i+2<N){
      if(S[i+1]=='B' && S[i+2]=='C') ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;





int main()
{
   
    double a, b;
    double h, m;
    cin >> a >> b;
    cin >> h >> m;
    

    double ax, ay;
    double bx, by;
    double g, f;
    if (h < 3) {
        g = 90 - 30 * h;
        g -= (m / 2);
    }
    else if (h < 6) {
        g = -30 * (h - 3);
        g -= (m / 2);
    }
    else if (h < 9) {
        g = -90 - 30 * (h - 6);
        g -= (m / 2);
    }
    else if (h < 12) {
        g = -180 - 30 * (h - 9);
        g -= (m / 2);
    }

    f = 90;
    f -= 6 * m;

 //   cout << g << " " << f << endl;
    g = g / 180 * M_PI;
    f = f / 180 * M_PI;
    ax = a * cos(g);
    ay = a * sin(g);

    bx = b * cos(f);
    by = b * sin(f);
    //cout << ax << " " << ay << " " << bx << " " << by << endl;

    cout << setprecision(20);
    double p;

    p = sqrt(abs(ax - bx) * abs(ax - bx) + abs(ay - by) * abs(ay - by));
   
    cout << p << endl;

    return 0;

}

Measured memory_bytes: 3976
N = int(input())
A = list()
for i in range(2) :
    A.append(list(map(int, input().split())))
dp = [[0 for i in range(N)] for j in range(2)]
dp[0][0] = A[0][0]
for i in range(2) :
    for j in range(N) :
        for dx, dy in [[0, 1], [1, 0]] :
            x = j + dx
            y = i + dy
            if y < 2 and x < N :
                dp[y][x] = max(dp[y][x], dp[i][j] + A[y][x])
print(dp[1][N-1])

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<P> PP(N);
  REP(i,N) {
      ll pi;
      cin >> pi;
      PP[i] = P(pi,i);
  }
  sort(PP.begin(), PP.end(), [](auto const& lp, auto const& rp){
      return lp.first > rp.first;
  });
  

  ll ans = 0;
  multiset<ll> seen = {-1,-1,PP[0].second,N,N};
  REP3(i,1,PP.size()){
    ll val = PP[i].first;
    ll index = PP[i].second;

    auto itr = seen.upper_bound(index);
    ll r1 = *itr;
    ll r2 = *next(itr);
    ll l1 = *next(itr,-1);
    ll l2 = *next(itr,-2);  
    
    ans += ((l1-l2)*(r1-index) + (index-l1)*(r2-r1)) * val;
    seen.insert(index);
  }

  cout << ans << "\n";
  return 0;
}

// 区間内にxより大きいものが1つのみ
//
// 最初にxより大きいものが出てくるindex l1 r1
// 次にxより大きいものが出てくるindex l2 r2
// ans += ((r2-i)*(i-l1)+(r1-i)*(l2-i)) * x
// xはPを大きい順に見る
// indexをsetで管理してlower_bound,upper_boundでr1,r2,l1,l2を獲得すればlog(N)

Measured memory_bytes: 6528
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll p=1000000007;
ll exgcd(ll a,ll b,ll &x,ll &y)
{
    if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    ll g=exgcd(b,a%b,x,y);
    ll temp=x;
    x=y;
    y=temp-a/b*y;
    return g;
}
ll inverse(ll a,ll m)
{
    ll x,y;
    ll g=exgcd(a,m,x,y);
    return (x%m+m)%m;
}
ll C(ll n,ll m)
{
    ll ans=1;
    for(ll i=1;i<=m;i++)
    {
        ans=ans*(n-m+i)%p;
        ans=ans*inverse(i,p)%p;
    }
    return ans;
}
ll lucas(ll n,ll m)
{
    if(m==0)
    {
        return 1;
    }
    return C(n%p,m%p)*lucas(n/p,m/p)%p;
}
ll quickpow(ll a,ll b)
{
    if(b==0)
    {
        return 1;
    }
    if(b%2==1)
    {
        return a*quickpow(a,b-1)%p;
    }
    else
    {
        ll temp=quickpow(a,b/2);
        return temp*temp%p;
    }
}
int main()
{
    int n,a,b;
    cin>>n>>a>>b;
    ll sum=quickpow(2,n)-1;
    ll sum1=lucas(n,a)%p;
    ll sum2=lucas(n,b)%p;
    ll sum3=((sum-sum1-sum2)%p+p)%p;
    cout<<sum3<<endl;
    return 0;
}

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

int main() {
	int N, A[100];
	cin >> N;

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

	sort(A, A + N);
	cout << A[N - 1] - A[0] << endl;
}


Measured memory_bytes: 256
def main():
    from functools import lru_cache
    import sys

    sys.setrecursionlimit(10 ** 7)

    N, X = map(int, input().split())

    size = [0] * (N + 1)
    patty = [0] * (N + 1)
    size[0] = 1
    patty[0] = 1
    for lv in range(1, N + 1):
        size[lv] = size[lv - 1] * 2 + 3
        patty[lv] = patty[lv - 1] * 2 + 1

    @lru_cache(maxsize=None)
    def burger(lv, x):
        if lv == 0:
            return int(x > 0)

        if x <= 1:
            return 0

        if x <= 1 + size[lv - 1]:
            return burger(lv - 1, x - 1)

        if x == 1 + size[lv - 1] + 1:
            return patty[lv - 1] + 1

        if x <= 1 + size[lv - 1] + 1 + size[lv - 1]:
            return patty[lv - 1] + 1 + burger(lv - 1, x - (1 + size[lv - 1] + 1))

        return patty[lv]

    ans = burger(N, X)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

struct UFTree(T)
{
    struct Node
    {
        T parent;
        T rank = 1;
    }

    ///
    T min_size, max_size;

    ///
    this(T n)
    {
        nodes.length = n;
        sizes.length = n;
        foreach (i, ref node; nodes) {
            node = Node(i.to!T);
            sizes[i] = 1;
        }

        min_sizes.length = n + 1;
        min_sizes[1] = n;
        min_size = 1;
        max_size = 1;
    }

    ///
    bool unite(T a, T b)
    {
        a = root(a);
        b = root(b);

        if (a == b) return false;

        auto a_size = sizes[a];
        auto b_size = sizes[b];
        --min_sizes[a_size];
        --min_sizes[b_size];
        ++min_sizes[a_size + b_size];
        foreach (nxt_size; min(a_size, b_size)..min_sizes.length) if (min_sizes[nxt_size] != 0) {
            min_size = nxt_size.to!T;
            break;
        }
        max_size = max(max_size, a_size + b_size);

        if (nodes[a].rank < nodes[b].rank) {
            sizes[a] += sizes[b];
            nodes[b].parent = a;
        } else {
            sizes[b] += sizes[a];
            nodes[a].parent = b;
            if (nodes[a].rank == nodes[b].rank) ++nodes[b].rank;
        }

        return true;
    }

    ///
    bool is_same(T a, T b)
    {
        return root(a) == root(b);
    }

    ///
    T size(T i)
    {
        return sizes[root(i)];
    }

private:
    Node[] nodes;
    T[] sizes;
    T[] min_sizes;

    T root(T i)
    {
        if (nodes[i].parent == i) return i;

        return nodes[i].parent = root(nodes[i].parent);
    }
}

///
UFTree!T uftree(T)(T n)
{
    return UFTree!T(n);
}

alias P = Tuple!(int, "i", int, "x", int, "y");
enum P[] E = [];

void main()
{
    auto N = readln.chomp.to!int;
    P[] ps;
    foreach (i; 0..N) {
        auto xy = readln.split.to!(int[]);
        ps ~= P(i, xy[0], xy[1]);
    }
    sort!"a.x < b.x"(ps);
    auto y2i = new int[](N+1);
    foreach (i, p; ps) y2i[p.y] = i.to!int;

    auto max_y = ps.map!(p => p.y).array;
    foreach_reverse (i; 0..N-1) max_y[i] = max(max_y[i], max_y[i+1]);

    auto memo = new bool[](N);
    auto uft = uftree!int(N);
    foreach (y; 1..N+1) {
        auto i = y2i[y];
        auto p = ps[i];
        if (memo[i]) continue;
        memo[i] = true;

        int j = i+1;
        while (j < N) {
            if (memo[j]) break;
            memo[j] = true;
            uft.unite(p.i, ps[j].i);
            ++j;
        }
        if (j < N && memo[j]) {
            if (max_y[j] > y) uft.unite(ps[j-1].i, ps[j].i);
        }
    }
    foreach (i; 0..N) writeln(uft.size(i));
}

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

bool judgePrimeNumber( int a )
{
    for( int i = 2; i <= sqrt(a); i++ )
        if( a % i == 0 )
            return false;
    return true;
}

int main()
{
    int n;

    while( cin >> n )
    {
        if( n == 0 )
            break;

        int cnt = 0;
        for( int i = 2; i <= n / 2; i++ )
            if( judgePrimeNumber(i) && judgePrimeNumber(n-i) )
                cnt++;
        cout << cnt << endl;
    }
    return 0;
}



Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int i, j, n, k, p, q;
    int num = 0;
    int temp = 0;
    int flag = 0;
    cin>>n;
    int r[n];
    for(i=0; i<n; ++i){
        cin>>r[i];
    }
    int minv=r[0];
    int maxp=-2000000000;
    for(i=1; i<n; ++i){
        maxp=max(r[i]-minv,maxp);
        minv=min(minv,r[i]);
    }
    cout<<maxp<<endl;
    return 0;
}


Measured memory_bytes: 3868
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    N,K=map(int,input().split())
    A=list(map(int,input().split()))


    ng =0
    ok =10**9+1

    while ok -ng >1:
        mid = (ok+ng)//2
        ans =0
        for i in range(N):
            ans += A[i]//mid -1
            if A[i]%mid !=0:
                ans +=1

        if ans <=K:
            ok =mid
        else:
            ng =mid

    print(ok)



if __name__ == "__main__":
    main()


Measured memory_bytes: 103560
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;

set<ll> v[30];

void solve()
{
    ll n,q;
    string s;
    ll i,j;
    cin>>n>>s>>q;
 
    for(i=0;i<n;i++)
    {
        // cout<<s<<"\n";
        v[s[i]-'a'].insert(i);
    }
    while(q--)
    {
        ll t;
        cin>>t;
        if(t==1)
        {
           ll pos;
           char cc;
           cin>>pos>>cc;
        //    cout<<t<<" "<<pos<<" "<<cc<<"\n";
           pos--;
        //    if(s[pos]==cc)continue;
           v[(s.at(pos)-'a')].erase(pos);
           v[(cc-'a')].insert(pos);
           s.at(pos)=cc;

        }
        else{
           ll l,r;
           cin>>l>>r;
        //    cout<<t<<" "<<l<<" "<<r<<"\n";
           l--,r--;

           ll res=0;
           for(i=0;i<30;i++)
           {
           
              if(v[i].lower_bound(l)!=v[i].upper_bound(r))
              {
                //   cout<<(char)(i+'a')<<" ";
                  res++;
              }    
              
           }
        //    cout<<"\n";
           cout<<res<<"\n";
        }
    }
    // cout<<s<<"\n";
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 27236
import java.util.*;

public class Main {
  private static long INF = 1_000_000_000_000L;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int Q = sc.nextInt();
    
    long[] s = new long[A+2];
    s[0] = -INF;
    s[A+1] = INF;
    for (int i = 1; i <= A; i++) {
      s[i] = sc.nextLong();
    }
    
    long[] t = new long[B+2];
    t[0] = -INF;
    t[B+1] = INF;
    for (int i = 1; i <= B; i++) {
      t[i] = sc.nextLong();
    }
    
    for (int i = 0; i < Q; i++) {
      long x = sc.nextLong();
      int sr = search(s, x);
      int tr = search(t, x);
      long min = INF;
      for (int j = 0; j < 2; j++) {
        long[] a = j == 0 ? s : t;
        long[] b = j == 0 ? t : s;
        int apos = j == 0 ? sr : tr;
        int bpos = j == 0 ? tr : sr;
        for (int k = 0; k < 2; k++) {
          for (int l = 0; l < 2; l++) {
            min = Math.min(min, Math.abs(x-a[apos-k])+Math.abs(a[apos-k]-b[bpos-l]));
          }
        }
      }
      System.out.println(min);
    }
  }
  
  private static int search(long[] a, long x) {
    int ng = 0;
    int ok = a.length-1;
    while (Math.abs(ok-ng) > 1) {
      int m = (ok+ng)/2;
      if (x <= a[m]) {
        ok = m;
      } else {
        ng = m;
      }
    }
    
    return ok;
  }
}

Measured memory_bytes: 103868
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

template <typename T>
struct edge {
    int from, to;
    T cost;
    edge(){}
    edge(int _from, int _to, T _cost) : from(_from), to(_to), cost(_cost) {}
    bool operator< (const edge& e) const {
        return cost == e.cost ? (from == e.from ? to < e.to : from < e.from) : cost < e.cost;
    }
    bool operator> (const edge& e) const {
        return cost == e.cost ? (from == e.from ? to > e.to : from > e.from) : cost > e.cost;
    }
    void print() {
        cout << from << " " << to << " " << cost << endl;
    }
};

template <typename T>
class Prim {
private:
    int n;
    vector<vector<edge<T>>> G;
public:
    Prim(int _n) : n(_n) {
        G.resize(n);
    }
    // undirected
    void addEdge(int u, int v, T c) {
        G[u].emplace_back(u, v, c);
        G[v].emplace_back(v, u, c);
    }
    T calc(int s, int min_cost) {
        T ma_gap = -1;
        vector<bool> visited(n);
        int num_visited = 0;
        priority_queue<edge<T>, vector<edge<T>>, greater<edge<T>>> pq;
        pq.push(edge<T>(-1, s, min_cost));
        while (!pq.empty() && num_visited < n) {
            auto e = pq.top(); pq.pop();
            if (visited[e.to]) continue;
            ma_gap = max(ma_gap, e.cost - min_cost);
            visited[e.to] = true;
            num_visited++;
            for (const auto& ne: G[e.to]) {
                if (!visited[ne.to] && ne.cost >= min_cost) pq.push(ne);
            }
        }
        return (num_visited < n ? 1e9 : ma_gap);
    }
};
/* !!!!! T: ?????????????????????(int, double) !!!!! */

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

    int n, m;
    int t = 0;
    while (cin >> n >> m, n) {
        Prim<int> prim(n);
        rep(i, m) {
            int a, b, c;
            cin >> a >> b >> c;
            a--, b--;
            prim.addEdge(a, b, c);
        }

        int ans = 1e9;
        const int MAX_W = 10000;
        rep2(min_cost, 1, MAX_W + 1) {
            ans = min(ans, prim.calc(0, min_cost));
        }

        cout << (ans == 1e9 ? -1 : ans) << endl;
    }
}

Measured memory_bytes: 3520
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n;
  cin >> n;
  int minNum = 200000;
  int ans = 0;
  rep(i, n){
    int p;
    cin >> p;
    minNum = minNum > p ? p : minNum;
    if(p == minNum) ans++;
  }
  cout << ans << endl;
}

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

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

  int l, mx=0, sum=0;

  for(int i=0; i<n; ++i){
    cin >> l;
    sum += l;

    mx = max(mx,l);
  }

  if(mx < sum-mx){
    cout << "Yes";
    return 0;
  }

  cout << "No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 5005

int N;
int table[NUM];
int dp[NUM][NUM];

int main(){

	scanf("%d",&N);

	if(N == 2){

		printf("2\n");
		return 0;
	}

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){
			if(k == i){

				dp[i][k] = 1;
			}else{

				dp[i][k] = 2;
			}
		}
	}

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

		scanf("%d",&table[i]);
	}
	sort(table,table+N);

	int ans = 2;
	int diff,right;

	for(int mid = 1; mid <= N-2; mid++){
		right = mid+1;
		for(int left = mid-1; left >= 0; left--){
			diff = table[mid]-table[left];
			while(right < N && table[right]-table[mid] < diff){
				right++;
			}
			if(table[right]-table[mid] == diff){

				dp[mid][right] = dp[left][mid]+1;
				ans = max(ans,dp[mid][right]);
			}
		}
	}

	printf("%d\n",ans);

	return 0;
}



Measured memory_bytes: 101052
// B.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	int len = (int)s.length();
	bool ans = false;
	for (int i = 0; i < len; ++i) {
		for (int j = 0; j < len; ++j) {
			if (i + j <= len) {
				string a = s.substr(0, i) + s.substr(i + j, len - i - j);
				if (a == "keyence") {
					ans = true;
				}
			}
		}
	}
	cout << (ans ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

min_abs = float('inf')
cnt = 0
for i in range(n):
    if a[i] < 0:
        cnt += 1
        a[i] *= -1
    min_abs = min(min_abs, a[i])

if cnt % 2 == 0:
    print(sum(a))
else:
    print(sum(a) - 2 * min_abs)

Measured memory_bytes: 85120
#include<bits/stdc++.h>
using namespace std;
#define MX 1001
#define INF 9999999

int main()
{
    int i,j,n,t,f=0;

    string s,s1;
    cin>>s;
    if(s=="ARC")
        cout<<"ABC"<<"\n";
    else
        cout<<"ARC"<<"\n";
  

    return 0;

}


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

int main() {
  
  int N; //黒板に描かれる数の個数
  cin >> N;
  
  vector<int> count(N);//各数字が何回２で割れるかを数える配列
  
  for ( int i=0; i<N; i++){
    int num;//numのスコープはnum/=2まで
    cin >> num;
   
    while( num %2 ==0){
      count.at(i) ++;
      num /= 2;
    }
  }
  
  sort(count.begin(),count.end());
  
  cout << count.at(0) << endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

void compute() {

}

int main() {
  vector<ll> vec(3);
  rep(i,3) cin >> vec[i];
  sort(ALL(vec));
  ll ans = LLONG_MAX;
  do {
    ll v = vec[0] * vec[1];
    ll s = vec[2] / 2LL;
    ll t = vec[2] - s;
    ans = min(ans,llabs(s-t)*v);
  } while(next_permutation(ALL(vec)));
  cout << ans << endl;
  compute();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  map<int,int> mp;
  for(int i=0; i<N; i++){
    int x;
    cin >> x;
    mp[x]++;
  }
  priority_queue<int> PQ;
  for(auto itr = mp.begin(); itr != mp.end(); itr++){
    PQ.push(itr->second*-1);
  }
  
  vector<int> ans(N);
  int s = PQ.size();
  for(int i=s-1; i>0; i--){
    int x = PQ.top();
    ans[i] = x*-1;
    PQ.pop();
    while(x != 0){
      int y = PQ.top();
      PQ.pop();
      y--;
      PQ.push(y);
      x++;
    }
  }
  
  ans[0] = N;
  
  for(int i=0; i<N; i++){
    cout << ans[i] << endl;
  }
}

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

A.sort()
maxA = A[-1]
DP = [-1 for i in range(maxA+1)]
for a in A:
  if DP[a] != 0:
    if DP[a] == 1:
      DP[a] = 0
      continue
    for i in range(2*a, maxA+1, a):
      DP[i] = 0
    DP[a] = 1
  
    
ans = 0
for i in DP:
  if i == 1:
    ans += 1
    
print(ans)

Measured memory_bytes: 32168
#include <iostream>                                                             #include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
  int N;
  long H;
  cin >> N >> H;
  vector<long> A(N, 0);
  vector<long> B(N, 0);
  for (int n = 0; n < N; ++n) cin >> A[n] >> B[n];
  sort(A.begin(), A.end(), [](long a, long b) { return b < a; });
  sort(B.begin(), B.end(), [](long a, long b) { return b < a; });

  for (int n = 0; n < N; ++n) {
    if (B[n] < A[0]) {
      B.resize(n);
      break;
    }
  }

  long attacks = 0;
  for (auto b: B) {
    ++attacks;
    H -= b;
    if (H <= 0) break;
  }
  if (H > 0) attacks += (H / A[0]) + (H % A[0] > 0 ? 1 : 0);
  cout << attacks << endl;
  return 0;
} 


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const int N=301010;
char s[N],t[N];
int main(){
	int h,w,n;scanf("%d%d%d",&h,&w,&n);
	int x,y;scanf("%d%d",&x,&y);
	scanf("%s%s",s,t);
	int L=x,R=x;
	for(int i=0;i<n;i++){
		if(s[i]=='U')L--;
		else if(s[i]=='D')R++;
		if(L<=0||R>h)return puts("NO"),0;
		if(t[i]=='U'&&R>1)R--;
		else if(t[i]=='D'&&L<h)L++;
	}
	L=R=y;
	for(int i=0;i<n;i++){
		if(s[i]=='L')L--;
		else if(s[i]=='R')R++;
		if(L<=0||R>w)return puts("NO"),0;
		if(t[i]=='L'&&R>1)R--;
		else if(t[i]=='R'&&L<w)L++;
	}
	puts("YES");
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  set<int> s;
  rep(i,3) {
    int x;
    R x;
    s.in(x);
  }
  pr(s.size());
}

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


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

int main(){
  int sx, sy, tx, ty;
  int ver, hol;
  cin >> sx >> sy >> tx >> ty;
  ver = ty - sy;
  hol = tx - sx;
  for(int i = 0; i < ty - sy; i++){
    cout << "U";
  }
  for(int i = 0; i < tx - sx; i++){
    cout << "R";
  }
  for(int i = 0; i < ty - sy; i++){
    cout << "D";
  }
  for(int i = 0; i < tx - sx; i++){
    cout << "L";
  }
  //１周おわり
  cout << "L";
  for(int i = 0; i < ver + 1; i++){
    cout << "U";
  }
  for(int i = 0; i < hol+1; i++){
    cout << "R";
  }
  cout << "D";
  cout << "R";
  for(int i = 0; i < ver+1; i++){
    cout << "D";
  }
  for(int i = 0; i < hol+1; i++){
    cout << "L";
  }
  cout << "U";
}
  

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

using namespace std;

#define INF ((1LL<<31)-1)
#define D 10

struct SegTree {
	int segSize, realSegSize, nodeSize;
	vector<int> seg;

	void init(int n) {
		realSegSize = n;

		nodeSize = 0;
		for (segSize = 1; segSize < n; segSize *= D) nodeSize += segSize;

		seg = vector<int>(nodeSize+n, INF);
	}

	int get(int n) {
		if (n < (int)seg.size()) return seg[n];
		else return INF;
	}
	void set(int n, int v) {
		if (n < (int)seg.size()) seg[n] = v;
	}

	void update(int pos, int val) {
		int n = nodeSize + pos;
		set(n, val);
		while (n) {
			n = (n-1)/D;

			int r = INF;
			for (int i = 0; i < D; ++i) {
				r = min(r, seg[n*D+i+1]);
			}
			set(n, r);
		}
	}
	int get(int n, int l, int r, int L, int R) {
//		cout << n << " " << l << " " << r << endl;
		if (L <= l && r <= R) return get(n);
		else if (R <= l || r <= L) return INF;
		else {
			int ret = INF;
			int prev = l;
			for (int i = 0; i < D; ++i) {
				int next = i == D-1 ? r : prev + (r-l)/D;
				ret = min(ret, get(n*D+i+1, prev, next, L, R));
				prev = next;
			}
			return ret;
		}
	}
	int get(int L, int R) {
		return get(0, 0, segSize, L, R);
	}
};

struct Query {
	int y1, x1, y2, x2;
};

int main() {
	int H, W, Q;
	while ( cin >> H >> W >> Q, H || W || Q ) {
		vector< vector<int> > m(H, vector<int>(W, 0));

		for (int y = 0; y < H; ++y) {
			for (int x = 0; x < W; ++x) {
				cin >> m[y][x];
			}
		}

		bool isSegRow = H < W;
		vector<SegTree> seg;

		if (isSegRow) {
			seg.resize(H);
			for (int y = 0; y < H; ++y) {
				seg[y].init(W);
			}
		}
		else {
			seg.resize(W);
			for (int x = 0; x < W; ++x) {
				seg[x].init(H);
			}
		}

		for (int y = 0; y < H; ++y) {
			for (int x = 0; x < W; ++x) {
				if (isSegRow) seg[y].update(x, m[y][x]);
				else seg[x].update(y, m[y][x]);
			}
		}

		for (int t = 0; t < Q; ++t) {
			int y1, x1, y2, x2; cin >> y1 >> x1 >> y2 >> x2;

			int ans = INF;
			if (isSegRow) {
				for (int y = y1; y <= y2; ++y) {
					ans = min(ans, seg[y].get(x1, x2+1));
				}
			}
			else {
				for (int x = x1; x <= x2; ++x) {
					ans = min(ans, seg[x].get(y1, y2+1));
				}
			}
			cout << ans << endl;
		}

		std::vector<SegTree>(seg).swap(seg);
	}
}

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

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

int main() {
  string s, s3, s2;
  cin >> s;
  int len = s.size();
  bool flg = true;

  for (int i = 0; i <= len / 2; ++i) {
    if (s[i] == s[len - 1 - i]) continue;
    flg = false;
    // cout << "hoge1" << endl;
  }
  s2 = s.substr(0, (len - 1) / 2 );
  s3 = s.substr((len + 3) / 2 - 1, len - 1);

  int len2 = s2.size();
  int len3 = s3.size();

  for (int i = 0; i <= len2 / 2; ++i) {
    if (s2[i] == s2[len2 - 1 - i]) continue;
    flg = false;
    // cout << "hoge2" << endl;
  }
  for (int i = 0; i <= len3 / 2; ++i) {
    if (s3[i] == s3[len3 - 1 - i]) continue;
    flg = false;
    // cout << "hoge3Z" << endl;
  }

  cout << (flg ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s,t;cin>>s>>t;
  ll n=s.size(),m=t.size();
  ll ans = llINF;
  for(int i=0;i<=n-m;i++){
    ll cnt = 0;
    for(int j=i;j<i+m;j++){
      cnt += (s[j] != t[j-i]);
    }
    ans = min(ans,cnt);
  }
  cout<<ans<<endl;
  return 0;
}


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

int main(){
  
  int N,X;
  cin >> N >> X;
  vector<int> L(N);
  for (int i = 0; i < N; i++) cin >> L.at(i);
  
  int dist = 0;
  int count = 0;
  
  for (int i = 0; i < N && dist <= X; i++){
    dist += L.at(i);
    count ++;
    if (i == N - 1 && dist <= X){
      count ++;
    }
  }
  
  cout << count << endl;
  
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, long long> A;
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
    A[a.at(i)]++;
  }
  
  long long ans = 0;
  for(auto k : A){
    long long t = k.second;
    ans += t * (t - 1) /2;
  }
  
  for(int i = 0; i < n; i++){
    long long t = A[a.at(i)];
    ans += (t - 1) * (t - 2) / 2 - t * (t - 1) / 2;
    
    cout << ans << endl;
    
    ans += t * (t - 1) / 2 - (t - 1) * (t - 2) / 2;
  }
}

Measured memory_bytes: 10240
// Daniel Grzegorzewski
// while (clock()<=69*CLOCKS_PER_SEC)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

const int N = (int)2e5 + 3;
const int MOD = (int)1e9 + 7;

int n, k, sil[N], inv[N], wyn;

int fpow(int x, int y) {
  if (y == 0)
    return 1;
  if (y&1)
    return x*fpow(x, y-1)%MOD;
  int res = fpow(x, y/2);
  return res*res%MOD;
}

int ne(int x, int y) {
  if (y == 0 || y == x)
    return 1;
  if (y < 0 || y > x)
    return 0;
  return sil[x]*inv[y]%MOD*inv[x-y]%MOD;
}

signed main() {
  init_ios();
  cin >> n >> k;
  k = min(k, n-1);
  sil[0] = 1;
  for (int i = 1; i < N; ++i)
    sil[i] = i*sil[i-1]%MOD;
  inv[N-1] = fpow(sil[N-1], MOD-2);
  for (int i = N-2; i >= 0; --i)
    inv[i] = (i+1)*inv[i+1]%MOD;
  wyn = (1+n*(n-1))%MOD;
  for (int i = 2; i <= k; ++i)
    wyn = (wyn+ne(n, i)*ne(n-1, n-1-i)%MOD)%MOD;
  cout<<wyn<<"\n";
}

Measured memory_bytes: 3328
#include <iostream>
#include <stack>
#include <utility>
#define llint long long

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint a[200005];
llint cnt[400005];
stack<P> stk;

bool check(llint x)
{
  if(x == 1){
      for(int i = 1; i < n; i++){
        if(a[i+1] <= a[i])return false;
      }
      return true;
  }

  while(stk.size()) stk.pop();
  stk.push(make_pair(0, 0));
  for(int i = 1; i <= n; i++){
    if(stk.top().first < a[i]){
      stk.push(make_pair(a[i], 0));
      //cout << "push" << " " << a[i] << " " << 0 << endl;
    }
    else{
      llint pre = a[i];
      while(1){
        if(stk.top().first < a[i]){
          //cout << pre << " " << a[i] << " " << stk.top().first << endl;
          if(stk.top().first == min(pre,a[i])-1){
            if(stk.top().second < x-1){
              stk.top().second++;
              stk.push(make_pair(a[i], 0));
              //cout << "push" << " " << a[i] << " " << 0 << endl;
              break;
            }
          }
          else{
            stk.push(make_pair(min(pre,a[i])-1, 1));
            //cout << "push" << " " << min(pre,a[i])-1 << " " << 1 << endl;
            stk.push(make_pair(a[i], 0));
            //cout << "push" << " " << a[i] << " " << 0 << endl;
            break;
          }
        }

        pre = stk.top().first;
        stk.pop();
        //cout << "pop" << endl;
        if(stk.size() == 0) return false;
      }

    }

  }

  return true;
}

int main(void)
{
  cin >> n;
  for(int i = 1; i <= n; i++) cin >> a[i];

  //cout << check(1) << endl;;

  llint ub = 200005, lb = 0, mid;
  while(ub-lb>1){
    mid = (ub+lb)/2;
    if(check(mid)) ub = mid;
    else lb = mid;
  }
  cout << ub << endl;
  return 0;
}


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

using namespace std;
using ll = long long;

int main() {
    ll n = 0;
    cin >> n;
    vector<ll> v(n);
    for(ll i = 0;i < n;i++){
        cin >> v[i];
    }
    sort(v.begin(),v.end());

    cout <<  v[n / 2] - v[n / 2 - 1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int a[505][505];
    int H, W;
    vector<string> ans;

    cin >> H >> W;

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> a[i][j];
        }
    }

    for (int i = 0; i < W; i++) {
        for (int j = 0; j < H-1; j++) {
            if (a[j][i] % 2 == 1) {
                a[j][i]--;
                a[j+1][i]++;
                ans.push_back( to_string(j+1) + " " + to_string(i+1) + " "
                        + to_string(j+2) + " " + to_string(i+1) );
            }
        }
    }

    for (int i = 0; i < W-1; i++) {
        if (a[H-1][i] % 2 == 1) {
            a[H-1][i]--;
            a[H-1][i+1]++;
            ans.push_back( to_string(H) + " " + to_string(i+1) + " "
                        + to_string(H) + " " + to_string(i+2) );
        }
    }

    cout << ans.size() << endl;

    for (auto& e: ans) {
        cout << e << endl;
    }

    return 0;
}

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

class Test
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        for (int i = 1; i <= n; i++)
        {
            if (i % 3 == 0)
            {
                Console.Write(" " + i);
                continue;
            }

            int p = i;
            while ( p > 0)
            {
                if (p % 10 == 3)
                {
                    Console.Write(" " + i);
                    break;
                }
                p /= 10;
            }
        }
        Console.Write("\n");
    }
}


Measured memory_bytes: 15924
#include <stdio.h>
#include <string.h>
#include <stdio.h>
int d[13];
bool s[25];
int main()
{
    int n,temp;
    scanf("%d",&n);
    memset(d,0,sizeof(d));
    memset(s,false,sizeof(s));
    s[0]=s[24]=true;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&temp);
        d[temp]++;
    }
    if(d[0]||d[12]>=2)
    {
        printf("0\n");
        return 0;
    }
    for(int i=1;i<=12;i++)
    {
        if(d[i]>2)
        {
            printf("0\n");
            return 0;
        }
    }
    int k=0;
    for(int i=1;i<12;i++)
    {
        if(d[i]==2)
        {
            s[i]=true;
            s[24-i]=true;
        }
        else if(d[i])
        {
            if(k)
            {
                s[24-i]=true;
                k=0;
            }
            else
            {
                s[i]=true;
                k=1;
            }
        }
    }
    if(d[12])
    {
        s[12]=true;
    }
    int maxs=24;
    for(int i=1;i<24;i++)
    {
        if(s[i])
        {
            for(int j=i-1;j>=0;j--)
            {
                if(s[j])
                {
                    if(i-j<maxs)
                    {
                        maxs=i-j;
                    }
                    break;
                }
            }
            for(int j=i+1;j<=24;j++)
            {
                if(s[j])
                {
                    if(j-i<maxs)
                    {
                        maxs=j-i;
                    }
                    break;
                }
            }
        }
    }
    printf("%d\n",maxs);
    return 0;
}


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

typedef long long ll;
ll bsqrt(ll x){
    ll lo = 1, hi = 1e9;
    while(lo<hi){
        ll mid = (lo+hi)/2+1;
        if(mid*mid < x) lo = mid;
        else hi = mid-1;
    }
    return lo;
}

int main(){
    int Q; scanf("%d",&Q);
    while(Q--){
        ll a, b; scanf("%lld%lld", &a,&b);
        if(a>b) swap(a,b);

        if(a==b){
            printf("%lld\n", 2*(a-1));
            continue;
        }

        ll ans = a-1;
        ll s = bsqrt(a*b);

        if(s*(s+1) >= a*b) {
            if(s <= a){
                ans += s-1;
            }
            else{
                if(s-a < b-s){
                    ans += s-1 + s-a;
                }
                else{
                    ans += b-1;
                }
            }
        }
        else {
            if(s+1 <= a){
                ans += s;
            }
            else{
                if(s+1-a < b-s){
                    ans += s + s-a;
                }
                else{
                    ans += b-1;
                }
            }
        }
        printf("%lld\n", ans);
    }
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define REP(i,n) for(int i=0;i<n;i++)
#define pb push_back


// vectorの中身をcout << vs;で表示
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
    o << "{";
    for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
    o << "}";
    return o;
}

int main(void) {
	// cin, coutの結びつきを解除し、速くする
	cin.tie(0);
   	ios::sync_with_stdio(false);

	// 4 * 2
	// 3 * 3 * 3 * 5 = 135
	// 3 * 3 * 3 * 7 = 189
	
	// 2 * 2 * 2
	// 3 * 5 * 7 = 105
	// 3 * 5 * 11 = 165
	// 3 * 5 * 13 = 195

	int n; cin >> n;
	if (n < 105) cout << 0 << endl;
	else if (105 <= n && n < 135) cout << 1 << endl;
	else if (135 <= n && n < 165) cout << 2 << endl;
	else if (165 <= n && n < 189) cout << 3 << endl;
	else if (189 <= n && n < 195) cout << 4 << endl;
	else if (195 <= n) cout << 5 << endl;
	else return 0;
}



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

int main(){
    int N,K=0;
  	int j=0;
  	cin>>N;
    vector<int> d(N);
    	for(int i=0;i<N;i++){
          cin>>d.at(i);
        }
  for(int i=0;i<N-1;i++){
    j=i+1;
      while(j<N){
        K+=d.at(i)*d.at(j);
        j++;
      }
  }
    cout<<K<<endl;
}


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

int main(void){
    int n, k;
    cin>>n>>k;
    vector<ll> H(n);
    rep(i, n){
        cin>>H[i];
    }
    sort(H.begin(), H.end());
    ll ans=0;
    rep(i, n-k){
        ans+=H[i];
    }
    cout<<ans<<endl;
    
}

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

using namespace std;
int main(void)
{
	int n,i,j,cnt,k,f;
	int p[1000][3],flg[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++) flg[i]=0;
	for(i=0;i<n;i++){
		for(j=0;j<3;j++) scanf("%d",&p[i][j]);
	}
	for(i=0;i<n;i++) sort(p[i],p[i]+3);
	cnt=0;
	for(i=0;i<n-1;i++){
		if(flg[i]!=1){
			for(j=i+1;j<n;j++){
				f=1;
				for(k=0;k<3;k++){
					if(p[i][k]!=p[j][k]){
						f=0; break;
					}
				}
				if(f==1){
					cnt++; flg[j]=1;
				}
			}
		}
	}
	printf("%d\n",cnt);
	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()

#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<string> s(n);

  REP(i, n) cin >> s[i];

  unordered_map<string, int> M;
  int ans = 0;
  REP(i, n) {
    if (M.count(s[i]) == 0) ans++;
    M[s[i]]++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 24040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

vll S_flag;
map<pair<ll, ll>, ll> C_mp;
vvll T;

void search(ll pos){
  if(S_flag[pos]>0) return;
  S_flag[pos] = 1;
  set<ll> used_color;
  for(ll i=0; i<T[pos].size(); ++i){
      pair<ll, ll> p1(pos, T[pos][i]);
      if(C_mp.find(p1)!=C_mp.end()) used_color.emplace(C_mp[p1]);
    }
  ll color=1;
  for(ll i=0; i<T[pos].size(); ++i){
      pair<ll, ll> p1(pos, T[pos][i]);
      if(C_mp.find(p1)!=C_mp.end()) continue;
      while(used_color.find(color)!=used_color.end()) color++;
      pair<ll, ll> p2(T[pos][i], pos);
      C_mp[p1] = color;
      C_mp[p2] = color;
      used_color.emplace(color);
    }
  for(ll i=0; i<T[pos].size(); ++i) search(T[pos][i]);
  return;
}

int main(void){
  ll N;
  cin >> N;
  T.resize(N);
  vll a(N-1), b(N-1);
  for(ll i=0; i<N-1; ++i){
      cin >> a[i] >> b[i];
      a[i]--; b[i]--;
      T[a[i]].push_back(b[i]);
      T[b[i]].push_back(a[i]);
    }
  
  ll K = 0;
  for(ll i=0; i<N; ++i) K = max(K, (ll)T[i].size());
  
  S_flag.resize(N, 0);
  
  search(0);
  
  cout << K << endl;
  for(ll i=0; i<N-1; ++i){
      pair<ll, ll> p1(a[i], b[i]);
      cout << C_mp[p1] << endl;
    }
  
  return 0;
}


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

using namespace std;

int main(){
    int h, n;
    cin>>h>>n;
    int sum=0;
    for(int i=0;i<n;i++){
        int a;
        cin >>a;
        sum+=a;
    }
    if(sum>=h){
        cout <<"Yes";
    }
    else{
        cout <<"No";
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        for (int i = 0; i != 4; i++) {
            int t = scan.nextInt();
            int n = scan.nextInt();
            switch (t) {
                case 1:
                    System.out.println(n * 6000);
                    break;
                case 2:
                    System.out.println(n * 4000);
                    break;
                case 3:
                    System.out.println(n * 3000);
                    break;
                case 4:
                    System.out.println(n * 2000);
                    break;

            }

        }
    }
}



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

#define rep(i,n) for(int i=0; i<(n); i++)
#define repi(i,a,b) for(int i = (a); i<= (b); i++)
#define repA(i,n) for(int i=n; i>=0; i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (int)(a.size())
#define fastio ios::sync_with_stdio(0);cin.tie(0); cout.tie(0)

typedef long long ll;
typedef long double ld;
const ll mod = (ll)(1e9+7);//998244353;
const int N = (int)(1e6+5);

int n,t;

void solve() {

}

int main() {
  fastio;
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  #endif
  //cin>>t;rep(i,t)solve();

  cin>>n;
  string s[] = {"AC","WA","TLE","RE"};
  vector<int> cnt(4,0);
  rep(i,n)  {
    string a; cin>>a;
    if(a == s[0]) cnt[0]++;
    else if(a == s[1])  cnt[1]++;
    else if(a == s[2])  cnt[2]++;
    else  cnt[3]++;
  }

  rep(i,4) {
    cout<<s[i]<<" x "<<cnt[i]<<'\n';
  }


  return 0;
}


Measured memory_bytes: 3656
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

#define pb push_back
#define mp make_pair
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define sf(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);


int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const double pi = acos(-1.0);
ll mod = 1000000007;
ll sum(ll n)
{
    if(n <= 0)
    return 0;
    return (n*(n+1))/2;
}
int main()
{
    ull n, m = 0, x, k;
    cin >> n >> k;
    ll f = 0;
    for(int i = n+1 ; i >= k ; i--){

     m = (m  + (sum(n) - sum(n  - i )  - sum(n - f++) + 1 )) % mod;


    }
    cout << m << endl;



    return 0;
}





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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

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

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);


  int n, m;
  while (cin >> n >> m) {
    set<int> x, y;
    for (int i = 0; i < m; ++i) {
      int a, b;
      cin >> a >> b;
      if (a == 1) x.insert(b);
      if (b == n) y.insert(a);
    }
    bool f = false;
    for (int i = 1; i <= n; ++i) {
      f = f || (x.count(i) && y.count(i));
    }
    cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  }
  return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n,k,q;
    int a[100000];
    cin >> n >> k >> q;
    int b[100000];
    for(int h=0; h<n; h++){
        b[h] = 0;
    }
    for(int i=0; i<q; i++){
        cin >> a[i];
    }
    
    for(int j=0; j<q; j++){
        b[a[j]-1]++;
    }
    
    for(int l=0; l<n; l++){
        if((q-b[l])>=k){
            cout << "No" << endl;
        }
        else{
            cout << "Yes" << endl;
        }
    }
}

Measured memory_bytes: 1408