akhauriyash/Code-Regression huggingface dataset:
/* -> Written by <-
   -----------
  |K_A_Z_A_M_A|
  |___________|
  |    _    |
  |   (^_^)   |
  |  /( | )\  |
  |____|_|____|
    H O A N G
*/

#define Task ""
#define F first
#define S second
#define push_back pb
#define bit(x, i) (x >> i) & 1
#define inf 1e9 + 7
#define INF 1e18 + 7
#define all(x) x.begin(), x.end()

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <string>
#include <sstream>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;

typedef long long ll;

const int MOD = 998244353;
const double eps = 1e-6;
const int maxn = 3e5 + 5;

int n, k;
int dp[maxn];

struct IT
{
    int tree[4 * maxn];
    int id[maxn];

    void Init(int node, int l, int r)
    {
        if (l == r)
        {
            id[l] = node;
            return;
        }
        int mid = (l + r) >> 1;
        Init(2 * node, l, mid);
        Init(2 * node + 1, mid + 1, r);
    }

    int Get(int node, int l, int r, int u, int v)
    {
        if (l > v || r < u) return 0;
        if (l >= u && r <= v) return tree[node];
        int mid = (l + r) >> 1;
        int L = Get(2 * node, l, mid, u, v);
        int R = Get(2 * node + 1, mid + 1, r, u, v);
        return max(L, R);
    }

    void Update(int pos, int val)
    {
        int p = id[pos];
        tree[p] = max(tree[p], val);
        while (p > 1)
        {
            int node = p / 2;
            tree[node] = max(tree[2 * node], tree[2 * node + 1]);
            p = node;
        }
    }
}T;

void Solve()
{
    cin >> n >> k;
    T.Init(1, 0, 300000);
    for (int i = 1; i <= n; i ++)
    {
        int x;
        cin >> x;
        int c = T.Get(1, 0, 300000, max(0, x - k), min(300000, x + k));
        dp[i] = c + 1;
        T.Update(x, dp[i]);
    }
    cout << *max_element(dp + 1, dp + 1 + 300000);
}


int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    if(fopen(Task".inp", "r"))
    {
        freopen(Task".inp","r",stdin);
        freopen(Task".out","w",stdout);
    }
    int test_case = 1;
//    cin >> test_case;
    while (test_case --)
        Solve();
    return 0;
}


Measured memory_bytes: 10104
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>

using namespace std;

struct UnionFind
{
    vector<int> par; // par[a] = b ... a の親は b であるという意味. 根の場合は木の深さに(-1)をかけた値.
    UnionFind(int n) : par(n, -1){} // 親なし(-1)として初期化

    // x の根を返す
    int root(int x)
    {
        // 親がいない場合 x 自身が根
        if (par[x] < 0) return x;
        // 親がいる場合はその親を辿り、再帰的に根を求める
        else return par[x] = root(par[x]);
    }

    // x と y が同じ木に属しているかどうか
    bool isSame(int x, int y)
    {
        return root(x) == root(y);
    }

    // x が属している木と y が属している木の結合
    void merge(int x, int y)
    {
        int rx = root(x), ry = root(y);
        if (rx == ry) return; // 既に結合しているため
        
        if (par[rx] > par[ry]) swap(x, y);
        par[rx] += par[ry]; // 深さを更新
        par[ry] = rx;       // x の根 rx に y の根 ry を結合 

    }

    // x が属する木の深さを返す
    int size(int x)
    {
        return -par[root(x)];
    }
};

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    UnionFind uf(N);
    vector<vector<int>> list(N); // 友達関係 or ブロック関係

    for (int i = 0; i < M; ++i)
    {
        int a, b;
        cin >> a >> b;
        --a; --b;
        uf.merge(a, b);
        list[a].push_back(b);
        list[b].push_back(a);
    }

    for (int i = 0; i < K; ++i)
    {
        int c, d;
        cin >> c >> d;
        --c; --d;
        if (!uf.isSame(c, d)) continue;

        list[c].push_back(d);
        list[d].push_back(c);
    }
    vector<int> results(N, 0);

    for (int i = 0; i < N; ++i)
    {
        int num = uf.size(i) - 1 - list[i].size();
        results[i] = num; 
    }

    for (int i = 0; i < N; ++i)
    {
        cout << results[i];
        if (i != N - 1) cout << ' ';
        else cout << endl;
    }
    return 0;
}


