akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
 
#define ll long long
#define endl '\n'
#define mod 1000000007


void solve(){
	int n;
	double d;
	cin>>n>>d;
	double x,y;
	int cnt = 0;
	for(int i = 0;i<n;i++){
		cin>>x>>y;
		if(sqrt(x*x + y*y) <= d){
			cnt++;
		}
	}
	cout<<cnt;
}
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	while(t--)
    	solve();
	return 0;
}


Measured memory_bytes: 3824
import heapq
import math

n, m = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
a = [(-x, x) for x in a]

# heap
heapq.heapify(a)


for i in range(m):
    j = heapq.heappop(a)
    k = math.floor(j[1]/2)
    heapq.heappush(a, (-k, k))


sum_v = 0
for i in a:
    sum_v += i[1]
print(sum_v)

Measured memory_bytes: 17604
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  long long int sum=0;
  long long int l=s.length();
  for(long long int i=0;i<l;i++)
    sum+=(int)s[i]-48;
  if(sum%9==0)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}


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

Aeven = []
for i in A:
  if i%2 == 0:
    Aeven.append(i)
    
for i in Aeven:
  if i%3 != 0 and i%5 != 0:
    print("DENIED")
    break
else:
  print("APPROVED")

Measured memory_bytes: 9108
//https://atcoder.jp/contests/abc178/tasks/abc178_f
#include <bits/stdc++.h>
 
using namespace std;
 
const int MAXN=1e2+4;
int sz[MAXN][2+2];
 
int main() {
    int n;
    cin>>n;
    for (int i=1; i<=n; i++) {
        cin>>sz[i][1]>>sz[i][2];
    }

    for (int i=1; i<=n-2; i++) {
        if (sz[i][1]==sz[i][2] && sz[i+1][1]==sz[i+1][2] && sz[i+2][1]==sz[i+2][2]) {
            cout<<"Yes\n";
            return 0;
            }         
    }
    cout<<"No\n";
 
    return 0;
}

