akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

#define M 1046257
#define NIL (-1)
#define L 14

char H[M][L];

/* 文字から数値に変換 */
int getChar(char ch) {
  if ( ch == 'A' ) return 1;
  else if ( ch == 'C' ) return 2;
  else if ( ch == 'G' ) return 3;
  else if ( ch == 'T' ) return 4;
  return 0;
}

/* 文字列から数値へ変換して key を生成する */
long long getKey(char str[]) {
  long long sum = 0, p = 1, i;
  for(i=0;i<strlen(str);i++) {
    sum += p*(getChar(str[i]));
    p*= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }

int find(char str[]) {
  long long key, i, h;
  key = getKey(str); /* 文字列を数値に変換 */
  for(i=0; ;i++) {
    h = (h1(key) + i*h2(key)) % M;
    if( strcmp(H[h],str) == 0) return 1;
    else if ( strlen(H[h]) == 0 ) return 0;
  }
  return 0;
}

int insert(char str[]) {
  long long key, i, h;
  key = getKey(str); /* 文字列を数値に変換 */
  for(i=0; ; i++) {
    h = (h1(key) + i * h2(key)) %M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) {
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(void) {
  int i, n;
  char str[L], com[9];
  for(i=0;i<M;i++) H[i][0] = '\0';
  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%s %s",com,str);
    if(com[0] == 'i') {
      insert(str);
    } else {
      if(find(str)){
        printf("yes\n");
      } else {
        printf("no\n");
      }
    }
  }
  return 0;
}


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s; cin >> s;
	int st = 0, ed = s.length() - 1;
	int ans = 0;
	for ( ; st < ed; ) {
		if (s[st] == s[ed]) {
			st++; ed--;
			continue;
		}
		if (s[st] == 'x' && s[ed] == 'x') {
			st++; ed--;
			continue;
		}
		if (s[st] == 'x') {
			ans++;
			st++;
			continue;
		}
		if (s[ed] == 'x') {
			ans++;
			ed--;
			continue;
		}
		if (s[st] != s[ed]) {
			ans = -1;
			break;
		}
		st++; ed--;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3716
n=int(input())
s=[]
ans=0
for i in range(n):
    a=int(input())
    s.append([list(map(int,input().split())) for _ in range(a)])
for i in range(2**n):
    bit=bin(i)[2:].zfill(n)
    flag=1
    for j in range(n):
        if bit[j]=='0':
            continue
        for sh in s[j]:
            if int(bit[sh[0]-1])!=sh[1]:
                flag=0
    if flag:
        ans=max(ans,bit.count('1'))
print(ans)

Measured memory_bytes: 9168
#a = int(input())
#b,c = map(int,input().split())
#s = input()
#list_s = list(input())
#list_int = list(map(int,input().split()))

#list = [0 for i in range(n)]
#dp = [[0 for i in range(A)] for j in range(B)]

#list_int 並べて出力 print (' '.join(map(str,ans_li)))
#list_str 並べて出力 print (' '.join(list))

# 2進数 format(10, 'b') # '1010'

# aa=[int(input()) for i in range(n)]

#for i,name in enumerate(list)

''' 二次元配列を一列ずつ
for i in ans:
	print(*i)
'''
''' heapq
queue = []
heapq.heapify(queue) #heapqの作成
heapq.heappush(queue,num) #numのpush(値の追加)
pop = heapq.heappop(queue) #numのpop(最小値の出力)
pop = heapq.heappushpop(queue,num) #push -> pop

'''

from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7


N,M = map(int,(input().split()))
queue = [tuple(map(int,(input().split()))) for i in range(M)]
queue.sort(key=lambda x:x[1])

left = 0
ans = 0
for q in queue:
	if q[0] >= left:
		ans += 1
		left = q[1]

print(ans)


Measured memory_bytes: 18820
#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
vector<int>num;

int main()
{
	num.push_back(1);
	num.push_back(0);
	int n,cnt=1;
	cin>>n;
	if(n<10){
		cout<<n<<endl;
		return 0;
	}
	n-=10;
	while(n--){
		int len=num.size();
		int flag=0;
		for(int i=len-1;i>=0;i--){
			if(i!=0){
				if(num[i]==9){
					num.pop_back();
					flag=1;
					continue;
				}
				if(num[i]!=num[i-1]+1){
					num[i]++;
					break;
				}else{
					num.pop_back();
					flag=1;
					continue;
				}
			}else{
				if(num[i]==9){
					cnt++;
					num[i]=1;
				}else{
					num[i]++;
				}
				flag=1;
			}
		}
		if(flag){
			len=num.size();
			for(int i=len;i<=cnt;i++){
				num.push_back(max(num[i-1]-1,0));
			}
		}
//		len=num.size();
//		for(int i=0;i<len;i++){
//			cout<<num[i];
//		}
//		cout<<endl;
	}
	int len=num.size();
		for(int i=0;i<len;i++){
			cout<<num[i];
		}
 	return 0;
}







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

vector<int> color(MAX_N, -1);
vector<int> adjlist[MAX_N];

bool check_bipartite() {
    queue<int> q;
    q.push(0);
    color[0] = 0;
    while (!q.empty()) {
        int v = q.front(); q.pop();
        for (int u: adjlist[v]) {
            if (color[u] == -1) {
                q.push(u);
                color[u] = (color[v] + 1) % 2;
            } else {
                if (color[u] == color[v]) return false;
            }
        }
    }
    return true;
}

int main() {
    long long int N, M; cin >> N >> M;
    for (int i=0; i<M; i++) {
        int a, b; cin >> a >> b;
        adjlist[a-1].push_back(b-1);
        adjlist[b-1].push_back(a-1);
    }
    if (check_bipartite()) {
        long long int black = 0;
        for (int i=0; i<N; i++) black += color[i];
        cout << black * (N-black) - M << endl;
    } else {
        cout << N * (N-1) / 2 - M << endl;
    }
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n;
  cin >> n;
  VEC<LL> A(n), B(n), C(n);
  REP(i, 0, n) cin >> A[i];
  REP(i, 0, n) cin >> B[i];
  REP(i, 0, n) cin >> C[i];
  sort(ALL(A));
  sort(ALL(B));
  sort(ALL(C));
  DUMP(A);
  DUMP(B);
  DUMP(C);
  LL sum = 0;
  auto al = A.begin();
  auto cr = C.end();

  REP(i, 0, n) {
      auto  ar = lower_bound(ALL(A),B[i]);
      auto cl = upper_bound(ALL(C),B[i]);
      LL da = distance(al,ar);
      LL dc = distance(cl,cr);
      //DUMP(i,da,dc);
      sum+=da*dc;
  }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 2560
import heapq

class UnionFind:
	def __init__(self, n):
		self.n = n
		self.root = [-1]*(n+1)
		self.rnk = [0]*(n+1)
		self.Maxroot = -1

	def Find_Root(self, x):
		if (self.root[x] < 0):
			return x
		else:
			self.root[x] = self.Find_Root(self.root[x])
			return self.root[x]

	def Unite(self, x, y):
		x = self.Find_Root(x)
		y = self.Find_Root(y)
		if x == y:
			return 
		elif self.rnk[x] > self.rnk[y]:
			self.root[x] += self.root[y]
			if self.root[x] < self.Maxroot:
				self.Maxroot = self.root[x]
			self.root[y] = x
		else:
			self.root[y] += self.root[x]
			if self.root[y] < self.Maxroot:
				self.Maxroot = self.root[y]
			self.root[x] = y
			if self.rnk[x] == self.rnk[y]:
				self.rnk[y] += 1

	def isSameGroup(self, x, y):
		return self.Find_Root(x) == self.Find_Root(y)

	def Count(self, x):
		return self.root[self.Find_Root(x)] * (-1)

N = int(input())
P = [list(map(int, input().split()))+[i] for i in range(N)]
Px = sorted(P)
Py = sorted(P, key = lambda x: x[1])

q = []
for i in range(N-1):
	x1, dumy1, p1 = Px[i]
	x2, dumy2, p2 = Px[i+1]

	heapq.heappush(q, [x2-x1, p1, p2])

for i in range(N-1):
	dumy1, y1, p1 = Py[i]
	dumy2, y2, p2 = Py[i+1]

	heapq.heappush(q, [y2-y1, p1, p2])

solve = UnionFind(N)

ans = 0
while not (solve.Maxroot == N * (-1)):
	d, p1, p2 = heapq.heappop(q)
	if not solve.isSameGroup(p1, p2):
		solve.Unite(p1, p2)
		ans += d

print(ans)

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

for i in range(n):
    i += 1
    j = i
    if (j % 3 == 0):
        print("", i, end="")
    else:
        while(j):
            if (j % 10 == 3):
                print("", i, end="")
                break
            else:
                j = int(j / 10)
print("")

Measured memory_bytes: 8100
h,n=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(n)]

length=h+max(AB)[0]
DP=[float("inf")]*length
DP[0]=0

for i in range(h):
    for a,b in AB:
        DP[i+a]=min(DP[i+a],DP[i]+b)

print(min(DP[h:]))

Measured memory_bytes: 43356
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
#define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-9;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];

    sort(all(a));
    sort(all(b));

    if (n % 2 == 1)
        cout << b[n / 2] - a[n / 2] + 1 << endl;
    else
        cout << (b[n / 2 - 1] + b[n / 2]) - (a[n / 2 - 1] + a[n / 2]) + 1 << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}

Measured memory_bytes: 6364
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>

using namespace std;

typedef long long in;

int main(){
    char c;
    cin >> c;
    vector<char> v;
    v.push_back('a');
    v.push_back('e');
    v.push_back('i');
    v.push_back('o');
    v.push_back('u');
    for(int i=0;i<v.size();i++){
        if(v[i]==c){
            cout << "vowel"<<endl;
            return 0;
        }
    }
    cout << "consonant"<<endl;
    return 0;

}


Measured memory_bytes: 256
S = input()
abc_to_num = {'a': 0, 'b': 1, 'c': 2}
count = [0, 0, 0]
for s in S:
    count[abc_to_num[s]] += 1
count.sort()
if count[2] - count[0] < 2:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3188
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int[] a = {4,1,4,1,2,1,2,1};
		int[] p = new int[8];
		for (int i=0; i<8; i++) {
			p[i] = in.nextInt();
		}

		int min = Integer.MAX_VALUE;
		int ans = -1;
		for (int i=0; i<8; i++) {
			int cnt = 0;
			for (int j=0, k=i; j<8; j++, k=(k+1)%8) {
				cnt += Math.max(0,p[j] - a[k]);
			}
			int x = 0;
			for (int j=i, k=7; k>=0; j=(j+1)%8, k--) {
				x += Math.pow(10,k)*a[j];
			}
			if (cnt < min) {
				ans = x;
				min = cnt;
			} else if (cnt == min) {
				ans = Math.min(ans, x);
			}
		}

		String s = String.valueOf(ans);
		for (int i=0; i<7; i++) {
			out.print(s.charAt(i)+" ");
		}

		out.println(s.charAt(7));
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		while(in.hasNext()) solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 29468
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

    int X = scanner.nextInt();

    int[] primes = primes(1_000_000);
    for (int p : primes) {
      if (p >= X) {
        System.out.println(p);
        return;
      }
    }
  }

  private static int[] primes(int n) {
    boolean[] isNotPrime = new boolean[n + 1];
    isNotPrime[0] = isNotPrime[1] = true;
    for (int i = 2; i < Math.sqrt(n); i++) {
      if (!isNotPrime[i]) {
        for (int j = 2; i * j <= n; j++) {
          isNotPrime[i * j] = true;
        }
      }
    }
    final List<Integer> ls = new ArrayList<>();
    for (int i = 2; i <= n; i++) if (!isNotPrime[i]) ls.add(i);
    int[] res = new int[ls.size()];
    for (int i = 0; i < ls.size(); i++) res[i] = ls.get(i);
    return res;
  }
}