Measured memory_bytes: 8440
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	ll n;
	cin >> n;

	vector<ll> d(n);
	for (auto &v : d) {
		cin >> v;
	}
	sort(begin(d), end(d));

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2e5 + 5);
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a,b) << " " << max(0,a+b-n) << endl;
    return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  vi num(13,0);
  rep(i,n){
    int d;
    cin>>d;
    num[d]++;
  }
 
  rep(i,13)if(num[i]>=3){
    cout<<0<<endl;
    return 0;
  }
 
  vi t(25,0);
  if(num[0]){
    cout<<0<<endl;
    return 0;
  }

  rep(i,13)if(num[i]==2){
    t[i]++;
    t[24-i]++;
  }
 
  t[0]++;
  int ans=0;
  int bit;
  rep(bit,1<<13){
    vector<bool> tmp(24,false);
    rep(i,13)if(num[i]==1){
      if((bit&(1<<i))!=0)tmp[i]=true;
      else tmp[24-i]=true;
    }
    int m=INF;
    rep(i,24)rep(j,24)if(i!=j)
      if((t[i]||tmp[i]) && (t[j]||tmp[j])){
	int d=abs(i-j);
	m=min(m, min(d,24-d));
      }
    ans=max(ans,m);
  }
  cout<<ans<<endl;
}


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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;

ll A[105], dp[2*N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n,k;
    cin>>n>>k;
    rep(i,0,n)  cin>>A[i];
    rep(i,0,k+1){
        if(dp[i] == 1) continue;
        rep(j,0,n){
            dp[i+A[j]] = 1; 
        }
    }    
    if(dp[k])   cout<<"First"<<endl;
    else cout<<"Second"<<endl;
    return 0;
}

Measured memory_bytes: 1792
object Main extends App {
  val Array(h,w) = io.StdIn.readLine.split(' ').map(_.toInt)

  val as =  for (i <- 0 until h) yield for (s <- io.StdIn.readLine) yield s

  val ngCol = (0 until as.head.size).filter(i => as.forall(s => s(i) == '.'))

  for (a <- as if !a.forall(_ == '.'))
    println((0 until as.head.size).filter(!ngCol.contains(_)).map(a).mkString)

}


Measured memory_bytes: 30880
#include <bits/stdc++.h>  // ver2.1.9
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define Pii pair<int,int>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lW,0,a.size()){Vout(a[lW]);}
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;
 
int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void uniq(Vi &v){sort(ALL(v)); v.erase(unique(ALL(v)),v.end());}  //  uniqのやつ
 
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}

signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(16);
  Vi a(50);
  int n;
  cin >> n;
  int ans = dem(n,50) + 49;
  int ct = (50 - n%50)%50;
  
  //cout << ans << endl;
  int ans2 = ans + ct;
  ans = ans+ct-51;
  
  rep(i,0,50){
    if(i < ct) a[i] = ans;
    else a[i] = ans2;
  }
  //cout << ct << endl;
  cout << 50 << endl;
  Vout(a);
  return 0;
}

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

using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
#define pb push_back
#define mk make_pair
typedef long long ll;


template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
int mod = 1e9 + 7;

int add(int a, int b){
	if(a + b >= mod)return a+ b - mod;
	return a + b;
}
int mul(int a, int b){
	return 1LL * a * b  % mod;
}
int power(int a, int b){
	if(b < 0)return 0;
	int re = 1;
	while(b){
		if(b&1){
			re = mul(re, a);
		}
		a = mul(a, a);
		b >>= 1;
	}
	return re;
}
// int const N = 100000 + 5;
// int fact[N], inverse[N];
// void FAC(){
//  	fact[0] = 1;
// 	for(int x = 1; x< N; x++){
// 		fact[x] = mul(fact[x-1], x);
// 	}
// 	inverse[N-1] = power(fact[N-1], mod -2);
// 	for(int x = N-2; x>= 0; x--){
// 		inverse[x] = mul(x + 1, inverse[x+1]);
// 	}

//  }

// int ncr(int a, int b){
// 	if(a < b)return 0;
// 	return mul(fact[a], mul(inverse[a-b], inverse[b]));
// }


/******************************************************/

void solve(){
	ll n, m;
	cin >> n >> m;
	if(min(n, m) == 1){
		cout << 1;
	}
	else{
		cout << (n/2) * m + (n % 2 == 1) * (m  - m / 2);
	}
}


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

}


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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
int main(){
   int n;
  cin >> n;
  cout << ((n+1)/2) << endl;
    return 0;
}


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

n=int(input())
P=list(map(int,input().split()))

ANS=0
for i in range(1,n-1):
    if P[i-1]<P[i]<P[i+1] or P[i-1]>P[i]>P[i+1]:
        ANS+=1

print(ANS)


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

