akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <queue>
#include <utility>
#include <string>
#include <algorithm>

using namespace std;

bool is_bipartite(vector<vector<int>> S) {
    int N = (int) S.size();
    // -1: not assigned, 0/1: assigned
    vector<int> part(N, -1);
    queue<pair<int, int>> que;

    // init
    // node_num=0, part=0
    que.push(make_pair(0, 0));

    // traverse
    while (!que.empty()) {
        pair<int, int> node = que.front();
        // cout << node.first << ", " << node.second << endl;
        que.pop();
        if (part[node.first] != -1) {
            // inconsistency
            if (part[node.first] != node.second) {
                return false;
            } else {
                continue;
            }
        }
        part[node.first] = node.second;
        for (int target = 0; target < N; target++) {
            if (S[node.first][target] == 1) {
                que.push(make_pair(target, 1 - node.second));
            }
        }
    }
    return true;
}

int calc_diameter(vector<vector<int>> S) {
    int N = (int) S.size();
    const int max_value = N * N * N;
    vector<vector<int>> distance(N, vector<int>(N, max_value));
    // init
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (S[i][j]) {
                distance[i][j] = 1;
            } else if (i == j) {
                distance[i][j] = 0;
            }
        }
    }
    // update values
    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                // distance[k] denotes using nodes equal to or smaller than k as a checkpoint.
                // distance[k][i][j]
                // = min(distance[k-1][i][j],
                //       distance[k-1][i][k] + distance[k-1][k][j]) via k
                // using better value for distance[i][j] causes no trouble.
                distance[i][j] = min(distance[i][k] + distance[k][j], distance[i][j]);
            }
        }
    }
    int diameter = -1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            // no such path
            if (distance[i][j] >= max_value) {
                continue;
            }
            diameter = max(diameter, distance[i][j]);
        }
    }
    return diameter;
}

int main(int argc, char const *argv[]) {
    int N;
    cin >> N;
    vector<vector<int>> S(N, vector<int>(N));
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < N; j++) {
            S[i][j] = s[j] - '0';
        }
    }
    if (!is_bipartite(S)) {
        cout << -1 << endl;
    } else {
        cout << calc_diameter(S) + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
const long long MX = 1e18;
int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  rep(i, N){
    if (A.at(i)  == 0){
      cout << 0 << endl;
      return 0;
    }
  }
  long long out = 1;
  for (long long i: A){
    if((MX / out) < i){
      cout << -1 << endl;
      return 0;
    }
    out *= i;
  }
  cout << out << endl;
  return 0;
}


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

int main()
{
    double n, m; cin >> n >> m;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);

    double cnt = 0;
    double sum = 0;
    arep(x, a) sum += x;


    arep(x, a) {
        if(x < sum/(4*m)) {
            continue;
        } else {
            cnt++;
        }
    }

    if(cnt >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define mod 1000000007

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char c;
    cin>>c;
    ll x=c-'a';
    if(x>=0){
        cout<<char(97)<<endl;;
    }
    else{
        cout<<char(65)<<endl;
    }
}


