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

int n;
int bio[300010];

int main () {

	cin >> n;
	for (int i = 2; i <= 55555; i ++) {
		for (int j = i*2; j <= 55555; j += i) {
			bio[j] = 1;
		}
	}
	
	int br = 0, w = 2;
	while (br < n) {
		if (bio[w] == 0) {
			if (w % 5 == 1) {
				cout << w << " ";
				br ++;
			}
		}
		
		w ++;
	}

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
  for (auto it = vc.begin(); it != vc.end(); ++it)
  {
    if (std::next(it) == vc.end())
      os << *it;
    else
      os << *it << ' ';
  }
  return os;
}

template<class T1, class T2>
inline
std::ostream & operator<<(std::ostream & os, const std::pair<T1, T2> & p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  using std::vector;
  using std::map;
  using std::pair;
  using std::cin;
  using std::cout;
  ull A{}, B{}; std::cin >> A >> B;

  ull ans = A % 2 ? A : 0;
  A += A % 2;
  ull mod = (B - A + 1) % 4;
  rep_ul_down(mod, 0)
  {
    ans ^= B - i + 1;
  }
  
  cout << ans << '\n';
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {

	static long expo(long base, long exp) {
		long t = 1L;
		while (exp > 0) {
			if (exp % 2 != 0)
				t = (t * base);

			base = (base * base);
			exp /= 2;
		}
		return t;
	}

	public static void main(String args[]) throws Exception {
		MyScanner sc = new MyScanner();
		PrintWriter pr = new PrintWriter(System.out);
		int k = sc.nextInt();
		String s = sc.next();

		if (s.length() <= k)
			pr.println(s);
		else
			pr.println(s.substring(0, k) + "...");
		pr.close();

	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}

Measured memory_bytes: 36524
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)998244353;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var Di = Sarray();
            var dct = new Dictionary<long, long>();
            if (Di[0] != 0 || Di.Count(d => d == 0) != 1)
            {
                WriteLine(0);
                return;
            }
            for (var i = 0; i < N; ++i)
            {
                if (!dct.ContainsKey(Di[i])) dct[Di[i]] = 0;
                ++dct[Di[i]];
            }
            var max = Di.Max();
            var ans = 1L;
            for (var i = 1; i <= max; ++i)
            {
                if (!dct.ContainsKey(i))
                {
                    WriteLine(0);
                    return;
                }
                var t = ModPow(dct[i - 1], dct[i], Mod);
                ans = (ans * t) % Mod;
            }
            WriteLine(ans);
            //Out.Flush();
        }
        static long ModPow(long a, long n, long mod)
        {
            var res = 1L;
            while (0 < n)
            {
                if (n % 2 != 0) res = res * a % mod;
                a = a * a % mod;
                n >>= 1;
            }
            return res;
        }
    }
}

Measured memory_bytes: 25440
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  if (N > 999) {
    cout << "ABD" << endl;
  } else {
    cout << "ABC" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
 // freopen("input.txt","r",stdin);
#endif

  ll n,k;
  cin>>n>>k;
  ll hun=500;
  if(n*hun>=k)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<string>s(n);
  int i;
  for(i=0;i<n;i++){
    cin >> s[i];
  }
  map<string,int>m;
  for(i=0;i<n;i++){
    m[s[i]]++;
  }
  int maxx = 0;
  for(i=0;i<n;i++){
    if(maxx < m[s[i]])maxx = m[s[i]];
  }
  set<string>ss;
  for(i=0;i<n;i++){
    if(maxx == m[s[i]])ss.insert(s[i]);
  }
  for(auto j: ss){
    cout << j << endl;
  }
}


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

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

typedef long long lint;

using namespace std;

int main(){
  int N,K,C;
  cin>>N>>K>>C;
  string S;
  cin>>S;
  vector<int> l(K,0),r(K,0);
  REP(i,K){
    static int j=0;
    while(S[j]=='x')j++;
    l[i]=j;
    j+=C+1;
  }
  for(int i=K-1;i>=0;i--){
    static int j=N-1;
    while(S[j]=='x')j--;
    r[i]=j;
    j-=C+1;
  }
  // for(auto e:l)cerr<<(int)e<<" ";
  // cerr<<endl;
  // for(auto e:r)cerr<<(int)e<<" ";
  // cerr<<endl;
  REP(i,K)if(l[i]==r[i])cout<<l[i]+1<<endl;
  return 0;
}


Measured memory_bytes: 3332
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  stores = [[i + 1] + list(input().split()) for i in range(int(input()))]
  stores = [(i, s.strip(), int(p)) for i, s, p in stores]
  stores.sort(key=lambda x: (x[1], -x[2]))

  for i, _, _ in stores:
    print(i)


if __name__ == '__main__':
  main()



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

using lint = long long;
constexpr lint INF = 1LL << 60;

