akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int> ,null_type,less<pair<int,int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
long long MOD = 1e9+7;
pair<int,int> dx[4] = {{1,0},{-1,0},{0,1},{0,-1}};
long long fastpow(long long x,long long k)
{
    if(!k)
        return 1;
    if(k & 1)
        return ((x * fastpow(x,k-1) % MOD) % MOD) % MOD;
    long long ans = fastpow(x,k/2);
    ans %= MOD;
    ans *= ans;
    ans %= MOD;
    return ans;
}
long long sumF(long long x)
{
    int s = 0;
    while(x)
        s += x%10,x /= 10;
    return s;
}
void convert(int x,int base)
{
    if(x == 0)
        return;
    convert(x / base,base);
    cout << x%base;
    return;
}
struct hashFunc
{
    string s;
    vector<long long> prefixHash;
    vector<long long> suffixHash;
    long long MOD;
    long long p;
    vector<long long> hashPower;

};
void setPrefixHash(hashFunc& hashStruct)
{
    hashStruct.prefixHash.resize(hashStruct.s.length());
    long long curSum = 0;
    for(int i = 0;i < hashStruct.s.length();i++)
        curSum = ((curSum * hashStruct.p) % hashStruct.MOD + (hashStruct.s[i])) % hashStruct.MOD,hashStruct.prefixHash[i] = curSum;
}
void setSuffixHash(hashFunc& hashStruct)
{
    hashStruct.suffixHash.resize(hashStruct.s.length());
    long long curSum = 0;
    for(int i = hashStruct.s.length()-1;i >= 0;i--)
        curSum = ((curSum * hashStruct.p) + (hashStruct.s[i])) % hashStruct.MOD,hashStruct.suffixHash[hashStruct.s.length() - i - 1] = curSum;
}
long long getHash(int l,int r,hashFunc& hashStruct,bool isSuffix)
{
    if(!isSuffix)
    {
        long long enddy = hashStruct.prefixHash[r] % hashStruct.MOD;
        long long starto = (l ? hashStruct.prefixHash[l-1] : 0);
        starto = (starto * hashStruct.hashPower[r-l+1]) % hashStruct.MOD;
        return (((enddy - starto) % hashStruct.MOD) + hashStruct.MOD) % hashStruct.MOD;
    } else
    {
        r = hashStruct.s.length() - r - 1;
        l = hashStruct.s.length() - l - 1;
        if(l > r)
            swap(l,r);
        long long enddy = hashStruct.suffixHash[r];
        long long starto = (l ? hashStruct.suffixHash[l-1] : 0);
        starto = (starto * hashStruct.hashPower[r-l+1]) % hashStruct.MOD;
        return (((enddy - starto) % hashStruct.MOD) + hashStruct.MOD) % hashStruct.MOD;
    }
}
void readyHashPower(long long m,long long pp,hashFunc& hashStruct)
{
    hashStruct.MOD = m;
    hashStruct.p = pp;
    hashStruct.hashPower.resize(hashStruct.s.length()+1);
    hashStruct.hashPower[0] = 1;
    for(int i = 1;i < hashStruct.hashPower.size();i++)
        hashStruct.hashPower[i] = (hashStruct.hashPower[i-1] * hashStruct.p) % hashStruct.MOD;
}
//dp[i][j][k] = dp[i-1][j-1][s-i] + dp[i-1][j][s];
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int x;
    cin >> x;
    if(x == 3 || x == 5 || x == 7)
        cout << "YES";
    else
        cout << "NO";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
int inf=1000000000;
ll INF=10000000000000000;


