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

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

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i) // ROF(i,n,0)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで降順
#define SUM(a) accumulate(all(a),int(0))
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;
constexpr ll mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>T add(const T &a, const T &b){return (a+b)%mod;}

signed main(){
  int n; cin >> n;
  vi a(n); rep(i,n) cin >> a[i];
  map<int,int> mp;
  rep(i,n){
    auto itr = mp.upper_bound(-a[i]);
    if(itr == mp.end()) mp[-a[i]]++;
    else{
      itr->second--;
      if(itr->second == 0) mp.erase(itr);
      mp[-a[i]]++;
    }
  }
  dump(mp);
  int ans = 0;
  for(auto p : mp) ans += p.second;
  cout << ans << endl;
}



Measured memory_bytes: 7168
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;

const int N = 1e6 + 10;
int pre[N], n, sub[N];
char s[N], t[N];

bool chkpre(int x) {
    return x % (x - pre[x]) > 0 || !pre[x];
}

bool chksub(int x) {
    return x % (x - sub[x]) > 0 || !sub[x];
}

void getfail(char *s, int *nxt) {
    nxt[0] = nxt[1] = 0;
    int j = 0;
    rep(i, 1, n - 1) {
        while(j && s[i] != s[j]) j = nxt[j];
        nxt[i + 1] = (s[i] == s[j] ? ++j : 0);
    }
}

int main() {
    scanf("%s", s);
    n = strlen(s);
    rep(i, 0, n - 1) t[i] = s[n - i - 1];
    t[n] = '\0';

    getfail(s, pre), getfail(t, sub);
    
    int flag = chkpre(n) ? 1 : 2;
    bool f = 1;
    // rep(i, 1, n - 1) if (s[i] != s[i - 1]) { f = 0; break; }
    // if (f) flag = n;
    if (n - pre[n] == 1) flag = n;
    printf("%d\n", flag);
    if (flag != 2) { puts("1"); return 0; }

    int ans = 0;
    rep(i, 0, n - 1) {
        int x = n - i - 1;
        if (chkpre(i + 1) && chksub(x)) ans++;
    }
    printf("%d\n", ans);
    return 0;
}


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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n,m,s;
void solve(){
    cin>>n>>m;
    rep(i,0,m){
        int x;
        cin>>x;
        s+=x;
    }
    if(n>=s) cout<<n-s<<endl;
    else cout<<-1<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <cassert>
using namespace std;

int takHP, takAttack, aoHP, aoAttack;
vector<int> vec;
string s;

bool solve() {

    int takCnt = 0;

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

        if (aoHP <= 0) {
            takCnt = i;
            break;
        }

        aoHP -= takAttack;
    }

    int aoCnt = 0;

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

        if (takHP <= 0) {
            aoCnt = i;
            break;
        }

        takHP -= aoAttack;
    }

    return takCnt <= aoCnt;


}

int main() {

    cin >> takHP >> takAttack >> aoHP >> aoAttack;
    //vec.resize(N);
    //for (int i = 0; i < N; i++) {
    //    cin >> vec.at(i);
    //}
    
    if (solve()) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }


    return 0;
}



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