int main() {
  
  char c;
  cin >> c;
  
  if ( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' ){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
    
}


Measured memory_bytes: 256
N=int(input())
H=list(map(int,input().split()))
count=0
maxcount=0
for n in range(N-1):
    right=H[-(n+1)]
    left=H[-(n+2)]
    if left>=right:
        count+=1
    else:
        count=0
    if count>maxcount:
        maxcount=count

print(maxcount)

Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LONG_LONG_MAX / 2;
const ll mod = 1000000000 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main() {
  int N, M;
  cin >> N >> M;
  vector<pair<int, int>> students, pos;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    students.push_back(make_pair(a, b));
  }

  for (int i = 0; i < M; i++) {
    int c, d;
    cin >> c >> d;
    pos.push_back(make_pair(c, d));
  }

  for (int i = 0; i < N; i++) {
    int dis_min = INT_MAX;
    int ans = INT_MAX;
    for (int j = 0; j < M; j++) {
      int dis = abs(students[i].first - pos[j].first) +
                abs(students[i].second - pos[j].second);
      if (dis < dis_min) {
        dis_min = dis;
        ans = j + 1;
      }
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 3608
<?php
list($N, $K) = ints();
$A = ints();
$mi = $pl = [];
$zero = 0;
foreach($A as $a){
  if($a < 0){
    $mi[] = $a;
  }elseif($a > 0){
    $pl[] = $a;
  }else{
    $zero++;
  }
}
$minusCount = count($mi)*count($pl);
$zeroCount = $zero*(count($pl)+count($mi)) + intdiv($zero*($zero-1), 2);
rsort($mi);
sort($pl);
$micount = count($mi);
$plcount = count($pl);

$min = (int)-10**18;
$max = (int)10**18;
while($max>$min){
  $mid = $min + intdiv($max-$min+1,2);
  if(countLT($mid)>=$K){
    $max = $mid-1;
  }else{
    $min = $mid;
  }
}
echo $min;

function countLT($t){
  global $mi, $pl, $zero, $minusCount, $zeroCount, $micount,$plcount;
  if($t==0){
    return $minusCount;
  }elseif($t > 0){
    $count = $minusCount + $zeroCount;
    //pl*pl
    $i = $plcount-1;
    foreach($pl as $j => $p){
      while(($pl[$i]??0) * $p >= $t)--$i;
      if($i > $j)$count+=$i-$j;
    }
    //mi*mi
    $i = $micount-1;
    foreach($mi as $j => $m){
      while(($mi[$i]??0) * $m >= $t)--$i;
      if($i > $j)$count+=$i-$j;
    }
  }else{
    $count = ($micount-1) * $plcount;
    $i = $micount-1;
    foreach($pl as $p){
      while(($mi[$i]??0) * $p < $t)$i--;
      $count-=$i;
    }
  }
  return $count;
}

function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}


Measured memory_bytes: 29172
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = (ll)n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = (ll)r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U> inline void cmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> inline void cmin(T &a, U b) { if (a > b) a = b; }
constexpr char el = '\n';
template<class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<class T, class U> istream &operator>>(istream &is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) os << v[i] << (i+1 != v.size() ? " " : ""); return os; }
template<class T> istream &operator>>(istream &is, vector<T> &v) { for(T &i : v) is >> i; return is; }
struct IoSetup {
  IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); }
} io_setup;
#line 2 "e.cpp"

int main() {
  ll n;
  cin >> n;
  vl a(n);
  cin >> a;

  ll sum = 0;
  rep(i, n) {
    sum ^= a[i];
  }

  rep(i, n) {
    cout << (sum ^ a[i]) << " ";
  }
  cout << el;
}


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



int main(){
	int N;
	cin>>N;
	vector<int> dp(N+1,999999);
	dp[0]=0;
	vector<int> K;
	int a = 1;
	K.push_back(a);
	a*=9;
	while(a<=N){
		K.push_back(a);
		a*=9;
	}
	a=6;
	while(a<=N){
		K.push_back(a);
		a*=6;
	}
	
	for(int i=1;i<=N;i++){
		for(int j=0;j<K.size();j++){
			if(i-K[j]<0)continue;
			dp[i]=min(dp[i],dp[i-K[j]]+1);
		}
	}
	
	cout<<dp[N]<<endl;
	
	
	return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder1
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] inputLine = (Console.ReadLine()).Split(' ');

            int num1 = int.Parse(inputLine[0]);
            int num2 = int.Parse(inputLine[1]);

            int num3 = (num1 * (num1 - 1) / 2) + (num2 * (num2 - 1) / 2);

            Console.WriteLine(num3);

        }
    }
}

Measured memory_bytes: 13140
from operator import itemgetter
n = int(input())
l = []

for i in range(1, n+1):
    a = input().split()
    l.append([a[0], int(a[1]), i])

l2 = sorted(l, key=itemgetter(1), reverse=True)
l2 = sorted(l2, key=itemgetter(0))

for i in l2:
    print(i[2])

Measured memory_bytes: 3064
n = int(input())

for i in range(1, n + 1):
    if (i + 1) * i // 2 >= n:
        ans = []
        for j in range(i, 0, -1):
            if n - j >= 0:
                n -= j
                ans.append(j)

        print(*ans[::-1], sep="\n")
        exit()


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

int main()
{
    int X, sosu;
    bool ee = false;
    cin >> X;
    if (X == 2)
    {
        sosu = 2;
        ee = true;
    }
    for (int i = X;; i++)
    {
        if (ee == true)
        {
            break;
        }
        for (int j = 2; j < i; j++)
        {

            if (i % j == 0)
            {
                break;
            }
            else if (i % j != 0 && j == i - 1)
            {
                sosu = i;
                ee = true;
                break;
            }
        }
    }
    cout << sosu << endl;
}


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