void solve() {
    int n, k;
    std::cin >> n >> k;

    std::vector<int> ps(n);
    for (auto& p : ps) {
        std::cin >> p;
        --p;
    }

    std::vector<lint> cs(n);
    for (auto& c : cs) std::cin >> c;

    lint ans = -INF;
    for (int v = 0; v < n; ++v) {
        std::vector<lint> accs{0};

        int u = v;
        bool first = true;

        while (u != v || first) {
            u = ps[u];
            accs.push_back(accs.back() + cs[u]);
            first = false;
        }

        int len = accs.size() - 1;
        lint sum = accs.back();

        for (int i = 1; i <= len && i <= k; ++i) {
            int circ = (k - i) / len;
            ans = std::max(ans, accs[i] + std::max(0LL, sum * circ));
        }
    }

    std::cout << ans << "\n";
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
const double PI = acos(-1);
using namespace std;
int main() {
    string x;
    string y = "0";
    while(true){
        cin >> x;
        long long ans = 0;
        if(x == y){
            break;
        }
        for(int i = 0; i < x.size(); i++){
            if(x.at(i) == '0'){
                ans += 0;
            }
             if(x.at(i) == '1'){
                ans += 1;
            }
             if(x.at(i) == '2'){
                ans += 2;
            }
             if(x.at(i) == '3'){
                ans += 3;
            }
             if(x.at(i) == '4'){
                ans += 4;
            }
             if(x.at(i) == '5'){
                ans += 5;
            }
             if(x.at(i) == '6'){
                ans += 6;
            }
             if(x.at(i) == '7'){
                ans += 7;
            }
             if(x.at(i) == '8'){
                ans += 8;
            }
             if(x.at(i) == '9'){
                ans += 9;
            }

        }
        cout << ans << endl;

    }
    
}


Measured memory_bytes: 3196
#include <stdio.h>

#define INF 1010101010

int N, M, K;

int A[222222], B[222222];

int mikakosi[222222];

int main(void) {
	int i;
	int gotiusanokokoa = 0, gotiusanosyaro = 0;
	if (scanf("%d%d%d", &N, &M, &K) != 3) return 1;
	if (N > 222222 || M > 222222) {
		puts("too large");
		return 1;
	}
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	for (i = 0; i < M; i++) {
		if (scanf("%d", &B[i]) != 1) return 1;
	}
	mikakosi[0] = B[0];
	for (i = 1; i < M; i++) {
		mikakosi[i] = mikakosi[i - 1] + B[i];
		if (mikakosi[i] > INF) mikakosi[i] = INF;
	}
	for (i = 0; i <= N; i++) {
		int rimitto = K - gotiusanosyaro;
		if (rimitto < 0) {
			/* nop */
		} else if (rimitto < mikakosi[0]) {
			if (i > gotiusanokokoa) gotiusanokokoa = i;
		} else if (rimitto >= mikakosi[M - 1]) {
			int mareitaso = i + M;
			if (mareitaso > gotiusanokokoa) gotiusanokokoa = mareitaso;
		} else {
			int ok = 0, ng = M - 1;
			int riesyonn;
			while (ok + 1 < ng) {
				int m = ok + (ng - ok) / 2;
				if (rimitto >= mikakosi[m]) ok = m; else ng = m;
			}
			riesyonn = i + ok + 1;
			if (riesyonn > gotiusanokokoa) gotiusanokokoa = riesyonn;
		}
		if (i < N) {
			gotiusanosyaro += A[i];
			if (gotiusanosyaro > INF) gotiusanosyaro = INF;
		}
	}
	printf("%d\n", gotiusanokokoa);
	return 0;
}


Measured memory_bytes: 4080
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 2005;

int n, m, ans, tp, p[MAXN], st[MAXN], f[MAXN][MAXN];
bool a[MAXN][MAXN];
char s[MAXN][MAXN];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), m = Read(), ans = max(n, m);
	for (int i = 1; i <= n; i ++)
		scanf("%s", s[i] + 1);
	for (int i = 1; i < n; i ++)
		for (int j = 1; j < m; j ++)
			a[i][j] = (s[i][j] == '#') ^ (s[i + 1][j] == '#') ^ (s[i][j + 1] == '#') ^ (s[i + 1][j + 1] == '#') ^ 1;
	n --, m --;
	for (int i = 1; i <= n; i ++)
		for (int j = 1; j <= m; j ++)
			if (a[i][j])
				f[i][j] = f[i - 1][j] + 1;
	for (int i = 1; i <= n; i ++)
	{
		st[tp = 1] = 1, p[1] = 1;
		for (int j = 2; j <= m + 1; j ++)
		{
			bool flg = true;
			while (tp && f[i][j] < f[i][st[tp]])
			{
				flg = false;
				ans = max(ans, (f[i][st[tp]] + 1) * (j - p[tp] + 1));
				tp --;
			}
			st[++ tp] = j;
			if (flg)
				p[tp] = j;
		}
	}
	return printf("%d\n", ans), 0;
}