int main() {
  int A, B, Q;
  cin >> A >> B >> Q;
  vector<long> s(A),t(B),x(Q);
  for (int i=0; i<A; i++) {
    cin >> s[i];
  }
  for (int i=0; i<B; i++) {
    cin >> t[i];
  }  
  for (int i=0; i<Q; i++) {
    cin >> x[i];
  }
  vector<long> s_t(A),t_s(B),x_s(Q),x_t(Q);
  
  
  int j = 0;
  for (int i=0; i<A; i++) {
    while (j<B) {
      if (s[i] < t[j]) {
        if (j == 0) {
          s_t[i] = t[j] - s[i];
          break;
        }
        else {
          s_t[i] = min(t[j] - s[i],s[i] - t[j-1]);
          break;
        }
      }
      if (j == B-1) {
        s_t[i] = s[i] - t[j];
        break;
      }
      j++;
    }
  }
  j = 0;
  for (int i=0; i<B; i++) {
    while (j<A) {
      if (t[i] < s[j]) {
        if (j == 0) {
          t_s[i] = s[j] - t[i];
          break;
        }
        else {
          t_s[i] = min(s[j] - t[i],t[i] - s[j-1]);
          break;
        }
      }
      if (j == A-1) {
        t_s[i] = t[i] - s[j];
        break;
      }
      j++;
    }
  }
  for (int i=0; i<Q; i++) {
    int ok = -1;
    int ng = A;
    while (ng - ok > 1) {
      int mid = (ok + ng)/2;
      if (x[i] > s[mid]) {
        ok = mid;
      }
      else {
        ng = mid;
      }
    }
    if (ok == -1) {
      x_s[i] = s[0] - x[i] + s_t[0];
    }
    if (ng == A) {
      x_s[i] = x[i] - s[A-1] + s_t[A-1];
    }
    if (ok != -1 && ng != A) {
      x_s[i] = min(s[ng] - x[i] + s_t[ng],x[i] - s[ok] + s_t[ok]);
    }
  }
    for (int i=0; i<Q; i++) {
    int ok = -1;
    int ng = B;
    while (ng - ok > 1) {
      int mid = (ok + ng)/2;
      if (x[i] > t[mid]) {
        ok = mid;
      }
      else {
        ng = mid;
      }
    }
    if (ok == -1) {
      x_t[i] = t[0] - x[i] + t_s[0];
    }
    if (ng == B) {
      x_t[i] = x[i] - t[B-1] + t_s[B-1];
    }
    if (ok != -1 && ng != B) {
      x_t[i] = min(t[ng] - x[i] + t_s[ng],x[i] - t[ok] + t_s[ok]);
    }
  }
  for (int i=0; i<Q; i++) {
    cout << min(x_s[i],x_t[i]) << endl;
  }
  
  /*  for (int i=0; i<A; i++) {
    cerr << s_t[i] << endl;
  }
  for (int i=0; i<B; i++) {
    cerr << t_s[i] << endl;
  }  
  for (int i=0; i<Q; i++) {
    cerr << x_s[i] << endl;
  }*/
  
}


Measured memory_bytes: 6784
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

ll merge(vll &a, ll n, ll left, ll mid, ll right) {
    ll cnt = 0;
    ll n1 = mid - left;
    ll n2 = right - mid;
    vll a1(n1 + 1), a2(n2 + 1);
    REP(i, n1) a1[i] = a[left + i];
    REP(i, n2) a2[i] = a[mid + i];
    a1[n1] = a2[n2] = HIGHINF;
    ll i = 0, j = 0;
    rep(k, left, right) {
        if (a1[i] <= a2[j]) {
            a[k] = a1[i];
            i++;
        } else {
            a[k] = a2[j];
            j++;
            cnt += n1 - i;
        }
    }
    return cnt;
}

ll mergeSort(vll &a, ll n, ll left, ll right) {
    if (left + 1 < right) {
        ll mid = (left + right) / 2;
        ll v1 = mergeSort(a, n, left, mid);
        ll v2 = mergeSort(a, n, mid, right);
        ll v3 = merge(a, n, left, mid, right);
        return v1 + v2 + v3;
    } else return 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vll a(n); REP(i, n) cin >> a[i];
    if (n == 1) {
        cout << a[0] << '\n';
        return 0;
    }
    ll low = 1, high = HIGHINF / 2 + 1;
    ll bound = (((1 + n) * n / 2) + 1) / 2;  // bound 個以上あれば OK
    while (low < high) {
        ll mid = (low + high) / 2;
        vll acca(n + 1, 0);
        REP(i, n) acca[i + 1] = acca[i] + (a[i] >= mid ? 1 : -1);
        ll sw = mergeSort(acca, n + 1, 0, n + 1);
        if (bound >= sw) low = mid + 1;
        else high = mid;
    }
    cout << low - 1 << '\n';
    return 0;
}


Measured memory_bytes: 2792
### constant

N = 5

### main

m = gets.to_i

m.times do
  flds = []
  N.times do
    line = gets.strip
    line = gets.strip if line.empty?
    flds << line.split.map(&:to_i)
  end
  #p flds

  hsums = N.times.map{[]}

  for y in (0...N)
    hsums[y][0] = flds[y][0]
    for x in (1...N)
      if flds[y][x] == 1
        hsums[y][x] = hsums[y][x - 1] + 1
      else
        hsums[y][x] = 0
      end
    end
  end
  #p hsums

  max_rct = 0

  for x in (0...N)
    for y in (0...N)
      min_hs = hsums[y][x]
      next if min_hs == 0

      max_rct = min_hs if max_rct < min_hs

      (y - 1).downto(0) do |y0|
        hs0 = hsums[y0][x]
        break if hs0 == 0
        min_hs = hs0 if min_hs > hs0
        rct = min_hs * (y - y0 + 1)
        max_rct = rct if max_rct < rct
      end
    end
  end

  puts max_rct
end

Measured memory_bytes: 6148
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

vector<int>g[4000];

int dist[3000][3000];