Measured memory_bytes: 27988
#include<stdio.h>
int main(){
  int n,i;
  scanf("%d",&n);
  char s[2][n+1];
  for(i=0;i<2;i++)
    scanf("%*c%s",s[i]);
  long long count;
  int check=0;
  for(i=0;i<n;i++){
    if(i==0){
      if(s[0][i]==s[1][i]){
        count=3;
        check=0;
      }
      else{
        count=6;
        i++;
        check=1;
      }
    }
    else{
      if(s[0][i]==s[1][i]){
        if(check==0)
          count*=2;
        check=0;
      }
      else{
        if(check==1)
          count*=3;
        if(check==0)
          count*=2;
        i++;
        check=1;
      }
    }
    count%=1000000007;
  }
  printf("%lld\n",count);
  return 0;
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = INT64_MAX;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

// size-base union-find
class UF {
public:
    ll node_size;
    vll siz;
    vll par;
    UF(ll sz) : par(sz), siz(sz, 1LL) {
        REP(i, sz) par[i] = i;
        node_size = sz;
    }
    // 再初期化
    void initialize(ll sz) {
        par.resize(sz);
        siz.assign(sz, 1LL);
        REP(i, sz) par[i] = i;
        node_size = sz;
    }
    ll root(ll x) {
        while(par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if(x == y) return false;
        if(siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }
    bool find(ll x, ll y) {
        return root(x) == root(y);
    }
    ll size(ll x) {
        return siz[root(x)];
    }
    map<ll, ll> islands() {
        set<ll> st;
        REP(i, node_size) {
            st.insert(root(i));
        }
        map<ll, ll> ret;
        for(auto &s:st) {
            ret[s] = size(s);
        }
        return ret;
    }
};

void solve() {
    ll N, M;
    cin >> N >> M;
    UF uf(N);
    REP(i, M) {
        ll x, y, z;
        cin >> x >> y >> z;
        uf.unite(x - 1, y - 1);
    }
    out(uf.islands().size());
}

int main() {
   // fast_io;
    solve();
    return 0;
}


Measured memory_bytes: 12800
import math
k = int(input())
n = []
for a in range(1, k+1):
  for b in range(1, k+1):
    d = math.gcd(a,b)
    n.append(d)
m = []
for d in n:
  for c in range(1, k+1):
    e = math.gcd(d,c)
    m.append(e)
    
print(sum(m))

Measured memory_bytes: 71628
N = int(input())
a = list(map(int, input().split()))

t = 0
# 累積和
d = dict()
d[0] = 1

ans = 0
for aa in a:
    t += aa
    ans += d.get(t, 0)
    # それまでに合計tの区間があるか

    d[t] = d.get(t, 0) + 1

print(ans)


Measured memory_bytes: 38676
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#define F first
#define S second
using namespace std;

int p[111111];
void init(int x){
  for(int i = 0; i <= x; i++) p[i] = i;
}
int find(int x){
  return p[x]==x?x:p[x]=find(p[x]);
}

bool same(int x,int y){
  return find(x) == find(y);
}

void merge(int x,int y){
  p[find(x)] = find(y);
}


int n,m;
int k[111111];
vector<int> l[111111];
int main(void){
  scanf("%d %d",&n,&m);


  init(m);
  for(int i = 0; i < n; i++){
    scanf("%d",k+i);
    for(int j = 0; j < k[i]; j++){
      int ll;
      scanf("%d",&ll);
      l[i].push_back(ll);
      if(j){
	merge(l[i][0],l[i][j]);
      }
    }
  }

  bool f = true;
  for(int i = 1; i < n; i++){
    if(!same(l[0][0],l[i][0])) f = false;
  }
  if(f) puts("YES");
  else puts("NO");
}


Measured memory_bytes: 6784
from collections import Counter
n = int(input())
ans_list = [0]*(10**6)
for i in range(1, 100):
  for j in range(1, 100):
    for k in range(1, 100):
      ans = i**2 + j**2 + k**2 + i*j + j*k + k*i
      ans_list[ans-1] += 1
for i in ans_list[:n]:
  print(i)

Measured memory_bytes: 17376
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
    }
    int h=1;
    for(int i=2;i<=n;i++)
    {
    	int sum=0;
    	for(int j=i-1;j>=1;j--)
    	{
    		if(a[j]>sum)
    		{
    			sum=a[j];
			}
		}
		if(sum<=a[i])
		{
			h++;
		}
	}
	cout<<h<<endl;
	return 0;
} 

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

void main() {
    int N;
    string[][string] M;
    string Q;
    bool input() {
        scanf("%d\n", &N);
        if (N == 0) return false;
        M.clear;
        foreach (_; 0 .. N) {
            string s = readln.chomp.chop;
            auto x = s.split(":");
            string key = x[0];
            if (_ == 0) Q = key;
            string[] value = x[1].split(",");
            M[key] = value;
        }
        return true;
    }
    void solve() {
        bool[string] set;
        bool[string] used;
        void dfs(string key) {
            if (key !in M) {
                set[key] = true;
                return;
            }
            foreach (nkey; M[key]) {
                if (nkey in used) continue;
                used[nkey] = true;
                dfs(nkey);
            }
        }
        dfs(Q);
        writeln(set.length);
    }
    while (input) solve;
}

Measured memory_bytes: 2028
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll d, t, s;
    cin >> d>> t >> s;
    if(d <= t * s) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3664
import java.util.*;

public class Main{
public static void main(String[] args) {
  String a = "AAA";
  String b = "BBB";
  Scanner sc = new Scanner(System.in);
//  System.out.print("S: ");
  String s = sc.next();

  if(s.equals(a) || s.equals(b)){
    System.out.println("No");
  }else{
    System.out.println("Yes");
  }
}
}


Measured memory_bytes: 21844
#include <iostream>
#include <sstream>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

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

    vector<int> niz(n);
    for (int i = 0; i < n; i++)
        cin >> niz[i];
    sort(niz.begin(), niz.end(), greater<int>());

    int ans = 0;
    for (int i = 0; i < k; i++)
        ans += niz[i];
    cout << ans;
}