Measured memory_bytes: 23808
from collections import*
from heapq import*
n,*a=map(int,open(0).read().split())
q=[-t for t in Counter(a).values()]
heapify(q)
while q[0]<-1:
    p=heappop(q)
    if p<-2:
        heappush(q,p+2)
    else:
        heappush(q,p+1)
        r=heappop(q)
        if r<-1:
            heappush(q,r+1)
print(len(q))

Measured memory_bytes: 64308
from sys import setrecursionlimit
setrecursionlimit(10**6)
n = int(input())
edge = [tuple(int(i) for i in input().split()) for i in range(n-1)]
to = [[] for _ in range(n+1)]
for e in edge:
    a,b = e
    to[a].append(b)
    to[b].append(a)
color = {}

def f(cn,pn,pc):
    c = 1
    for nn in to[cn]:
        if nn == pn: continue
        if c == pc: c += 1
        tmp = (cn,nn)
        color[(min(tmp),max(tmp))] = c
        f(nn,cn,c)
        c += 1

f(1,0,0)
print(max(color.values()))
for key in edge: print(color[key])

Measured memory_bytes: 80496
#include <iostream>
using namespace std;
int main() {
    int w,h,x,y,r,l,R,u,d;
    while (cin>>w>>h>>x>>y>>r) {
        l=x-r;
        R=x+r;
        u=y+r;
        d=y-r;
        if (0<=l&&R<=w&&u<=h&&d>=0) {
            cout<<"Yes"<<endl;
        } else {
            cout<<"No"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3108
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int A[100000];
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  vector<int> A;
  rep(i, N) {
    int x;
    cin >> x;
    if (A.size() > 0 && A[A.size()-1] == x) continue;
    A.pb(x);
  }

  int c = 0;
  int x = -1;
  while (x < (int)A.size()-1) {
    x++;
    if (A[x] < A[x+1]) {
      while (x < N-1 && A[x] <= A[x+1]) x++;
      c++;
    }
    else {
      while (x < N-1 && A[x] >= A[x+1]) x++;
      c++;
    }
  }
  cout << c << "\n";
  return 0;
}


Measured memory_bytes: 892
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};

fn main() {
  let a = read::<i32>();
  let b = read::<i32>();

  if a % 2 == 1 && b % 2 == 1 {
    println!("Yes");
  } else {
    println!("No");
  }

}



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

class Program
{
    static void Main()
    {
		int a =int.Parse(Console.ReadLine());
		int b = 0;
		for(int i=1; i<=a; i++)
		{
			if((i>=1 && i<=9) || (i>=100 && i<=999) || (i>=10000 && i<=99999)) b++;
		}
      	Console.WriteLine(b);
    }
}


Measured memory_bytes: 27508
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

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

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

int main() {
    int N, C, K;
    cin >> N >> C >> K;
    vector<int> T(N);
    for (int i = 0; i < N; i++) cin >> T.at(i);
    sort(T.begin(), T.end());

    int bus = 0;
    int passenger = 0;
    int time;
    for (int i = 0; i < N; i++) {
        if (passenger == 0 || T.at(i) - time > K || passenger + 1 > C) {
            bus++;
            passenger = 1;
            time = T.at(i);
        } else passenger++;
    }
    cout << bus << endl;
}


Measured memory_bytes: 640
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	r := intScanner()
	fmt.Println(r * r)
}


Measured memory_bytes: 1772
import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;

import java.io.*;

public class Main {

	void solve() {
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		V[] vs = new V[N];
		for (int i = 0; i < N; i++) vs[i] = new V(i);
		for (int i = 0; i < M; i++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int c = sc.nextInt();
			vs[a].add(vs[b], c);
		}
		long INF = 1L << 58;
		for (V v : vs) v.score = -INF;
		vs[0].score = 0;
		
		for (int step = 0; step < 3 * N + 10; step++) {
			for (V v : vs) {
				for (E e : v.es) {
					if (e.to.score < (v.score + e.w)) {
						e.to.score = v.score + e.w;
						if (step >= N) {
							e.to.score = INF;
						}
					}
				}
			}
		}
		
		long ans = vs[N-1].score;
		if (ans >= INF / 2)
			out.println("inf");
		else
			out.println(ans);
	}
	
	class V {
		ArrayList<E> es = new ArrayList<E>();
		int id;
		long score = 0;
		public V(int id) { this.id = id; }
		void add(V to, int w) {
			this.es.add(new E(to, w));
		}
	}
	class E {
		V to;
		long w;
		E(V to, long w) {
			this.to = to;
			this.w = w;
		}
	}
	static void tr(Object... os) { System.err.println(deepToString(os)); }
	static void tr(int[][] as) { for (int[] a : as) tr(a); }