void bfs(int s){
	queue<int> q;
	q.push(s);
	dist[s][s] = 0;
	while(!q.empty()){
		int u = q.front();
		q.pop();
		for(int v:g[u]){
			if(dist[s][v] == -1){
				dist[s][v] = dist[s][u] + 1;
				q.push(v);
			}
		}
	}
}

void solve(){
	int n,x,y;
	memset(dist,-1,sizeof(dist));
	cin>>n>>x>>y;
	for(int i=1;i<=n-1;i++){
		g[i].pb(i+1);
		g[i+1].pb(i);
	}
	g[x].pb(y);
	g[y].pb(x);

	for(int i=1;i<=n;i++){
		bfs(i);
	}

	vector<int> cnt(n);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cnt[dist[i][j]] += 1;
			// cout<<dist[i][j]<<" ";
		}
		// cout<<endl;
	}
	for(int i=1;i<n;i++){
		cout<<cnt[i]/2<<endl;
	}
}

int main(){
	fastread;
	int t = 1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


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

using namespace std;

typedef long long ll;

const ll M = 1'000'000'007ULL;

vector<ll> fac(2'000'006);   // n!(mod M)
vector<ll> ifac(2'000'006);  // k!^{M-2} (mod M)
// a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x,
        ll n) {  // x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
  ll ans = 1;
  while (n != 0) {
    if (n & 1)
      ans = ans * x % M;
    x = x * x % M;
    n = n >> 1;
  }
  return ans;
}

ll comb(ll a, ll b) {  // aCbをmod計算
  if (a == 0 && b == 0)
    return 1;
  if (a < b || a < 0)
    return 0;
  ll tmp = ifac[a - b] * ifac[b] % M;
  return tmp * fac[a] % M;
}

int64_t calc(int r, int c) {
  if (r < 0 || c < 0) return 0;
  return comb(r + c + 2, c + 1) - 1;
}

void solve() {
  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;
  --r1;
  --c1;
  auto area1 = calc(r1, c1);
  auto area2 = calc(r2, c1);
  auto area3 = calc(r1, c2);
  auto area4 = calc(r2, c2);

  auto res = area4 - area2 - area3 + area1;
  if (res < 0)
    res += M;
  res %= M;

  cout << res << endl;
}

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

  fac[0] = 1;
  ifac[0] = 1;
  for (ll i = 0; i < 2'000'005; i++) {
    fac[i + 1] = fac[i] * (i + 1) % M;  // n!(mod M)
    ifac[i + 1] =
        ifac[i] * mpow(i + 1, M - 2) % M;  // k!^{M-2} (mod M) ←累乗にmpowを採用
  }

  solve();
}


Measured memory_bytes: 31488
///Code by: Luis Alejandro
///Handle: Sekai
///Country: Cuba

#include <bits/stdc++.h>
#define endl '\n'
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("avx2")

using namespace std;

typedef unsigned long long ull;
typedef long long lld;
typedef long double ld;
typedef pair<int,int> pii;

const int MAXN=1e5+5;
const int MOD=1e9+7;
const int INF=INT_MAX;
const ld PI=acos(-1);
const ld EPS=1e-9;

#define lg2(x) 31-__builtin_clz(x)
#define logx(a,b) (log(a)/log(b))
#define read(x) cin>>x;

pii mkp(int a, int b){
    if(a>b)swap(a,b);
    return make_pair(a,b);
}

int mod_pow(int a, int b){
    if(!b)return 1;
    if(b&1)return mod_pow(a,b-1)*a%MOD;
    int power=mod_pow(a,b>>1);
    return power*power%MOD;
}

int modular_inverse(int a){
    return mod_pow(a,MOD-2);
}

void solve(){
    int a;
    cin>>a;
    cout<<a+(a*a)+(a*a*a)<<endl;
}