#define ll long long
#define db double
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define all(x) x.begin(),x.end()
#define fo(i, n) for(i=0 ; i<n ; i++)
#define Fo(i, k, n) for(i=k ; i<n ; i++)

using namespace std;
using namespace chrono;

const ll mod = 1000000007;
const ll N = 300005;  // array size
const ll inf = 10000000000000000;


void print(vector<ll> v) {
    ll i;
    fo(i, v.size())cout << v[i] << " ";
    cout << "\n";
}

vector<ll> read(ll n) {
    ll i;
    vector<ll> arr(n, 0);
    fo(i, n)cin >> arr[i];
    return arr;
}

vector<ll> read(ll n, ll k) {
    ll i;
    vector<ll> arr(n + k, 0);
    Fo(i, k, n + k)cin >> arr[i];
    return arr;
}

bool isEven(ll n) {
    return n % 2 == 0;
}

bool isOdd(ll n) {
    return n % 2 != 0;
}


void solve() {
    ll t;
    cin >> (t);
    while (t--) {

        ll i, j, k, n, m, p, q, x, y, a, b, l, r;


    }
}

int main() {

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

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif

    auto start = high_resolution_clock::now();

    ll i, j, k, n, m, p, q, x, y, a, b, l, r;

    cin>>n;
    string s1,s2;
    cin>>s1>>s2;
    fo(i,n){
        cout<<s1[i]<<s2[i];
    }


    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
#ifndef ONLINE_JUDGE
    cerr << "Time: " << duration.count() / 1000.0 << endl;
#endif


    return 0;
}




Measured memory_bytes: 3652
import java.util.*;
import static java.lang.System.*;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  
	  long N = sc.nextLong();
	  long rute = (long)Math.sqrt(N);
	  long a = 0, b = 0;
	  
	  for(long r = rute; r>0; r--) {
		  if (N % r == 0) {
			  a = r;
			  b = N / a;
			  break;
		  }
	  }
	  long ans = (a-1)+(b-1);
	  out.println(ans);
		  
	}
  }	

Measured memory_bytes: 23892
def gcd(x,y):
    if x<y:
        x,y=y,x
    while x%y!=0:
        x,y=y,x%y
    return(y)

n=int(input())

v=[]
line=input().split()

for i in range(n):
    v.append(int(line[i]))

gcd_l=[]
gcd_r=[]

for i in range(n-1):
    if i==0:
        gcd_l.append(v[i])
    else:
        gcd_l.append(gcd(gcd_l[i-1],v[i]))

for i in range(n-1):
    if i==0:
        gcd_r.append(v[n-1])
    else:
        gcd_r.append(gcd(gcd_r[i-1],v[n-i-1]))

gcd_list=[]

for i in range(n):
    if i==0:
        gcd_list.append(gcd_r[n-2])
    elif i==n-1:
        gcd_list.append(gcd_l[n-2])
    else:
#        print(gcd(gcd_l[i-1],gcd_r[n-i-2]))
        gcd_list.append(gcd(gcd_l[i-1],gcd_r[n-i-2]))

#print(gcd_list)

print(max(gcd_list))


Measured memory_bytes: 16832
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  vector<vector<int>> data(3,vector<int>(3));
  REP(i,3){
    REP(j,3){
      cin >> data[i][j];
    }
  }
  int N; cin >> N;
  vector<vector<bool>> bingo(3,vector<bool>(3));
  REP(i,N){
    int tmp; cin >> tmp;
    REP(j,3){
      REP(k,3){
        if(tmp == data[j][k])
          bingo[j][k]=true;
      }
    }
  }
  bool flag=false;
  REP(i,3){
    if(bingo[i][0] && bingo[i][1] && bingo[i][2]) flag = true;
  }
  REP(i,3){
 	if(bingo[0][i] && bingo[1][i] && bingo[2][i]) flag = true;
  }
  if(bingo[0][0] && bingo[1][1] && bingo[2][2]) flag = true;
  if(bingo[0][2] && bingo[1][1] && bingo[2][0]) flag = true;
  if(flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<memory>
#include<string>
#include<map>

using namespace std;

int main()
{
  string s;
  string mxs;
  int mxl = 0;
  map<string, int> h;
  int mxh = 0;
  string mxhs;
  
  while ( cin >> s )
    {
      if ( h.count( s ) == 0 )
        h[ s ] = 1;
      else
        ++h[ s ];
      
      if ( s.size() > mxl )
        {
          mxl = s.size();
          mxs = s;
        }
    }

  for ( auto it = h.begin(); it != h.end(); ++it )
    if ( (*it).second > mxh )
      {
        mxh = (*it).second;
        mxhs = (*it).first;
      }
  
  cout << mxhs << " " << mxs << endl;
  
  return 0;
}

Measured memory_bytes: 1196
n = int(input())

ans = 'Yes'

w = []

for i in range(n):
	a = input()
	if a in w:
		ans = 'No'
	else:
		w.append(a)
b = w[0]
c = w[1:]
for i in c:
	if i[0] == b[-1]:
		b = i
	else:
		ans = 'No'
		break
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define resz resize
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 100003
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define sumall(v) accumulate(all(v),(ll)0)
#define sum accumulate
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION(n) std::cout.unsetf ( std::ios::floatfield );std::cout.precision((ll)n)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define br "\n"
#define sp " "
#define zero (ll)0
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
void READ(vll &v, ll n){ll a ;for(ll i=0 ; i<n ; i=i+1){cin>>a ;v.pb(a);}}
void PRINT(vll &v , ll a = 0){for(ll i=a ; i<v.size() ; i=i+1){/*v[i] = max((ll)0,v[i]);*/cout<<v[i]<<" " ;}cout<<"\n" ;}
double logy(ll n , ll b){if(b==0){return(-1);}if(n==1){return(0);}return((db)log10(n)/log10(b));}
long long power(long long k , long long n , long long m=mod){long long res = 1;while(n){if(n%2!=0){res = (res*k)%m ;}k = (k*k)%m ;n = n/2 ;}return(res) ;}
ll n,m,k;
bool ok = false;
int main()
{
    FastIO ;
    PRECISION(10) ;
    ll a,b,c,d,i,j,t,x,y,z;//,x1,y1,z1,e,f;
    ll p,q,r,u,w ;
    char ch,chr ;
    //string str,st,str1,str2,str3,str4;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    cin>>k>>a>>b;
    d = (a+k-1)/k;
    if(d*k>b)
    {
        cout<<"NG";
    }
    else
    {
        cout<<"OK";
    }
}

Measured memory_bytes: 3696
#include "bits/stdc++.h"

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
//const int INF = 1 << 30;
const int INF = 1e9 + 10;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)