	void print(int[] a) {
		out.print(a[0]);
		for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
		out.println();
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

Measured memory_bytes: 61248
while True:
    N,X = map(int,input().split())
    if N == 0 and X == 0:
        break
    ans = 0
    for a in range(1,N):
        for b in range(a+1,N+1):
            c = X-(a+b)
            if c > b and c <= N:
                ans += 1
    print("%d"%(ans))



Measured memory_bytes: 5592
import java.awt.*;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int h[]=new int[n];
        for (int i=0;i<n;i++)h[i]=sc.nextInt();
        int dp[]=new int[n];dp[1]=Math.abs(h[0]-h[1]);
        for (int i=2;i<n;i++){
            dp[i]=Math.min(dp[i-1]+Math.abs(h[i-1]-h[i]),dp[i-2]+Math.abs(h[i]-h[i-2]));
        }
        System.out.println(dp[n-1]);
    }
}

Measured memory_bytes: 49072
#include <iostream>
#include <cmath>
#include <unordered_set>
#include <cstdlib>
#include <string>

using namespace std;

void solve(string s, int n) {
    unordered_set<int> r, g, b;
    r = {};
    g = {};
    b = {};
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') r.insert(i);
        else if (s[i] == 'G') g.insert(i);
        else b.insert(i);
    }

    long long out = 0;
    for (int i : r) {
        for (int j : g) {
            int diff = abs(j - i);
            int low = min(i, j) - diff;
            int hi = max(i, j) + diff;
            int mid;
            if (diff % 2 == 0) mid = min(i, j) + diff / 2;
            else mid = -1;
            out += b.size();
            int arr[3] = {low, mid, hi};
            for (int x : arr) {
                if (b.find(x) != b.end()) out -= 1;
            }
        }
    }
    cout << out << endl;
}

int main() {
    int n;
    string s;
    cin >> n >> s;
    solve(s, n);
}

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;

pii dfs(vector<vi>& g, vector<int>& isVisited, int u, int cnt){
    if(isVisited[u] != -1) return {u, cnt};

    isVisited[u]=cnt;
    ++cnt;

    for(auto& v: g[u]){
        return dfs(g, isVisited, v, cnt);
    }
}

void solve(){

    int n;
    cin >> n;
    ll k;
    cin >> k;

    vi a(n, 0);
    vector<vi> g(n);
    rep(i,0,n){
        cin >> a[i];
        g[i].pb(a[i]-1);
    }

    vi isVisited(n, -1);
    pii c = dfs(g, isVisited, 0, 0);

    int cycle=c.second-isVisited[c.first];
    if(k > isVisited[c.first]+cycle){
        k -= isVisited[c.first];
        k = k%cycle+isVisited[c.first];
    }

    int s = 0;
    while(k--){
        s = a[s]-1;
    }

    cout << s+1 << "\n";

    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


Measured memory_bytes: 15852
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define ppll pair<ll, pll>
#define pii pair<int, int> 
#define mod 1000000007
ll power(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b%2!=0) res=(res*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return res;
}
ll ncr(ll n,ll k){
    if(k==0||k==n) return 1ll;
    if(k>n-k) k=n-k;
    ll pro=1;
    for(ll i=0;i<k;i++){
        pro=(pro*(n-i))%mod;
        pro/=(i+1);
    }
    return (pro%mod);
}
vector<int> prime;
void seive(){
    vector<bool > isprime(1000001,true);
    for(int i=2;i*i<=1000000;i++){
        if(isprime[i]){
            for(int j=i*i;j<=1000000;j+=i){
                isprime[j]=false;
            }
        }
    }
    for(int i=2;i<=1000000;i++){
        if(isprime[i]) prime.push_back(i);
    }
}
int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b;
    cin>>a>>b;
    ll ans=a-2*b;
    ans=max(0ll,ans);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  cout<<min(a,b)<<" ";
  if(a+b-n<0) cout<<'0'<<endl;
  else cout<<a+b-n<<endl;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int a, b, c;

    cin >> a >> b;

    if(a>=1&&b>=1&&a<=20&&b<=20)
    {
        if(a<10&&b<10)
        {
            c=a*b;
            cout << c << endl;
        }
        else
            cout << "-1" << endl;
    }
    return 0;
}


Measured memory_bytes: 3600
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cstring>

using namespace std;

int main(){
	int n, m, i, j, k;
	char a[22], b[22], c[22];
	while(~scanf("%s %s %s", a, b, c)){
		m = strlen(b), k = strlen(a);
		getchar();
		if(a[k - 1] == b[0] && b[m -1] == c[0]) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
main(void){
    
    int a,b;
    scanf("%d %d",&a,&b);
    
    if(a>b){
        printf("a > b\n");
    }else if (a==b){
        printf("a == b\n");
    }else if(a<b){
        printf("a < b\n");
    }
}


Measured memory_bytes: 2120
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))

