akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

const int maxn=200;
char s[maxn];
int ans, len, flag[1000];

int main()
{
    while(~scanf("%s", &s)){
        len=strlen(s);
        memset(flag, 0, sizeof(flag));
        ans=1000;
        for(int i=0;i<len;i++){
            int c=s[i];
            if(!flag[c]){
                int tans=i, cnt=0;
                for(int j=i+1;j<len;j++){
                    if(s[j]==s[i]){
                        tans=max(cnt, tans);
                        cnt=0;continue;
                    }
                    cnt++;
                }
                tans=max(cnt, tans);
                ans=min(ans, tans);
                flag[c]=1;
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int h , w;
char grid[2005][2005];
bool valid(int x , int y){
	if(x>=h ||y >= w ||x<0||y<0||grid[x][y]=='#')
		return false;
	return true;
}
int mem[2005][2005];
int ans;
int solve(int x = 0 , int y = 0){
	for(int i = 0 ; i < h ; i++){
		int cnt = 0 , lp = 0;
		for(int j = 0; j <= w ;j++){
			if(!valid(i,j)){
				if(cnt>0)
				cnt--;
				for(int k = lp; cnt>0;k++){
					mem[i][k]+=cnt;cnt--;
				}
				lp = j+1;
			}else{
				cnt++;
			}
		}
	}

	for(int i = 0; i< h ; i++){
		int cnt = 0 , lp = w-1;
		for(int j = w-1 ; j >= -1 ; j--){
			if(!valid(i,j)){
				if(cnt>0)cnt--;
				for(int k = lp; cnt>0;k--){
					mem[i][k]+=cnt;cnt--;
				}
				lp = j-1;
			}else{
				cnt++;
			}
		}
	}

	for(int i = 0; i < w ; i++){
		int cnt = 0 , lp = 0;
		for(int j = 0; j <= h ; j++){
			if(!valid(j,i)){
				if(cnt>0)cnt--;
				for(int k = lp; cnt>0;k++){
					mem[k][i]+=cnt;cnt--;
				}
				lp = j+1;
			}else{
				cnt++;
			}
		}
	}
	for(int i = 0;i < w ;i++){
		int cnt = 0 , lp =h-1;
		for(int j = h-1 ; j>= -1 ;j--){
			if(!valid(j,i)){
				if(cnt)cnt--;
				for(int k = lp; cnt>0;k--){
					mem[k][i]+=cnt;cnt--;
				}
				lp = j-1;
			}else{
				cnt++;
			}
		}
	}
}
int main() {
	cin>>h>>w;
	for(int i = 0; i< h ; i++){
		for(int j = 0 ; j < w ; j++){
			cin>>grid[i][j];
		}
	}
	solve();
	for(int i =0; i < h ; i++){
		for(int j = 0; j < w ;j++){
			if(grid[i][j]!='#'){
				ans = max(ans,mem[i][j]+1);
			}
		}
	}
	cout<<ans;
    return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_DIGIT 100'000
#define MOD 1'000'000'007

i64 dp[MAX_DIGIT + 1][13];

int main() {
    string s; cin >> s;
    i64 L = s.length();

    REP(i, MAX_DIGIT + 1) REP(j, 13) dp[i][j] = 0;
    dp[0][0] = 1;

    reverse(s.begin(), s.end());

    i64 p = 1;
    REP(i, L) {
        REP(j, 13) {
            if (s[i] == '?') {
                REP(d, 10) {
                    dp[i + 1][(j + d * p) % 13] += dp[i][j] % MOD;
                    dp[i + 1][(j + d * p) % 13] %= MOD;
                }
            } else {
                dp[i + 1][(j + (s[i] - '0') * p) % 13] += dp[i][j] % MOD;
                dp[i + 1][(j + (s[i] - '0') * p) % 13] %= MOD;
            }
        }
        p *= 10;
        p %= 13;
    }

    cout << dp[L][5] % MOD << endl;

    return 0;
}

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

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


int main() {
    int k,x;
    cin >> k >> x;
    rep(i,2*k-1) {
        printf("%d ", x-k+1+i);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 3680
#include <stdio.h>

int main(void)
{
  int a, b;
  
  scanf("%d %d", &a, &b);
  
  if(a > 12)
    printf("%d\n", b);
  else if(a > 5)
    printf("%d\n", b/2);
  else
    printf("0\n");
}

Measured memory_bytes: 128
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMax = 1e12 + 1;
constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N, K;
  cin >> N >> K;
  vector<pll> P;
  P.emplace_back(pll{0, 0});
  vector<pll> v;
  REP(i, 0, N) {
    ll a, b;
    cin >> a >> b;
    v.emplace_back(pll{a, b});
  }
  sort(v.begin(), v.end(), [](const auto& a, const auto& b) {
    return a.first < b.first;
  });

  for (const auto& vv : v) {
    pll p(vv.first, P[P.size() - 1].second + vv.second);
    P.emplace_back(p);
  }

  for (const auto& p : P) {
    if (K <= p.second) {
      cout << p.first << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 4848
#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    ll k, a, b;
    cin >> k >> a >> b;

    ll ans = 0;
    ll first = a - 1 + 1 + 1; // hit a-1 times, exchange , exchange
    if(2 >= b - a || first > k){
        cout << k+1 << endl;
        return 0;
    }

    k -= first;
    ans += b;

    ll rep = k / 2;
    ans += (b-a) * rep;
    ans += k % 2;

    cout << ans << endl;
    return 0;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}


void Main()
{
    int n;cin>>n;
    string s;cin>>s;

    VI r(n),g(n),b(n);
    if(s[n-1] == 'R'){
        r[n-1] = 1;
    }
    if(s[n-1] == 'G'){
        g[n-1] = 1;
    }
    if(s[n-1] == 'B'){
        b[n-1] = 1;
    }

    for(int i=n-2;i>=0;i--){
        r[i] = r[i+1];
        g[i] = g[i+1];
        b[i] = b[i+1];
        if(s[i] == 'R'){
            r[i]++;
        }
        if(s[i] == 'G'){
            g[i]++;
        }
        if(s[i] == 'B'){
            b[i]++;
        }
    }
    
    //REP(i,n){
    //   cerr<<r[i] << " " << g[i] << " "<<b[i] << endl;
    //}

    LL result = 0;

    REP(i,n-1){
        FOR(j,i+1,n-1){
            if(s[i] == s[j]){
                continue;
            }
            int k = j+j-i;
            if((s[i]=='R' && s[j]=='G') || (s[i]=='G' && s[j]=='R')){
                result += b[j+1];
                if( k< n && s[k] == 'B'){
                    result --;
                }

            }
            if((s[i]=='R' && s[j]=='B') || (s[i]=='B' && s[j]=='R')){
                result += g[j+1];
                if( k< n && s[k] == 'G'){
                    result --;
                }

            }
            if((s[i]=='G' && s[j]=='B') || (s[i]=='B' && s[j]=='G')){
                result += r[j+1];
                if( k< n && s[k] == 'R'){
                    result --;
                }

            }


            
        }
    }

    cout<<result<<endl;



	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

int main()
{
    char alpha;
    cin >> alpha;
    if (alpha >= 'A' && alpha <= 'Z') {
        cout << 'A' << endl;
    }
    else if (alpha >= 'a' && alpha <= 'z') {
        cout << 'a' << endl;
    }
    return 0;
}


Measured memory_bytes: 3672
//============================================================================
// Name        : AOJ.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;
typedef long long ll;
int main(){

	int x;

	cin>>x;

	if(x<1200){
		cout<<"ABC"<<endl;
	}else{
		cout<<"ARC"<<endl;
	}


	return 0;


}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int i;
  int num;
  int n;

  scanf("%d", &num);
  for (i = 1; i <= num; i++) {
    n = i;
    if (n % 3 == 0) {
      printf(" %d", i);
    } else {
      while (n) {
        if (n % 10 == 3) {
          printf(" %d", i);
          break;
        } else {
          n /= 10;
        }
      }
    }
  }
  putchar('\n');

  return 0;
}



Measured memory_bytes: 2140
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

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

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    String s = sc.next();
    int[] position = new int[s.length()];
    int blockLength = 0;
    for (int i = 0; i < s.length() - 1; i++) {
      String current = Character.toString(s.charAt(i));
      String next = Character.toString(s.charAt(i + 1));
      blockLength++;
      if (current.equals(next)) {
        continue;
      } else {
        position[i] += blockLength / 2;
        position[i + 1] += blockLength / 2;
        if (blockLength % 2 != 0) {
          position[i] += 1;
        }
        blockLength = 0;
        int nextBlockLength = 0;
        for (int j = i + 1; j < s.length(); j++) {
          if (j == s.length() - 1) {
            nextBlockLength++;
          }
          if (next.equals(Character.toString(s.charAt(j))) && j != s.length() - 1) {
            nextBlockLength++;
            continue;
          } else {
            position[i] += nextBlockLength / 2;
            position[i + 1] += nextBlockLength / 2;
            if (nextBlockLength % 2 != 0) {
              position[i + 1] += 1;
            }
            i = j - 1;
            break;
          }
        }
      }
    }
    boolean isFirst = true;
    for (int i = 0; i < s.length(); i++) {
      if (!isFirst) {
        pw.print(" ");
      }
      pw.print(position[i]);
      isFirst = false;
    }
  }
}


Measured memory_bytes: 50520
n=int(input())
r=[list(map(int,input().split())) for i in range(n)]
b=[list(map(int,input().split())) for i in range(n)]
b.sort()
d,ans=dict(),0
for i in range(n):
  cnt=-1
  ok=False
  for j in range(n):
    if j not in d:
      if b[i][0]>r[j][0] and b[i][1]>r[j][1]:
        if r[j][1]>cnt:
          cnt=r[j][1]
          k=j
          ok=True
  if ok:
    ans+=1
    d[k]=0
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
string st;
int main()
{
    cin>>st;
    if(st.size()<5||st.size()>9)
    {
        cout<<"NO";
        exit(0);
    }
    if(st=="AKIHABARA"||st=="KIHBR")cout<<"YES";else
    if(st=="KIHABARA"||st=="AKIHBARA"||st=="AKIHABRA"||st=="AKIHABAR")cout<<"YES";else
    if(st=="KIHBARA"||st=="KIHABRA"||st=="KIHABAR"||st=="AKIHBRA"||st=="AKIHBAR"||st=="AKIHABR")cout<<"YES";else
    if(st=="KIHBRA"||st=="KIHBAR"||st=="AKIHBR"||st=="KIHABR")cout<<"YES";else cout<<"NO";
    cout<<endl;
    return 0;
}

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


int main()
{
  string a,b;
  cin>>a>>b;
  
  int n=a.size();
  int s=b.size();
  int dp[3100][3100] = {0};
  
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<s;j++)
    {
      if(a[i]==b[j])
      {
        dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1);
      }
      dp[i+1][j+1]=max(dp[i+1][j+1],max(dp[i][j+1],dp[i+1][j]));
    }
  }
  
  string ans="";
  while(n>0&&s>0)
  {
    if(dp[n][s]==dp[n-1][s])
      n--;
    else if(dp[n][s]==dp[n][s-1])
      s--;
    else
    {
      ans+=a[n-1];
      n--;
      s--;
    }
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
}

Measured memory_bytes: 37760
#include <stdio.h>
int main(void) {
  int a,b;
  scanf("%d%d",&a,&b);
  if(a==1){a=14;}
  if(b==1){b=14;}
  printf("%s\n",(a==b)?"Draw":(a>b)?"Alice":"Bob");
  return 0;
}

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

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  vector<int> P(N),Q(N),R(N);
  REP(i,N)cin>>P[i];
  REP(i,N)cin>>Q[i];
  REP(i,N)R[i]=i+1;
  int A,B;
  int i=0;
  do{
    // for(auto e:R)cerr<<e;
    // cerr<<endl;
    if(equal(ALL(P),R.begin()))A=i;
    if(equal(ALL(Q),R.begin()))B=i;
    i++;
  }while(next_permutation(ALL(R)));
  cout<<max(A-B,B-A)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <set>
#include <utility>
static const int MAXN = 2e5 + 4;
static const int LOGN = 18;

int n;
int a[MAXN], p[MAXN];
int b[MAXN], top = 0;

struct quq {
    int first, second;
    quq(int f = 0, int s = 0) : first(f), second(s) { }
    inline bool operator < (const quq &other) const {
        return (this->first == other.first) ?
            (this->second < other.second) : (this->first < other.first);
    }
};

struct rmq {
    quq f[LOGN][MAXN];
    inline void build(int n, int *a) {
        for (int i = 0; i < n; ++i) f[0][i] = quq(a[i], i);
        for (int j = 1; j < LOGN; ++j)
            for (int i = 0; i <= n - (1 << j); ++i)
                f[j][i] = std::min(f[j - 1][i], f[j - 1][i + (1 << (j - 1))]);
    }
    inline quq query(int l, int r) {
        if (l == r) return f[0][l];
        int sz = 8 * sizeof(int) - __builtin_clz(r - l) - 1;
        return std::min(f[sz][l], f[sz][r - (1 << sz) + 1]);
    }
} all, even, odd;

struct cmp_peek {
    inline bool operator () (const std::pair<int, int> a, const std::pair<int, int> b)
    {
        int ua = ((a.first & 1) ? odd : even).query(a.first, a.second).first;
        int ub = ((b.first & 1) ? odd : even).query(b.first, b.second).first;
        return ua < ub;
    }
};

std::set<std::pair<int, int>, cmp_peek> s;

void solve(int l, int r)
{
    auto u = ((l & 1) ? odd : even).query(l, r);
    auto v = ((r & 1) ? odd : even).query(u.second, r);
    int pu = u.second, pv = v.second;
    b[top++] = u.first;
    b[top++] = v.first;
    if (l <= pu - 1) s.insert(std::make_pair(l, pu - 1));
    if (pu + 1 <= pv - 1) s.insert(std::make_pair(pu + 1, pv - 1));
    if (pv + 1 <= r) s.insert(std::make_pair(pv + 1, r));
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]), p[--a[i]] = i;

    all.build(n, a);
    for (int i = 0; i < n; ++i) b[i] = (i & 1) ? MAXN : a[i];
    even.build(n, b);
    for (int i = 0; i < n; ++i) b[i] = (i & 1) ? a[i] : MAXN;
    odd.build(n, b);

    s.insert(std::make_pair(0, n - 1));
    while (!s.empty()) {
        auto r = *s.begin(); s.erase(s.begin());
        solve(r.first, r.second);
    }

    for (int i = 0; i < n; ++i) printf("%d%c", b[i] + 1, i == n - 1 ? '\n' : ' ');
    return 0;
}


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


#define vt vector
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define ar array
#define inf() ifstream cin("d.txt")
#define onf() ofstream cout("test.txt")
#define mod 1000000007
#define pb push_back
#define endl cout<<"\n";
#define prt1(a) cout<<a<<" "
#define prt2(a,b) cout<<a<<" "<<b<<" "
#define prt3(a,b,c) cout<<a<<" "<<b<<" "<<c<<" "
#define in(a) cin>>a
#define inn(a,b) cin>>a>>b
#define innn(a,b,c) cin>>a>>b>>c 
#define rep(i,st,end) for(int i=st;i<end;i++)
#define repv(i,st,end) for( i=st;i>=end;i--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define TEST ll tc;cin>>tc;while(tc--)
#define EACH(x, a) for (auto& x: a)

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vt<A>& x) {
    EACH(a, x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    EACH(a, x)
        read(a);
}

void solve()
{
  ll n;
  read(n);
  vt<ll>v(n),prefix(n,0);
  read(v);

  ll ans= 0;
  prefix[0] = v[0];
  rep(i,1,n)
  prefix[i] = (prefix[i-1]%mod + v[i]%mod)%mod;

  rep(i,0,n-1)
  {
    ans=(ans%mod + (v[i]%mod*(prefix[n-1]-prefix[i]+mod)%mod)%mod)%mod;
  }
  cout<<ans;
}

 int main()
 {
    fio;
    ll k = 1;
    ll tc;
    tc = 1;
    // cin>>tc;
    while(tc--){
       // cout<<"Case #"<<k<<": ";k++;
        solve();
        endl;
    }
    
 }




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

int main() {
  int a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "a < b\n";
  } else if (a > b) {
    cout << "a > b\n";
  } else {
    cout << "a == b\n";
  }
  return 0;
}


Measured memory_bytes: 3084
#include <iostream>

using namespace std;

int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	while (1){
		c -= b;
		if (c <= 0) break;
		a -= d;
		if (a <= 0) break;
	}
	if (a <= 0){
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;
	}
	return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll MOD=100000007;
const ll INF=1000000101001;
int main(){
int a,b;cin >> a >> b;
if(1<=a&&a<=9&&1<=b&&b<=9)cout << a*b << endl;
else cout << -1 << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

struct Card {
    char suit;
    int value;
};

#define INF 1000000000

void merge(Card card[], int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    Card L[n1 + 1];
    Card R[n2 + 1];
    for (int i = 0; i < n1; i++)
        L[i] = card[left + i];
    for (int i = 0; i < n2; i++)
        R[i] = card[mid + i];
    L[n1].value = INF;
    R[n2].value = INF;
    int i = 0;
    int j = 0;
    for (int k = left; k < right; k++)
    {
        if (L[i].value <= R[j].value)
        {
            card[k] = L[i];
            i++;
        } else
        {
            card[k] = R[j];
            j++;
        }
    }
}

void merge_sort(Card card[], int left, int right)
{
    if (left + 1 < right)
    {
        int mid = (left + right) / 2;
        merge_sort(card, left, mid);
        merge_sort(card, mid, right);
        merge(card, left, mid, right);
    }
}


int partition(Card card[], int p, int r)
{
    int x = card[r].value;
    int i = p - 1;
    for (int j = p; j < r; j++)
    {
        if (card[j].value <= x)
        {
            i++;
            swap(card[i], card[j]);
        }
    }
    swap(card[i + 1], card[r]);
    return i + 1;
}

void quick_sort(Card card[], int p, int r)
{
    if (p < r)
    {
        int q = partition(card, p, r);
        quick_sort(card, p, q - 1);
        quick_sort(card, q + 1, r);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    Card card[n];
    Card card_cmp[n];
    char S[16];
    for (int i = 0; i < n; i++)
    {
        scanf("%s", S);
        card[i].suit = card_cmp[i].suit = S[0];
        scanf("%d", &(card[i].value));
        card_cmp[i].value = card[i].value;
    }
    quick_sort(card, 0, n - 1);
    merge_sort(card_cmp, 0, n);

    bool stable = true;

    for (int i = 0; i < n; i++)
    {
        if (card[i].suit != card_cmp[i].suit)
        {
            stable = false;
            break;
        }
    }
    if (stable)
        printf("Stable\n");
    else
        printf("Not stable\n");
    for(int i = 0; i < n; i++)
        printf("%c %d\n", card[i].suit, card[i].value);
}


Measured memory_bytes: 5560
import math

N = int(input())

flg = [1 for _ in range(1001)]
flg[0] = 0
flg[1] = 0


def judge(n):
	tmp = math.floor(n**(1/2))
	for i in range(2,tmp+1):
		if n % i == 0:
			return False
	return True


for i in range(2,1001):
	if flg[i] == 0:
		continue

	if judge(i):
		for j in range(2, 1000//i + 1):
			flg[i*j] = 0

sosu = [i for i in range(1001) if flg[i] == 1]



cnt = [0 for _ in range(N+1)]

def SB(n):
	t = n
	i = 0
	while t != 1:
		tmp_cnt = 0
		while t % sosu[i] == 0:
			t //= sosu[i]
			tmp_cnt += 1
		cnt[sosu[i]] += tmp_cnt
		i += 1
		tmp_cnt = 0


for i in range(2,N+1):
	SB(i)

ans_l = [cnt[i] for i in range(N+1) if cnt[i] != 0]

ans = 1
for i in range(len(ans_l)):
	ans *= (ans_l[i]+1)
	ans %= 1000000007

print(ans)




Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int n,m;cin>>n>>m;
    int arr[n];
    int sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        sum+=arr[i];
    }
    int val=0;
    if(sum%(4*m)==0)val=(sum)/(4*m);
    else val=(sum)/(4*m)+1;
    // int val=(sum)/(4*m);
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        if(arr[i]>=val)cnt++;
    }
    if(cnt>=m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
return 0;    
}

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

int main(){
  int N, M;
  cin >> N >> M;
  priority_queue<int> pq;
  for(int i = 0; i < N; ++i){
    int a;
    cin >> a;
    pq.push(a);
  }
  for(int i = 0; i < M; ++i){
    int a = pq.top();
    pq.pop();
    a /= 2;
    pq.push(a);
  }
  long long ans = 0;
  for(int i = 0; i < N; ++i){
    ans += pq.top();
    pq.pop();
  }
  cout << ans << endl;
}


Measured memory_bytes: 892
#include <cstdio>
#define k 1024
#define r(a) for(int i=0;i<a;i++)
#define s(a) scanf("%d",&a);
#define m(a,b) a<b?a:b
int w,n,m,c[k],d[k],p[k];main(){s(n)s(m)r(n)s(d[i])r(m)s(c[i])r(n)p[i+1]=1e9;r(m*n)w=n-i%n,p[w]=m(p[w],p[w-1]+c[i/n]*d[w-1]);printf("%d\n",p[n]);}

Measured memory_bytes: 1036
#include <iostream>
#include <algorithm>
#include <set>

long long table[3];
long long size[3];
using namespace std;
int main() {
    long long N;
    long long a[100000];
    cin >> N ;
    for (int i=0; i<N; i++) cin >> a[i];

    sort(a, a+N);
    long long unique = 0;
    long long prev = -1;
    for (int i=0; i<N; i++) {
        if (prev != a[i]) {
            prev = a[i];
            if (unique == 3) {cout << "No" << endl; return 0;}
            table[unique] = prev;
            unique++;
        }
        size[unique-1]++;
    }
    if (unique == 3) {
        if (table[0] == 0) {cout << "No" << endl; return 0;}
        if (N % 3 == 0 && size[0] == size[1] && size[1] == size[2] && (table[0] ^ table[1] ^ table[2]) == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    } else if (unique == 2) {
        if (table[0] != 0) {cout << "No" << endl; return 0;}
        if (N % 3 == 0 && size[0] * 2 == size[1]) {
            cout << "Yes" << endl;
            return 0;
        }
    } else if (unique == 1) {
        if (table[0] == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }



    cout << "No" << endl;
    return 0;
}



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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"




int main()
{
	int h, w = 0;
	cin >> h >> w;

	char grid[h][w];
	REP(i, h)
	{
		REP(j, w)
		{
			cin >> grid[i][j];
		}
	}

	const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
	const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
	REP(i, h)
	{
		REP(j, w)
		{
			if (grid[i][j] == '#')
			{
				continue;
			}

			int num = 0;

			REP(k, 8)
			{
				int ni = i + dy[k];
				int nj = j + dx[k];

				if (nj < 0 || h <= ni)
				{
					continue;
				}
				if (nj < 0 || w <= nj)
				{
					continue;
				}
				if (grid[ni][nj] == '#')
				{
					num++;
				}
			}

			grid[i][j] = char(num + '0');
		}
	}

	REP(i, h)
	{
		REP(j, w)
		{
			cout << grid[i][j];
		}

		cout << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e19;
const ll MAX_N = 1010101;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[8] = { 1,-1,0,0,1,1,-1,-1 };
ll dy[8] = { 0,0,1,-1,1,-1,1,-1 };
string dir[8] = { "R","L","D","U","RD","RU","LD","LU" };
bool flag[201010];
ll ans[201010];

vector<vector<ll>>to;

void dfs(ll v) {
	flag[v] = true;
	for (auto nv : to[v]) {
		if (flag[nv] == false) {
			ans[nv] += ans[v];
			dfs(nv);
		}
	}
}

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n;
	cin >> n;
	if (n < 2)cout << 0 << endl;
	else {
		ll ans = 0;
		ll res = 1;
		ll ten = 1, nine = 2, eight = 1;
		while (n > 0) {
			ten *= 10;
			nine *= 9;
			eight *= 8;
			ten %= MOD;
			nine %= MOD;
			eight %= MOD;
			n--;
		}
		ans = (ten + eight) % MOD;
		ans += MOD;
		ans -= nine;
		ans %= MOD;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> void chmax(T& x, U y){if(x<y) x=y;}
template<class T,class U> void chmin(T& x, U y){if(y<x) x=y;}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	int N,Q; cin >> N >> Q;
	V<int> c(N); rep(i,N) cin >> c[i],c[i]--;
	V<int> L(Q),R(Q);
	rep(i,Q) cin >> L[i] >> R[i], L[i]--;
	V<int> idx(Q); iota(all(idx),0);
	const int B = 700;
	sort(all(idx),[&](int l,int r){
		if(L[l]/B != L[r]/B) return L[l]/B < L[r]/B;
		return R[l] < R[r];
	});
	V<int> ans(Q);
	int now = 0;
	V<int> cnt(N);
	auto add = [&](int i){
		shows("add",i);
		cnt[i]++;
		if(cnt[i] == 1) now++;
	};
	auto erase = [&](int i){
		shows("era",i);
		cnt[i]--;
		if(cnt[i] == 0) now--;
	};
	int x=0,y=0;
	for(int i: idx){
		show(i);show(x);show(y);
		for(;L[i]<x;) add(c[--x]);
		for(;R[i]>y;) add(c[y++]);
		for(;L[i]>x;) erase(c[x++]);
		for(;R[i]<y;) erase(c[--y]);
		ans[i] = now;
	}
	for(int v: ans) cout << v << '\n';
}


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

using namespace std;

#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define LL long long

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,(int)(v.size()-1)) os << v[i] << " ";
    os << v[v.size()-1];
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

const int maxn = 2e5+5;
LL N,D;
LL A[maxn];
LL R[maxn];
LL L[maxn];

LL fee(int l,int r){
    return (r - l)*D + A[l] + A[r];
}



int main()
{
    cin >> N >> D;
    _rep(i,1,N){
        cin >> A[i];
    }
    R[N] = N;
    for(int i = N-1; i>= 0;i--){
        LL bef = R[i+1];
        if( (bef - i)*D + A[bef] > A[i]){
            R[i] = i;
        }
        else R[i] = bef;
    }

    L[1] = 1;
    for(int i = 2;i<=N;i++){
        LL bef = L[i-1];
        if((i-bef)*D + A[bef] > A[i]){
            L[i] = i;
        }
        else L[i] = bef;
    }


    LL ans = 0;
    int p = 1;
    int l = 1;
    int r = 2;

    while(p < N){
        r = R[r];
        ans += fee(l,r);
        _for(i,p+1,r){
            ans += min(fee(l,i),fee(i,r));
        }
        p = r;
        l = L[r];
        r++;
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 4992
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<vector<int>>())

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int, int> pii;
typedef std::pair<int, double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L
const int mod = 1e9+7;


void solve(){
    int h,w;
    cin >> h >> w;
    
    multiset<int> s;
    map<int,int> mp;
    
    rep(i,w){
        s.insert(0);
        mp[i] = i;
    }
    rep(i,h){
        int a,b;
        cin >> a >> b;
        a--;
        
        int mr = -1;
        auto it = mp.lower_bound(a);
        

        while(it!=mp.end() && it->first <= b){
            int now = it->first;
            int start = it->second;
            mr = max(start,mr);
            s.erase(s.find(now-start));
            mp.erase(it++);
        }
        
        if (mr!=-1 && b < w){
            s.insert(b-mr);
            mp[b] = mr; 
        }
        
        int ans = -1;
        if (s.size() > 0){
            ans = i+1+*s.begin();        
        }
        cout << ans << endl;
        

    }
    
};



int main() {
    int T;
    //cin >> T;
    T = 1;
    while (T--) {
        solve();
        cout << endl;
    }
}




Measured memory_bytes: 22328
n = int(input())
a = list(map(int, input().split()))
b = []
answer = []

for i in range(n):
	b.append(a[i]-i)
b.sort()
med = b[int(n/2)]

for i in range(n):
	answer.append(abs(a[i]-(med+i)))
	

print(sum(answer))

Measured memory_bytes: 26888
#include<stdio.h>
#include<stdlib.h>
#define N 100
int n,time;
int g[N][N],color[N],d[N],f[N];

void visit(int u){
  int i;
  color[u]=1;
  d[u]=++time;
  for(i=0;i<n;i++){
    if(g[u][i]==0) continue;
    if(color[i]==0) visit(i);
  }
  color[u] = 2;
  f[u]= ++time;
}

void dfs(){
  int i;
  for(i=0;i<n;i++) color[i]=0;
  time = 0;
  for(i=0;i<n;i++){
    if(color[i] == 0) visit(i);
  }
}

int main(){
  int i,j;
  int u,v,k;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      g[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      g[u-1][v-1]=1;
    }
  }
  dfs();
  for(i=0;i<n;i++) printf("%d %d %d\n",i+1,d[i],f[i]);
  return 0;
}

Measured memory_bytes: 636
a, b, c = map(int, input().split())

n = 0
if a == b :
    if c % a == 0 :
        n = n + 1

else :
    i = list(range(a, b+1))
    for x in i :
        if c % x == 0 :
            n = n + 1

print(n)


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int keta(ll A)
{
        int cnt = 0;
        while (A)
        {
                cnt++;
                A /= 10;
        }
        return cnt;
}

int main()
{
        int A, B, C, X, Y;
        cin >> A >> B >> C >> X >> Y;
        int ans = A * X + B * Y;
        ans = min(ans, C * max(X, Y) * 2);
        if (X > Y)
        {
                ans = min(ans, 2 * C * Y +  A* (X - Y));
        }
        else
        {
                ans = min(ans, 2 * C * X + B * (-X + Y));
        }
        ans = min(ans, C * max(X, Y) * 2);

        cout << ans << endl;
        return 0;
}


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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;



template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

template <typename T> inline
void chmin(T &a, T b){
    if (a > b) {
        a = b;
    }
}

template <typename T> inline
void chmax(T &a, T b){
    if (a < b) {
        a = b;
    }
}

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

    int N; cin >> N;

    vector<int> a(N), b(N), c(N);
    REP(i, N) cin >> a[i] >> b[i] >> c[i];

    vector<unordered_map<int, LL>> dp(N);

    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    FOR(i, 1, N) {
        dp[i][0] = max(dp[i-1][1] + a[i], dp[i-1][2] + a[i]);
        dp[i][1] = max(dp[i-1][0] + b[i], dp[i-1][2] + b[i]);
        dp[i][2] = max(dp[i-1][0] + c[i], dp[i-1][1] + c[i]);
    }

    cout << max(max(dp[N-1][0], dp[N-1][1]), dp[N-1][2]) << endl;
}


Measured memory_bytes: 20992
#include <iostream>
using namespace std;
int main(){
	double t1,t2;
	while(cin>>t1>>t2){
		const double T1[]={70.00,55.00,50.00,43.00,40.00,37.50,35.50,0};
		const double T2[]={148.00,116.00,105.00,89.00,83.00,77.00,71.00,0};
		const string N[]={"NA","E","D","C","B","A","AA","AAA"};
		for(int i=0;i<8;++i){
			if(T1[i]<=t1||T2[i]<=t2){
				cout<<N[i]<<endl;
				break;
			}
		}
	}
	return 0;
}

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

static constexpr int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

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

using u64 = unsigned long long;

constexpr u64 M = (1UL << 61) - 1;
constexpr u64 POSITIVISER = M * 3;
constexpr u64 MASK30 = (1UL << 30) - 1;
constexpr u64 MASK31 = (1UL << 31) - 1;



class rolling_hash_u64 {

    static u64 get_base(){
        u64 z = (static_cast<uint64_t>((chrono::system_clock::now().time_since_epoch().count())&((1LL << 32)-1)))+0x9e3779b97f4a7c15;
        z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;
        z = (z ^ (z >> 27)) * 0x94d049bb133111eb;
        return z;
    }

    static u64 &B() {
        static u64 B_ = (get_base())%(M-2)+2;
        return B_;
    }
    static vector<u64> &p() {
        static vector<u64> p_{1, B()};
        return p_;
    }

    static inline u64 mul(u64 x, u64 y){
        u64 a = x >> 31, b = x & MASK31, c = y >> 31, d = y & MASK31, e = b*c+a*d;
        return (a*c << 1) + b*d + ((e & MASK30) << 31) + (e >> 30);
    }

    static inline u64 calc_mod(u64 val){
        val = (val & M) + (val >> 61);
        if(val > M) val -= M;
        return val;
    }
public:
    vector<u64> hash;
    explicit rolling_hash_u64(const string &s) {
        if(p().size() <= s.size()){
            int l = p().size();
            p().resize(s.size()+1);
            for (int i = l; i < p().size(); ++i) {
                p()[i] = calc_mod(mul(p()[i-1], p()[1]));
            }
        }
        hash.resize(s.size()+1, 0);
        for (int i = 0; i < s.size(); ++i) {
            hash[i+1] = calc_mod(mul(hash[i],B()) + s[i]);
        }
    };

    u64 get(int l, int r){
        return calc_mod(hash[r] + POSITIVISER - mul(hash[l], p()[r-l]));
    }
};


int main() {
    int n; string s;
    cin >> n >> s;
    rolling_hash_u64 hash(s);
    int ok = 0, ng = n;
    while(ng - ok > 1){
        int mid = (ok+ng)/2;
        map<u64, int> v;
        int good = 0;
        for (int i = 0; i+mid-1 < n; ++i) {
            u64 x = hash.get(i, i+mid);
            if(v.count(x)){
                if(v[x]+mid-1 < i) good = 1;
            }else {
                v[x] = i;
            }
        }
        if(good) ok = mid;
        else ng = mid;
    }
    cout << ok << "\n";
    return 0;
}

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

using namespace std;

int main() {
    unsigned long long int a, b, c, k;
    cin >> a >> b >> c >> k;
    vector<unsigned long long int> init = {a, b, c};
    vector<vector<unsigned long long int>> transit = {
            {0, 1, 1},
            {1, 0, 1},
            {1, 1, 0}
    };
    auto product = [](vector<vector<unsigned long long int>> matA, vector<vector<unsigned long long int>> matB)
    {
        //product of matrix
        vector<vector<unsigned long long int>> result(3, vector<unsigned long long int>(3, 0));
        for(int i = 0; i < 3; i++)
        {
            for(int j = 0; j < 3; j++)
            {
                for(int k = 0; k < 3; k++)
                {
                    result[i][j] += matA[i][k] * matB[k][j];
                }
            }
        }
        return result;
    };
    auto fast_pow = [&](vector<vector<unsigned long long int>> matA, unsigned long long int k)
    {
        unsigned long long int mask = 1;
        vector<vector<unsigned long long int>> result ={
                {1, 0, 0},
                {0, 1, 0},
                {0, 0, 1}
        };
        vector<vector<unsigned long long int>> temp = matA;
        for(; mask != 0; mask = mask << 1)
        {
            if(mask != 1)
            {
                temp = product(temp, temp);
            }
            if(k & mask)
            {
                result = product(result, temp);
            }
        }
        return result;
    };
    /*vector<vector<unsigned long long int>> temp = fast_pow(transit, 4);
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0; j < 3; j++)
        {
            cout << temp[i][j] << " ";
        }
        cout << endl;
    }
    temp = product(transit, transit);
    temp = product(temp, transit);
    temp = product(temp, transit);
    cout << endl;
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0; j < 3; j++)
        {
            cout << temp[i][j] << " ";
        }
        cout << endl;
    }*/
    vector<vector<unsigned long long int>> temp = fast_pow(transit, k);
    vector<unsigned long long int> result = {
            init[0] * temp[0][0] + init[1] * temp[0][1] + init[2] * temp[0][2],
            init[0] * temp[1][0] + init[1] * temp[1][1] + init[2] * temp[1][2],
            init[0] * temp[2][0] + init[1] * temp[2][1] + init[2] * temp[2][2]
    };
    long long int diff = (long long int)(result[0] - result[1]) ;
    if(abs(diff) > 1000000000000000000)
    {
        cout << "Unfair" << endl;
    }else{
        cout << diff << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())
 
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
    
    ll i,j,n,k;
    cin>>n>>k;
    vector<ll> a(n);
    for(i=0;i<n;i++) cin>>a[i];
    for(i=k;i<n;i++)
    {
        if(a[i]>a[i-k]) cout<<"Yes\n";
        else cout<<"No\n";
    }
}

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

int main(){
  vector<int> a(5);
  for(int i = 0;i < 5;i++)cin >> a[i];


  vector<int> times;

  for(int i = 0;i < 5;i++){
    for(int j = 0;j < 5;j++){
      for(int k = 0;k < 5;k++){
        for(int l = 0;l < 5;l++){
          for(int m = 0;m < 5;m++){
            if(i != j && i != k && i != l && i != m && j != k && j != l && j != m && k != l && k != m && l != m){

              int time = 0;

              time = a[i] + a[j] + a[k] + a[l] + a[m];
              if(a[i] % 10 != 0)time += (10 - a[i] % 10);
              if(a[j] % 10 != 0)time += (10 - a[j] % 10);
              if(a[k] % 10 != 0)time += (10 - a[k] % 10);
              if(a[l] % 10 != 0)time += (10 - a[l] % 10);
              times.push_back(time);

            }
          }
        }
      }
    }
  }

  cout << *min_element(times.begin(),times.end()) << endl;
}


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

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

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

    vector<vector<int>> F(N, vector<int>(10)), P(N, vector<int>(11));
    rep(i, N){
        rep(j, 10){
            cin >> F.at(i).at(j);
        }
    }
    rep(i, N){
        rep(j, 11){
            cin >> P.at(i).at(j);
        }
    }

    int ans = - INF;

    for(int tmp = 1; tmp < (1 << 10); tmp++){
        bitset<10> s(tmp);
        int profit = 0; 
        for(int i = 0; i < N; i++){
            int open = 0;
            for(int j = 0; j < 10; j++){
                if(s.test(j) && F.at(i).at(j)) open++;
            }
            profit += P.at(i).at(open);
        }
        ans = max(ans, profit);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    int V[N], C[N];
    for (int i = 0; i < N; ++i) cin >> V[i];
    for (int i = 0; i < N; ++i) cin >> C[i];
    int m = 0;
    for (int i = 0; i < N; ++i) {
        int p = V[i] - C[i];
        if (p > 0) m += p;
    }
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define fr first
#define sc second
#define int ll

using namespace std;
const int MN = 55+7;
const int MOD = 1e9+7;

int k, n, a[MN][MN], dp[MN][MN][MN], ans[MN][MN];


signed main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cin >> a[i][j];
            if(a[i][j])dp[i][j][0]++;
        }
    }
    int z = 0, f = 0;
    for(int i = 0; i < n; i++){
        ans[i][0] = 1;
    }
    while(k){
        if(k & 1){
            for(int i = 0; i < n; i++){
                for(int j = 0; j < n; j++){
                    ans[i][f+1] = (ans[j][f] * dp[j][i][z] + ans[i][f+1]) % MOD;
                }
            }
            f++;
        }
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                dp[i][j][z+1] = 0;
                for(int l = 0; l < n; l++){
                    dp[i][j][z+1] = (dp[i][j][z+1] + dp[i][l][z] * dp[l][j][z]) % MOD;
                }
            }
        }
        z++;
        k >>= 1;
    }
    ll re = 0;
    for(int i = 0; i < n; i++){
        re = (re + ans[i][f]) % MOD;
    }
    cout << re;
}


Measured memory_bytes: 1664