Measured memory_bytes: 3644
K=int(input())

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

sum=0

for i in range(1,K+1):
    for j in range(1,K+1):
        for n in range(1,K+1):
            sum+=gcd(i,j,n)

print(sum)

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

#define rep(i, n) REP(i, 0, n)
#define REP(i,k,n) for(int i = k; i < n; i++)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define argmax max_element
#define argmin min_element
#define push push_back
#define pop pop_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

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

template<class T = ll> T in() {
    T _in;
    cin >> _in;
    return _in;
}

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

    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    string ans="No";
    if (abs(c-a) <= d || (abs(b-a)<=d && abs(c-b)<=d))
        ans="Yes";

    cout << ans << endl;

    return 0;
}


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

using namespace std;

int main(){
    int mod=1000000007;
    int n,k,f=0,tmp,chk;
    bool b[10]={0};
    scanf("%d %d",&n,&k);
    vector<int> d(k);
    for(auto&e:d) scanf("%d",&e);
    for (int i=0;i<k;i++) b[d[i]]=1;
    for (int i=1;i<100000;i++) {
        f=0;
        tmp=i;
        while (tmp>0) {
            chk=tmp%10;
            tmp/=10;
            if (b[chk]==1) {
                f=1;
                break;
            }
        }
        if (f==0 && i>=n) {
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}

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

int main() {
    int A,B;
    cin >> A >> B;

    if (A - B * 2 >= 0) cout << A-B*2 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.function.Function;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        E solver = new E();
        solver.solve(1, in, out);
        out.close();
    }

    static class E {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            int K = in.Int();
            int[] A = in.Int(N);
            Arrays.sort(A);

            long ans = nibu(A[N - 1], t -> {
                int k = K;
                for (int i = 0; i < N; i++) {
                    int a = A[N - 1 - i];
                    k -= ((int) Math.ceil((double) a / t)) - 1;
                    if (k < 0) return false;
                }
                return true;
            });
            out.println(ans);
        }

        private long nibu(long n, Function<Long, Boolean> check) {
            long ng = -1, ok = n;
            while (Math.abs(ok - ng) > 1) {
                long mid = (ng + ok) / 2;
                boolean f = check.apply(mid);
                if (!f) {
                    ng = mid;
                } else {
                    ok = mid;
                }
            }
            return ok;
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

        public int[] Int(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Int();
            }
            return a;
        }

    }
}



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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
const int inf=1010001000;
const ll  INF=1001000100010001000;
const int mod=(int)1e9+7;