Measured memory_bytes: 3620
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramB
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var list = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray();
            var result = int.MaxValue;

            for (var t = 0; t < n - 1; t++)
            {
                var s1 = 0;
                var s2 = 0;
                for (var j = 0; j < n; j++)
                {
                    if (t >= j)
                        s1 += list[j];
                    else
                        s2 += list[j];
                }

                result = Math.Min(result, Math.Abs(s1 - s2));
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 28220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod = 1e9 + 7;

int main() {
  ll x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<ll> p(a), q(b), r(c);
  rep(i, a) cin >> p[i];
  rep(i, b) cin >> q[i];
  rep(i, c) cin >> r[i];
  sort(ALL(p), greater<ll>());
  sort(ALL(q), greater<ll>());
  sort(ALL(r), greater<ll>());
  vector<ll> kumi;
  rep(i, x) kumi.push_back(p[i]);
  rep(i, y) kumi.push_back(q[i]);
  sort(ALL(kumi), greater<ll>());
  int f = kumi.size();
  f--;
  int k = 0;
  while (true) {
    if (k == c) break;
    if (kumi[f] < r[k]) {
      kumi[f] = r[k];
      k++;
      f--;
    } else {
      break;
    }
  }
  ll ans = 0;
  rep(i, x + y) ans += kumi[i];
  cout << ans << endl;
  return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  long double a,b,c;
  cin>>a>>b>>c;
  long double d = a+2*sqrt(a*b)+b;
  if(d<c){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

}


Measured memory_bytes: 256
n, m = map(int, input().split())
drink = []
for i in range(n):
	a, b = map(int, input().split())
	drink.append([a,b])
drink.sort()
s = 0
for i, j in drink:
	if m >= j:
		m -= j
		s += i*j
		
	else:
		s += m*i
		break
print (s)

Measured memory_bytes: 20048
# ABC 042: B – 文字列大好きいろはちゃんイージー / Iroha Loves Strings (ABC Edition)
n, l = [int(s) for s in input().split()]
s = [input() for _ in range(n)]
s.sort()

result = ''
for word in s:
    result += word

print(result)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
vector<vector<pair<int, int>>> a;
vector<bool> b;
void calc(int prev, int ind)
{
	for(int i = 0; i < a[ind].size(); ++i)
	{
		if(a[ind][i].scd != prev)
		{
			b[a[ind][i].scd] = b[ind] ^ (a[ind][i].fst % 2);
			calc(ind, a[ind][i].scd);
		}
	}
}
int main()
{
	int n;
	scanf("%d", &n);
	a.resize(n, vector<pair<int, int>>(0));
	b.resize(n, false);
	for(int i = 0, j, k, l; i < n - 1; ++i)
	{
		scanf("%d%d%d", &j, &k, &l);
		a[j - 1].push_back(make_pair(l, k - 1));
		a[k - 1].push_back(make_pair(l, j - 1));
	}
	b[0] = true;
	calc(0, 0);
	for(bool i : b)
	{
		printf(i ? "1\n" : "0\n");
	}
}

Measured memory_bytes: 8576
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

if S == "ABC":
    print("ARC")
else:
    print("ABC")





Measured memory_bytes: 9912
n, c_cnt = map(int, input().split())
d = [list(map(int, input().split())) for i in range(c_cnt)]
c = [list(map(int, input().split())) for i in range(n)]

def solve():
    ans0 = []
    ans1 = []
    ans2 = []
    for col in range(1, c_cnt + 1):
        res = 0
        for i in range(n):
            for j in range(n):
                if (i + j) % 3 == 0:
                    res += d[c[i][j] - 1][col - 1]
        ans0.append(res)

    for col in range(1, c_cnt + 1):
        res = 0
        for i in range(n):
            for j in range(n):
                if (i + j) % 3 == 1:
                    res += d[c[i][j] - 1][col - 1]
        ans1.append(res)

    for col in range(1, c_cnt + 1):
        res = 0
        for i in range(n):
            for j in range(n):
                if (i + j) % 3 == 2:
                    res += d[c[i][j] - 1][col - 1]
        ans2.append(res)
        
    return ans0, ans1, ans2

res = 10 ** 18
ans0, ans1, ans2 = solve()
for i0, num0 in enumerate(ans0):
    for i1, num1 in enumerate(ans1): 
        for i2, num2 in enumerate(ans2):
            if i0 != i1 and i1 != i2 and i2 != i0:
                res = min(num0 + num1 + num2, res)
print(res)

Measured memory_bytes: 46812
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;
int n;
ll t;
ll m;
ll sa, kazu;
ll a[100010]; 
int main()
{
	cin >> n >> t;
	cin >> a[0];
	m=a[0];
	kazu=0;
	sa=-1;
	repp(i, 1, n)
	{
		cin >> a[i];
		if(a[i]>m)
		{
			if(a[i]-m==sa)
			{
				kazu++;
			}
			else if(a[i]-m>sa)
			{
				kazu=1;
				sa=a[i]-m;
			}
		}
		else
		{
			m=a[i];
		}
	}
	cout << kazu << endl;
	return 0;
}

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

#define ll long long int
#define float long double
#define IoFast ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;
const int maxn=2e5+20,mod=1e9+7;
int a[maxn];
int dp[maxn];
int rock[maxn];

int main () {
	IoFast;
	int n;
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[i];
	}
	dp[0] = dp[1] = 1;
	rock[a[1]] =rock[a[1]]+ dp[0];
	for(int i=2;i<=n;i++){
		if(a[i-1]!=a[i]){
			rock[a[i]] =(rock[a[i]] + dp[i - 1])%mod;
		}
		dp[i]=rock[a[i]];
	}
	cout << dp[n] << endl;
	return 0;
}


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

using P = pair<Int, Int>;
struct SegmentTree{
  Int n;
  vector<P> v;
  vector<vector<Int> > dat;
  SegmentTree(){};
  SegmentTree(Int n,vector<P> v):v(v){init(n);build();};
  
  void init(Int n_){
    n=1;
    while(n<n_) n*=2;
    dat.clear();
    dat.resize(2*n-1);
  }
  
  void build(){
    for(Int i=0;i<(Int)v.size();i++)
      dat[v[i].first+(n-1)].emplace_back(v[i].second);
    
    for(Int i=0;i<n;i++)
      sort(dat[i+n-1].begin(),dat[i+n-1].end());
    
    for(Int i=n-2;i>=0;i--){
      merge(dat[i*2+1].begin(),dat[i*2+1].end(),
	    dat[i*2+2].begin(),dat[i*2+2].end(),
	    back_inserter(dat[i]));
    }
  }
  // [a,b) * [c,d)
  inline Int query(Int a,Int b,Int c,Int d){
    Int res=0;
    auto calc=[a,b,c,d](vector<Int> &x){
      auto latte=lower_bound(x.begin(),x.end(),d);
      auto malta=lower_bound(x.begin(),x.end(),c);
      return Int(latte-malta);
    };
    for(Int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
      if(l&1) res+=calc(dat[(l++)-1]);
      if(r&1) res+=calc(dat[(--r)-1]);
    }
    return res;
  }
  
};



//INSERT ABOVE HERE
signed main(){
  Int n,m,q;
  cin>>n>>m>>q;
  vector<Int> x(m),y(m);
  for(Int i=0;i<m;i++) cin>>x[i]>>y[i];

  vector<P> vp;
  for(Int i=0;i<m;i++) vp.emplace_back(x[i],y[i]);

  SegmentTree seg(n+1,vp);

  for(Int i=0;i<q;i++){
    Int a,b;
    cin>>a>>b;
    cout<<seg.query(a,b+1,a,b+1)<<endl;    
  }
  return 0;
}


Measured memory_bytes: 34580
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] a = new int[2][n];
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < n; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		sc.close();

		int ans = 0;
		for (int i = 0; i < n; i++) {
			int sum = 0;
			for (int j = 0; j < n; j++) {
				if (j < i) {
					sum += a[0][j];
				} else if (j == i) {
					sum += a[0][j];
					sum += a[1][j];
				} else {
					sum += a[1][j];
				}
			}
			ans = Math.max(ans, sum);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 22612
#include <iostream>
#include <vector>

/*
 L 1e6
 */

class edge{
public:
  int from, to, cost;
  
  edge(int f, int t, int c){
    from = f;
    to = t;
    cost = c;
  }
};

int main(){
  
  int L, N, M;
  int tmp, tmp_L;
  
  // read L
  scanf("%d", &L);
  
  // calculate N : 2^{N-1} <= L < 2^(N)
  N = 0;
  tmp = L;
  while(tmp > 0){
    tmp /= 2;
    N++;
  }
  
  // solve problem
  std::vector<class edge> graph;
  M = 0;
  // set initial edges
  for(int i = 1; i < N; i++){
    graph.push_back(edge(i, i+1, 0));
    graph.push_back(edge(i, i+1, (1 << N-1-i)));
    M += 2;
  }
  
  // push additional edges
  tmp = L;
  for(int i = 0; i < N-1; i++){
    if((tmp & (1 << i)) != 0){
      tmp -= (1 << i);
      graph.push_back(edge(1, N-i, tmp));
      M++;
    }
  }
  
  // print answer
  std::cout << N << " " << M << std::endl;
  for(int i = 0; i < M; i++){
    std::cout << graph[i].from << " ";
    std::cout << graph[i].to << " ";
    std::cout << graph[i].cost << std::endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;

ll F(ll in) {
	if (in % 2 == 0) {
		return in / 2;
	}
	else {
		return 3 * in + 1;
	}
}

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

	// long long?
	int s;
	cin >> s;

	set<ll> past;

	ll now = s;
	past.insert(s);
	for (int i = 0; i != 1000000; ++i) {
		s = F(s);
		if (past.find(s) != past.end()) {
			cout << i+2 << endl;
			break;
		}
		past.insert(s);
	}

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
vector<string> split(string s, char p){vector<string>v;stringstream m(s);string b;while(getline(m,b,p))v.push_back(b);return v;}
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 (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main(){
    ll n, m; cin >> n >> m;
    cout << (n-1)*(m-1) << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>

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

using namespace std;

int main() {
    
    string s;
    cin >> s;
    int cnta=1,cntb=1,cntc=1;
    FOR(i, 0, 3){
        if(s[i] == 'a'){
            cnta--;
        }else if(s[i] == 'b'){
            cntb--;
        }else if(s[i] == 'c'){
            cntc--;
        }
    }
    
    if((cnta==0)&&(cntb==0)&&(cntc==0)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


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

#define MEM(a, b) memset(a, b, sizeof a);
#define REP(i, k) for(int i = (0); i < (k); i++ )

#define ALL(cont) cont.begin(), cont.end()
#define RALL(cont) cont.begin(), cont.end()
#define FOREACH(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define debug puts("FANGO")
#define INF (int)MAX_INT
#define EPS (int)1e-9
#define PI acos(-1)
#define MOD 1000000007

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef long long int32;
typedef unsigned long long uint32;
typedef long long int int64;
typedef unsigned long long int uint64;

template <class T>
T sqr(T val) {
  return val * val;
}

bool valid_base(char c) {
  switch(c) {
    case 'A':
    case 'T':
    case 'G':
    case 'C':
      return true;
    default:
      return false;
  }
  return false;
}

void solve(__attribute__((unused)) int tc = 0) {
  string s;
  getline(cin, s);
  int n = 0;
  int ans = 0;
  for (char c : s) {
    if (valid_base(c)) {
      n++;
    } else {
      ans = max(ans, n);
      n = 0;
    }
  }
  ans = max(ans, n);
  cout << ans << "\n";
  return;
}

int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  /*int TC;
  cin >> TC;
  REP(tc, TC) {
    solve(tc);
  }*/
  solve();
}


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

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

    if (n == m)
        puts("Yes");
    else 
        puts("No");
    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.array, std.math, std.regex, std.range, std.ascii;
import std.typecons, std.functional;
import std.algorithm, std.container;

void main()
{
    int N = scanElem!int;
    int M = scanElem!int;
    int[] nList;
    nList.length = N + 1;
    foreach(i;0..M)
    {
        int s = scanElem!int;
        int g = scanElem!int;
        if(nList[s]==0)
        {
            nList[s] = g;
        }else{
            nList[s] = min(nList[s], g);
        }
    }
    int count;
    int end;
    foreach(s, g; nList)
    {
        if(g==0) continue;
        if(end <= s)
        {
            count++;
            end = g;
        }
        end = min(end, g);
    }
    writeln(count);
}

void scanValues(TList...)(ref TList list)
{
    auto lit = readln.splitter;
    foreach (ref e; list)
    {
        e = lit.fornt.to!(typeof(e));
        lit.popFront;
    }
}

T[] scanArray(T = long)()
{
    return readln.split.to!(long[]);
}

void scanStructs(T)(ref T[] t, size_t n)
{
    t.length = n;
    foreach (ref e; t)
    {
        auto line = readln.split;
        foreach (i, ref v; e.tupleof)
        {
            v = line[i].to!(typeof(v));
        }
    }
}

T scanElem(T = long)()
{
    string res;
    int c = ' ';
    while (isWhite(c) && c != -1)
    {
        c = getchar;
    }
    while (!isWhite(c) && c != -1)
    {
        res ~= cast(char) c;
        c = getchar;
    }
    return res.strip.to!T;
}

template fold(fun...) if (fun.length >= 1)
{
    auto fold(R, S...)(R r, S seed)
    {
        static if (S.length < 2)
        {
            return reduce!fun(seed, r);
        }
        else
        {
            import std.typecons : tuple;

            return reduce!fun(tuple(seed), r);
        }
    }
}

struct Factor
{
    long n;
    long c;
}

Factor[] factors(long n)
{
    Factor[] res;
    for (long i = 2; i ^^ 2 <= n; i++)
    {
        if (n % i != 0)
            continue;

        int c;
        while (n % i == 0)
        {
            n = n / i;
            c++;
        }
        res ~= Factor(i, c);
    }
    if (n != 1)
        res ~= Factor(n, 1);

    return res;
}

bool isPrime(long n)
{
    if (n <= 1)
        return false;
    if (n == 2)
        return true;
    if (n % 2 == 0)
        return false;
    for (long i = 3; i ^^ 2 <= n; i += 2)
        if (n % i == 0)
            return false;
    return true;
}

Measured memory_bytes: 3452
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <iomanip>

#include <map>
#include <set>
#include <queue>
#include <stack>

#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdbl vector<double>
#define vstr vector<string>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	ll A,B,C;
	cin >> A >> B >> C;

	ll ans = 0;
	while(true){
		if(A & 1 || B & 1 || C & 1) {
			cout << ans << endl;
			return 0;
		}

		if(A == B && B == C){
			cout << -1 << endl;
			return 0;
		}

		ll a = (B + C) / 2, b = (C + A) / 2, c = (A + B) / 2;
		A = a; B = b ; C = c;
		ans++;
	}	
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[3],p;
int main(){
	cin>>n;for(int i=0;i<n;i++){cin>>p;a[p%3]++;}
	if(a[1]==0 && a[2]==0)cout<<"1"<<endl;
	else{
		int sum=0;
		if(a[1]>=a[2]){
			sum+=1;a[1]--;sum+=a[0];
			int F=min(a[1],a[2]);sum+=F*2;
			a[1]-=F;a[2]-=F;
			if(a[1]>=1)sum+=min(2,a[1]);
			if(a[2]>=1)sum+=min(1,a[2]);
		}
		else{
			sum+=1;a[2]--;sum+=a[0];
			int F=min(a[1],a[2]);sum+=F*2;
			a[1]-=F;a[2]-=F;
			if(a[1]>=1)sum+=min(1,a[1]);
			if(a[2]>=1)sum+=min(2,a[2]);
		}
		cout<<sum<<endl;
	}
	return 0;
}

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

int main() {
  int k,x;
  cin >> k >> x;
  string ans = k * 500 >= x ? "Yes" : "No";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

struct Sieve {
    /*
        エラトステネスの篩
        O( n log log n )
        verified yukicoder No. 6
    */
    vector<int> primes;
    vector<int> _isPrime;
    Sieve(int n) : _isPrime(n+1, 1) {
        buildPrimes();
    }
    void buildPrimes() {
        _isPrime[0] = _isPrime[1] = 0;
        int n = _isPrime.size();
        REP(i, 2, n) {
            if(_isPrime[i]) {
                primes.push_back(i);
                for(int j = i+i; j < n; j += i) _isPrime[j] = false;
            }
        }
    }
    bool isPrime(int i) {
        return _isPrime[i];
    }
};

int main(){
    const int MAX_R = 1e5+10;
    Sieve sieve(MAX_R);
    vector<int> cnt(MAX_R);
    rep(i, MAX_R) {
        if(sieve.isPrime(i) && sieve.isPrime((i+1)/2)) cnt[i] = 1;
    } 
    REP(i, 1, MAX_R) {
        cnt[i] += cnt[i-1];
    }
    // rep(i, 20) {
    //     cout << cnt[i] << " ";
    // }
    // cout << endl;
    int Q;
    cin >> Q;
    rep(i, Q) {
        int l, r;
        cin >> l >> r;
        cout << cnt[r] - cnt[l-1] << endl;
    }
    return 0;
}

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

using namespace std;

typedef pair<int, int> ii;

const int N = 1e3 + 10;
const int maxv = 1 << 16;
const int inf = 1e9 + 10;

int nver;
int n;
int num[18][1 << 16];
int a[N][2];
int w[2 * maxv + 5][2];
int d[2 * maxv + 5];


bool minimize(int &x, int y) {
    if (x > y) x = y; else return 0;
    return 1;
}
pair<int, int> getState(int len1, int v1, int len2, int v2) {
    if (len1 < len2) {
        swap(len1, len2);
        swap(v1, v2);
    }
    if (len1 == len2) {
        if (v1 != v2) return ii(-1, -1);
        return ii(0, 0);
    }
    int c1 = v1 >> (len1 - len2);
    if (c1 != v2) return make_pair(-1, -1);
    return make_pair(len1 - len2, v1 & ((1 << (len1 - len2)) - 1));
}
int solve() {
    for(int i = 1; i <= nver; i++) d[i] = inf; 

    priority_queue<ii> pq;
    for(int i = 0; i < n; i++) {
        for(int j = i + 1; j < n; j++) {
            int len, val;
            tie(len, val) = getState(a[i][0], a[i][1], a[j][0], a[j][1]);
            if (len == -1) continue;
            int cur = num[len][val];
            if (minimize(d[cur], max(a[i][0], a[j][0])))
                pq.push(ii(-d[cur], cur));
        }
    }
    while (!pq.empty()) {
        int cwei, cur;
        tie(cwei, cur) = pq.top(); pq.pop();

        /*
        cout << "State " << cur << " " << w[cur][0] << " ";
        for(int i = w[cur][0] - 1; i >= 0; i--)
            cout << (w[cur][1] >> i) % 2;

        cout << endl;
        */
        cwei = -cwei;
        if (cwei != d[cur]) continue;
        if (cur == num[0][0]) return cwei;

        for(int i = 0; i < n; i++) {
            int nlen, nv;
            tie(nlen, nv) = getState(w[cur][0], w[cur][1], a[i][0], a[i][1]);
            if (nlen == -1) continue;
            
            int ncur = num[nlen][nv];
            int nwei = cwei + max(0, a[i][0] - w[cur][0]);
            if (minimize(d[ncur], nwei)) {
                pq.push(ii(-d[ncur], ncur)); 
            }
        }
    }
    return 0;
}
int main() {
    for(int len = 0; len <= 16; len++)
        for(int i = 0; i < (1 << len); i++) {
            num[len][i] = ++nver;
            w[nver][0] = len;
            w[nver][1] = i;
        }

    cin >> n;
    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;
        a[i][0] = s.length();
        for(auto ch : s) a[i][1] = a[i][1] * 2 + ch - '0';
    }


    
    cout << solve() << endl;
}



Measured memory_bytes: 5324
package main

/*
        N
	T A
        H1 H2 H3 ... HN
*/
import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	n, _ := strconv.Atoi(stdin.Text())
	_ = n
	stdin.Scan()
	ta := strings.Split(stdin.Text(), " ")

	t_i, _ := strconv.Atoi(ta[0])
	t := float64(t_i)
	a_i, _ := strconv.Atoi(ta[1])
	a := float64(a_i)
	stdin.Scan()
	line := strings.Split(stdin.Text(), " ")
	is := make([]float64, len(line))
	for i, v := range line {
		h, _ := strconv.Atoi(v)
		tt := t
		is[i] = math.Abs(Avgx(tt, float64(h)) - a)
	}
	var result int = 0
	minheatdelta := minarr(is)
	for li, heatdelta := range is {
		if minheatdelta == heatdelta {
			result = li
		}
	}
	fmt.Println(result + 1)
}
func Avgx(tp float64, x float64) float64 {
	return tp - x*0.006
}

func minarr(a []float64) float64 {
	var val float64
	x := len(a)
	for i := 0; i <= x-1; i++ {
		val = min(a[0], a[i])
		for j := 1; j <= x-1; j++ {
			val = min(val, a[j])
		}
	}
	return val
}
func min(a, b float64) float64 {
	if a <= b {
		return a
	} else {
		return b
	}
}


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

typedef long long ll;
const int INF = 1e9;
const int S = 3e5;

vector<int> adj[S];
int n;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin>>n;
	for (int i = 0; i < n-1; i++){
		int u, v;
		cin>>u>>v; u--; v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	ll ans = 0;
	for (ll i = 1; i <= n; i++){
		ans += i*(n-i+1);
	}
	for (ll i = 0; i < n; i++){
		for (ll it: adj[i]){
			if (it < i){
				ans -= (it+1)*(n-i);
				// cout<<i+1<<" "<<it+1<<": "<<ans<<'\n';
			}
		}
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 17264
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

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

        String a = sc.next();
        String b = sc.next();
        String c = sc.next();

        System.out.print(a.charAt(0));
        System.out.print(b.charAt(1));
        System.out.print(c.charAt(2));
    }

}




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

#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()
#define VI         vector<int>
#define MOD 1000000007

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

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);
//const int INF=(1<<29);

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

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
using namespace __gnu_pbds; 
#define mod 998244353 
#define int long long
#define ll long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inp(n) for(i=0;i<n;i++) cin>>A[i];
#define inz(A) memset(A,0,sizeof(A))
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define T 1000005
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define vp vector<pair< int,int> >
#define mpi map<pair<int,int> ,int>
#define PI M_PI
#define lower(s) transform(all(s),s.begin(),::tolower)
#define endl "\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, 
         tree_order_statistics_node_update> pbds;
int add(int a, int b) {a=(a%mod + b%mod)%mod;return a;}
int sub(int a, int b) {a =(a%mod - b%mod + mod)%mod ;return a;}
int mul(int a, int b) {return (a%mod * b%mod) % mod;}


void solve()
{   
  char c;cin >> c;
  if(c>='a' && c<='z')cout<<"a";
  else cout<<"A";  
}

signed main()
{ boost
  int test=0,t;
    //cin >> t ;
    t=1;
   while(test++ <t){
	  //cout<<"Case #"<<test<<": ";
	   solve();}
  
}

Measured memory_bytes: 3644
// button

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

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

    int res = 0;
    if (a >= b) {
        res += a;
        a--;
    } else {
        res += b;
        b--;
    }

    if (a >= b) {
        res += a;
    } else {
        res += b;
    }

    cout << res << endl;

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

template <int mod>
struct ModInt {
  int x;
  ModInt(): x(0) {}
  ModInt(long long a) { x = a % mod; if (x < 0) x += mod; }
  ModInt &operator+=(ModInt that) { x = (x + that.x) % mod; return *this; }
  ModInt &operator-=(ModInt that) { x = (x + mod - that.x) % mod; return *this; }
  ModInt &operator*=(ModInt that) { x = (long long) x * that.x % mod; return *this; }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt inverse() {
    int a = x, b = mod, u = 1, v = 0;
    while (b) { int t = a / b; a -= t * b; u -= t * v; swap(a, b); swap(u, v); }
    return ModInt(u);
  }
  #define op(o, p) ModInt operator o(ModInt that) { return ModInt(*this) p that; }
    op(+, +=) op(-, -=) op(*, *=) op(/, /=)
  #undef op
  friend ostream& operator<<(ostream &os, ModInt m) { return os << m.x; }
};

using mint = ModInt<1000000007>;

void solve() {
  int n, k;
  cin >> n >> k;
  mint ans = 0;
  repic(i, k, n + 1) {
    mint temp = 0;
    temp += (mint) n * (n + 1) / 2;
    temp -= (mint) i * (i - 1) / 2;
    temp -= (mint) (n - i + 1) * (n - i) / 2;
    temp += 1;
    ans += temp;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3652
def main():
    from fractions import gcd
    from math import ceil

    n, m, *a = map(int, open(0).read().split())
    b = [0 for _ in range(n)]
    a.sort()

    for i, j in enumerate(a):
        c = 0
        while j % 2 == 0:
            c += 1
            j = j // 2
        a[i] = j
        b[i] = c

    if len(set(b)) > 1:
        print(0)
        exit()

    lcm = 1
    for i in a:
        lcm = (lcm * i) // gcd(lcm, i)

    k = b[0] - 1
    ans = ceil(m // 2 ** k // lcm / 2)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 16080
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define int long long
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
const int INF = 1e9;

int dp[100001], color[100001];
vector<int> e[100001];

void paint(int v, int d, int c)
{
    if (!color[v]) color[v] = c;
    if (dp[v] >= d || d == 0) return;
    dp[v] = d;
    for (auto u : e[v]) paint(u, d - 1, c);
}

signed main()
{
    int N, M, Q, a, b;
    cin >> N >> M;

    REP(i,M) {
        cin >> a >> b;
        e[a].push_back(b);
        e[b].push_back(a);
    }

    cin >> Q;
    int v[Q], d[Q], c[Q];
    REP(i,Q) {
        cin >> v[i] >> d[i] >> c[i];
    }

    for (int i=Q-1; i>=0; i--) paint(v[i], d[i], c[i]);
    REP(i,N) cout << color[i + 1] << endl;
}


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

using namespace std;

int main()
{
    set<int> seq;
    int n;
    cin >> n;
    seq.insert(n);
    int i = 2;
    int k;
    while(1 > 0)
    {
        k = seq.size();
        if(n % 2 == 0)
        {
            n = n/2;
            seq.insert(n);
        }
        else if(n % 2 == 1)
        {
            n = 3*n + 1;
            seq.insert(n);
        }
        if(k == seq.size())
        {
            break;
        }
        i++;

    }
    cout << i;
}


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

struct trump{
    int value;
    char pattern;
};
int main(){
    int n;
    cin>>n;
    trump a[36],b[36];
    rep(i,n){
        cin>>a[i].pattern>>a[i].value;
        b[i].pattern=a[i].pattern;
        b[i].value=a[i].value;
    }
    //bubble sort
    rep(i,n){
        for(int j=n-1;j>=i+1;j--){
            if(a[j].value<a[j-1].value){
                swap(a[j],a[j-1]);
            }
        }
    }
    rep(i,n-1){
        cout<<a[i].pattern<<a[i].value<<" ";
    }
    cout<<a[n-1].pattern<<a[n-1].value<<endl;
    cout<<"Stable"<<endl;

    //selection sort
    rep(i,n){
        int minj=i;
        for(int j=i;j<n;j++){
            if(b[j].value<b[minj].value){
                minj=j;
            }
        }
        swap(b[i],b[minj]);
    }
    bool flg=false;
    rep(i,n-1){
        cout<<b[i].pattern<<b[i].value<<" ";
        if(b[i].pattern!=a[i].pattern)flg=true;
    }
    cout<<b[n-1].pattern<<b[n-1].value<<endl;

    if(flg){
        cout<<"Not stable"<<endl;
    }else{
        cout<<"Stable"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3104
import sys
from itertools import accumulate
import bisect
n, m, k = [int(i) for i in sys.stdin.readline().split()]
a_ls = [int(i) for i in sys.stdin.readline().split()]
b_ls = [int(i) for i in sys.stdin.readline().split()]
a_ls = [i for i in accumulate([0] + a_ls)]
b_ls = [i for i in accumulate([0] + b_ls)]
i = 0
best = 0
while i <= n and a_ls[i] <= k:
    res = i + bisect.bisect_right(b_ls, k - a_ls[i]) - 1
    best = max(best, res)
    i += 1
print(best)

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

namespace ABC144D
{
    class Program
    {
        public static void Main()
        {
            var n = Console.ReadLine()
                    .Split(' ').Select(x => int.Parse(x))
                    .ToArray();
            var s = 0.0;

            if (Math.Pow(n[0], 2) * n[1] * 0.5 >= n[2]) {
                s = Math.Atan((n[0] * Math.Pow(n[1], 2)) / (2 * n[2]));    
            }
            else {
                s = Math.Atan((2 * n[1] * Math.Pow(n[0],2) - 2 * n[2]) / Math.Pow(n[0], 3));
            }
            Console.WriteLine(s*180/Math.PI);
        }
    }
}


Measured memory_bytes: 13268
using System;

namespace Project
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			string s = Console.ReadLine();
			string p = Console.ReadLine();
			char[] c = new char[s.Length * 2];
			for (int i = 0; i < s.Length; i++)
			{
				c[i] = s[i];
				c[i + s.Length] = s[i];
			}
			for (int i = 0; i < 2 * s.Length; i++)
			{
				for (int j = 0; j < p.Length; j++)
				{
					if (2 * s.Length - (i + 1) < p.Length) goto retry;
					if (c[i + j] != p[j]) goto retry;
				}
				Console.WriteLine("Yes");
				goto finish;
			retry:
				continue;
			}
			Console.WriteLine("No");
		finish:
			return;
		}
	}
}

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

typedef vector<int> vi;

#define pb push_back

bool dfs(vi& a, int i, int b, int c)
{
  if (i == 10)
    return true;
  if (b < a[i] && dfs(a, i+1, a[i], c))
    return true;
  if (c < a[i] && dfs(a, i+1, b, a[i]))
    return true;
  return false;
}

int main(int argc, char **argv)
{
  int n, x;
  cin >> n;
  while (n--) {
    vi a;
    for (int i = 0; i < 10; i++) {
      cin >> x;
      a.pb(x);
    }
    if (dfs(a, 0, 0, 0))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=(a);i<=(b);++i)
#define rep(i,n) rep2(i,0,n-1)

using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");
main(){
    int a[20010]={};
    int j=1;
    rep2(i,1,30000){
        if(i%2==0||i%3==0){
            a[j]=i; j++;
        }      
    }
    int n;
    cin>>n;
    if(n==3) { cout<<2<<" "<<3<<" "<<25; return 0;}
    int m=(n/8)*8;
    rep2(i,1,m){
        cout<<a[i]<<" ";
    }
    n%=8;
    if(n==0) return 0;
    int b[9];
    b[0]=a[m+4];
    b[1]=a[m+1];
    b[2]=a[m+3];
    b[3]=a[m+2];
    b[4]=a[m+6];
    b[5]=a[m+5];
    b[6]=a[m+7];
    b[7]=a[m+8];
    if(n%2){
        rep(i,n)
        cout<<b[i]<<" ";
    }
    else {
        rep2(i,1,n)
        cout<<b[i]<<" ";
    }
    return 0;
}

Measured memory_bytes: 508
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
double pp=0.0,tmp=0.0;
int k,n;
double each[200000+1];
int main(){
//	fastio;
	cin>>n>>k;
	rb(i,1,n){
		double p;
		cin>>p;
		each[i]=p*(p+1)*0.5/p;
	}
	rb(i,1,k){
		tmp+=each[i];
	}
	pp=tmp;
	rb(i,k+1,n){
		tmp-=each[i-k];
		tmp+=each[i];
		pp=max(pp,tmp);
	}printf("%.10f\n",pp);
	return 0;
}


Measured memory_bytes: 1792
using System;
using System.Linq;

class B
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var n = int.Parse(Console.ReadLine());
		var a = read();
		var b = read();
		var c = read();

		var s = b.Sum();
		for (int i = 0; i < n - 1; i++) if (a[i] + 1 == a[i + 1]) s += c[a[i] - 1];
		Console.WriteLine(s);
	}
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define NMAX 10
#define DMAX 10

int main(){
    int dp[NMAX][DMAX];
    int n,d;
    cin >> n >> d;
    rep(i,n){
        rep(j,d){
            cin >> dp[i][j];
        }
    }
    
    int total=0;
    
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            int total2=0;
            for(int k=0;k<d;k++) total2+=(dp[i][k]-dp[j][k])*(dp[i][k]-dp[j][k]);
            for(int l=1;l<=130;l++){
                if(total2==l*l) total++;
            }
        }
    }
    
    cout << total << endl;
    
    return 0;
}











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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl

bool hate[10]={};

bool liked(int n){
    if(n==0 && hate[0])return false;
    while(n){
        if(hate[n%10])return false;
        n/=10;
    }
    return true;
}

int main(){
    int n,k;
    cin>>n>>k;
    REP(i,k){
        int d;
        cin>>d;
        hate[d]=true;
    }

    while(!liked(n))n++;
    cout<<n<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int x,k;
int main() {
	scanf("%d%d",&k,&x);
	for(int i=x-k+1;i<=x;i++)
		printf("%d ",i);
	for(int i=x+1;i<=x+k-1;i++)
		printf("%d ",i);
			
	return 0;
} 

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n, m = MAP()
ans = (n * 2 + m) // 4
if ans > m // 2:
    ans = m // 2
print(ans)


Measured memory_bytes: 59500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  string s;
  cin >> s;
  cout << s[0]<<s[1]<<s[2] << "\n";
  return 0;
}


Measured memory_bytes: 3592