int H, W;
ll c[10][10];
ll A[210][210];
ll ans;

int V = 10;

void warshall_floyd() {
	for (int k = 0; k < V; k++)
		for (int i = 0; i < V; i++)
			for (int j = 0; j < V; j++) c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
}

void debug() {
	for (int i = 0; i < V; i++) {
		for (int j = 0; j < V; j++) {
			cout<< right << setw(4) << c[i][j] << " ";
		}cout<<endl;
	}cout<<endl;
}

int main(void){
	cin>>H>>W;
	for (int i = 0; i < V; i++)
		for (int j = 0; j < V; j++) cin>>c[i][j];

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

	warshall_floyd();

	for (int i = 0; i < H; i++)
		for (int j = 0; j < W; j++) ans += c[A[i][j]][1];

	cout<< ans <<endl;

	//debug();
	
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

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

        int n = sc.nextInt();
        String[] s = new String[n];

        int ab = 0;
        int xa = 0;
        int bx = 0;
        int bxa = 0;

        for(int i = 0; i < n; i++){
            s[i] = sc.next();

            if(s[i].charAt(s[i].length() - 1) == 'A'){
                if(s[i].charAt(0) == 'B'){
                    bxa++;
                }else{
                    xa++;
                }
            }else if(s[i].charAt(0) == 'B'){
                bx++;
            }
            for(int j = 0; j < s[i].length(); j++){
                int index = s[i].indexOf("AB", j);
                if(index != -1){
                    j = index;
                    ab++;
                }else{
                    j = s[i].length();
                }
            }
        }

        if(bxa > 0){
            ab += bxa - 1;
            if(xa > 0){
                xa--;
                ab++;
            }
            if(bx > 0){
                bx--;
                ab++;
            }
        }
        ab += Math.min(xa, bx);
        System.out.println(ab);

    }

}


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

int	main() {
	double x1, y1, x2, y2, x3, y3;
	cin >>x1 >>y1 >>x2 >>y2 >>x3 >>y3;
	double u1=x3-x1;
	double v1=y3-y1;
	double u2=x2-x1;
	double v2=y2-y1;
	double u3=x3-x2;
	double v3=y3-y2;
	double a=sqrt(u1*u1+v1*v1);
	double b=sqrt(u2*u2+v2*v2);
	double c=sqrt(u3*u3+v3*v3);
	double l=max(max(a, b), c);
	double r=u1*v2-v1*u2;
	r /=(a+b+c);
	if (r<0)
		r = -r;
	double x=l*r/(l+2*r);
	cout <<setprecision(10) <<x <<endl;
	return 0;
};


Measured memory_bytes: 384
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;