A.sort()
F.sort(reverse=True)

l = -1
r = A[-1] * F[0]


def ok(c):
    s = 0
    for a, f in zip(A, F):
        s += max(0, a - c//f)
    return s <= K


while r - l > 1:
    c = (l+r)//2
    if ok(c):
        r = c
    else:
        l = c

print(r)


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

struct Node {
    int key;
    Node *right, *left, *parent;
};

Node *root, *nil;

Node *find(Node *u, int k){
    while(u != nil && k != u->key){
        if(k < u->key) u = u->left;
        else u = u->right;
    }

    return u;
}

void insert(int k){
    Node *y = nil; // xの親
    Node *x = root; // 現在の接点(挿入するべき場所)
    Node *z; // 挿入する接点

    // zの初期化
    z = new Node;
    z->key = k;
    z->left = nil;
    z->right = nil;

    while(x != nil){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }
        else{
            x = x->right;
        }
    }

    z->parent = y;
    if(y == nil) root = z;
    else{
        if(z->key < y->key) y->left = z;
        else y->right = z;
    }
}

void inorder(Node *u){
    if(u == nil) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u){
    if(u == nil) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n;    
    scanf("%d", &n);

    for(int i=0; i<n; ++i){
        string com;
        cin >> com;

        if(com == "find"){
            int x;
            scanf("%d", &x);
            Node *t = find(root, x);
            if(t != nil) printf("yes\n");
            else printf("no\n");
        }
        else if(com == "insert"){
            int x;
            scanf("%d", &x);
            insert(x);
        }
        else{
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


Measured memory_bytes: 21984
//In the name of Allah
//Ya Ali!
#include <bits/stdc++.h>

using namespace std;
typedef long long ll ;

const ll maxn = 210 ;
const ll INF = 1e18 ;

#define f first
#define s second

ll n , edd[maxn][maxn] , ans = 1 , o0 = '0' ;
vector<ll> g[maxn] ;
vector<pair<ll,ll> > edg ;

ll bfs(ll v){

 queue<ll> qu ;
 ll dis[maxn] , mark[maxn] , maxx = 1 ;

  for(int i = 1 ; i <= n ; i ++){dis[i] = INF ; mark[i] = 0 ;}

 qu.push(v) ;
 mark[v] = 1 ;
 dis[v] = 1 ;

 while(qu.size()){

    ll p = qu.front() ;
    qu.pop() ;
    maxx = max(maxx , dis[p]) ;

    for(int i = 0 ; i < g[p].size() ; i ++){
        ll u = g[p][i] ;
        if(!mark[u]){

            mark[u] = 1 ;
            dis[u] = dis[p] + 1 ;
            qu.push(u) ;

        }
    }

 }

  return maxx ;

}

bool bfs2(ll v){

 queue<ll> qu ;
 ll dis[maxn] , mark[maxn] , go[maxn] ;
 vector<ll> v1 , v2 ;

 for(int i = 1 ; i <= n ; i ++){dis[i] = INF ; mark[i] = 0 ;}

 qu.push(v) ;
 mark[v] = 1 ;
 dis[v] = 1 ;

 while(qu.size()){

    ll p = qu.front() ;
    qu.pop() ;

    if(dis[p] & 1){ v1.push_back(p) ; go[p] = 1 ;}
    else{ v2.push_back(p) ; go[p] = 2; }

    for(int i = 0 ; i < g[p].size() ; i ++){
        ll u = g[p][i] ;
        if(!mark[u]){

            mark[u] = 1 ;
            dis[u] = dis[p] + 1 ;
            qu.push(u) ;

        }
    }

 }

 for(int i = 0 ; i < edg.size() ; i ++){
    ll v = edg[i].f , u = edg[i].s ;

    if(go[v] == go[u])return false ;
 }

 return true ;
}

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

cin >> n ;
for(int i = 1 ; i <= n ; i ++){

    string s1 ;
    cin >> s1 ;

    for(int j = 1 ; j <= n ; j ++){

        ll x ;
        x = s1[j-1] ;
        x -= o0 ;

        if(x == 1 && edd[i][j] == 0){
            g[i].push_back(j) ;
            g[j].push_back(i) ;

            edd[i][j] = 1 ;
            edd[j][i] = 1 ;

            edg.push_back({i , j}) ;
        }
    }
}

if(!bfs2(1)) return cout << -1 , 0 ;

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

cout << ans ;
 return 0;
}
/*
                  _     _   __
            /_\  (_    (_)  __)
           /   \  _) . (_) (__
*/


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

//string型文字列をint型整数にして返す
int str_to_num(string s) {return atoi(s.c_str());}
//約数の総数を返す
int count_divisor(int n){int c[n/2] = {1}; int n_half = n/2; for(int i=2;i<n_half;i++){if(n%i==0){n /= i;c[i]+=1;i--;if(n>1) continue;else break;}  }int r = 1;for(int i=2;i<n_half;i++){r *= c[i];}return r;}
//各桁の数の和を返す
int dig_num(int n){return (n<10) ? n: dig_num(n/10) + n%10;}

int main(){
  int N; cin >> N;
  int X; cin >> X;
  int d = 0;
  int r = 0;
  REP(i,N){
    int L; cin >>L;
    d += L;
    if(d>X){
      r = i+1;
      break;
    }
  }
  if(r==0){r=N+1;}
  cout << r << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  char c;
  for(int i=0;i<h+2;i++){
    for(int j=0;j<w+2;j++){
      if(i==0||i==h+1||j==0||j==w+1){
        cout<<'#';
      }else{
        cin>>c;
        cout<<c;
      }
    }
    cout<<endl;
  }
}

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

//

#define RESIDUE(u,v) (capacity[u][v] - flow[u][v])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long



int main(){
  int m,n;
  string s;
  cin>>m>>n;
  cin>>s;
  REP(i,m){
    if(!(s[i] >= '0' && s[i] <= '9')){
      cout<<"No"<<endl;
      return 0;
    }
  }

  if(!(s[m]== '-')){
    cout<<"No"<<endl;
    return 0;
  }
    

  REP(i,n){
    if(!(s[m+1+i] >= '0' && s[m+1+i] <= '9')){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
int h;
int w;
char c[100];
char op;
int i;
int j;
scanf("%d",&h);
(void)getchar();
scanf("%c",&op);
scanf("%d",&w);
if(op=='+'){
	
	printf("%d",h+w);
}else{
	printf("%d",h-w);
}
	return 0;
}

Measured memory_bytes: 128
L, R = map(int, input().split())

mod_list = []
mul_list = []
if R >= L + 2019:
    print(0)
else: 
    for i in range(L, R+1):
        if i % 2019 == 0:
            print(0)
            break
        else:
            mod_list.append(i)
    else: #連続する2数の積が最小だが2019で割るとそれが最小になるかはわからない
        for i in range(len(mod_list)):
            for j in range(len(mod_list)):
                if i != j: #同じ数は選べない
                    k = (mod_list[i] * mod_list[j]) % 2019
                    mul_list.append(k)
                else:
                    pass

        print(min(mul_list))


Measured memory_bytes: 147688
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
typedef long long ll;
using namespace std;
int main(void){
    int s;cin>>s;
    map<int,int> mp;
    mp[s]++;
    for(int i=2;;i++){
        if(s%2==0)s/=2;
        else s=3*s+1;
        if(mp[s]>0){
            cout<<i<<endl;
            return 0;
        }else{
            mp[s]++;
        }
    }
}


Measured memory_bytes: 384
class BinaryIndexedTree:
    def __init__(self, N, f=max, id=0):
        self.N = N
        self.bit = [id] * (self.N+1)
        self.f = f
        self.id = id

    def query(self, i):
        res = self.id
        while i > 0:
            res = self.f(res, self.bit[i])
            i -= i & -i
        return res

    def update(self, i, x):
        while i <= self.N:
            self.bit[i] = self.f(self.bit[i], x)
            i += i & -i

def main():
    N,*A=map(int, open(0).read().split())
    L,R=[0]*N,[0]*N
    bit=BinaryIndexedTree(N, max, -1)
    for i,a in enumerate(A):
        L[a-1]=i-bit.query(a)
        bit.update(a, i)
    bit=BinaryIndexedTree(N, max, -1)
    for i,a in enumerate(A[::-1]):
        R[a-1]=i-bit.query(a)
        bit.update(a, i)
    print(sum(L[i]*R[i]*(i+1) for i in range(N)))

if __name__ == "__main__":
    main()

Measured memory_bytes: 84356
#include <cstdio>
#include <algorithm>

using namespace std;

const long long INF = 2e12;

int main() {
  int N, M, X, Y;
  int i;
  int x[110] = {};
  int y[110] = {};
  scanf("%d %d %d %d", &N, &M, &X, &Y);
  for (i = 0; i < N; i++) {
    scanf("%d", &x[i]);
  }
  for (i = 0; i < M; i++) {
    scanf("%d", &y[i]);
  }
  x[N] = X;
  y[M] = Y;
  sort(x, x+N+1);
  sort(y, y+M+1);
  if (x[N] >= y[0]) {
    printf("War");
  } else {
    printf("No War");
  }
  return 0;
}


Measured memory_bytes: 128
while 1:
    a,op,b=input().split()
    if op == '+':
        r = int(a)+int(b)
    elif op == '-':
        r = int(a)-int(b)
    elif op == '*':
        r = int(a)*int(b)
    elif op == '/':
        r = int(a)//int(b)
    elif op == '?':
        break;
    print(r)


Measured memory_bytes: 5592
#include <iostream>
using namespace std;
int main() {
  int a[] = {1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
  int k;
  cin >> k;
  cout << a[k-1] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
  int X,Y,Z;
  scanf("%d %d %d" ,&X,&Y,&Z);
  int T;
  T=Z;
  Z=Y;
  Y=X;
  X=T;
  printf("%d %d %d\n",X,Y,Z);
  return 0;
}

Measured memory_bytes: 1704
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    string s;
    cin  >> s;
    ll co = 0;

    if(s=="SUN") co=7;
    else if(s=="MON") co=6;
    else if(s=="TUE") co=5;
    else if(s=="WED") co=4;
    else if(s=="THU") co=3;
    else if(s=="FRI") co=2;
    else if(s=="SAT") co=1;

    cout << co << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
X,Y = map(int,input().split())
ans = 0
if X == 1:
    ans += 300000
elif X == 2:
    ans += 200000
elif X == 3:
    ans += 100000
if Y == 1:
    ans += 300000
elif Y == 2:
    ans += 200000
elif Y == 3:
    ans += 100000
if X == 1 and Y == 1:
    ans += 400000
print(ans)


Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 21:01:18 2020

@author: over-
"""

N=int(input())
P=input().split()

c=1
m=int(P[0])
for i in range(1,N):
    if m>int(P[i]):
        c+=1
        m=int(P[i])


print(c)

Measured memory_bytes: 17904
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	int n;
	cin>>n;
	int count;
	int ans=0;
	for(int i=0;i<n;++i){
		int a,b;
		cin>>a>>b;
		if(a==b)
			count+=1;
		else count=0;
		if(count==3) ans=3;
		
			
	}
	if(ans<3)
	cout<<"No";
	else cout<<"Yes";
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  ll k;
  cin >> k;
  vector<ll> a(k);
  rep(i,k) cin >> a[i];
  ll lb=2;
  ll ub=2;
  ll mod=1;
  for(int i=k-1;i>=0;i--){
    ll maxcan = ub/a[i]*a[i];
    if(maxcan < lb){
      cout << -1 << endl;
      return 0;
    }
    else{      
        mod = a[i];
        lb=((lb/mod*mod==lb)?lb:(lb/mod+1)*mod);    
        ub= (ub/mod+1)*mod-1;

    }
  }
  cout << lb << " " << ub << endl;
  return 0;
    

}


Measured memory_bytes: 3972
N, M = map(int, input().split())
all = list(range(10**(N-1), 10**N))
if N == 1:
  all += [0]
# print(all)
for i in range(M):
  s, c = map(int, input().split())
  _all = []
  for j in all:
    k = str(j)[s-1]
    # print(k)
    if  int(k) == c:
      _all.append(j)
  all = _all
  if len(all) == 0:
    print(-1)
    exit()

print(min(all))


Measured memory_bytes: 62372
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) { o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o; }
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) { o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o; }
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) { o << "{" << obj.first << ", " << obj.second << "}"; return o; }
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
void print(void) { cout << endl; }
template <class Head> void print(Head&& head) { cout << head; print(); }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head << " "; print(forward<Tail>(tail)...); }
void YN(bool flg) { cout << ((flg) ? "YES" : "NO") << endl; }
void Yn(bool flg) { cout << ((flg) ? "Yes" : "No") << endl; }
void yn(bool flg) { cout << ((flg) ? "yes" : "no") << endl; }

int main() {
	int N,A,B; cin >> N >> A >> B;
	V<int> P(N); REP(i, N) cin >> P[i];
	int a = 0, b = 0, c = 0;
	REP(i,N){
		if (P[i] <= A) a++;
		if (A + 1 <= P[i] && P[i] <= B) b++;
		if (B + 1 <= P[i]) c++;
	}
	cout << min({ a,b,c }) << endl;
	


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
	string S, T;
	cin >> S >> T;
	for (int i = 0; i < S.size(); i++) {
		S.insert(0, &S.back());
		S.pop_back();
		if (S == T) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
ll MOD = 1000000007LL;
#include <set>
#include <deque>


int arr[] ={
	1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};
int main() {
	int K; cin >> K;
	K--;
	cout << arr[K] << endl;
	


	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    long int luca[128];
    luca[0] = 2;
    luca[1] = 1;
    for (int i = 2; i <= n; i++) luca[i] = luca[i-1] + luca[i-2];

    cout << luca[n] << endl;
}

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

#include <fstream>
#define inputtxt() std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf())

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];

vector<set<int>> exists('z'+1,set<int>());
int N, Q; string S;

bool has_alphabet(int left, int right, char c){
    auto it = exists[c].lower_bound(left); 
    if(it==exists[c].end()) return false;
    return *it <= right;
}

int main(){
    cin >> N >> S >> Q;
    rep(i,N){
        exists[S[i]].insert(i+1);
    }
    rep(q,Q){
        int type; cin >> type;
        if(type==1){
            int i; char c; cin >> i >> c;
            if(S[i-1] == c) continue;
            exists[S[i-1]].erase(i);
            S[i-1] = c;
            exists[c].insert(i);
        }else{
            int l,r; cin >> l >> r;
            int res = 0;
            reps(c,'a','z'){
                if(has_alphabet(l, r, c)) res++;
            }
            printf("%d\n",res);
        }
    }
    return 0;
}

Measured memory_bytes: 24196
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=(a);i<=(int)(n);++i)
#define lpd(i,a,n) for(int i=(a);i>=(int)(n);--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define readll(x) scanf("%I64d",&x)
#define mod 1000000007
#define eps 1e-6
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 100002;
int n,parent[N];
struct str {int f,s,i;} a[N];
vector<str> edges;

int find(int a) {return parent[a] == a ? a : parent[a] = find(parent[a]);}
void merge(int a, int b) {parent[find(a)] = parent[find(b)];}

int main(){
    readi(n);
    lp(i,1,n) read2i(a[i].f, a[i].s), a[i].i = parent[i] = i;

    sort(a+1, a+1+n, [](str x, str y){return x.f < y.f;});
    lp(i,1,n-1) edges.pb({a[i].i, a[i+1].i, a[i+1].f - a[i].f});
    sort(a+1, a+1+n, [](str x, str y){return x.s < y.s;});
    lp(i,1,n-1) edges.pb({a[i].i, a[i+1].i, a[i+1].s - a[i].s});

    sort(all(edges), [](str x, str y){return x.i < y.i;});

    ll ans = 0;
    for(str x : edges){
        if(find(x.f) != find(x.s)){
            ans += x.i;
            merge(x.f, x.s);
        }
    }
    cout <<ans;
}

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
//ios::sync_with_stdio(0);cin.tie(0);


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

using namespace std;

struct Q {
  	int a, b, c, d;
};

void Score (int ai, int* aa, int n, int m, long* max, vector<Q>& a) {
  	for (aa[ai] = aa[ai - 1]; aa[ai] <= m; aa[ai]++) {
      	if (ai > n) {
          	long sc = 0;
          	for (unsigned int i = 0; i < a.size(); i++) {
              	if (aa[a[i].b] - aa[a[i].a] == a[i].c) {
                  	sc += a[i].d;
                }
            }
          	if (sc > *max) *max = sc;
        } else {
          	Score(ai+1, aa, n, m, max, a);
        }
    }
}

int main () {
  	int n, m, q;
	int aa[11];
  	long max = 0;
  	aa[0] = 1;
  	vector<Q> a;
  	cin >> n >> m >> q;
  	a.reserve(q);
  	for (int i = 0; i < q; i++) {
      	Q tmp;
      	cin >> tmp.a >> tmp.b >> tmp.c >> tmp.d;
      	a.push_back(tmp);
    }
  
  	Score(1, aa, n, m, &max, a);
  	cout << max << endl;
    
	return 0;
}

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

int main() {
  
  string N;
  cin >> N;
  
  bool res = false;
  if(N.at(0)==N.at(1)){
  	if(N.at(2)==N.at(3) && N.at(0)!=N.at(2)){
    	res = true;
    }
  }else if(N.at(0)==N.at(2)){
  	if(N.at(1)==N.at(3) && N.at(0)!=N.at(1)){
    	res = true;
    }
  }else if(N.at(0)==N.at(3)){
  	if(N.at(1)==N.at(2) && N.at(0)!=N.at(1)){
    	res = true;
    }
  }
  

  if( res ){ cout << "Yes" << endl; }
  else{ cout << "No" << endl; }
  

}

Measured memory_bytes: 256
#include <iostream>
#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(void){
	int root[16][16];
	int a,b,n;
	while(cin >> a >> b, a|b){
		cin >>n;
		REP(y,b)
			REP(x,a)
				root[x][y]=0;
		REP(i,n){
			int x,y;
			cin >> x >> y;
			root[x-1][y-1]=-1;
		}
		root[0][0]=1;
		REP(y,b)
			REP(x,a)
				if(root[x][y]!=-1){
					if(root[x-1][y]!=-1&&x)
						root[x][y]+=root[x-1][y];
					if(root[x][y-1]!=-1&&y)
						root[x][y]+=root[x][y-1];
				}
		cout << root[a-1][b-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1160