int main()
{
    //freopen("IN.txt","r",stdin);
    //freopen("OUT.txt","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

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

int main()
{
    string n;
    int ans1=0,ans2=0,ans3=0;
    cin >> n;
    if(n[0] == n[1]) ans1 = 1;
    if(n[1] == n[2]) ans2 = 1;
    if(n[2] == n[3]) ans3 = 1;
    if((ans1==1 && ans2 == 1) || (ans2==1 && ans3==1)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


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

int cnt[26], a[26], N;

int main() {
	scanf("%d", &N);
	memset(a, 127, sizeof(a));
	for (int i = 0; i < N; i++) {
		string S;
		cin >> S;
		memset(cnt, 0, sizeof(cnt));
		for (int j = 0; j < S.length(); j++) cnt[S[j] - 'a']++;
		for (int j = 0; j < 26; j++) a[j] = min(a[j], cnt[j]);
	}
	for (int i = 0; i < 26; i++) for (int j = 0; j < a[i]; j++) printf("%c", 'a' + i);
	printf("\n");
}


Measured memory_bytes: 256
# chmin can't use
# List in Python create copy by using slice

def main():
    INF = 10 ** 9
    N, K = map(int, input().split())
    h = list(map(int, input().split()))

    # memo of cost of i th avalable going range
    dp = [INF] * (N + 10)

    # condition of init
    dp[0] = 0

    #
    for i in range(N):
        for k in range(1, K+1):
            if i + k >= len(h):break
            tmp_cost = dp[i]+ abs(h[i] - h[i + k])
            if tmp_cost < dp[i + k]:
                dp[i + k] = tmp_cost
    print(dp[N-1])

if __name__ == "__main__":
    main()

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

#define f first
#define s second
#define p pair<int,int>
#define ll unsigned long long
#define db double
#define db double

const int maxn=1e6+5;
const int inf=1e9;

ll Lu(ll a, ll b)
{
    ll temp;
    if (a < b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    if (a%b == 0)
        return b;
    else
        return Lu(b, a%b);
}

ll Zheng(ll a, ll b)
{
    return a/Lu(a, b)*b;
}

int main()
{
    ll n, m , s;
    while (cin >> n)
    {
        s = 1;
        for (ll i = 0; i < n; i++)
        {
            cin >> m;
            s = Zheng(s, m);
        }
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll k;
    cin >> k;
    ll sum = 0;
    for(int a = 1; a <= k; a++){
        for(int b = 1; b <= k; b++){
            for(int c = 1; c <= k; c++){
                sum += __gcd(__gcd(a,b),c);
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3636
// ~/SolverToBe/Developers/Corvus
// ~/sudo apt-get verdict Accpeted

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <memory.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <functional>
#include <assert.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 3005, M = 1000005;
const ll MOD = 1e9 + 7;
const double eps = 1e-9;

int n,m,dp[N][N],sol[N][N];
char s[N],t[N];

int calc(int i,int j) {
    if(i==n || j==m)
        return 0;
    int &r = dp[i][j];
    if(r!=-1)
        return r;
    if(s[i]==t[j]) {
        r = calc(i+1,j+1) + 1;
        sol[i][j] = 0;
    }
    else {
        int a = calc(i+1,j);
        int b = calc(i,j+1);
        r = max(a,b);
        sol[i][j] = (a >= b ? 1 : 2);
    }
    return r;
}

int main() {
    scanf("%s%s",s,t);
    n = strlen(s);
    m = strlen(t);
    memset(dp,-1,sizeof dp);
    calc(0,0);
    int i=0,j=0;
    string ans = "";
    while(i<n && j<m) {
        if(sol[i][j]==0) ans += s[i], i++,j++;
        else if(sol[i][j]==1) i++;
        else j++;
    }
    puts(ans.c_str());
    return 0;
}

Measured memory_bytes: 71168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

int main(){

    int N;cin>>N;
    vector<int> X(N),Y(N);
    vector<char> S(N);
    for(int i=0;i<N;i++){
        cin>>X[i]>>Y[i]>>S[i];
        X[i]*=2;
        Y[i]*=2;
    }
    int UX1,LX1,RX1,DX1,UX2,LX2,RX2,DX2,UY1,LY1,RY1,DY1,UY2,LY2,RY2,DY2;//1は正
    UX1=LX1=RX1=DX1=UY1=LY1=RY1=DY1=-INF;
    UX2=LX2=RX2=DX2=UY2=LY2=RY2=DY2=INF;
    
    for(int i=0;i<N;i++){
        if(S[i]=='U'){
            UX1=max(UX1,X[i]);
            UX2=min(UX2,X[i]);
            UY1=max(UY1,Y[i]);
            UY2=min(UY2,Y[i]);
        }else if(S[i]=='L'){
            LX1=max(LX1,X[i]);
            LX2=min(LX2,X[i]);
            LY1=max(LY1,Y[i]);
            LY2=min(LY2,Y[i]);
        }else if(S[i]=='R'){
            RX1=max(RX1,X[i]);
            RX2=min(RX2,X[i]);
            RY1=max(RY1,Y[i]);
            RY2=min(RY2,Y[i]);
        }else{
            DX1=max(DX1,X[i]);
            DX2=min(DX2,X[i]);
            DY1=max(DY1,Y[i]);
            DY2=min(DY2,Y[i]);
        }
    }
    
    ll ans;
    
    int xmax=max({UX1,LX1,RX1,DX1}),xmin=min({UX2,LX2,RX2,DX2}),ymax=max({UY1,LY1,RY1,DY1}),ymin=min({UY2,LY2,RY2,DY2});
    
    ll a=ll((xmax-xmin))*((ymax-ymin));
    ans=a;
    
    for(int t=1;t<=200000000;t++){
        int xmax=max({UX1,LX1-t,RX1+t,DX1}),xmin=min({UX2,LX2-t,RX2+t,DX2}),ymax=max({UY1+t,LY1,RY1,DY1-t}),ymin=min({UY2+t,LY2,RY2,DY2-t});
        
        ll a=ll((xmax-xmin))*((ymax-ymin));
        ans=min(ans,a);
        //if(t<=100.0) cout<<t<<" "<<setprecision(25)<<ans<<endl;
    }
    
    if(ans%4==0) cout<<ans/4<<endl;
    else if(ans%4==1) cout<<ans/4<<".25"<<endl;
    else if(ans%4==2) cout<<ans/4<<".50"<<endl;
    else cout<<ans/4<<".75"<<endl;
    
}


Measured memory_bytes: 1152
#include<stdio.h>
#define MAX 101
#define WHITE 0
#define BLACK 1
#define INF 10000000
#define NIL -1

int G[MAX][MAX],n;
int d[MAX],p[MAX],color[MAX];

void Dij(int a){
  int i,j;
  for(i=0;i<n;i++){
    d[i]=INF;
    p[i]=NIL;
  }
  d[a]=0;
  while(1){
    int u,cost = INF;
    for(i=0;i<n;i++){
  	if(color[i]!=BLACK && d[i]<cost){
	  cost=d[i];
	  u=i;
  	}
    }
    
    if(cost==INF)break;
    color[u]=BLACK;
    
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && G[u][i]+d[u]<d[i] && G[u][i]!=NIL){
	p[i]=u;
	d[i]=G[u][i]+d[u];
      }
    }
  }
}

int main(){
  int i,j,u,k,c;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      G[i][j]=NIL;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
       scanf("%d",&c);
       
       scanf("%d",&G[u][c]);
    }
  }
  Dij(0);
  for(i=0;i<n;i++)printf("%d %d\n",i,d[i]);
  return 0;
}



Measured memory_bytes: 2048
N, M, Q = gets.split.map(&:to_i)

lines = M.times.map do
  l, r = gets.split.map(&:to_i)
  [l, r]
end

questions = Q.times.map do
  p, q = gets.split.map(&:to_i)
  [p, q]
end

sum = Array.new(N+1) { Array.new(N+1) {0} }

lines.each do |line|
  l = line[0]
  r = line[1]
  sum[l][r] += 1
end

1.upto(N) do |l|
  1.upto(N) do |r|
    sum[l][r] += sum[l-1][r]
    sum[l][r] += sum[l][r-1]
    sum[l][r] -= sum[l-1][r-1]
  end
end

# p sum

questions.each do |question|
  l = question[0]
  r = question[1]
  ans = sum[r][r] - sum[r][l-1] - sum[l-1][r] + sum[l-1][l-1]
  p ans
end


Measured memory_bytes: 48052
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

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

int main() {
    //cout.precision(10);
    string alpha = "abcdefghijklmnopqrstuvwxyz";
    string a;
    cin >> a;
    long long ans = a.size() * (a.size() - 1) / 2 + 1;
    long long number[26];
    for(int i = 0; i < 26; i++){
        number[i] = 0;
    }
    for(int i = 0; i < a.size(); i++){
        for(int j = 0; j < 26; j++){
            if(alpha[j] == a[i]){
                number[j]++;
            }
        }
    }
    for(int i = 0; i < 26; i++){
        ans -= number[i] * (number[i] - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

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

using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<ll> a(n),b(n);
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];
    ll asum=accumulate(a.begin(),a.end(),0LL);
    ll bsum=accumulate(b.begin(),b.end(),0LL);
    if(asum<bsum){
        cout<<-1<<endl;
        return 0;
    }
    vector<ll> mergin;
    for(int i=0;i<n;i++){
        if(b[i]<a[i]) mergin.push_back(a[i]-b[i]);
    }
    sort(mergin.begin(),mergin.end(),greater<ll>());
    ll sum=0;
    int cnt=0;
    for(int i=0;i<n;i++){
        if(a[i]<b[i]){
            sum+=b[i]-a[i];
            cnt++;
        }
    }

    vector<ll> msum(mergin.size()+1);
    partial_sum(mergin.begin(),mergin.end(),msum.begin()+1);
    cout<<cnt+(lower_bound(msum.begin(),msum.end(),sum)-msum.begin())<<endl;
    return 0;
}

Measured memory_bytes: 2808
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		if(a<b){
			System.out.println("a < b");
		}
		else if(a>b){
			System.out.println("a > b");
		}
		else if(a==b){
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 26152
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <stack>
#include <map>
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<ll,ll> P;
const ll INF = 100100100100100100;

ll N;
ll a[100100];
ll b[3];
int main(){
  cin >> N;
  rep(i,N){
    cin >> a[i];
    if(a[i] % 2 == 1) b[0]++;
    else if(a[i] % 4 == 0) b[1]++;
    else b[2]++;
  }
  if(b[0] > b[1] + 1 || ( b[0] > b[1] && b[2] != 0)){
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}


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

int main() {
    int N,s=0,l,r;
    cin >> N;

    rep(i,N) {
        cin >> l >> r;
        s += r-l+1;
    }

    cout << s << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  string S;
  cin>>S;
  string ans="No";
  sort(ALL(S));
  if(S=="abc")
    ans="Yes";
  cout<<ans;
  }


Measured memory_bytes: 256
from collections import deque
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

def solve():
  h,w,d  = (int(i) for i in input().split())
  a = deque([])
  for i in range(h):
    tmp = list(int(i) for i in input().split())
    a.append(tmp)

  query = [False]*(h*w)
  distance = [0]*(h*w+1)
  for i in range(h):
    for j in range(w):
      query[a[i][j] - 1] = (i,j)
  q = int(input())
  
  for i in range(d,h*w):
    leftx,lefty = query[i-d]
    rightx,righty = query[i]
    distance[i] = distance[i-d]+abs(rightx-leftx)+abs(righty-lefty)
  #print(distance)

  for i in range(q):
    l,r = (int(m) for m in input().split())
    print(distance[r-1]-distance[l-1])
    
solve()

Measured memory_bytes: 57308
// atcoder/abc159/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

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

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

const int H = 10 + 3;
const int W = 1000 + 5;

int g[H][W];

int main(int argc, char *argv[])
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.setf(std::ios_base::fixed);
  std::cout.precision(15);

  int h, w, K;
  while (cin >> h >> w >> K) {
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        char c;
        cin >> c;
        g[i][j] = c - '0';
      }
    }

    int mn = 1LL << 29;
    for (int bit = 0; bit < (1 << h); ++bit) {
      vec<pair<int, int>> v;
      int prev = 0;
      for (int i = 0; i < h; ++i) {
        if (bit & (1 << i)) {
          v.push_back(make_pair(prev, i + 1));
          prev = i + 1;
        }
      }
      // cout << v << ", " << h << endl;
      if (v.empty()) {
        v.push_back(make_pair(0, h));
      } else if (v.back().second != h) {
        v.push_back(make_pair(v.back().second, h));
      }

      int cnt = max(0, (int)v.size() - 1);
      map<int, int> m;
      for (int j = 0; j < w; ++j) {
        map<int, int> n = m;
        int mx = 0;
        for (int k = 0; k < v.size(); ++k) {
          for (int i = v[k].first; i < v[k].second; ++i) {
            setmax(mx, n[k] += g[i][j]);
          }
        }
        if (K < mx) {
          ++cnt;
          m.clear();
        }
        mx = 0;
        for (int k = 0; k < v.size(); ++k) {
          for (int i = v[k].first; i < v[k].second; ++i) {
            m[k] += g[i][j];
            setmax(mx, m[k]);
          }
        }
        if (K < mx) {
          cnt = (1 << 29);
          break;
        }
      }

      setmin(mn, cnt);
    }
    cout << mn << endl;
    // cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    set<char> se;
    REP(i,s.size()) se.insert(s[i]);
    ll ans=1e9;
    bool flg=true;
    for(char c:se){
        string tmpS=s;
        ll sum=0;
        while(true){
            REP(i,tmpS.size()) if(c!=tmpS[i]) flg=false;
            if(flg) break;
            else{
                sum++;
                REP(i,tmpS.size()-1){
                    if(c!=tmpS[i] && tmpS[i+1]==c) tmpS[i]=c;
                }
                tmpS.pop_back();
            }
            flg=true;
        }
        chmin(ans,sum);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, a, b;
    cin>>n>>a>>b;
    ll t = n / (a + b);
    if(a == 0) {
    	cout<<"0\n";
    	return 0;
    }
    ll temp = n % (a + b);
    if(temp > a) {
    	temp = a;
    }
    cout<<(t * a) + temp<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>
#include <fstream>

using namespace std;
using ll = long long;

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

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

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

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


    int H, W;
    cin >> H >> W;
    vector<string> A(H);
    cin >> A;

    bool b = true;
    REP(h, H - 1) {
        REP(w, W - 1) {
            if (A[h + 1][w] == '#' && A[h][w + 1] == '#')b = false;
        }
    }

    YESNO(b, "Possible", "Impossible");
    return 0;
}

Measured memory_bytes: 256
lis = []
n = int(input())
for i in range(n):
  s = str(input())
  if s not in lis:
    lis.append(s)
  else:
    print("No")
    exit()
for i in range(n-1):
  if lis[i][-1] != lis[i+1][0]:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 3060
h,w = map(int,input().split())
raw = [[0 for _ in range(w+1)]]
for _ in range(h):
  tmp = input()
  add = [0]
  for j in range(w):
    if tmp[j] == '.':
      add.append(0)
    else:
      add.append(1)
  raw.append(add)
#for x in raw:
  #print(x)
ans = []
for i in range(1,h+1):
  add = []
  for j in range(1,w+1):
    can = []
    if i == j == 1:
      add.append(raw[1][1])
      continue
    if i != 1:
      if raw[i][j] == 0:
        can.append(ans[i-2][j-1])
      elif raw[i-1][j] == 1:
        can.append(ans[i-2][j-1])
      else:
        can.append(ans[i-2][j-1]+1)
    if j != 1:
      if raw[i][j] == 0:
        can.append(add[j-2])
      elif raw[i][j-1] == 1:
        can.append(add[j-2])
      else:
        can.append(add[j-2]+1)
    add.append(min(can))
  ans.append(add)
#for x in ans:
  #print(x)
print(ans[-1][-1])

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

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(auto &it : (v))
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define sz(x) (int)(x).size()

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

int main(){
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	vector<int> a(n);
	int num=1;
	int numOdd=1;
	rep(i,0,n) {
		cin >> a[i];
		num *= 3;
		if(a[i]%2)
			numOdd *= 1;
		else
			numOdd *= 2;
	}
	cout << num-numOdd << endl;
}

Measured memory_bytes: 256
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL;
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    ll a,b;
    cin>>a>>b;
    ll k;cin>>k;
    rep(i,0,k){
        if(i%2==0){
            if(a%2==1)a--;
            b+=a/2;
            a/=2;
        }else {
            if(b%2==1)b--;
            a+=b/2;
            b/=2;
        }
    }
    cout<<a<<" "<<b<<endl;
    
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	string s;
	cin>>s;
	if(s[0]=='1')	s[0]='9';
	else			s[0]='1';
	if(s[1]=='1')	s[1]='9';
	else			s[1]='1';
	if(s[2]=='1')	s[2]='9';
	else			s[2]='1';
	cout<<s<<endl;
	return 0;
}

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


using namespace std;

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

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


#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
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)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


using pll = pair<long long, long long>; // (right edge, damage)

int N;
long long X, Y;
vector<pll> xin, yin;

bool isok(vector<pll> v, long long r) {
    //COUT(v); COUT(r);
    long long cur = 0;
    for (int i = 0; i < v.size(); ++i) {
        if (cur < v[i].first) return false;
        chmax(cur, v[i].second);
    }
    if (cur < r) return false;
    return true;
}

int main() {
    cin >> N >> X >> Y;
    xin.resize(N), yin.resize(N);
    for (int i = 0; i < N; ++i) {
        long long x, y, d;
        cin >> x >> y >> d;
        xin[i] = {x-d, x+d};
        yin[i] = {y-d, y+d};
    }
    sort(xin.begin(), xin.end());
    sort(yin.begin(), yin.end());

    if (isok(xin, X) || isok(yin, Y)) cout << "Yes" << endl;
    else cout << "No" << endl;
}



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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); --i)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

ll arr[MX];

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int N; unsigned long long K; cin >> N >> K;

    FOR(i, 1, N+1) cin >> arr[i];

    bitset<MX+1> mk; mk.reset();

    vi tele;
    mk[1] = true;
    int cur = 1, cycle = -1; tele.pb(1);
    while(true) {
        cur = arr[cur];
        if (mk[cur]) {
            cycle = cur; break;
        }
        tele.pb(cur);
        mk[cur] = true;
    }

    assert(cycle != -1);

    vi c; bool e = false;
    trav(x, tele) {
        if (x == cycle) {
            e = true;
        }
        if (e) c.pb(x);
        else {
            if (K == 0) {
                cout << x << "\n";
                exit(0);
            }
            K--;
        }
    }


    ll X = (K)%(sz(c));

    cout << c[X] << "\n";

}


Measured memory_bytes: 6808
import heapq

N = int(input())
a_list = list(map(int, input().split()))

h = []
goukei = 0
for a in a_list[:N]:
    goukei += a
    heapq.heappush(h,a)

k_left_goukei = [goukei]

for a in a_list[N:2*N]:
    goukei += a
    d = heapq.heappushpop(h,a)
    goukei -= d
    k_left_goukei.append(goukei)

h = []
goukei = 0
for a in a_list[::-1][:N]:
    goukei += a
    heapq.heappush(h,(-a,a))
    
k_right_goukei = [goukei]

for a in a_list[::-1][N:2*N]:
    goukei += a
    d = heapq.heappushpop(h,(-a,a))
    goukei -= d[1]
    k_right_goukei.append(goukei)

max_diff = None
for l, r in zip(k_left_goukei, k_right_goukei[::-1]):
    diff = l-r
    if max_diff == None:
        max_diff = diff
    else:
        max_diff = max(diff,max_diff)

print(max_diff)

Measured memory_bytes: 121320
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
struct card {
	char c;
	int num;
	card (char c,int num) :c(c),num(num) {}
	bool operator < (const card &rhs) const {
		return num<rhs.num;
	}
	bool operator == (const card &rhs) const {
		return num==rhs.num&&c==rhs.c;
	}
};
vector<card> a,b;
int part (int l,int r) {
	int i=l-1;
	for (int j=l;j<r;j++) {
		if (a[j].num<=a[r].num) swap (a[++i],a[j]);
	}
	swap (a[++i],a[r]);
	return i;
}
void quickSort (int l,int r) {
	if (l<r) {
		int mid=part(l,r);
		quickSort(l,mid-1);
		quickSort(mid+1,r);
	}
}
int main () {
	int n;
	scanf ("%d",&n);
	a.push_back(card(0,0));
	for (int i=0;i<n;i++) {
		getchar();
		char c;
		int num;
		scanf ("%c %d",&c,&num);
		a.push_back(card(c,num));
	}
	b=a;
	quickSort (1,n);
	stable_sort (++b.begin(),b.end());
	if (a==b) printf ("Stable\n");
	else printf ("Not stable\n");
	for (int i=1;i<=n;i++) {
		printf ("%c %d\n",a[i].c,a[i].num);
	}
    return 0;
}


Measured memory_bytes: 4704
#include <stdio.h>

int check(float n){
	if(n>=1.1) return 0;
	else if(n>=0.6) return 1;
	else if(n>=0.2) return 2;
	else return 3;
}

int main(void){
	float l , r;
	int cnt[40][2] = {0} , i;
	while(scanf("%f %f" , &l , &r)!=EOF){
		cnt[check(l)][0]++;
		cnt[check(r)][1]++;		
	}
	for(i=0;i<4;i++){
		printf("%d %d\n" , cnt[i][0] , cnt[i][1]);
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solveA();
		// new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int n = 0;
		try {
			scanner = new Scanner(System.in);
			n = scanner.nextInt();
			int[] wk = new int[n];
			for (int i = 0; i < n; i++) {
				wk[i] = scanner.nextInt();
			}
			Arrays.sort(wk);

			int count = 0;
			for (int i = 0; i < wk.length - 1; i++) {
				count += wk[i];
			}

			System.out.println(count <= wk[wk.length - 1] ? "No" : "Yes");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 22740
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll n, a = 0, r = 0, t = 0, w = 0;
	cin >> n;
	string s[n];
	rep(i, 0, n)
	{
		cin >> s[i];
		if (s[i] == "AC")
			a++;
		if (s[i] == "RE")
			r++;
		if (s[i] == "TLE")
			t++;
		if (s[i] == "WA")
			w++;
	}
	cout << "AC x " << a << endl;
	cout << "WA x " << w << endl;
	cout << "TLE x " << t << endl;
	cout << "RE x " << r << endl;
	return 0;
}

Measured memory_bytes: 6780
#include<iostream>
using namespace std;
main(){
int a[20][20],b[20],c,n,m,count1=0,ans=0;

cin>>n>>m>>c;
for(int i=0;i<m;i++){
    cin>>b[i];
}

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

for(int i=0;i<n;i++)
{ ans=0;
    for(int j=0;j<m;j++)
    {
       ans+=a[i][j]*b[j];
    }
    ans+=c;
    if(ans>0) count1 ++;
}

cout<<count1<<endl;

}

Measured memory_bytes: 256