int main(){
    int n;
    cin >> n;
    vector<int> a(110,0);
    vector<int> e={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59};
    rep(i,n){
        rep(j,e.size()){
            int ii=i+1;
            while (true){
            if ((ii)%e.at(j)==0) a.at(e.at(j))++;
            else break;
            ii/=e.at(j);
            }
        }
    }
    int ans=0;
    rep(i,60){
        for (int j=i+1;j<60;j++){
            for (int k=j+1;k<60;k++){
                if (a.at(i)>3 && a.at(j)>3 && a.at(k)>1) ans++;
                if (a.at(i)>3 && a.at(j)>1 && a.at(k)>3) ans++;
                if (a.at(i)>1 && a.at(j)>3 && a.at(k)>3) ans++;
            }
            if (a.at(i)>13 && a.at(j)>3) ans++;
            if (a.at(i)>3 && a.at(j)>13) ans++;
            if (a.at(i)>23 && a.at(j)>1) ans++;
            if (a.at(i)>1 && a.at(j)>23) ans++;
        }
        if (a.at(i)>73) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int K, N;
const int A_SIZE = 200005;
vector<int> A(A_SIZE);

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

Measured memory_bytes: 1152
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int a, b;
    cin >> a >> b;
    if(a>0 && b>0)
        cout << "Positive" << endl;
    else if(a<0 && b>0)
        cout << "Zero" << endl;
    else {
        if((b-a)%2==0)
            cout << "Negative" << endl;
        else
            cout << "Positive" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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





int a, b, c, x, y, z, r;
int N;

int main() {
    while (cin >> a >> b >> c) {
        if (a == 0 && b == 0 && c == 0) break;
        cin >> N;
    
        int ok[500];
        memset(ok, 0, sizeof(ok));
        
        vector<vint> inp;
        for (int i = 0; i < N; ++i) {
            cin >> x >> y >> z >> r;
            if (r == 1) ok[x] = ok[y] = ok[z] = 1;
            else {
                vint tmp(3);
                tmp[0] = x; tmp[1] = y; tmp[2] = z;
                inp.PB(tmp);
            }
        }
        
        for (int i = 0; i < inp.size(); ++i) {
            int x = inp[i][0], y = inp[i][1], z = inp[i][2];
            if (ok[y] == 1 && ok[z] == 1) ok[x] = 2;
            else if (ok[z] == 1 && ok[x] == 1) ok[y] = 2;
            else if (ok[x] == 1 && ok[y] == 1) ok[z] = 2;
        }
         
        for (int i = 1; i <= a+b+c; ++i) cout << 2-ok[i] << endl;
    }
    return 0;
}


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

int main(){
    ll x;
    cin >> x;
    ll a = 100;
    int ans = 0;
    while(a<x){
        a *= 1.01;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

#define ANS_MAX 10000

int main(void) {
    int num;
    cin >> num;
    int sum = 0;
    int mmax = 0;
    int exclude = 0;
    for(int i = 1; i <= ANS_MAX; i++) {
        sum += i;
        if(sum >= num) {
            exclude = sum - num;
            mmax = i;
            break;
        }
    }

    for(int i = 1; i <= mmax; i++) {
        if(exclude == i) continue;
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 3604
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;

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

int main () {
  int r, d, x;
  
  cin >> r >> d >> x;

  REP(i, 10){
    x=r*x-d;
    cout << x << '\n';
  }

    
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	int N, c = 0,  A, B, C, D;
	string S;
	bool flag = true, f = false;
	cin >> N >> A >> B >> C >> D;
	cin >> S;
	if (D < C) {
		for (int i = B - 1; i < D - 1; i++)
		{
			if (S[i] == '#')c++;
			else c = 0;
			if (c == 2) {
				flag = false;
			}
			if (!flag)break;
		}
		c = 0;
		for (int i = A - 1; i < C - 1; i++)
		{
			if (S[i] == '#')c++;
			else c = 0;
			if (c == 2) {
				flag = false;
			}
			if (!flag)break;
		}
		c = 0;
		for (int i = B-1; i < D; i++)
		{
			if (S[i - 1] == '.'&&S[i] == '.'&&S[i + 1] == '.')f = true;
		}
		if (flag&&f)cout << "Yes";
		else cout << "No";
	}
	else
	{
		for (int i = B-1; i < D-1; i++)
		{
			if (S[i] == '#')c++;
			else c = 0;
			if (c == 2) {
				flag = false;
			}
			if (!flag)break;
		}
		c = 0;
		for (int i = A-1; i < C-1; i++)
		{
			if (S[i] == '#')c++;
			else c = 0;
			if (c == 2) {
				flag = false;
			}
			if (!flag)break;
		}
		if (!flag)cout << "No";
		else cout << "Yes";
	}
}


Measured memory_bytes: 640
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        n: usize,
        d: [u32;n]
    }
    let mut sum = 0;
    for i in 0..n {
        for j in i+1..n {
            sum += d[i] * d[j];
        }
    }
    println!("{}", sum);
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 4352
import scala.math._

object Main extends App {
  val tempList: Seq[Seq[String]] = {
    for(line <- io.Source.stdin.getLines()) yield {
      line.split(' ').toSeq
    }
  }.toSeq

  val aInfo = tempList(0).map(_.toLong)
  val bInfo = tempList(1).map(_.toLong)
  val timeLimit = tempList(2)(0).toLong

  //AとBの速度差: -ならその時点でNO
  val diffSpeed = aInfo(1) - bInfo(1)
  //T秒で縮められる距離
  val diffInSec = diffSpeed*timeLimit
  //AとBの距離
  val distance = abs(aInfo(0) - bInfo(0))

  if(diffInSec >= distance) println("YES")
  else println("NO")
}

Measured memory_bytes: 54948
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t,i,j,k,l,m,n,a[200005],b[200005];
    char s[200005];
    long long count=0,sum=0,count1=0;
    map<long long,long long>mp;
    for(i=0;i<5;i++)
    cin>>a[i];
    cin>>k;
    sort(a,a+5);
  	if(a[4]-a[0]<=k)
    cout<<"Yay!";
    else
    cout<<":(";
    return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, k, q; cin >> n >> k >> q;
  vi a(n);
  REP(i, n) cin >> a[i];

  ll su = LINF;
  REP(i, n) {
    ll now = a[i];
    multiset<ll> st;
    multiset<ll> koho;
    REP(j, n) {
      if(a[j] < now) {
        //cout << j << ":" << SZ(st) << " ";
        if(SZ(st) >= k) {
          int cnt = 0;
          for(auto &e: st) {
            cnt++;
            if(cnt > SZ(st) - k + 1) break;
            koho.insert(e);
          }
        }
        st.clear();
      } else {
        st.insert(a[j]);
      }
    }
    //cout << n << ":" << SZ(st) << " ";
    if(SZ(st) >= k) {
      int cnt = 0;
      for(auto &e: st) {
        cnt++;
        if(cnt > SZ(st) - k + 1) break;
        koho.insert(e);
      }
    }

    int cnt = 0;
    ll nowans = LINF;
    //cout << endl;
    //cout << now << ": ";
    for(auto &e: koho) {
      //cout << e << " ";
      cnt++;
      if(cnt == q) {
        nowans = e - now;
        break;
      }
    }
    //cout << endl;

    if(cnt >= q) chmin(su, nowans);
  }
  cout << su << endl;
}
























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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << setprecision(15) << double(h * w) / 2.0 << " ";
  if ((double)x == ((double)w/2.0) && (double)y == ((double)h/2.0))
	cout << 1 << endl;
  else
	cout << 0 << endl;
}


Measured memory_bytes: 256
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;

signed main(){
    ll n,d=5000000000000;
    cin>>n;
    ll ns = 2+sqrt(n);
    vector<pair<ll,ll>> s;
    for(int i=1;i<ns;i++){
        if(n%i==0){
            s.push_back(make_pair(i,n/i));
            s.push_back(make_pair(n/i,i));
        }
    }
    ll ss = s.size();
    rep(i,ss){
        if((abs(s[i].first-1)+abs(s[i].second-1))<d) d = abs(s[i].first-1)+abs(s[i].second-1);
    }
    cout<<d<<endl;
}


Measured memory_bytes: 512
#include <cassert>
#include <cstdio>
#include <iostream>

using namespace std;

namespace {

struct Process {
  char name[10];
  // required time to process this task.
  int time;
};

// Ring-buffer based queue. Enqueue and dequeue run in O(1).
template <typename T, int N>
class Queue {
 public:
  // Note: leave one element empty so that we can distinguish
  // that the ring buffer is empty or full.
  Queue()
      : size_(N + 1),
        begin_((T*)data_),
        end_((T*)data_ + N + 1),
        head_((T*)data_),
        tail_((T*)data_) {}

  void Enqueue(T p) {
    assert(!IsFull());
    *tail_ = p;
    tail_ = next(tail_);
  }

  T Dequeue() {
    assert(!Empty());
    auto p = head_;
    head_ = next(head_);
    return *p;
  }

  bool IsFull() const { return head_ == next(tail_); }

  bool Empty() const { return head_ == tail_; }

 private:
  T* next(T* p) const { return p + 1 == end_ ? begin_ : p + 1; }

  char data_[sizeof(T) * (N + 1)];
  const int size_;
  T* const begin_;
  T* const end_;
  T* head_;
  T* tail_;
};

}  // namespace

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

  Queue<Process, 100000> queue;
  for (int i = 0; i < n; ++i) {
    Process p;
    scanf("%s %d", p.name, &p.time);
    queue.Enqueue(p);
  }

  int current_time = 0;
  while (!queue.Empty()) {
    auto p = queue.Dequeue();
    const int used = min(p.time, q);
    p.time -= used;
    current_time += used;

    if (p.time <= 0) {
      printf("%s %d\n", p.name, current_time);
      continue;
    }
    queue.Enqueue(p);
  }
  return 0;
}

Measured memory_bytes: 4700
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
using namespace std;

int INF = 1e9 + 7;

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

vector<int> s(100010), t(100010), c(100010), sum(100010);
vector<vector<int>> broad(40, vector<int>(100010, 0));

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

	for (int i = 1; i <= n; i++) {
		cin >> s[i] >> t[i] >> c[i];

		for (int j = s[i]; j <= t[i]; j++) {
			broad[c[i]][j] = 1;
		}
	}

	int MAX = 0;
	for (int i = 1; i <= 100001; i++) {
		for (int j = 1; j <= cha; j++) {
			sum[i] += broad[j][i];
		}
		MAX = max(sum[i], MAX);
	}
	cout << MAX << endl;
}

Measured memory_bytes: 17920
#include<iostream>

using namespace std;

int arr[100005], fault[100005];

int main(){
    int N, ans = 1, temp = 0;
    cin >> N;
    for(int i=1; i<= N; i++){
        cin >> arr[i];
        if(i > 1){
            if(arr[i] > arr[i-1]){
                temp++;
                fault[temp] = 0;
            } else if (arr[i] < arr[i-1]){
                temp++;
                fault[temp] = 1;
            }
        }
    }
    for(int i=1; i<= temp-1; i++){
        if(fault[i] != fault[i+1]){
             ans++;
             i++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(unused_variables)]

use proconio::{fastout, input};
use std::cmp::{max, min};

const INF: i32 = 1001001001;
const LNF: i64 = 1001001001001001001;
const MOD: i32 = 1000000007;

#[fastout]
fn main() {
  input!(n: usize);
  let mut v = vec![1; n + 1];
  for i in 2..=n {
    for j in (i..=n).step_by(i) {
      v[j] += 1;
    }
  }
  let mut ans = 0;
  for i in 1..=n {
    ans += v[i] * i;
  }
  println!("{}", ans);
}


Measured memory_bytes: 80160
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'

typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
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; }
const long long INF = 1LL<<60;

int main(){
    map<string,int> mp;
    int n;cin >> n;
    for(int i=0;i<n;i++){
        string s;cin >> s;
        mp[s]++;
    }
    int maxx = 0;
    for(auto &i:mp){
        maxx = max(maxx,i.second);
    }
    //cout << endl << endl;
    for(auto &i:mp){
        if(maxx==i.second){
            cout << i.first << endl;
        }
    }
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    string str;
    cin >> str;
    
    string st;
    rep(i, str.size()-1) {
        st.pb(str[i]);
    }

    if (str.back() == '1' || str[0] == '0') {
        cout << -1 << endl;
        return 0;
    }

    rep(i, str.size()/2) {
        if (st[i] != st[st.size()-i-1]) {
            cout << -1 << endl;
            return 0;
        }
    }

    int pos = 1;
    rep(i, str.size()-1) {
        cout << pos << " " << i+2 << endl;
        if (str[i] == '1') {
            pos = i+2;
        }
    }


    return 0;
}


Measured memory_bytes: 1744
N, M=map(int, input().split())
A = [int(input()) for _ in range(M)]
mod = 10**9 + 7
step = [1]*(N+1)

for a in A:
    step[a]=0
for i in range(2, N+1):
    step[i]=(step[i-1]+step[i-2])%mod*step[i]
print(step[-1])

Measured memory_bytes: 7824
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		List<Integer> alf = new ArrayList<Integer>();
		for(int i=0;i<26;i++) {
			alf.add(0);
		}
		for(int i=0;i<s.length();i++) {
	//		System.out.println(s.charAt(i));
			int a = (int)s.charAt(i);
	//		System.out.println(a);
			alf.set(a-97, alf.get(a-97)+1);
		}
	//	System.out.println(alf);
		String ans = "Yes";
		for(int i=0;i<26;i++) {
			if(alf.get(i)%2!=0) {
				ans = "No";
			}
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 21844
package main

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

const (
	initialBufSize = 1024
	maxBufSize     = 1e6
)

var (
	scanner = bufio.NewScanner(os.Stdin)
)

func main() {
	scanner.Split(bufio.ScanWords)
	h := scanInt()
	fmt.Println(calAttackTimes(h))
}

func calAttackTimes(hp int) int {

	if hp == 1 {
		return 1
	}

	return 1 + (calAttackTimes(hp/2) * 2)
}

func scanInt() int {
	i, _ := strconv.Atoi(scanText())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanText(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

func scanText() string {
	scanner.Scan()
	return scanner.Text()
}

func scanTexts(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanText()
	}
	return s
}

func abs(n int) int {
	return int(math.Abs(float64(n)))
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}

func min(n []int) (min, idx int) {
	min = math.MaxInt64
	for i := 0; i < len(n); i++ {
		if n[i] < min {
			min = n[i]
			idx = i
		}
	}
	return
}

func max(n []int) (max, idx int) {
	max = math.MinInt64
	for i := 0; i < len(n); i++ {
		if n[i] > max {
			max = n[i]
			idx = i
		}
	}
	return
}


Measured memory_bytes: 640
H, W = map(int, input().split())
S = ["."*(W+1)]+["."+input() for _ in range(H)]

dp = [[0]*(W+1) for _ in range(H+1)]
for h in range(H+1):
    dp[h][0] = H*2
for w in range(W+1):
    dp[0][w] = W*2
dp[0][1] = 0

for h in range(1, H+1):
    for w in range(1, W+1):
        dp[h][w] = min(dp[h-1][w]+(S[h][w]!=S[h-1][w]), dp[h][w-1]+(S[h][w]!=S[h][w-1]))

print((dp[-1][-1]+1)//2)

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

int main() {
  string S, T;
  cin >> S;
  cin >> T;
  int sLen = (int)S.size();
  int tLen = (int)T.size();

  int matchCount = 0;
  int maxMatchCount = 0;
  
  for (int i = 0; i <= sLen - tLen; i++) {
    for (int j = 0; j < tLen; j++) {
      if (S.at(i + j) == T.at(j)) {
        matchCount++;
      }
    }

    if (matchCount >= maxMatchCount) {
      maxMatchCount = matchCount;
    }

    matchCount = 0;
  }

  cout << tLen - maxMatchCount << endl;
}


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

int main (){
    int N, ans=INT_MAX, i, count = 0;
    cin >> N;
    char s[N];
    cin >> s;

    for(i = 1; i < N; i++){
        if(s[i] == 'E'){
            count ++;
        }
    }
    ans = count;

    for(i = 1; i < N; i ++){
        if(s[i -1] == 'E' && s[i] == 'E'){
            count --;
        }else if(s[i - 1] == 'W' && s[i] == 'W'){
            count ++;
        }
        if(ans > count){
            ans = count;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
#ifdef DEBUG
#define display(x) cerr << #x << " = " << x << endl;
#define displaya(a, st, n)\
	{cerr << #a << " = {";\
	for(int qwq = (st); qwq <= (n); ++qwq) {\
		if(qwq == (st)) cerr << a[qwq];\
		else cerr << ", " << a[qwq];\
	} cerr << "}" << endl;}
#define displayv(v) displaya(v, 0, (int)(v).size() - 1)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define display(x) ;
#define displaya(a, st, n) ;
#define displayv(v) ;
#define eprintf(...) if(0) fprintf(stderr, "...")
#endif
template<typename T> bool chmin(T &a, const T &b) { return a > b ? a = b, true : false; }
template<typename T> bool chmax(T &a, const T &b) { return a < b ? a = b, true : false; }

const int maxN = 1000 + 5;

vector<string> b3 = {
"aab",
"c.b",
"cdd"
};
vector<string> b4 = {
"aacd",
"bbcd",
"fgee",
"fghh"
};
vector<string> b5 = {
"aabbc",
"hii.c",
"h..jd",
"g..jd",
"gffee"
};
vector<string> b7 = {
"aab...a",
"..bcc.a",
".cii.bb",
".c..ic.",
"bb..ic.",
"a.ccb..",
"a...baa"
};

char a[maxN][maxN];

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
#endif
	int n; cin >> n;
	if(n == 2) {
		cout << "-1" << endl;
		return 0;
	} else {
		vector<int> p;
		{
			int m = n;
			if(m == 7) {
				p = {7};
			} else if(m == 11) {
				p = {7, 4};
			} else if(m % 3 == 0) {
				p = vector<int>(m / 3, 3);
			} else {
				while(m % 5 > 0) {
					m -= 4; p.push_back(4);
				}
				while(m) {
					m -= 5; p.push_back(5);
				}
			}
		}
		displayv(p);
		memset(a, 0, sizeof(a));
		int off = 1;
		for(int x : p) {
			vector<string> &t = (x == 3 ? b3 : x == 4 ? b4 : x == 5 ? b5 : b7);
			for(int i = 0; i < x; ++i) for(int j = 0; j < x; ++j)
				a[off + i][off + j] = t[i][j];
			off += x;
		}
		for(int i = 1; i <= n; ++i)
			for(int j = 1; j <= n; ++j) if(a[i][j] == 0) a[i][j] = '.';
		int count = 0;
		for(int i = 1; i <= n; ++i) count += (a[1][i] != a[1][i - 1] && a[1][i] != '.');
		display(count);
		for(int i = 1; i <= n; ++i) {
			int c = 0;
			for(int j = 1; j <= n; ++j) c += (a[i][j] != a[i][j - 1] && a[i][j] != '.');
			eprintf("line %d has %d\n", i, c);
			assert(c == count);
		}
		for(int i = 1; i <= n; ++i) {
			int c = 0;
			for(int j = 1; j <= n; ++j) c += (a[j][i] != a[j - 1][i] && a[j][i] != '.');
			eprintf("col %d has %d\n", i, c);
			assert(c == count);
		}
		for(int i = 1; i <= n; ++i) cout << (a[i] + 1) << '\n';
	}
	return 0;
}


Measured memory_bytes: 2176
#include <iostream>

using namespace std;

int N,K;
char S[50];

int main(){
  cin >> N >> K;
  for (int i =0;i<N;i++){
    cin >> S[i];
  }
  if(S[K-1]=='A') S[K-1]='a';
  if(S[K-1]=='B') S[K-1]='b';
  if(S[K-1]=='C') S[K-1]='c';

  cout << S << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define EPS 1e-10
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}
ll dx[]={0, 0, -1, 1};
ll dy[]={1, -1, 0, 0};// up,down,left right


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

    string a,b;
    cin >> a >>b ;
    ll na,nb;
    cin >> na >> nb;
    
    string ab ; cin >> ab ;
    if(ab == a) na--;
    else nb--;
    
    cout << na << " " << nb << endl;


    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;

typedef long long ll;



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

	vector<pair<int, int>> arm(n);
	for (int i = 0; i < n;i++) {
		int x, l;
		cin >> x >> l;
		arm[i] = make_pair(x+l, x-l);
	}

	sort(arm.begin(), arm.end());
	int cnt = 1;
	int r = arm[0].first;
	for (int i = 1; i < n;i++) {
		if (arm[i].second >= r) {
			cnt++;
			r = arm[i].first;
		}
	}
	cout << cnt << endl;
}
	

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

int main(){

    while(1){
        int n;
        cin >> n;
        if(n==0)break;
        vector<char> h(n);
        for(int i=0;i<n;i++){
            cin >> h[i];
        }
        vector<pair<int,char>> cand(26);
        string al="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        for(int i=0;i<26;i++){
            cand[i].first=0;
            cand[i].second=al[i];
        }
        bool f=true;
        for(int i=0;i<n;i++){
            cand[h[i]-'A'].first++;
            vector<pair<int,char>> t(cand);
            sort(t.begin(),t.end(),greater<>());
            if(t[0].first>t[1].first+n-i-1){
                cout << t[0].second << " " << i+1 << endl;
                f=false;
                break;
            }
        }
        if(f)cout << "TIE" << endl;
    }

    return 0;
}


Measured memory_bytes: 3116
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d;
    int l,r;
    cin>>a>>b>>c>>d;
    l=a+b;
    r=c+d;
    if(l>r)
    {
        cout<<"Left";
    }
    else if(r>l)
    {
        cout<<"Right";
    }
    else{cout<<"Balanced";}
    return 0;
}


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

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


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int[] H = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		Arrays.sort(H);
		int l = 0;
		int r = H[N - 1] % B == 0 ? H[N - 1] / B : H[N - 1] / B + 1;
		while (r - l > 1) {
			long cnt = 0;
			int m = (r + l) / 2;
			for (int i = 0; i < N; i++) {
				int diff = H[i] - B * m;
				if(diff > 0){
					cnt += diff / (A - B);
					if (diff % (A - B) > 0) {
						cnt++;
					}
				}
			}
			if (cnt > m) {
				l = m;
			} else {
				r = m;
			}
		}
		System.out.println(r);
	}
}

Measured memory_bytes: 50952
import sys
input = sys.stdin.readline
from collections import deque
class Unionfindtree:
    def __init__(self, number,L):
        self.par = [i for i in range(number)]
        self.rank = [0] * (number)
        self.cost = L
        self.count = [0] * (number)

    def find(self, x):  # 親を探す
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):  # x,yを繋げる
        px = self.find(x)
        py = self.find(y)
        if px == py:
            self.count[py]+=1
            return
        if self.rank[px] < self.rank[py]:
            self.par[px] = py
            self.cost[py]+=self.cost[px]
            self.count[py]+=self.count[px]+1
        else:
            self.par[py] = px
            self.cost[px]+=self.cost[py]
            self.count[px]+=self.count[py]+1
        if self.rank[px] == self.rank[py]:
            self.rank[px] += 1

    def connect(self, x, y):  # 親が同じかみる
        return self.find(x) == self.find(y)



N,M=map(int,input().split())
X=[int(i) for i in input().split()]
que=[]
table=[[] for i in range(N)]
for i in range(M):
    a,b,c=map(int,input().split())
    a,b=a-1,b-1
    que.append((c,a,b))

que.sort()
T=Unionfindtree(N,X)
used=0
for i in range(M):
    c,a,b=que[i]
    T.union(a,b)
    if T.cost[T.find(a)]>=c:
        used+=T.count[T.find(a)]
        T.count[T.find(a)]=0
    #print(T.count)
    #print(T.par)

print(M-used)


Measured memory_bytes: 111896
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
int n;
int a[100005],b[100005],t[200005],c[100005],sum[100005],mx;
long long y;
int lowbit(int x){
	return (x&-x);
}
void insert(int x,int v){
	while(x<=2*n){
		t[x]+=v;
		x+=lowbit(x);
	}
}
int getsum(int x){
	int res=0;
	while(x>0){
		res+=t[x];
		x-=lowbit(x);
	}
	return res;
}
int check(int x){
	memset(t,0,sizeof(t));
	long long xx=0;
	for(int i=1;i<=n;i++){
		sum[i]=a[i]>=x?1:-1;
		sum[i]+=sum[i-1];
	}
	for(int i=0;i<=n;i++){
		xx+=getsum(sum[i]+n);
		insert(sum[i]+n,1);
	}
	long long ss;
	if(y%2==1) ss=(y+1)/2;
	else ss=y/2;
	if(xx>=ss) return 1;
	else return 0;
}
int main(){
	cin>>n;
	int l=1,r=1,ans;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		r=max(r,a[i]);
	}
	y=(long long)n*(n+1)/2;
	while(l<=r){
		int mid=(l+r)/2;
		if(check(mid)) ans=mid,l=mid+1;
		else r=mid-1;
	}
	cout<<ans;
	/*for(int i=1,x;i<=n;i++){
		cin>>x;
		insrt(x,1);
		c[i]=i-getsum(x);
	}
	求每个位的逆序数 
	*/
}

Measured memory_bytes: 5196
#include<bits/stdc++.h>
using namespace std;
int main()
{
	//#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
	//#endif
		//ios_base::sync_with_stdio(0);
		//cin.tie(0);
	string w;
	cin>>w;
	if(w=="Sunny") cout<<"Cloudy";
	else if(w=="Cloudy") cout<<"Rainy";
	else if(w=="Rainy") cout<<"Sunny";


}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    vector<Pii> a_sorted(n), b_sorted(n);
    for(int i=0;i<n;++i){
        cin >> a[i];
        a_sorted[i] = {a[i], i};
    }
    for(int i=0;i<n;++i){
        cin >> b[i];
        b_sorted[i] = {b[i], i};
    }
    
    sort(a_sorted.begin(), a_sorted.end());
    sort(b_sorted.begin(), b_sorted.end());
    vector<int> rev_ai(n);
    bool can_swap = false;
    for(int i=0;i<n;++i) {
        if(a_sorted[i].first > b_sorted[i].first) {
            cout << "No\n";
            return 0;
        }
        if(i && (a_sorted[i].first <= b_sorted[i-1].first)) {
            can_swap = true;
        }
        rev_ai[a_sorted[i].second] = i;
    }
    if(can_swap) {
        cout << "Yes\n";
        return 0;
    }

    int i = 0, cnt = 0;
    // cerr << i << endl;
    vector<bool> used(n, false);
    while(!used[i]) {
        used[i] = true;
        ++cnt;
        i = b_sorted[rev_ai[i]].second;
        // cerr << i << endl;
    }
    cout << ((cnt == n)?"No\n":"Yes\n");
    
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 100005;
int N;
vector<int> vec;

signed main()
{
  cin >> N;
  int ans = 0;
  REP(n,N) {
    int a,b; cin >> a >> b;
    vec.push_back(a+b);
    ans -= b;
  }

  sort(vec.begin(), vec.end(), greater<int>());

  REP(n,N) {
    if(n%2==0) {
      ans += vec[n];
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1400
#include <stdio.h>
#include <string.h>

char s[ 1000003 ], pn[ 2000002 ];

int main( void ) {
	char *p;
	int i, n, t;

	for ( ; scanf( "%d %*d %s", &n, s + 2 ), n; printf( "%d\n", t ) ) {
		for ( i = 0 ; i < n * 2 + 1; i++ )
			sprintf( pn + i, i & 1 ? "O" : "I" );

		t = 0;
		for ( p = s; ( p = strstr( p + 2, pn ) ) != NULL; t++ ) ;
	}

	return 0;
}

Measured memory_bytes: 1608
#include <stdio.h>
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define ull unsigned ll
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (ll i = l; i < r; i++)
#define repb(i, r, l) for (ll i = r; i > l; i--)
#define sz(a) (ll)a.size()
#define fi first
#define se second

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll N = 100000;
const ll inf = (ll)1e9 + 1;
const ll big = (ll)1e18 + 1;
const ll P = 31;
const ll MOD = (ll)1e9 + 7;
const ll MOD1 = (ll)1e9 + 9;
const ll MAX_ll = (1 << 31) - 1;
const double eps = 1e-6;
const double pi = atan2(0, -1);

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("battleship.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    ll n;
    ll a, b;
    cin >> n >> a >> b;
    ll x[n];
    rep(i, 0, n)
        cin >> x[i];
    ll a1[n], b1[n];
    a1[0] = 0; b1[0] = 0;
    rep(i, 1, n)
    {
        if (x[i]- x[i - 1] < a)
            a1[i] = 1;
        else
            a1[i] = 0;
        if (x[i] - x[i - 1] < b)
            b1[i] = 1;
        else
            b1[i] = 0;
        a1[i] += a1[i - 1];
        b1[i] += b1[i - 1];
    }
    ll dp[n][2];
    rep(i, 0, n)
        rep(j, 0, 2)
            dp[i][j] = 0;
    rep(i, 0, n)
    {
        ll p = upper_bound(x, x + n, x[i] - a) - x;
        if (p == i)
        {
            if (i == 0)
                dp[i][0] = 1;
            else
                dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) % MOD;
        }
        else
        {
            if (b1[i - 1] - b1[p] > 0)
                dp[i][0] = 0;
            else
                dp[i][0] = dp[p][1];
        }

        p = upper_bound(x, x + n, x[i] - b) - x;
        if (p == i)
        {
            if (i == 0)
                dp[i][1] = 1;
            else
                dp[i][1] = (dp[i - 1][0] + dp[i - 1][1]) % MOD;
        }
        else
        {
            if (a1[i - 1] - a1[p] > 0)
                dp[i][1] = 0;
            else
                dp[i][1] = dp[p][0];
        }
    }
    cout << (dp[n - 1][0] + dp[n - 1][1]) % MOD;
    return 0;
}


Measured memory_bytes: 4224
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

//////////////////////////

void yes(){
    cout<<"OK"<<endl;
    exit(0);
}
void no(){
    cout<<"NG"<<endl;
    exit(0);
}

int main(){fastio
    
    ll k,a,b;cin>>k>>a>>b;
    rep(i,a,b){
        if(i%k==0){
            yes();
        }
    }
    no();
    
    return 0;
}


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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

int main(){
#define int ll
  int n,m; cin >> n >> m;
  vector<pii> a(m); rep(i,m) cin >> a[i].fst >> a[i].snd;
  sort(rall(a));
  dump(a);
  int res = 0, prev = -1;
  rep(i,m){
    if(a[i].fst <= prev and prev < a[i].snd) continue;
    else{
      prev = a[i].fst;
      dump(prev);
      res++;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 1792
from fractions import gcd
from functools import reduce
n, x = map(int, input().split())
X = list(map(int, input().split()))
X.append(x)
minn = min(X)

def rgcd(nums):
  return reduce(gcd, nums)
arr_X = [X[i]-minn for i in range(n+1)]
print(rgcd(arr_X))


Measured memory_bytes: 16308
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
T=[]
for i in range(n):
    T.append(t-h[i]*0.006)

A=[]
for j in range(n):
    A.append(abs(T[j]-a))

print(A.index(min(A))+1)

Measured memory_bytes: 3064
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s = input()
    if s.count("A") in [0,3]:
        print("No")
    else:
        print("Yes")
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 38384