Measured memory_bytes: 3576
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    string s;
    cin >> s;
    string s2 = "";
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'A'){
            s2.push_back('A');
        }else if(i <= s.size() - 1 && s[i] == 'B' && s[i + 1] == 'C'){
            s2.push_back('D');
            i++;
        }else{
            s2.push_back('E');
        }
    }
    ll ans = 0, cnt = 0;
    for(int i = 0; i < s2.size(); i++){
        if(s2[i] == 'A'){
            cnt++;
        }else if(s2[i] == 'D'){
            ans += cnt;
        }else{
            cnt = 0;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 776
//
//  main.cpp
//  ABC176E
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;
int main(int argc, const char * argv[]) {
    int h,w,m;
    cin>>h>>w>>m;
    int hi,wi;
    vector<int> h_sum(h);
    vector<int> w_sum(w);
    set<P> st;
    rep(i,m){
        cin >>hi>>wi;
        hi--; wi--;
        h_sum.at(hi)++; // 行単位での爆破対象の数
        w_sum.at(wi)++; // 列単位での爆破対象の数
        st.emplace(hi,wi); // 爆破対象の場所を登録する
    }
    int mx_h=0;
    rep(i,h) mx_h=max(mx_h,h_sum.at(i));
    vector<int> h_lst; // 爆破対象の多い行のリスト
    rep(i,h) if(h_sum.at(i)==mx_h) h_lst.push_back(i);
    int mx_w=0;
    rep(j,w) mx_w=max(mx_w,w_sum.at(j));
    vector<int> w_lst; // 爆破対象の多い列のリスト
    rep(j,w) if(w_sum.at(j)==mx_w) w_lst.push_back(j);
    bool flag=false;
    rep(i,h_lst.size()) rep(j,w_lst.size()){
        // 爆破対象が　h_lst,w_lstの場所にあるか？　クロスしている場所にあるか？
        if(!st.count(make_pair(h_lst.at(i),w_lst.at(j)))){
            flag=true; // クロスしている場所にない　重複していない
            break;
        }
    }
    if(flag==true){
        cout<< mx_h+mx_w<<endl; // 重複していない場合
    } else {
        cout<<mx_h+mx_w-1<<endl; // 重複している場合
    }
    return 0;
}


Measured memory_bytes: 23452
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
pI(x)=parse(Int,x)
pM(x::Array{SubString{String},1})=map(pI,x)
function main()
  n,a,b=pM(split(readline()))
  s=chomp(readline())
  tuuka=0
  kaigai=0
  for i in s
    if i=='a' && tuuka<a+b
      println("Yes")
      tuuka+=1
    elseif i=='b' && tuuka<a+b && kaigai<b
      println("Yes")
      tuuka+=1
      kaigai+=1
    else
      println("No")
    end
  end
end
main()
if isdefined(Base, :mystdin);close(mystdin);end


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

using namespace std;

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  if (k == 1 || k == 2 * n - 1) {
    puts("No");
    return 0;
  }
  puts("Yes");
  if (k >= n) {
    for (int i = 0; i < 2 * n - 1; ++i) {
      printf("%d%c", (i + k - n) % (2 * n - 1) + 1, " \n"[i == 2 * n - 2]);
    }
  } else {
    for (int i = 0; i < 2 * n - 1; ++i) {
      printf("%d%c", (2 * n - i - (n - k) - 2 + (2 * n - 1)) % (2 * n - 1) + 1,
             " \n"[i == 2 * n - 2]);
    }
  }
  return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P2;
const int inf=1000000000;
int main() {
	int n;
	ll x,a1,a2;
	cin>>n>>x;
	cin>>a1;
	ll t=0;
	if(a1>x){
		t=(a1-x);
		a1=x;
	}
	for(int i=1;i<n;++i){
		cin>>a2;
		if(a1+a2>x){
			t+=a1+a2-x;
			a2=x-a1;
		}
		a1=a2;
	}
	cout<<t<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;



int main(){
	ll a,b,c;
	cin>>a>>b>>c;
	cout<<max(0LL,c-a+b)<<endl;
return 0;
}  



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

int main() {
  string a, b;

  cin >> a >> b;

  if (a.length() < b.length()) {
    cout << "LESS";
    return 0;
  } else if (a.length() > b.length()) {
    cout << "GREATER";
    return 0;
  } else {
    for (int i = 0; i < a.length(); i++) {
      if (a[i] < b[i]) {
        cout << "LESS";
        return 0;
      } else if(a[i] > b[i]) {
        cout << "GREATER";
        return 0;
      }
    }
  }

  cout << "EQUAL";
  return 0;
}

Measured memory_bytes: 256
def solve():
  S = input()
  K = len(S)
  dp1 = [0]*(K+1)
  dp2 = [0]*(K+1)
  dp1[1] = 1
  dp2[2] = 1
  for i in range(1,K):
    dp1[i+1] = dp2[i]+1
    if S[i]!=S[i-1]:
      dp1[i+1] = max(dp1[i+1],dp1[i]+1)
    if i>=2:
      dp2[i+1] = dp1[i-1]+1
    if i>=3 and S[i-1:i+1]!=S[i-3:i-1]:
      dp2[i+1] = max(dp2[i+1],dp2[i-1]+1)
  ans = max(dp1[-1],dp2[-1])
  return ans
print(solve())

Measured memory_bytes: 24732
#include <bits/stdc++.h>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DEL(v) decltype(v)().swap(v)
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define NL cerr << endl;
#define chmax(a, b) a=(((a)<(b))?(b):(a))
#define chmin(a, b) a=(((a)>(b))?(b):(a))
#define F first
#define S second
using namespace std;
template<typename T1, typename T2> using P = pair<T1,T2>;
template<typename T> using V = vector<T>;
struct edge { int from, to; int cost; };
bool operator< (const edge &edge1, const edge &edge2) { return edge1.cost < edge2.cost; };
const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const V<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const P<T1,T2>& p) {
   s << "(" << p.first << "," << p.second << ")";
   return s;
}
template<typename T> ostream& operator << (ostream& s, const set<T>& st) {
   s << "{";
   for (auto i = st.begin(); i != st.end(); ++i) {
      s << *i;
      if (next(i) != st.end()) s << ", ";
   }
   s << "}";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const map<T1,T2>& m) {
   s << "{";
   for (auto i = m.begin(); i != m.end(); ++i) {
      s << i->first << ":" << i->second;
      if (next(i) != m.end()) s << ", ";
   }
   s << "}";
   return s;
}

signed main()
{
   int N, C; cin >> N >> C;
   V<V<P<int,int>>> p(C);
   REP(i, N) {
      int s, t, c; cin >> s >> t >> c; --c;
      p[c].PB(MP(s, t));
   }

   V<V<P<int,int>>> q(C);
   const int MAX_K = 1e+5;
   V<int> v(MAX_K);
   REP(i, C) {
      SORT(p[i]);
      int pre_t = -1;
      REP(j, p[i].size()) {
         int cur_s = p[i][j].F, cur_t = p[i][j].S;
         if (pre_t != cur_s) {
            ++v[cur_s-1];
         } else {
            ++v[cur_s];
         }
         --v[cur_t];
         pre_t = cur_t;
      }
   }

   V<int> sum(MAX_K+1);
   REP(i, MAX_K) {
      sum[i+1] = sum[i] + v[i];
   }

   int ans = -INF;
   REP(i, MAX_K+1) {
      chmax(ans, sum[i]);
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 4352
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        double B = sc.nextDouble();
        BigDecimal a = new BigDecimal(String.valueOf(A));
        BigDecimal b = new BigDecimal(String.valueOf(B));
        BigDecimal result = a.multiply(b);
        System.out.println(result.longValue());
    }
}

Measured memory_bytes: 37504
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define st(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;
i64 giant = 4000000000000000000;

using namespace std;



int main() {
	int n;
	cin >> n;
	int ans = 0;
	int pre = 1;
	ff(i, 0, n) {
		int a;
		cin >> a;
		if (a == pre) {
			ans++;
			pre++;
		}
	}
	if (ans == 0)ans--;
	else {
		ans = n - pre+1;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    vector<int> x(5);
    for(int i=0; i<5; i++) cin >> x.at(i);
    int y;
    for(int i=0; i<5; i++){
        if(x.at(i) == 0) y = (i+1);
    }
    cout << y << endl;
}

Measured memory_bytes: 3620
h,w,n=[input() for i in range(3)]
n = int(n)
w = int(w)
h = int(h)
if(h >= w):
  temp = h
elif(w > h):
  temp = w
if(n % temp != 0):
  temp = (n // temp)
  temp = temp + 1
else:
  temp = (n // temp)
print(temp)


Measured memory_bytes: 3060
#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){
    ll n;
    cin>>n;
    vector<ll> v(n);
    vector<ll> num(n);
    rep(i, n){
        ll a;
        cin>>a;
        --a;
        v[i]=a;
        num[a]++;
    }
    ll sum=0;
    rep(i, n){
        sum+=(num[i]*(num[i]-1))/2;
    }
    rep(i, n){
        ll ans=sum;
        ans-=(num[v[i]]*(num[v[i]]-1))/2-((num[v[i]]-1)*(num[v[i]]-2))/2;
        cout<<ans<<endl;
    }
    return 0;
    
}

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

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

using namespace std;

using ll = long long;
using P = pair<int , int>;

int gcd(int a, int b) {
  return b?gcd(b, a%b):a;
}

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

  int n; cin >> n;
  int a[n]; rep(i, n) cin >> a[i];
  int l[n+2], r[n+2]; l[0] = l[n+1] = r[0] = r[n+1] = 0;

  rep(i, n) {
    l[i+1] = gcd(a[i], l[i]);
    r[n-i] = gcd(a[n-i-1], r[n-i+1]);
  }
  int ans = 0;
  for(int i = 1; i < n+1; ++i) {
    int tmp = gcd(l[i-1], r[i+1]);
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
n = int(input())
A = list(map(int, input().split()))
money = 1000
stack = 0

for i in range(n-1):
    if A[i] < A[i+1]:
        stack = int(money/A[i])
        money = stack*A[i+1] - stack*A[i] + money

print(money)

Measured memory_bytes: 61820
x, y = map(int, input().split())

a = abs(abs(x)-abs(y))

if (x < 0 and y <= 0 and abs(x) > abs(y)) or (x >= 0 and y >= 0 and abs(x)<abs(y)):
    b = 0
elif (x < 0 and y > 0) or (x >= 0 and y <= 0):
    b = 1
else:
    b = 2

print(a+b)


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl); 
#define cop(a) for(auto x:(a)){cout << x << endl;}


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        // comment this out when you use scanf or printf
        cin.tie(0); ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    };
}fastio;

vector<int> c;
int main(){
    
    string s;
    int k;
    cin >> s >> k;
    int n = s.size();
    rep(i, n){
        c.emplace_back((26-s[i]+'a')%26);
    }

    int en = -1;
    ll sum = 0;
    rep(i, n){
        if(sum+c.at(i) > k) continue;
        sum += c.at(i);
        s.at(i) = 'a';
    }

    char t = s[n-1]+(k-sum)%26;
    cout << s.substr(0, n-1) << t << endl;
     
     
    return 0;
}


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i = 0;i < (n); ++i)
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    ll n;
    cin >> n;
    vector<int> t(n),x(n),y(n);
    rep(i,n) cin >> t[i] >> x[i] >> y[i];

    bool can = true;

    rep(i,n){
        can = (t[i]>=x[i]+y[i])&&(t[i]%2==0&&((x[i]+y[i])%2==0)||(t[i]%2!=0&&(x[i]+y[i])%2!=0));
        if(!(can)) break;
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1408
# 初期入力
from bisect import bisect_left
import sys
#input = sys.stdin.readline  #文字列では使わない
N = int(input())
c =input().strip()
ans =0
r =[i for i, x in enumerate(c) if x == 'R'] #全体の中でRのIndex
r_num =len(r) #全体でRの数

ans =bisect_left(r,r_num) #呪われないためのRとWの境界
print(r_num -ans) #境界より右側のRの数

Measured memory_bytes: 17212
#include <cstdio>
#include <functional>
#include <vector>
using namespace std;

void Brute(int n, int m) {
  vector<vector<int>> adj(n, vector<int>(n));
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--, v--;
    adj[u][v] = adj[v][u] = 1;
  }
  vector<int> uf(n * n);
  for (int i = 0; i < n * n; ++i) uf[i] = i;

  function<int(int)> Find = [&](int u) {
    if (uf[u] == u) return u;
    return uf[u] = Find(uf[u]);
  };

  auto Merge = [&](int u, int v) { uf[Find(u)] = Find(v); };

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < n; ++k) {
        for (int l = 0; l < n; ++l) {
          if (adj[i][k] && adj[j][l]) {
            Merge(i * n + j, k * n + l);
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n * n; ++i) ans += Find(i) == i;
  printf("%d\n", ans);
}

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<vector<int>> g(n);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  vector<int> color(n, -1);

  int sz = 0;
  function<bool(int, int)> Dfs = [&](int x, int c) {
    color[x] = c;
    sz++;
    bool res = true;
    for (int u : g[x]) {
      if (color[u] == -1) {
        if (!Dfs(u, c ^ 1)) res = false;
      } else {
        if (color[u] == color[x]) res = false;
      }
    }
    return res;
  };

  int iso = 0, bip = 0, oth = 0;
  for (int i = 0; i < n; ++i) {
    if (color[i] >= 0) continue;
    sz = 0;
    if (g[i].empty()) {
      ++iso;
    } else if (Dfs(i, 0)) {
      ++bip;
    } else {
      ++oth;
    }
  }
  long long ans = oth + 2 * bip + 1LL * oth * (oth - 1) +
                  1LL * bip * (2 * bip - 2) + 2LL * oth * bip +
                  1LL * iso * iso + 2LL * iso * (n - iso);
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 11776
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int e[250100];
Vi g;

int main()
{
	rep(i,2,501) {
		int j = i+i;
		while(j < 250000) {
			e[j]++;
			j += i;
		}
	}
	rep(i,2,202020) if (!e[i]) g.pb(i);
	
	while (1) {
		int n, p;
		cin >> n >> p;
		if (n==-1 && p==-1) break;
		Vi l;
		auto it = upper_bound(all(g), n)-g.begin();
		//debug(g[it]);
		rep(i,it,it+p) rep(j,i,it+p+1) {
			l.pb( g[i]+g[j] );
			//cout << g[i] << " " << g[j] << endl;
		}
		sort(all(l));
		//for (auto x: l) cout << x << " "; cout << endl;
		cout << l[p-1] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 4184
import sys
import  math
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, m = na()
a = 0.5 ** m
print(int((1900 * m + 100 * (n - m)) / a))

Measured memory_bytes: 5148
#include <iostream>
using namespace std;
int main(void){
    int W_score, W_1=0, W_2=0, W_3=0, K_score, K_1=0, K_2=0, K_3=0;
    for(int i=0; i<10; i++){
        cin >> W_score;
        if(W_score > W_1){
            W_3=W_2;
            W_2=W_1;
            W_1=W_score;
        }
        else if(W_score > W_2){
            W_3=W_2;
            W_2=W_score;
        }
        else if(W_score > W_3){
            W_3=W_score;
        }
    }
    cout << W_1+W_2+W_3 << " ";
    
    for(int i=0; i<10; i++){
        cin >> K_score;
        if(K_score > K_1){
            K_3=K_2;
            K_2=K_1;
            K_1=K_score;
        }
        else if(K_score > K_2){
            K_3=K_2;
            K_2=K_score;
        }
        else if(K_score > K_3){
            K_3=K_score;
        }
    }
    cout << K_1+K_2+K_3 << endl;
    return 0;
}



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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
	
	long long a, b, c, d;
	cin >> a >> b >> c >> d;
	
	long long x1 = a*c;
	long long x2 = b*c;
	long long x3 = a*d;
	long long x4 = b*d;
	
	long long mp = max(max(x1,x2), max(x3,x4));
	
	cout << mp;
	
	return 0;
}

Measured memory_bytes: 3640
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

dicD = {}
dicT = {}

for d in D:
    if d not in dicD:
        dicD[d] = 0
    dicD[d] += 1

for t in T:
    if t not in dicT:
        dicT[t] = 0
    dicT[t] += 1

for t in dicT:
    if t not in dicD:
        print("NO")
        break
    elif dicT[t] > dicD[t]:
        print("NO")
        break
else:
    print("YES")

Measured memory_bytes: 56788
# coding: utf-8
# Your code here!
import itertools
import sys

N, M, X  = map(int, input().split())
money = []
A = []
ans = []
for _ in range(N):
    nums = [int(x.strip()) for x in input().split(' ') ]
    money.append(nums[0])
    nums.pop(0)
    A.append(nums)
num_money = []
for index, num in enumerate(money):
    num_money.append(index)
    
def run(lis, num, A, X, M, ans, money):
    ans_list = []
    for team in itertools.combinations(lis, num):
        count = 0
        for i in range(M):
            tmp = 0
            for j in list(team):
                tmp += A[j][i]
            if tmp >= X:
                count += 1
        if count == M:
            tmp_ans = []
            for n in list(team):
                tmp_ans.append(money[n])
            ans_list.append(sum(tmp_ans))
    if not len(ans_list) == 0:
        ans.append(min(ans_list))
    
    return ans
        
for i in range(1, N+1):
    ans = run(num_money, i, A, X, M, ans, money)
    
if not len(ans) == 0:
    print(min(ans))
    
else:
    print(-1)

Measured memory_bytes: 9216
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> num(N);
    for(int i = 0; i < N; i++){
        cin >> num.at(i);
    }
    sort(num.begin(),num.end());
    int res = abs(num.at(N-1)-num.at(0));
    cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,i;
	scanf("%d%d%d",&c,&a,&b);
	if(b>a)
	{
		if((b-a)%2!=0)
		{
			printf("Borys");	
		}	
		else if((b-a)%2==0)
		{
			printf("Alice");	
		}
	}	
	else if(b<a)
	{
		if((b-a)%2!=0)
		{
			printf("Alice");	
		}	
		else if((b-a)%2==0)
		{
			printf("Borys");	
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>

using namespace std;

const int mod = 998244353;
int a[300];
long long b[301];
long long dp[2][90001];
long long dp2[2][90001];

int main() {
    int n, sum = 0, i, j;
    long long ans = 1;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    
    for (i = 0; i < n; i++) sum += a[i];
    
    dp[0][0] = 1;
    dp2[0][0] = 1;
    
    for (i = 0; i < n; i++) {
        for (j = 0; j <= sum; j++) {
            dp[1][j] += dp[0][j] * 2;
            dp[1][j + a[i]] += dp[0][j];
            
            dp2[1][j] += dp2[0][j];
            dp2[1][j + a[i]] += dp2[0][j];
        }
        
        for (j = 0; j <= sum; j++) {
            dp[0][j] = dp[1][j] % mod;
            dp[1][j] = 0;
            
            dp2[0][j] = dp2[1][j] % mod;
            dp2[1][j] = 0;
        }
    }
    
    b[0] = 1;
    for (i = 1; i <= n; i++) b[i] = b[i - 1] * 2 % mod;
    
    for (i = 1; i <= n; i++) ans = ans * 3 % mod;
    
    for (i = (sum + 1) / 2; i <= sum; i++) {
        ans -= dp[0][i] * 3 % mod;
        if (ans < 0) ans += mod;
        
        if (i * 2 == sum) {
            ans += dp2[0][i] * 3 % mod;
            if (ans >= mod) ans -= mod;
        }
    }
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 2944
package main

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

func main() {
    N := nextInt()
    W := nextInt64()
    weights := make([]int64, N+1)
    values := make([]int64, N+1)

    dp := make([][]int64, N+1)

    for i := 0; i < N; i++ {
        weights[i] = nextInt64()
        values[i] = nextInt64()

        dp[i] = make([]int64, W+1)
    }
    dp[N] = make([]int64, W+1)
    for i := 0; i < N; i++ {
        for w := int64(0); w <= W; w++ {
            if w >= weights[i] {
                dp[i+1][w] = max(dp[i][w-weights[i]] + values[i], dp[i][w])
            } else {
                dp[i+1][w] = dp[i][w]
            }
        }
    }
    fmt.Println(dp[N][W])
}

func max(a, b int64) int64 {
    if a > b {
        return a
    }
    return b
}

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: 81792
#include <bits/stdc++.h>
using namespace std;

int main() {

long n,k;
cin>>n>>k;
long a[n],f[n];
for(int i=0;i<n;i++) cin>>a[i];
for(int i=0;i<n;i++) cin>>f[i];
sort(a,a+n);
sort(f,f+n);
reverse(f,f+n);
long low =-1, high=8e18;
long mid;
while(high-low>1){
  mid = (low+high)/2;
  long train=0;
  for(int i=0;i<n;i++){
    if(a[i]*f[i]>mid){
      // a -> a-mid/f 
      //train += (a[i]*f[i]-mid)/f[i]; af-mが先に計算されるのでだめ
      if(a[i]-mid/f[i]>0){ 
        train += a[i]-mid/f[i];
      }
    }
  }
  if(train>k) low=mid;
  else high=mid;
}
cout<<high<<endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
const int N = 1e6 + 500;
const int LN = 21;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;

long long n, m, u, v, k, t, q, a, h, x, d;

long long fact[N];
long long dp[N];

int main() {
   ios::sync_with_stdio(false);cin.tie(0);
   cin >> n >> h >> d;
   
   fact[0] = 1;
   long long sum = 0;
   for (int i = 1; i <= n; ++i) {
      fact[i] = 1LL * i * fact[i - 1];
      fact[i] %= mod;
      sum += fact[i];
      if (sum >= mod) sum -= mod;
   }
   
   dp[0] = fact[n];
   for (int i = 1; i <= h - 1; ++i) {
      long long cur = dp[i - 1];
      if (i - d - 1>= 0) cur -= dp[i - d - 1];
      if (cur < 0) cur += mod;
      dp[i] = (sum * cur) % mod;
      dp[i] += dp[i - 1];
      if (dp[i] >= mod) dp[i] -= mod;
   }
   
   long long cur = dp[h - 1];
   if (h - d - 1 >= 0) cur -= dp[h - d - 1];
   if (cur < 0) cur += mod;
   cout << cur << endl;
}







Measured memory_bytes: 15872
import numpy as np
import itertools
H, W, K = map(int, input().split())
L = np.array([list(input()) for i in range(H)])
Ans = 0
for h in range(H):
    for w in range(W):
        if L[h,w] == '.':
            L[h,w] = '0'
        else:
            L[h,w] = '1'
L = L.astype("int64")

def del_w(w):#w列目
    if w != 0:
        for h1 in range(H):
            L1[h1,w-1] =  0   

def del_h(h):#h行目
    if h != 0:
        for w1 in range(W):
            L1[h-1,w1] =  0
            
H_list = []
for h in range(H+1):
    H_list += list(itertools.combinations(range(1,H+1),h))

W_list = []
for w in range(W+1):
    W_list += list(itertools.combinations(range(1,W+1),w))
    
for h_list in H_list:
    for w_list in W_list:
        
        L1 = L.copy()
        
        for w1 in w_list :
            for h in range(H):
                L1[h,w1-1] =  0
                
        for h1 in h_list :
            for w in range(W):
                L1[h1-1,w] =  0 
                
        if np.sum(L1) == K:
            #print(L1,h_list,w_list)
            Ans += 1
            
print(Ans)

Measured memory_bytes: 27284
#include <cstdio>
#include <algorithm>

using namespace std;

int x[100000];
int right[20][100000];

int get(int x, int y) {
    int z = x, i;
    
    for (i = 19; i >= 0; i--) {
        if ((y >> i) & 1) z = right[i][z];
    }
    
    return z;
}

int main() {
    int n, l, q, i, j;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d", &x[i]);
    
    scanf("%d", &l);
    
    for (i = 0; i < n; i++) {
        int l2 = i, r2 = n, m = (l2 + r2) / 2;
        
        while (r2 - l2 > 1) {
            if (x[m] - x[i] <= l) {
                l2 = m;
                m = (l2 + r2) / 2;
            } else {
                r2 = m;
                m = (l2 + r2) / 2;
            }
        }
        
        right[0][i] = l2;
    }
    
    for (i = 1; i < 20; i++) {
        for (j = 0; j < n; j++) {
            right[i][j] = right[i - 1][right[i - 1][j]];
        }
    }
    
    scanf("%d", &q);
    
    for (i = 0; i < q; i++) {
        int a, b, l2, r2, m;
        
        scanf("%d %d", &a, &b);
        
        a--;
        b--;
        
        if (a > b) swap(a, b);
        
        l2 = 0, r2 = n, m = (l2 + r2) / 2;
        
        while (r2 - l2 > 1) {
            int c = get(a, m);
            
            if (c >= b) {
                r2 = m;
                m = (l2 + r2) / 2;
            } else {
                l2 = m;
                m = (l2 + r2) / 2;
            }
        }
        
        printf("%d\n", r2);
    }
    
    return 0;
}


Measured memory_bytes: 8960
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a

ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int n,a,b;
    cin>>n>>a>>b;
    ll int ans ;
    if(a > b){
        swap(a,b);
    }
    ans = abs(b-a);
    if(!(ans & 1)){
        cout<<ans/2;
    }
    else{
        if(a == 1 || a == n || b == 1 || b == n){
            cout<<(ans+1)/2;
            return 0;
        }
        else{
            ans = (ans +1)/2;
            if(n - b > (a - 1)){
                cout<<((a-1) + ans );
                return 0;
            }
            else{
                cout<<((n-b) + ans );
                return 0;
            }
        }

    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>
 
 
int main() {
    int n; std::cin >> n;
    std::map<std::string, int> mp;
    for (int i = 0; i < n; i++) {
        std::string s; std::cin >> s;
        mp[s]++;
    }
    int ma = 0;
    for (auto &p : mp) ma = std::max(ma, p.second);
    for (auto &p : mp) {
        if (ma == p.second) std::cout << p.first << std::endl;
    }
    /*
    std::map<std::string, int> mp
    いろんな値を設定;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        std::cout << "key = " << itr->first           // キーを表示
                        << ", val = " << itr->second << "\n";    // 値を表示
    }*/
    return 0;
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
#define intt long long 
using namespace std;
intt Ans=0;
int main(){
	intt n,m;
	cin>>n>>m;
	for(intt i=1;i*i<=m;i++){
		if(m%i==0){
			intt x=m/i;
			if(m/x>=n)Ans=max(Ans,x);
			if(m/i>=n)Ans=max(Ans,i);
		}
	}	
	cout<<Ans<<endl;
	return 0;
}	


Measured memory_bytes: 256
X = int(input())

L = [0] * (2 * 10**4 + 3)
for a in range(-10**4, 10**4 + 1):
    L[a + 10**4] = a**5


for a in range(-10**3, 10**3 + 1):
    for b in range(-10**3, 10**3 + 1):
        if L[a + 10**4] - L[b + 10**4] == X:
            print(a, b)
            import sys
            sys.exit()



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

int main(){
    ll H;
    ll N;
    cin >> H >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    vector<ll>HH(100000, 1e9);
    HH[0] = 0;
    //vector<double> C(N);
    //int mi = 0;
    //double MM = 0;
    rep(i,N){
        cin >> A[i] >> B[i];
        /*if(MM <= A[i]/B[i]){
            mi = i;
            MM = A[i]/B[i];
            //MM = max(MM, A[i] / B[i]);
        }*/
    }
    /*
    for(ll k = 0;k*A[0] <= 20000;k++){
        for(ll j = 1;j<=k*A[0]; j++){
            HH[j+k*A[0]] = min(HH[j+k*A[0]], (k+1)*B[0]);
        }
    }*/
    rep(i,N){
        //ll i = 0;
        for(ll j=1;j<=10010;j++){
            if(j < A[i]){
                HH[j] = min(HH[j], B[i]);
            }else{
                /*if(j==100){
                    cout <<"koko:" <<HH[j]<<" "<< HH[j-A[i]] <<endl;
                }*/
                HH[j] = min(HH[j], HH[j-A[i]] + B[i]);
            }
        }
        //cout << HH[H] << endl;
    }
    

    /*
    ll NI = H/A[mi];
    ll NII = ceil(H/A[mi]);
    if(NI == NII){
        cout << NII*B[mi] << endl;
        return 0;
    }
    ll mp = NI*B[mi];
    ll tmp_mp = mp + B[mi];
    double rH = H - NI*A[mi];
    double mini = B[mi];
    rep(i,N){
        if(B[i] < B[mi]){
            mini = min(mini, B[i]*ceil(rH/A[i]));
        }
    }
    cout << mi <<" "<<A[mi]<<" "<< mini << endl;
    */
    cout << HH[H]  << endl;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
#define DEBUG 0
#define ll long long
#define Pll pair<ll, ll>
#define Pii pair<int, int>
 
using namespace std;
struct edge{int from, to; ll cost;};

signed main(){
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    int l, r, ans = 0;
    rep(n){
        cin >> l >> r;
        ans += r-l+1;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a + b + c > 21) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 3568
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

H=I()

cnt = 1

while True:
  if H == 1:
    break
  H = math.floor(H/2)
  cnt += 1
ans= 0
for i in range(cnt):
  ans += 2 ** i
  
print(ans)
  

Measured memory_bytes: 12164
//go:generate echo "https://atcoder.jp/contests/abc177/tasks/abc177_a"
package main

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

type scanner struct{ *bufio.Scanner }

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) Float64() float64 {
	s.Scan()
	f, _ := strconv.ParseFloat(s.Text(), 64)
	return f
}

func (s *scanner) Float64Slice(l int) []float64 {
	if l == 0 {
		return []float64{}
	}
	sl := make([]float64, l, l)
	for i := range sl {
		sl[i] = s.Float64()
	}
	return sl
}

func solve(d, t, s float64) bool {
	return d/s <= t
}

func main() {
	scan := newScanner(os.Stdin)
	d, t, s := scan.Float64(), scan.Float64(), scan.Float64()
	if solve(d, t, s) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1776
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner scn = new Scanner(System.in);
      	int x = scn.nextInt();
      	int n = scn.nextInt();
      	if(n == 0){
          System.out.println(x);
          return;
        }
      	
      	Integer[] nums = new Integer[n];
      	for(int i = 0; i < n; i++){
          nums[i] = scn.nextInt();
        }
      
      	int num = x;      	
      	for(int i = 0; i < 51;i++){
	      	if(!Arrays.asList(nums).contains(x-i)){
              System.out.println(x - i);
              return;
    	    }
          	if(!Arrays.asList(nums).contains(x+i)){
              System.out.println(x + i);
              return;
            }
        }
	}
}



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

dp = [0] * (K+1)
for i in range(K):
    for a in A:
        if dp[i] == 0:
            if i + a <= K:
                dp[i+a] = 1

if dp[-1] == 0:
    print('Second')
else:
    print('First')


Measured memory_bytes: 41744
//taken from https://www.geeksforgeeks.org/longest-repeating-and-non-overlapping-substring/
//i hope its not cheating

// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<"  "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

string longestRepeatedSubstring(string str)
{
	int n = str.length();
	int LCSRe[n+1][n+1];

	// Setting all to 0
	memset(LCSRe, 0, sizeof(LCSRe));

	string res;
	int res_length = 0;
	int i, index = 0;
	for (i=1; i<=n; i++){
		for (int j=i+1; j<=n; j++){
			if (str[i-1] == str[j-1] && LCSRe[i-1][j-1] < (j - i)){
				LCSRe[i][j] = LCSRe[i-1][j-1] + 1;
				if (LCSRe[i][j] > res_length){
					res_length = LCSRe[i][j];
					index = max(i, index);
				}
			}
			else LCSRe[i][j] = 0;
		}
	}
	if (res_length > 0)
		for (i = index - res_length + 1; i <= index; i++)
			res.push_back(str[i-1]);
	return res;
}

int main()
{
	int n;
	cin >> n;
	string str;
	cin >> str;
	string t=longestRepeatedSubstring(str);
	cout << t.size();
	return 0;
}

Measured memory_bytes: 97920
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a==b){
            System.out.println("a == b");
        }else if(a<b){
            System.out.println("a < b");
        }else if(a>b){
            System.out.println("a > b");
        }
        sc.close();
    }
}


Measured memory_bytes: 26180
from collections import deque
def mergeSort(A,left,right):

    middle = (left + right) // 2
    if left + 1 < right:
        mergeSort(A, left, middle)
        mergeSort(A, middle, right)
        merge(A,left,right,middle)
    
def merge(A,left,right,middle):
    global count
        
    L = deque(A[left:middle])
    R = deque(A[middle:right])
    L.append(float("inf"))
    R.append(float("inf"))
    for i in range(left,right):
        
        if L[0] < R[0]:
            A[i] = L.popleft()
        else:
            A[i] = R.popleft()
            count += len(L) -1 
count = 0     
input()
A = list(map(int,input().split()))
mergeSort(A,0,len(A))
print(count)

Measured memory_bytes: 31064
/*
   DP*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
const long long MaxN = 1e5;

int main()
{
	int n,a,b,k;
	while(~scanf("%d %d %d",&a,&b,&k))
	{
		for(int i = a;i < min(b,a + k);i++)
		{
			if(i == a) printf("%d",i);
			else printf("\n%d",i);
		}
		if(2 * k <= b - a + 1)
		{
			for(int i = b - k + 1;i <= b;i++)
			{
				printf("\n%d",i);
			}
		}
		else
		{
			for(int i = min(b,a + k);i <= b;i++)
			{
				printf("\n%d",i);
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
N, M =map(int, input().split())
H = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(M)]
graph = [[] for _ in range(N)]
for a, b in ab:
  a -= 1
  b -= 1
  graph[a] += [b]
  graph[b] += [a]

ans = N
for v in range(N):
  flag = False
  for u in graph[v]:
    if H[v] <= H[u]:
      ans -= 1
      break

    
  
print(ans)



Measured memory_bytes: 47420
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define ll                 long long    
#define vi                 vector<ll >
// -------------------Standard Traversal Moves---------------------
// vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1};
// vi fx = {2, -2, 2, -2,  1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2};
// vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1};
// ----------------------------------------------------------------

#define int                long long                        
#define pb                 push_back                                                     
#define mii                map<ll ,ll >
#define rep(i, a, b)       for(ll  i=a;i<b;i++)
#ifdef LOCAL
#define dbg(args...)       { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
#define dbg(args...)
#endif
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define hell               1000000007
// #define hell               (ll)998244353
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define mp                 make_pair
#define yes                cout << "YES" << endl
#define no                 cout << "NO" << endl
#define inf                3223372036854775807
#define endl               '\n' 
#define PI                  3.14159265
#define N                  200005
ll n, m, k, a[N];


int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    ll tests = 1;
    // cin >> tests;
    rep(test, 1, tests+1)
    {
        cin >> n;
        cin >> m;
        cout << n * m;
    }
    return 0;
}

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

int n;
bool init , col[300];
bool consec(int x)
{
    cout << "? ";
    for(int i=x ; i<n+x ; i++)
        cout << i << " ";
    cout << "\n";
    cout.flush();
    string rb;
    cin >> rb;
    if(rb == "Red")
        return true;
    return false;
}
bool f1(int b , int start)
{
    cout << "? " << b << " ";
    for(int i=start ; i<n-1+start ; i++)
        cout << i << " ";
    cout << "\n";
    cout.flush();
    string rb;
    cin >> rb;
    if(rb == "Red")
        return true;
    return false;
}
bool f2(int b , int k)
{
    cout << "? " << b << " ";
    for(int i=1 ; i<k ; i++)
        cout << i << " ";
    for(int i=k+1+n ; i<=2*n ; i++)
        cout << i << " ";
    cout << "\n";
    cout.flush();
    string rb;
    cin >> rb;
    if(rb == "Red")
        return true;
    return false;
}
int main()
{
    cin >> n;
    cout << "? ";
    for(int i=1 ; i<=n ; i++)
        cout << i << " ";
    cout << "\n";
    cout.flush();
    string rb;
    cin >> rb;
    if(rb == "Red")
        init = true;
    else init = false;
    int left=1 , right=n , ans=200;
    while(left <= right)
    {
        int mid = (left + right)/2;
        if(consec(mid) == init)
        {
            ans = mid+1;
            left = mid + 1;
        }
        else
            right = mid - 1;
    }
    col[ans-1] = init; col[ans+n-1] = !init;
    for(int i=1 ; i<ans-1 ; i++)
        col[i] = f1(i , ans);
    for(int i=ans+n ; i<=2*n ; i++)
        col[i] = f1(i , ans);
    for(int i=ans ; i<ans+n-1 ; i++)
        col[i] = f2(i , ans-1);
    cout << "! ";
    for(int i=1 ; i<=2*n ; i++)
    {
        if(col[i])
            cout << "R";
        else cout << "B";
    }
    cout << "\n";
    cout.flush();
}

Measured memory_bytes: 724