int main()
{
    int N, M;
    int ans = 0;

    cin >> N >> M;

    ans += N * (N - 1);
    ans += M * (M - 1);

    cout << ans / 2 << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

signed main(void)
{
  int a, b;
  cin >> a >> b;
  cout << (a+b)%24 << endl;

  return 0;
}


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

#R[0]
minv = int(input())
maxv = -10**12

#R[1..N-1]
for j in range(1, N):
    r = int(input())
    maxv = max(maxv, r - minv)
    minv = min(minv, r)
    
print(maxv)



Measured memory_bytes: 5608
N, M = [int(_) for _ in input().split()]
ab = [tuple(int(_) for _ in input().split()) for _ in range(M)]

xs = {}

for a, b in ab:
    if a == 1:
        xs[b] = 1

result = 0

for a, b in ab:
    if b == N and a in xs:
        result = 1
        break

if result:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 36024
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast","no-stack-protector","unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx")
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define int long long
#define F(i,L,R) for(int i=L;i<R;++i)
#define FE(i,L,R) for(int i=L;i<=R;++i)
#define getI(a) scanf("%lld",&a)
#define getII(a,b) scanf("%lld%lld",&a,&b)
#define getIII(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define VgetI(n) int (n); scanf("%lld",&(n))
#define VgetII(n,m) int (n),(m); scanf("%lld%lld",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k))
#define debug(x) cout<<(#x)<<"="<<x<<"\n";
#define qq cout<<"QQ\n";
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define f first
#define s second
#define INF 2000000000
char s[1005];
main(){
	while(~scanf("%s",s)){
		if(s[strlen(s)-1]=='s')
			printf("%ses\n",s);
		else
			printf("%ss\n",s);
	}
}


Measured memory_bytes: 3840
/*
Owner: dxxrk
Problem: Poisonous Cookies 
Date: 22/11/2019
*/
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 8;
const int logN = 20, BL = 400;
const double EPS = 3e-16;

int main(){
//	freopen("ex.in", "r", stdin);
//	freopen("ex.out", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int a, b, c; cin >> a >> b >> c;
	
	if(a + b >= c) return cout << b + c, 0;
	
	int ans = 0;
	while(c){
		ans++;
		c--;
		if(!a && !b) break;
		if(a) a--;
		else b--, ans++;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
# C
K, A, B = map(int, input().split())
res = 1
if A < B - 1:
    if res + K <= A:
        res += K
    elif res < A:
        K -= (A - res)
        res = A
    res += (B - A) * (K // 2)
    res += K % 2
else:
    res += K
print(res)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cstdio>
#define ll long long 
using namespace std;
const int maxn = 2e5 + 10;

ll a[maxn];

int main()
{
	int N; cin >> N;
	a[0] = 0;
	for (int i = 1; i <= N; i++) cin >> a[i];
	for (int i = 1; i <= N; i++) a[i] += a[i - 1];
	ll ans = 1e15;
	
	for (int k = 2; k <= N - 2; k++)
	{
		ll SL = a[k]; ll SR = a[N] - a[k];
		//L
		int l = lower_bound(a + 1, a + 1 + k, SL / 2) - a;
		if (l == k)l -= 1;
		ll sL1 = a[l]; ll sL2 = a[k] - a[l];
		if (l != 1)
		{
			if (abs(a[l - 1] - (a[k] - a[l - 1])) < abs(sL2 - sL1))
			{
				sL1 = a[l - 1]; sL2 = a[k] - a[l - 1];
			}
		}
		//R
		int r = lower_bound(a + 1 + k, a + 1 + N, SR / 2 + SL) - a;
		if (r == N)r -= 1;
		ll sR1 = a[r] - a[k]; ll sR2 = a[N] - a[r];
		if (r != k + 1)
		{
			if (abs((a[r - 1]-a[k]) - (a[N] - a[r - 1])) < abs(sR2 - sR1))
			{
				sR1 = a[r - 1] - a[k];
				sR2 = a[N] - a[r - 1];
			}
		}

		ll smax = max(max(sL1, sL2), max(sR1, sR2));
		ll smin = min(min(sL1, sL2), min(sR1, sR2));
		ans = min(ans, smax - smin);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
from collections import Counter
from itertools import combinations
import sys


def d(i: int, j: int, X: int, Y: int):
    res = min(
        abs(i - j),
        abs(i - X) + 1 + abs(Y - j),
        abs(i - Y) + 1 + abs(X - j),
    )
    return res


def solve(N: int, X: int, Y: int):
    X -= 1
    Y -= 1
    ctr = Counter(
        d(i, j, X, Y)
        for i, j in combinations(range(N), 2)
    )
    for di in range(1, N):
        print(ctr[di])


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(N, X, Y)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3948
#include<stdio.h>

int main() {
	int n, d, x, cnt, i, temp, val;
	
	val = scanf("%d%d%d", &n, &d, &x);
	if (val == 0) return 1;

	cnt = x;
	for (i = 0; i < n; i++) {
		val = scanf("%d", &temp);
		if (val == 0) return 1;
		cnt += (d - 1) / temp + 1;
	}
 
	printf("%d", cnt);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define DEBUG(x)           cout << '>' << #x << ':' << x << endl;
#define forn(i,n)          for(int i=0;i<(int)n;++i)
#define for1(i,n)          for(int i=1;i<=(int)n;++i)
#define forr(i,n)          for(int i=(int)n-1;i>=0;--i)
#define forre(i,a,b)       for(int i=(int)b;i>=(int)a;--i)
#define fore(i,a,b)        for(int i=(int)a;i<=(int)b;++i)
#define input(arr,n)       for(int i=0;i<n;i++)cin>>arr[i]
#define output(arr,n)      for(int i=0;i<n;i++)cout<<arr[i]<<" "
#define for_each(arr)      for(auto& it:arr)cout<<it<<" "
#define ff                 first
#define ss                 second
#define PI                 acos(-1.0)
#define all(a)             a.begin(),a.end()
#define rall(a)            a.rbegin(),a.rend()
#define Unique(a)          sort(all(a)),a.erase(unique(all(a)),a.end())
#define pb(x)              push_back(x)
#define eb(x)              emplace_back(x) 
#define ppb(x)             pop_back(x)
#define pf(x)              push_front(x)
#define ppf(x)             pop_front(x)
#define in(x,y)            insert({x,y})
#define Sort(a)            sort(a.begin(),a.end())
#define mem(arr,a)         memset(arr,a,sizeof arr)
#define ins(a)             insert(a)
#define max2(a,b)          max(a,b)
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max3(b,c,d))
#define min2(a,b)          min(a,b)
#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min3(b,c,d))
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }*/
/*int fx[]= {0,0,1,-1,-1,1,-1,1};
int fy[]= {1,-1,0,0,-1,1,1,-1};
int fx1[]={0,1,1,1,0,-1,-1,-1};
int fy1[]={1,1,0,-1,-1,-1,0,1};*/

ll a,b,c,n,ans,cn1,cn2,cn3,t;
string s,s1,s2;


int main()
{
    FIO;
  /* #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    cin>>a>>b>>c;
    ll mn=min(a,c);  // 2 3 3 
    a-=mn;   //2-2=0
    c-=mn;   //3-2=1

    b-=min(b,c); //3-1=2
    cout<<a<<" "<<b<<endl;
    

    
   	
    #ifdef ONLINE_JUDGE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    #endif
   return 0;
}
 

Measured memory_bytes: 256
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int mod = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
struct edge { int to, cost; };
int a[100010];
signed main() {
	int n;
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	if (n == 1) { cout << "Yes" << endl; ggr }
	int sum = 0;
	loop(i, 1, n) {
		if (sum > 1) { cout << "No" << endl;ggr }
		if (a[i] <= a[i - 1]) {
			sum += a[i - 1] - a[i];
		}
		elif(a[i] > a[i - 1])sum = 0;
	}
	if (sum > 1) { cout << "No" << endl;ggr }
	cout << "Yes" << endl;ggr
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    string N; cin >> N;
    if(N.at(0) == '9' || N.at(1) == '9'){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1e9+7;

int main() {
  int abc[3];
  rep(i,3) cin>>abc[i];
  sort(abc,abc+3);
  int k;
  cin>>k;
  cout<<abc[0]+abc[1]+abc[2]*pow(2,k)<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			h = h - sc.nextInt();
			if (h <= 0) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}


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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 998244353LL;
const ll MAX_N = 262144LL;

struct Segmenttree{
  
  ll n;
  ll dat[MAX_N*4];

  void init(){
    for(ll i = 0; i < 2*n-1; i++)dat[i]=0;
  }
  void update(ll i,ll x){
    i+=n-1LL;
    dat[i]=x;
    while(i>0LL){
      i=(i-1LL)/2LL;
      dat[i]=max(dat[i*2LL+1LL],dat[i*2LL+2LL]);
    }
  }
  ll query(ll a,ll b,ll k,ll l,ll r){
    if(r<=a||b<=l) return 0;
    if(a<=l&&r<=b) return dat[k];
    else{
      ll vl = query(a,b,k*2LL+1LL,l,(l+r)/2LL);
      ll vr = query(a,b,k*2LL+2LL,(l+r)/2LL,r);
      return max(vl,vr);
    }
  }
};

int main() {
  ll N;
  cin>>N;
  vector<vector<ll>> v(N,vector<ll>(2));
  for(ll i = 0LL; i < N; i++){
    cin>>v[i][0]>>v[i][1];
  }
  sort(v.begin(),v.end());
  ll cnt = 0LL;
  ll M = N;
  while(M>0){
    M=M>>1;
    cnt++;
  }
  ll n = 1LL<<cnt;
  Segmenttree tree;
  tree.n=n;
  tree.init();
  tree.update(N-1,N-1);
  vector<ll> move(N);
  move[N-1]=N-1;
  for(ll i = N-2; i >=0; i--){
    vector<ll> t = {v[i][0]+v[i][1],0};
    auto ite = lower_bound(v.begin(),v.end(),t);
    if((ll)(ite-v.begin())-1LL==i) {
      tree.update(i,i);
      move[i]=i;
    }
    else {
      ll s = tree.query(i+1,(ll)(ite-v.begin()),0,0,n);
      tree.update(i,s);
      move[i]=s;
    }
  }   
  vector<vector<ll>> dp(N,vector<ll>(2,1LL));
  for(ll i = N-2LL; i >= 0; i--){
    dp[i][1]=(dp[i+1][0]+dp[i+1][1])%mod;
    if(v[i][0]+v[i][1]<=v[i+1][0]) dp[i][0]=(dp[i+1][0]+dp[i+1][1])%mod;
    else dp[i][0]=dp[move[i]][0];
  }
  cout<<(dp[0][0]+dp[0][1])%mod<<endl;
}

Measured memory_bytes: 29696
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
int A;
  int B;
  cin >>A>>B;
  int x=A*B-(A+B) +1;
  cout << x<< endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.next();
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < input.length(); i++){
            sb.append("x");
        }
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 23252
from collections import defaultdict
n = int(input())
lis = list(map(int, input().split()))

mod = 998244353

if lis[0] != 0:
    print(0)
    exit()

d = defaultdict(int)

for i in lis:
    d[i] += 1

if d[0] != 1:
    print(0)
    exit()

ans = 1
for i in range(1, max(lis)+1):
    if i not in d:
        print(0)
        exit()
    ans = ans * (d[i-1]**d[i]) % mod

print(ans)

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

using namespace std;

int main(){
	int n;
	cin>>n;
	vector<double> a(n);
	
	for(int i =0; i<n;i++){
		cin>>a[i];
		
		}
	double sum = 0;
	for(int i = 0; i<n; i++){
		sum += 1./a[i];
		}	
	cout<<1./sum;	
	return 0;
	}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,b=0,g=0,r=0;
	string s;
	cin>>n>>s;
	for(long long i=0;i<s.length();i++)
	{
		if(s[i]=='B')	b++;
		if(s[i]=='G')	g++;
		if(s[i]=='R')	r++;
	}
	long long ct=b*g*r;
	//cout<<b<<" "<<g<<" "<<r<<" "<<b*g*r<<endl;
	for(long long i=0;i<n;i++)
	{
		for(long long j=i;j<n;j++)
		{
			long long pos=j+j-i;
			if(pos<n && s[pos]!=s[i] && s[i]!=s[j] && s[j]!=s[pos]) 	ct--;
		}
	}
	cout<<ct;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define MAX_SIZE 200000

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

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

    int n[2], k, c[2] = {};
    cin >> n[0] >> n[1] >> k;
    int rez = 0, ar[2][MAX_SIZE];
    for (int ctr = 0; ctr < 2; ++ctr)
        for (int ctr1 = 0; ctr1 < n[ctr]; ++ctr1)
            cin >> ar[ctr][ctr1];

    while (k >= ar[0][c[0]] && c[0] < n[0])
        k -= ar[0][c[0]++];
    rez = c[0];
    for (int ctr1 = 0; ctr1 < n[1]; ++ctr1) {
        while (k < ar[1][ctr1] && c[0] > 0) {
            k += ar[0][--c[0]];
        }
        if (k >= ar[1][ctr1])
            k -= ar[1][ctr1];
        else {
            break;
        }
        rez = max(rez, c[0] + ctr1 + 1);
    }
    cout << rez << '\n';

    return 0;
}


Measured memory_bytes: 5128
#include <stdio.h>

int main(){
  int i,j,n,a,m=0;
  scanf("%d",&n);
  j=1;
  for(i=0;i<n;i++){
    scanf("%d",&a);
    if(a==j){
      j++;
    }else{
      m++;
    }
  }
  if(m==n) m=-1;
  printf("%d",m);
  return(0);
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;


class Main
{
	

	public static void main(String args[]) throws IOException
	{
		FastScanner fs = new FastScanner();
		int D = fs.nextInt();
		double T = fs.nextDouble();
		int S = fs.nextInt();
		System.out.println(((float)D/S <=T)?"Yes":"No");
	}

	static final Random random = new Random();
	
	static void ruffleSort(int arr[])
	{
		int n = arr.length;
		for(int i=0; i<n; i++)
		{
			int j = random.nextInt(n),temp = arr[j];
			arr[j] = arr[i];
			arr[i] = temp;
			
		}
		Arrays.sort(arr);
	}
	

	static class Pairs implements Comparable<Pairs>
	{
		int value,index;
		Pairs(int value, int index)
		{
			this.value = value;
			this.index = index;
		}
		public int compareTo(Pairs p)
		{
			return Integer.compare(value,p.value);
		}
	}
}
class FastScanner
{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer str = new StringTokenizer("");
	
	String next() throws IOException
	{
		while(!str.hasMoreTokens())
			str = new StringTokenizer(br.readLine());
		
		return str.nextToken();
	}
	
	char nextChar() throws IOException {
		return next().charAt(0);
	}

	int nextInt() throws IOException
	{
		return Integer.parseInt(next());
	}
	
	float nextfloat() throws IOException
	{
		return Float.parseFloat(next());
	}
	
	double nextDouble() throws IOException
	{
		return Double.parseDouble(next());
	}
	long nextLong() throws IOException
	{
		return Long.parseLong(next());
	}
	byte nextByte() throws IOException 
	{
		return Byte.parseByte(next());
	}
	int [] arrayIn(int n) throws IOException
	{
		int  arr[] = new int[n];
		for(int i=0; i<n; i++)
		{
			arr[i] = nextInt();
		}
		return arr;
	}
}



	

Measured memory_bytes: 33168