int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<int>>a(h,vector<int>(w));
    vector<tuple<int,int,int,int>>t;
    rep(i,0,h){
        rep(j,0,w){
            cin>>a.at(i).at(j);
        }
    }
    int c=0;
    int ni,nj;
    rep(i,0,h){
        if(i%2==0){
            rep(j,0,w){
                if(a.at(i).at(j)%2==1){
                    ni=i;
                    nj=j+1;
                    if(j==w-1) ni=i+1,nj=w-1;
                    if(j==w-1 and i==h-1)continue;
                    c++;
                    a.at(i).at(j)--;
                    a.at(ni).at(nj)++;
                    t.push_back(make_tuple(i,j,ni,nj));
                }
            }
        }
        else{
            for(int j=w-1; j>=0; j--){
                if(a.at(i).at(j)%2==1){
                    ni=i;
                    nj=j-1;
                    if(j==0)ni=i+1,nj=0;
                    if(j==0 and i==h-1)continue;
                    c++;
                    a.at(i).at(j)--;
                    a.at(ni).at(nj)++;
                    t.push_back(make_tuple(i,j,ni,nj));
                }
            }
        }
    }
    cout<<c<<endl;
    rep(i,0,t.size()){
        cout<<get<0>(t.at(i))+1<<' '<<get<1>(t.at(i))+1<<' '<<get<2>(t.at(i))+1<<' '<<get<3>(t.at(i))+1<<endl;
    }
return 0;
}

Measured memory_bytes: 5232
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

struct UnionFind {
  vector<int> c, s, es;
  UnionFind(size_t n) : c(n), s(n, 1), es(n, 0) { iota(begin(c), end(c), 0); }
  int root(int i) { return c[i] == i ? i : (c[i] = root(c[i])); }
  bool same(int i, int j) { return root(i) == root(j); }
  void unite(int i, int j) {
    i = root(i); j = root(j);
    if (i != j) {
      if (s[i] > s[j]) { c[j] = i; s[i] += s[j]; es[i] += es[j] + 1; }
      else { c[i] = j; s[j] += s[i]; es[j] += es[i] + 1; }
    } else {
      es[i]++; 
    }
  }
  int size(int i) { return s[root(i)]; }
  int edges(int i) { return es[root(i)]; }
};

struct P {
  i64 r, c, a;
};

i64 n, h, w;
vector<P> ps;
int main() {
  cin >> n >> h >> w;
  map<i64, i64> rm, cm;
  for (i64 i = 0; i < n; ++i) {
    i64 r, c, a;
    cin >> r >> c >> a;
    ps.push_back({ r, c, a });
    rm[r] = 0;
    cm[c] = 0;
  }
  i64 idx = 0;
  for (auto& p : rm) {
    rm[p.first] = idx++;
  }
  for (auto& p : cm) {
    cm[p.first] = idx++;
  }

  vector<P> es;
  i64 m = rm.size() + cm.size();
  i64 ofs = rm.size();
  for (auto p : ps) {
    es.push_back({ rm[p.r], cm[p.c], p.a });
  }
  sort(begin(es), end(es), [](P p, P q) { return p.a < q.a; });

  UnionFind uf(m);
  i64 ans = 0;
  while (!es.empty()) {
    auto e = es.back();
    es.pop_back();

    if ((uf.same(e.r, e.c) && uf.edges(e.r) < uf.size(e.r)) ||
        (!uf.same(e.r, e.c) && 
        uf.edges(e.r) + uf.edges(e.c) < uf.size(e.r) + uf.size(e.c))) {
      uf.unite(e.r, e.c);
      ans += e.a;
    }
  }

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


Measured memory_bytes: 20528
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<int(n);++i)

ll a,b;
ll tmp;

ll gcd(ll a,ll b){
	if((0==a)||(0==b)) return 0;
	
	while(a!=0&&b!=0){
		if(a>b) a %= b;
		else b %= a;
	}
	return a==0?b:a;
}

ll lcm(ll a,ll b){
	if((a==0)||(b==0)) return 0;
	
	return ((a/tmp) * b);
}

int main(){
	while(cin>>a>>b){
		tmp = gcd(a,b);
		cout<<tmp<<" "<<lcm(a,b)<<endl;
	}
	return 0;
}

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

using namespace std;

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

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int a,b;
    cin >> a >> b;
    if(a+1 >= b*2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

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

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  ll n; std::cin >> n;
  ll nn = n-1;
  set<ll> ans;
  ans.insert(n);
  if (n > 2) ans.insert(nn);
  for (ll x = 2; x*x <= nn; x++) {
    if (nn % x) continue;
    if (nn / x == x) ans.insert(x);
    else ans.insert(x), ans.insert(n/x);
  }
  if (nn % 2) ans.insert(2);
  nn = n;
  for (ll x = 2; x*x <= nn; x++) {
    if (nn % x) continue;
    ll tmp = nn;
    while (tmp % x == 0) tmp /= x;
    if (tmp % x == 1) ans.insert(x);
  }
  std::cout << ans.size() << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define Max(_A,_B) (_A>_B?_A:_B)
#define Min(_A,_B) (_A<_B?_A:_B)
#define maxn 401
#define maxm 1000001
#define V e[i].v
#define ull unsigned long long
#define R register
#define md 1000000007
inline int read(){
    R int s = 0, f = 1; R char c = getchar();
        while (c > '9' || c < '0') { c = getchar();}
            while (c >= '0' && c <= '9') {s = s * 10 + c - '0'; c = getchar();}
                return s * f;
                }
/*
前n个人分c个糖果对应的幼儿园活跃指数的和表示为P(n, c)
P(n, c) = Σln <= xn <=rn  Σ0 <= cn <= c  P(n - 1, c - cn) * x_{n}^{cn}
*/
int l[maxn], r[maxn], c, n;
ll f[maxn][maxn], p[maxn][maxn], pre[maxn][maxn];
ll ksm(ll a, int b) {
    ll res = 1;
    while (b) {
        if (b & 1) {
            res = res * a % md;
        }
        a = a * a % md;
        b >>= 1;
    }
    return res;
}
int main() {
    //freopen("candies.in", "r", stdin); 
	//freopen("candies.out", "w", stdout);
    p[0][0] = 1;
    n = read(); c = read(); 
    for (int i = 1; i <= n; i++) l[i] = read();
    for (int i = 1; i <= n; i++) r[i] = read();
    memset(f, 0, sizeof(f));
    for (int i = 1; i <= 400; i++){
        p[i][0] = pre[i][0] = 1;
        for (int j = 1; j <= 400; j++){
            p[i][j] = (p[i][j - 1] * i) % md;
        }
    }
    //pre[i][j] 表示1^j + 2 ^ j + ... + i ^ j
    for (int i = 1; i <= 400; i++)
        for (int j = 0; j <= 400; j++) 
            pre[i][j] = (pre[i - 1][j] + p[i][j]) % md;
    f[0][0] = 1;
    for (int i = 1; i <= n; i++) 
        for (int j = 0; j <= c; j++)
            for (int cn = 0; cn <= j; cn++){
                ll t = (pre[r[i]][cn] - pre[l[i] - 1][cn] + md) % md;
                f[i][j] = (f[i][j] + f[i - 1][j - cn] * t) % md;
            }
    printf("%lld\n", f[n][c]);
    return 0;
}

Measured memory_bytes: 3968
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define clr clear()
#define ins insert
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define mem(x,val) memset((x),(val),sizeof(x));
#define cusmem(x,val) for(auto &i:x) i=val;
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false);\
            cin.tie(NULL);\
            cout.tie(NULL);
using namespace std;
typedef pair<int,int> pii;
typedef pair<ll,ll>pll;
typedef pair<ll,int>pli;
typedef vector<ll> vl;
typedef vector<pll> vpll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pii> vpii;
string impossible;

mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());

// const int N=6;
const int N=5e2+5;
const int M=1e4+5;
const int L=41;
int MOD=1e9+7;
ll n,m,k,i,j,d;
bool f0,f1,f2;
const int MAXN=2e3;
int main(){
    #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin); 
            freopen("output.txt","w",stdout);
    #endif
    fastio
    cout<<fixed<<setprecision(11);
    int tests=1;    
    // cin>>tests;
    for(int te=1;te<=tests;te++){
        ll x,k,d;   cin>>x>>k>>d;
        x=abs(x);
        ll a=x/d;
        if(k<a){
            cout<<abs(x-k*d);
        }
        else{
            ll left=k-a;
            if(left&1)  cout<<abs(x-a*d-d);
            else    cout<<abs(x-a*d);
        }
    }
    return 0;
}





Measured memory_bytes: 3628
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    int n;
    cin >> n;
    vi a(2 * n - 1);
    forn(i, 2 * n - 1) cin >> a[i], --a[i];
    int l = 0, r = 2 * n - 1;
    while (r - l > 1) {
        int m = (l + r) / 2;
        vi b(2 * n - 1);
        forn(i, 2 * n - 1) b[i] = (a[i] >= m);
        int i = n - 1, j = n - 1;
        while (i && b[i] != b[i - 1]) --i;
        while (j < 2 * n - 2 && b[j] != b[j + 1]) ++j;
//        cerr << m << ' ' << i << ' ' << j << '\n';
//        for (int x: b) cerr << x << ' '; cerr << '\n';
        int res = b[n - 1] ^ (min(j - (n - 1), (n - 1) - i) & 1);
        (res ? l : r) = m;
    }
    cout << l + 1 << '\n';

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


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

int main(){
    int n;
    cin>>n;
    map<long long,long long> mp;
    long long res=0;
    for(int i=0;i<n;++i){
        long long a;
        cin>>a;
        res+=mp[i+1-a];
        ++mp[i+1+a];
    }

    cout<<res<<endl;
}

Measured memory_bytes: 26144
/* ****GT_18**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        ll a,b,c,d,n,i,j,k;
        string s;
        cin>>n>>a>>b>>c>>d>>s;
        if(c==d)
        {
            cout<<"No";
            return 0;
        }
        if(d>c)
        {
            for(i=b;i<d;i++)
            {
                if(s[i]=='#'&&s[i+1]=='#')
                {
                    cout<<"No";
                    return 0;
                }
            }
            for(i=a;i<c;i++)
            {
                if(s[i]=='#'&&s[i+1]=='#')
                {
                    cout<<"No";
                    return 0;
                }
            }
        }
        else
        {
            for(i=b;i<d;i++)
            {
                if(s[i]=='#'&&s[i+1]=='#')
                {
                    cout<<"No";
                    return 0;
                }
            }
            for(i=a;i<c;i++)
            {
                if(s[i]=='#'&&s[i+1]=='#')
                {
                    cout<<"No";
                    return 0;
                }
            }
            ll t=0;
            for(i=b-2;i<d-1;i++)
            {
                if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.')
                {
                    t=1;
                }
            }
            if(t==0)
            {
                cout<<"No";
                return 0;
            }
        }
        cout<<"Yes";
    }
    return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  string hand[15] = {"Rock", "Fire", "Scissors", "Snake", "Human", "Tree", "Wolf", "Sponge", "Paper", "Air", "Water", "Dragon", "Devil", "Lightning", "Gun"};
  map<string, int> hand_id;
  REP(i, 15) hand_id[hand[i]] = i;
  int N;
  while(cin>>N && N){
    vector<string> result(N);
    vector<int> res_id(N);
    REP(i, N) cin>>result[i];
    REP(i, N) res_id[i] = hand_id[result[i]];
    vector<int> win(N);
    vector<int> lose(N);
    REP(i, N) {
      int id1 = res_id[i];
      FOR(j, i + 1, N){
        int id2 = res_id[j];
        if(id1 == id2){
        }else if((id1 - id2 + 15) % 15 <= 7){
          win[j] ++;
          lose[i]++;
        }else{
          assert((id2 - id1 + 15) % 15 <= 7);
          win[i] ++;
          lose[j]++;
        }
      }
    }
    string winner = "Draw";
    REP(i, N) if(win[i] > 0 && lose[i] == 0) winner = result[i];
    cout<<winner<<endl;
  }
  return 0;
}

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

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] c = s.toCharArray();
    Arrays.sort(c);
    String news = new String(c);

    if (news.equals("abc")) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
}

Measured memory_bytes: 35472
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define MAXN 3100
using namespace std;
const int M = 1e9+7;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

int dp[MAXN][MAXN];
int soma[MAXN];
char sign[MAXN];

signed main(){
	int n;
	cin>>n;
	
	for(int i=0;i<MAXN;i++)
		for(int j=0;j<MAXN;j++)
			dp[i][j]=0;
	dp[0][1]=1;
	
	soma[0]=0;   	
	
	for(int i=1;i<n;i++)cin>>sign[i];
	 
	for(int i=1;i<n;i++){
		soma[0]=0;
		for(int k=1;k<=i+1;k++){
			soma[k]=mod(soma[k-1]+dp[i-1][k],M);
		}
		
		for(int j=1;j<=i+1;j++){
			if(sign[i]=='<'){
				dp[i][j]=mod(soma[j-1],M);
			}else{
					dp[i][j]=mod(soma[i+1]-soma[j-1],M);
			}
		}
		
	}

	int res=0;
	for(int j=1;j<=n;j++){
		res=mod(dp[n-1][j]+res,M);
	}
	cout<<res<<endl;
	
}

Measured memory_bytes: 75392
#include <algorithm>
#include <iostream>
#include <vector>

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

    std::vector<int> t(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> t[i];
        sum += t[i];
    }

    int m;
    std::cin >> m;

    for (int i = 0; i < m; i++) {
        int p, x;
        std::cin >> p >> x;
        p--;
        std::cout << sum - t[p] + x << std::endl;
    }
}


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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("a.out", "w", stdout);
	#endif

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

	int n;
	cin >> n;
	vector<int> a(n);
	set<int> s;
	for (auto &i : a) cin >> i, s.insert(i);
	if (s.size() == n)
		cout << "YES\n";
	else
		cout << "NO\n";

	return 0;
}


Measured memory_bytes: 10368
#include<stdio.h>

int main()
{
	int a, b, c, s = 0;
	scanf("%d %d %d", &a, &b, &c);

	for (int i = a; i <=b; i++) {
		if (c%i == 0) {
			s++;
		}
	}
	printf("%d\n", s);
}

Measured memory_bytes: 1860
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#define MOD 1000000007
#define oo 987654321
#define INT long long int
using namespace std;

INT n, a[100010], d[100010], ans = 1;

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i = 0 ; i < n ; i++ )
        cin>>a[i];
    sort(a, a+n);
    for(int i = 0 ; i < n ; i++ )
        if( i > 0 ) d[i] = d[i-1] + a[i];
        else d[i] = a[i];
    for(int i = 0 ; i < n-1 ; i++ )
        if( d[i]*2 >= a[i+1] ) ans++;
        else ans = 1;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792