akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
struct Fraction{int numer,denom;};
Fraction add(Fraction f1,Fraction f2){
	return Fraction{f1.numer*f2.denom+f2.numer*f1.denom , f1.denom*f2.denom};
}

int p,q,a,n,cnt;

void solve(Fraction f,Fraction f1,int depth){
	Fraction next;
	while(1){
		next = add(f,f1);
		if(q*next.numer <= p*next.denom)break;
		f1.denom++;
	}
	if(next.denom>a)return;
	if(q*next.numer == p*next.denom){
		cnt++;
		f1.denom++;
	}
	while(1){
		Fraction tmp = {n-depth,f1.denom};
		tmp = add(f,tmp);
		if(q*tmp.numer < p*tmp.denom)return;
		next = add(f,f1);
		if(next.denom>a)return;
		solve(next,f1,depth+1);
		f1.denom++;
	}
}

int main(void){
	while(cin>>p>>q>>a>>n,p|q|a|n){
		cnt=0;
		solve(Fraction{0,1},Fraction{1,1},0);
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define INF 111111111111111111
#define MOD 1000000007
#define pb push_back
#define F first 
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag;
#pragma endregion
#define MAX 111111

bool IsPrime(ll x) {
  ll max = sqrt(x);
  if (x <= 1) {
	return false;
  }
  if (x == 2) {
	return true;
  }
  if (x % 2 == 0) {
	return false;
  }
  for (ll i = 3;i <= max;i += 2) {
	if (x%i == 0) {
	  return false;
	}
  }
  return true;
}


ll pr[11111];
int main(void) {
  bool ok;
  vll a, b;
  cin >> n;
  FOR(i, 2, 55556) {
	if (IsPrime(i)) {
	  pr[cnt] = i;
	  cnt++;
	}
  }
  
  FOR(i, 0, 5637) {
	if (pr[i] % 5 == 1) a.pb(pr[i]);
  }


  FOR(i, 0, n) {
	cout << a[i] << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  for (int i = 0; i < N - 1; i++) {
    if (A.at(i) == A.at(i + 1)) {
      cout << "NO" << endl;
      break;
    }
    else if (i == N - 2) {
      cout << "YES" << endl;
    }
  }
}


Measured memory_bytes: 4020
#include <stdio.h>
#include <stdlib.h>

struct node {
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node *Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x) {}

Node treeMaximum(Node x) {}

Node treeSearch(Node u, int k) {
  Node x = u;
  while(x != NIL) {
    if (x->key == k)
      return u;
    if (k < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  return NIL;
}

Node treeSuccessor(Node x) {}

void treeDelete(Node z) {
  Node y; // node to be deleted
  Node x; // child of y
}

void insert(int k) {
  Node y = NIL;
  Node x = root;
  Node z;

  z = (Node)malloc(sizeof(struct 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, i, x;
  char com[20];
  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%s", com);
    if (com[0] == 'f') {
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if (t != NIL)
        printf("yes\n");
      else
        printf("no\n");
    } else if (com[0] == 'i') {
      scanf("%d", &x);
      insert(x);
    } else if (com[0] == 'p') {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if (com[0] == 'd') {
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 21316
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
LL N, M, R;
vector<LL> r;
vector<vector<LL>> dist;






//サブ関数
//入力
void input()
{
	cin >> N >> M >> R;
	dist = vector<vector<LL>>(N, vector<LL>(N, INF));
	REP(i, R) {
		LL tmp;
		cin >> tmp;
		r.push_back(tmp - 1);
	}

	LL l, r, c;
	REP(i, M) {
		cin >> l >> r >> c;
		l--; r--;
		dist[l][r] = c;
		dist[r][l] = c;
	}
}

void dijkstra(vector<vector<LL>>& dist)
{
	REP(k, N)REP(i, N)REP(j, N)
		dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
}

LL measure(const vector<LL>& permu)
{
	vector<LL> route;
	for (LL now : permu)route.push_back(r[now]);

	LL res = 0;
	REP(i, permu.size() - 1) {
		res += dist[route[i]][route[i + 1]];
	}
	return res;
}


//vectorの中身を全部表示
template<typename T>
void show(vector<T> v)
{
	for (auto col : v)cout << col << " ";
	cout << endl;
}
template<typename T>
void show(vector<vector<T>> v)
{
	for (auto row : v)show(row);
	cout << endl;
}



//計算
void calc()
{
	//show(dist);
	dijkstra(dist);
	
	//show(dist);

	LL ans = INF;
	vector<LL> permu;
	REP(i, R)permu.push_back(i);
	do {
		ans = min(ans, measure(permu));
		//cout << measure(permu) << endl;
	} while (next_permutation(permu.begin(), permu.end()));
	cout << ans << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

const long long MOD = (long long)1e9 + 7;

int main(){
    int n, m;
    cin >> n >> m;
    vector<long long> x(n), y(m);
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    for(int i = 0; i < m; i++){
        cin >> y[i];
    }
    long long a = 0, b = 0;
    for(int i = 1; i < n; i++){
        a += i * x[i] - (n - i) * x[i - 1];
        while(a < 0) a += MOD;
        a %= MOD;
    }
    for(int i = 1; i < m; i++){
        b += i * y[i] - (m - i) * y[i - 1];
        while(b < 0) b += MOD;
        b %= MOD;
    }
    cout << (a * b) % MOD << endl;
    return 0;
}


Measured memory_bytes: 1792
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	m := make(map[rune]int, 0)
	for _, v := range s {
		m[v]++
	}
	ks := len(m)
	if ks == 4 {
		fmt.Println("Yes")
	} else if ks == 1 || ks == 3 {
		fmt.Println("No")
	} else {
		if (m['N'] >= 1 && m['S'] >= 1) ||
			(m['W'] >= 1 && m['E'] >= 1) {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}


Measured memory_bytes: 512
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define forn(i, n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vii;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

vi combine (const vi &l, const vi &r)
{
    if (l.empty() || r.empty())
        return l.empty() ? r : l;

    vi res(sz(l) + sz(r));
//    int pl = 0, pr = 0, h = 0;
//    while (pl < sz(l) && pr < sz(r))
//        res[h++] = (l[pl] > r[pr] ? l[pl++] : r[pr++]);
//    while (pl < sz(l))
//        res[h++] = l[pl++];
//    while (pr < sz(r))
//        res[h++] = r[pr++];
//    assert(h == sz(res));
    merge(ALL(l), ALL(r), res.begin(), greater<int>());

    return res;
}

vi dfs (int x, const vvi &g, vector<char> &used)
{
    used[x] = 1;
    vi res;

    for (int dest : g[x])
    if (!used[dest])
        res = combine(res, dfs(dest, g, used));

    res.insert(res.begin(), x);
    return res;
}

void solve (int n)
{
    vi a(n);
    forn (i, n) cin >> a[i];
    sort(ALL(a));

    vvi g(n);
    forn (i, n) forn (j, i)
    if (__gcd(a[i], a[j]) != 1)
    {
        g[i].pb(j);
        g[j].pb(i);
    }

    forn (i, n)
        sort(ALL(g[i]));

    vi res;
    vector<char> used(n);
    forn (i, n) if (!used[i])
        res = combine(res, dfs(i, g, used));

    forn (i, n)
        cout << a[res[i]] << " \n"[i + 1 == n];
}

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

    int n;
    while (cin >> n)
        solve(n);
}


Measured memory_bytes: 17024
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

#define TRACE(x) cerr << #x << " = " << x << endl
#define REP(i, n) for (int i=0; i<n; i++)
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define _ << " " <<

typedef long long ll;
typedef pair<int, int> P;
#define X first
#define Y second

const int MAX = 3005;

int p[MAX], dp[MAX];
vector <int> V[MAX];
P sor[MAX];

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

  REP(i, n) {
    scanf("%d", &p[i]);
    sor[i] = P(p[i], i);
  }

  REP(i, n-1) {
    int a, b;
    scanf("%d%d", &a, &b); a--; b--;
    V[a].push_back(b);
    V[b].push_back(a);
  }

  sort(sor, sor + n);

  REP(i, n)
    for (auto it : V[sor[i].Y])
      if (p[it] < p[sor[i].Y] && !dp[it])
	dp[sor[i].Y] = 1;
  
  REP(i, n)
    if (dp[i])
      printf("%d ", i + 1);

  printf("\n");

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;



int main() {
    int a;string s;
    cin >> a >> s;
    if(a>=3200)cout << s;
    else cout << "red";
}



Measured memory_bytes: 256
using System;
class program{
  static void Main(string[] args){
    program p= new program();
    p.Run();
  }
  
  void Run(){
    string[] inp=Console.ReadLine().Split();
    int a = int.Parse(inp[0]);
    int b = int.Parse(inp[1]);
    int t = int.Parse(inp[2]);
    int n=(int)((t+0.5)/a)*b;
    Console.WriteLine(n);
  }
}

Measured memory_bytes: 13140
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
	
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		final int A = sc.nextInt();
		final int B = sc.nextInt();
		
		System.out.println((A + B) % 24);
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
		
		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n; cin >> n;
  vector<int> data(n);
  for(int i = 0; i < n; ++i){
    cin >> data.at(i);
  }
  
  int cnt = 0;
  
  for(int i = 1; i < n-1; ++i){
    if(data.at(i) != max(data.at(i), max(data.at(i-1), data.at(i+1)))){
      if(data.at(i) != min(data.at(i), min(data.at(i-1), data.at(i+1)))){
        cnt++;
      }
    }
  }
  
  cout << cnt << endl;
}

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

int main(){
  int n;
  cin >> n;
  
  vector<int> p(n/2);
  vector<int> q(n/2);

  vector<int> pq(n);
  
  
  int num_p = 0;
  int num_q = 0;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    //cout << a << endl;
    if(i % 2 == 0){
      //p.push_back(a);
      p[num_p] = a;
      num_p++;
    }
    else {
      //q.push_back(a);
      q[num_q] = a;
      num_q++;
    }
    pq[i] = a;
  }

  sort(pq.begin(), pq.end());
  if(pq[0] == pq[n-1]){
      cout << n/2 << endl;
      return 0;
  }

  

  sort(p.begin(), p.end());
  sort(q.begin(), q.end());
  
  int count_p = 0;
  int count_q = 0;
  
  int tmp_p = p[0];
  int tmp_q = q[0];
  
  int max_p = 0;
  int max_q = 0;

  int memo_p;
  int memo_q;

  vector<int> p_c;
  vector<int> q_c;

  p.push_back(0);
  q.push_back(0);

  for(int i = 1; i <= n/2; i++){
    //cout << "p[i]:" << p[i] << " " << "tmp_p:" << tmp_p << endl;
    if(p[i] == tmp_p){
      count_p++;
    }
    else {
      tmp_p = p[i];
      p_c.push_back(count_p);
      if(count_p > max_p){
        max_p = count_p;
        memo_p = p[i-1];
      }
      count_p = 0;
    }
  }
  
  for(int i = 1; i <= n/2; i++){
    //cout << count_q << endl;
    if(q[i] == tmp_q){
      count_q++;
    }
    else {
      tmp_q = q[i];
      q_c.push_back(count_q);
      if(count_q > max_q){
        max_q = count_q;
        memo_q = q[i-1];
      }
      count_q = 0;
    }
  }

  sort(p_c.begin(), p_c.end(), greater<int>());
  sort(q_c.begin(), q_c.end(), greater<int>());

  if(memo_p == memo_q){
      if(p_c[0] > q_c[0]){
          max_p = p_c[0];
          max_q = q_c[1];
      }
      else if(p_c[0] < q_c[0]){
          max_p = p_c[1];
          max_q = q_c[0];
      }
      else {
          if(p_c[1] > q_c[1]){
              max_p = p_c[1];
              max_q = q_c[0];
          }
          else {
              max_p = p_c[0];
              max_q = q_c[1];
          }
      }
      //cout << max_p << endl;
      //cout << max_q << endl;
      cout << n - max_p - max_q - 2 << endl;
  }
  else {
      cout << n - max_p - 1 - max_q - 1 << endl;
  }
  
  
}

Measured memory_bytes: 1656
#include <stack>
#include <iostream>

using namespace std;
#define MAX_N 100
int visited[MAX_N],E[MAX_N][MAX_N],v,e,t = 0,ans = 0;
stack <int> st,root;
void search (int n){
  visited[n] = 1;
  st.push(n);

  while (!st.empty() && st.top() != t) {
    for (int i = 0; i <= t ; ++i) {
      if (visited[i] == 0 && E[n][i] != 0)
        search(i);
      if (st.top() == t) break;
      }
      if(st.top() == t) break;
      st.pop();
      break;
    }
}

/*void printst(){
    while(!root.empty()) {
      cout << root.top()<<endl;
      root.pop();
    }
}
*/

int main() {
  int a=0,b =0,maxflow = 0 ,temp1,temp2,temp3;
  cin >> v >> e;
  t = v-1;
  for (int i = 0; i < e; ++i) {
    cin >> temp1 >> temp2 >> temp3;
    E[temp1][temp2] = temp3;
  }

  while (1){
    search(0);
    if(!st.empty()){
      a = st.top() ;
      st.pop();
      root.push(a);
      for (int i = 0; i < st.size() + root.size() ; ++i) {
        a = root.top();
        if(st.empty()) break;
          b = st.top();
        st.pop();
        if (maxflow == 0)
          maxflow = E[b][a];
        else if(maxflow > E[b][a])
          maxflow = E[b][a];
        root.push(b);
      }
    }
    else break;
    //printst();
    //cout << st.size()<<endl;

    if(!root.empty()){
      a = root.top();
      root.pop();
      temp1 =root.size() ;
      for (int i = 0; i < temp1; ++i) {
        b = root.top();
        root.pop();
        E[a][b] -= maxflow;
        E[b][a] += maxflow;
        a = b;
      }
      ans += maxflow;

    }
    for (int j = 0; j <= t ; ++j) {
      visited[j] = 0;
    }

  }
  cout << ans<< endl;


 return 0;
}

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

int n,a,b,c,d,z[1999],x,y,bro[1999],j,brosky1=0,brosky2=0,m;

int main(){
    cin>>n>>m>>x;
    for(int j=1;j<=m;j++){
        cin>>z[j];
    }
    for(int i=0;i<=n+1;i++){
        bro[i]=i;
    }
    for(int i=1;i<x;i++){
        for(int j=1;j<=m;j++){
            if(bro[i]==z[j]){
            brosky1++;
            }
        }
    }
    for(int i=x+1;i<n+1;i++){
        for(int j=1;j<=m;j++){
            if(bro[i]==z[j]){
            brosky2++;
            }
        }
    }
    if(brosky1<brosky2){
        cout<<brosky1<<endl;
    }
    else if(brosky1>brosky2){
        cout<<brosky2<<endl;
    }
    else{
        cout<<brosky1<<endl;
    }
}

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

typedef long l;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define mod 1e9 + 7
#define INF 999999999
#define F first
#define S second
#define pb push_back
#define mp make_pair

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

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int num4, num2;

  cin >> n;
  num4 = num2 = 0;
  int a[n];
  REP(i, n) {
    cin >> a[i];
    if (a[i] % 4 == 0) num4++;
    else if (a[i] % 2 == 0) num2++;
  }

  num4 += num2 / 2;
  if (n / 2 <= num4) cout << "Yes\n";
  else cout << "No\n";

}


Measured memory_bytes: 640
package main

import "fmt"

func main(){
	var N, M, ans int 
	var L[1000000]int 
	var R[1000000]int 
	var left, right int
	fmt.Scan(&N, &M)

	for i := 0 ; i < M ; i++ {
		fmt.Scan(&L[i], &R[i])
	}
	left = L[0]
	right = R[0]
	for i := 1 ; i < M ; i++{
		if left < L[i] {
			left = L[i]
		}
		if R[i] < right {
			right = R[i]
		} 
	}
	for i := left ; i <= right ; i++{
		ans++
	}
/*
	for i := 0 ; i < M ; i++ {
		for j := L[i] ; j <= R[i] ; j++ {
			card[j]++
		}
	}
	ans = 0
	for i := 1 ; i <= N ; i++ {
		if card[i] == M {
			ans++
		}
	}
	*/
	fmt.Println(ans)

}

Measured memory_bytes: 12544
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

long long n, m;
vector<pair<long long, long long> > c;
long long sum[100005] = {0};

long long solve();

int main() {
  cin >> n >> m;
  c.resize(m);
  for(int i = 0; i < m; ++i) cin >> c[i].fi >> c[i].se;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(int i = 0; i < m; ++i) {
    ++sum[c[i].fi];
    --sum[c[i].se + 1];
  }
  for(int i = 1; i <= n; ++i) {
    sum[i] += sum[i - 1];
    if(sum[i] == m) ++ans;
  }
  return ans;
}

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

string devide[4] = {"dream", "dreamer", "erase", "eraser"};

int main(){
    string S;
    cin >> S;

    reverse(S.begin(), S.end());
    for (int i=0; i < 4; ++i) reverse(devide[i].begin(), devide[i].end());

    bool can = true;
    for(int i=0; i < S.size();){
        bool can2 = false;
        for(int j=0; j < 4; ++j){
            string d = devide[j];
            if(S.substr(i, d.size()) == d){
                can2 = true;
                i += d.size();
            }
        }
        if(!can2){
            can = false;
            break;
        }
    }
    if(can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b=0;
		if(a%10==1) {
			b+=9;
		}
		else {
			b+=1;
		}
		a/=10;
		if(a%10==1) {
			b+=90;
		}
		else {
			b+=10;
		}
		a/=10;
		if(a%10==1) {
			b+=900;
		}
		else {
			b+=100;
		}
		System.out.println(b);
		}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

int main()
{
    int h, w;
    cin >> h >> w;
    vector<vector<char>> grid(h, vector<char>(w));
    vector<vector<int>> score(h, vector<int>(w, INF));
    int all = 0;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> grid[i][j];
            if (grid[i][j] == '.')
            {
                ++all;
            }
        }
    }

    queue<P> qe;
    qe.push(make_pair(0, 0));
    score[0][0] = 0;
    while (!qe.empty())
    {
        P now = qe.front();
        qe.pop();
        int xs[4] = {1, -1, 0, 0};
        int ys[4] = {0, 0, 1, -1};
        for (int i = 0; i < 4; i++)
        {
            P next = make_pair(now.first + xs[i], now.second + ys[i]);
            if (next.first < 0 || next.second < 0 || next.first >= h || next.second >= w)
            {
                continue;
            }
            if (grid[next.first][next.second] == '#')
            {
                continue;
            }
            if (score[now.first][now.second] >= score[next.first][next.second] + 1)
            {
                continue;
            }
            if (score[next.first][next.second] != INF)
            {
                score[next.first][next.second] = score[now.first][now.second] + 1;
                continue;
            }

            // cout << next.first << ':' << next.second << endl;
            score[next.first][next.second] = score[now.first][now.second] + 1;
            qe.push(next);
        }
    }
    if (score[h - 1][w - 1] == INF)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << all - score[h - 1][w - 1] - 1 << endl;
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define INF 0x3f3f3f3f
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod=1000000007;
const double PI = atan(1) * 4;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N = 1e6+10;

int main() {
	int n;
	cin>>n;
	int x = n % 10;
	if(x == 2||x == 4||x == 5||x == 7||x == 9) {
		cout<<"hon\n";
	} else if(x == 0||x == 1||x == 6||x == 8) {
		cout<<"pon\n";
	} else {
		cout<<"bon\n";
	}
	return 0;
}

Measured memory_bytes: 3632
using System;

class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        string t = Console.ReadLine();
        int n = s.Length - t.Length;
        string[] strs = new string[n];
       

        for(int i = 0; i < n ; i++)
        {
            strs[i] = s.Substring(i,t.Length);
        }

        int HighIndex = 0;
        int max = 0;

        for (int i = 0 ; i < strs.Length; i++)
        {
            int count = 0;
            string st = strs[i];

            for(int j = 0; j < st.Length; j++)
            {
                if (st[j] == t[j])
                    count++;
            }

            if(count > max)
            {
                HighIndex = i;
                max = count;
            }
            




        }

        string high;
        if (n != 0)
            high = strs[HighIndex];
        else
            high = s;
        int ncount = 0;
        for(int i = 0; i < high.Length; i++)
        {
            if (high[i] != t[i])
                ncount++;
        }

        Console.WriteLine(ncount);


    }



}




Measured memory_bytes: 26424
import java.util.*;
public class Main{
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		map.put("A", 0);
		map.put("B", 0);
		map.put("O", 0);
		map.put("AB", 0);
		while(sc.hasNext()){
			String [] a = sc.next().split(",");
			map.put(a[1], map.get(a[1]) + 1);
		}
		System.out.println(map.get("A"));
		System.out.println(map.get("B"));
		System.out.println(map.get("AB"));
		System.out.println(map.get("O"));
	}
	
	public static void main(String [] args){
		new Main().doit();
	}
}

Measured memory_bytes: 12000
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int n = 0;
		int i = 0;
		while (true) {
			if (B == 1) {
				i = -1;
				break;
			}
			n = A + (A - 1) * i;
			if (B <= n) {
				break;
			}
			i++;

		}

		System.out.println(i + 1);
		sc.close();

	}
}


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

int main()
{
    int n, a, b, c, d;
    string s;

    cin >> n >> a >> b >> c >> d >> s;
    a--;b--;c--;d--;

    string ans = "Yes";
    if(c < d)
    {
        for (int i = b; i <= d - 1; i++)
        {
            if(s[i] == '#' && s[i + 1] == '#')ans = "No";
        }
        for (int i = a; i <= c - 1; i++)
        {
            if(s[i] == '#' && s[i + 1] == '#')ans = "No";
        }
    }
    else
    {
        ans = "No";
        for (int i = b - 1; i <= d - 1; i++)
        {
            if(s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.')ans = "Yes";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3728
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;
const int mod = 1e9+7;

signed main() {
  int n, m; cin >> n >> m;
  int xsum = 0, ysum = 0;
  for(int i = 1; i <= n; ++i) {
    int x; cin >> x;
    xsum = (xsum + (2 * i - n - 1) * x % mod) % mod;
  }
  for(int i = 1; i <= m; ++i) {
    int y; cin >> y;
    ysum = (ysum + (2 * i - m - 1) * y % mod) % mod;
  }
  cout << xsum * ysum % mod << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int e = sc.nextInt();
		int [] x1 = new int [a];
        int [] y1 = new int [a];
        int [] x2 = new int [e];
        int [] y2 = new int [e];
        int [] ans = new int [a];
      
        for(int i=0;i<a;i++){x1[i] = sc.nextInt();
                             y1[i] = sc.nextInt();                             
                             ans[i] = 1;
                             }
        for(int i=0;i<e;i++){x2[i] = sc.nextInt();
                             y2[i] = sc.nextInt();                           
                            }
        for(int i=0;i<a;i++){int b = 0; Long c = Long.MAX_VALUE;
        for(int j=0;j<e;j++){Long d = c-c; 
                             d+=Math.abs(x1[i]-x2[j]);
                             d+=Math.abs(y1[i]-y2[j]);
                             if(d<c){b=j;c=d;}
                             if(j==e-1){ans[i]+=b;}        
                            } 
                            }        
        for(int i=0;i<a;i++){System.out.println(ans[i]);}		
	}
}
	


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

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

const long long INF = 1LL << 60;

int N;
const int INT_MAX = 100010;
long long h[INT_MAX];
long long dp[INT_MAX];

int main(){

    int N, K;
    cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> h[i];

    for (int i = 0; i < INT_MAX; ++i) dp[i] = INF;

    dp[0] = 0;

    for (int i = 0; i < N; ++i) {
        for (int j = 1; j <= K; ++j) {
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    cout << dp[N-1] << endl;

    return 0;
}


Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
S = input()
T = input()
max = len(S)
for i in range(len(S)-len(T)+1):
    ans = len(T)
    for i,v in zip(T,S[i:i+len(T)]):
        if i == v:
            ans-=1
    if ans < max:
        max = ans
print(max)


Measured memory_bytes: 73568
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		out.println(ir.nextInt() >= 3200 ? ir.next() : "red");
	}

	public static void main(String[] args) {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

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

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

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}

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


Measured memory_bytes: 21076
from collections import defaultdict
d = defaultdict(int)

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

for i in li:
  d[i] += 1

h = 0
w = 0

new = sorted(d)

for i in new:
  if 4 > d[i] >= 2:
    if h >= w:
      w = i
    else:
      h = i

  elif d[i] >= 4:
    w = i
    h = i
    
print(w * h)

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

using namespace std;

typedef long int li;
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pt;

#define fi first
#define se second
#define dump(x) cout << #x << " = " << x << endl

li n, d, ress;
double arr[11][11];

int main () {
    cin >> n >> d;
    for (li i=0; i < n; i++) {
        for(li j=0; j < d; j++) {
            cin >> arr[i][j];
        }
    }
    ress=0;
    for (li i=0; i<n; i++){
        for(li j=i+1; j<n; j++) {
            double res=0;
            for(li k=0; k < d; k++) {
                res+=(arr[i][k]-arr[j][k])*(arr[i][k]-arr[j][k]);
            }
            res=sqrt(res);
            //dump(res);
            if (res-int(res)==0) ress++;
        }
    }
    cout << ress;
}


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

int main(void)
{
	ios::sync_with_stdio(false);

	int i, j, length, key, A[100];

	cin >> length;
	for (int i = 0; i < length; i++)	cin >> A[i];

	for (int i = 1; i < length; i++){
		cout << A[0];
		for (j = 1; j < length; j++)	cout << " " << A[j];
		cout << endl;

		key = A[i];
		j = i - 1;
		while (j >= 0 && A[j]>key)
			A[j + 1] = A[j--];
		A[j + 1] = key;
	}
	cout << A[0];
	for (j = 1; j < length; j++)	cout << " " << A[j];
	cout << endl;
	return 0;
}

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

int main()
{
    using namespace std;
    
    string str1, str2;
    int n, i, score1 = 0, score2 = 0;
    
    cin >> n;
    
    for (i = 0; i < n; ++i) {
        cin >> str1 >> str2;
        if (str1 > str2) score1 += 3;
        else if (str1 < str2) score2 += 3;
        else {
            score1++;
            score2++;
        }
    }

    cout << score1 << " " << score2 << endl;

    return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#define ll long long int 
using namespace std; 
int main(){
  ll x,y,sum=0;
  cin>>x>>y;
  if(x==1)sum+=300000;
  if(x==2)sum+=200000;
  if(x==3)sum+=100000;
  if(y==1)sum+=300000;
  if(y==2)sum+=200000;
  if(y==3)sum+=100000;
  if(x==1&&y==1)sum+=400000;
  cout<<sum<<endl;
  }

Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    long long m, rd, rr, cd, cr;
    cin >> m >> rd >> rr >> cd >> cr;

    long long x = 100 * cd / rd;
    long long y = 100 * cr / rr;
    if(rd * x / 100 < cd)
        ++ x;
    if(rr * y / 100 < cr)
        ++ y;

    if(m < x + y)
        cout << -1 << endl;
    else
        cout << (m - x - y) << endl;

    return 0;
}

Measured memory_bytes: 1160
n = int(input())
a = list(map(int, input().split()))

ans1 = 0
s1 = 0
for i in range(n):
	s1 += a[i]
	if i % 2 == 0:
		if s1 <= 0:
			ans1 += 1 - s1
			s1 = 1
	else:
		if s1 >= 0:
			ans1 += s1 + 1
			s1 = -1

ans2 = 0
s2 = 0
for i in range(n):
	s2 += a[i]
	if i % 2 == 1:
		if s2 <= 0:
			ans2 += 1 - s2
			s2 = 1
	else:
		if s2 >= 0:
			ans2 += s2 + 1
			s2 = -1

print(min(ans1, ans2))

Measured memory_bytes: 14468
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>

#define lli long long int
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

bool has(int x,int *d,int k){
	int i;
	for(i=0;i<k;i++){
		if(d[i] == x){
			return true;
		}
	}
	return false;
}

int judge(int n,int *d,int k){
	while(n){
		if(has(n%10,d,k)){
			return false;
		}
		n /= 10;
	}
	return true;
}

int main(void){
	int i;int n,k;int *d;
	scanf("%d%d",&n,&k);
	d = calloc(sizeof(int),k);
	for(i=0;i<k;i++){
		scanf("%d",&d[i]);
	}
	while(!judge(n,d,k))n++;
	printf("%d\n", n);

	return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  int X = A;
  int N;
  
	while (X <= B) {
      if (X%10 == X/10000 && X/10%10 == X/1000%10) N++;
      X++;
    }
  
  cout << N << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef pair<ll, pair<int, int>> P;
typedef pair<ll,pair<ll,ll>> T;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
int INFM =100000000;
ll MOD  = 1000000007;
int N,K;
string S;
vector<int> sum(100010);
void solve(){
    S += 'x';
    vector<pair<int, int>> T(0);
    if(S.at(0) == '0'){
        T.push_back({0, 1});
    }
    int cnt = 1;
    for(int i = 1; i <= N; i++){
        if(S.at(i) == S.at(i-1)){
            cnt++;
        }else{
            if(S.at(i-1) == '0'){
                T.push_back({cnt, 0});
            }else{
                T.push_back({cnt, 1});
            }
            cnt = 1;
        }
    }
    if(T.back().second == 0){
        T.push_back({0, 1});
    }
    
    
    sum[0] = 0;
    for(int i = 1; i <= T.size(); i++){
        sum[i] = sum[i-1] + T.at(i-1).first;
    }
    
    if(2*K+1>= T.size()){
        cout << N << endl;
    }else{
        int ans = 0;
        int i = 0;
        while(2*K+1+2*i <= T.size()){
            int res = sum[2*K+1+2*i] - sum[2*i];
            ans = max(res, ans);
            i++;
        }
        cout << ans << endl;
    }
    
}


int main(){
    cin >> N >> K >> S;
    solve();
}


Measured memory_bytes: 1912
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> P;
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 ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll modpow(ll a,ll n){
  if(n==0)return 1;
  if(n%2==0){
    ll t=modpow(a,n/2);
    return (t*t)%MOD;
  }
  return a*modpow(a,n-1)%MOD;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n,a;
  cin >> n >> a;
  n%=500;
  if(n<=a)cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;     
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long T, long long X) { cout << (double)T / X << endl; }

int main() {
  cout << setprecision(10);
  long long T;
  scanf("%lld", &T);
  long long X;
  scanf("%lld", &X);
  solve(T, X);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 0X3f3f3f3f
using namespace std;
typedef long long ll;
const int MAXN=1e9+10;
const int MAX=50000+10;
int main(){
    #ifdef ONLINE_JUDGE
    #else
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    #endif
    int n,ans=1,maxx;
    cin>>n;
    for(int i=1;i<=n;i++){
        int cnt=0;
        int temp=i;
        while(temp%2==0){
            temp=temp/2;
            cnt++;
        }
        if(maxx<cnt){
            maxx=cnt;
            ans=i;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, W;
	cin >> N >> W;
	vector<int> V[4];
	ll w1;

	rep(i, N) {
		int w, v;
		cin >> w >> v;

		if (i == 0) w1 = w;
		V[w - w1].pb(v);
	}
	rep(i, 4) {
		sort(V[i].begin(), V[i].end());
		reverse(V[i].begin(), V[i].end());
	}

	int V0 = V[0].size();
	int V1 = V[1].size();
	int V2 = V[2].size();
	int V3 = V[3].size();

	ll saidai = 0;
	rep(i, V0 + 1) {
		rep(ii, V1 + 1) {
			rep(iii, V2 + 1) {
				ll omosa = 0;
				omosa += w1 * i;
				omosa += (w1 + 1) * ii;
				omosa += (w1 + 2) * iii;
				if (omosa <= W) {
					int iiii = (W - omosa) / (w1 + 3);
					iiii = min(iiii, V3);
					ll kari = 0;
					rep(j, i) kari += V[0][j];
					rep(j, ii) kari += V[1][j];
					rep(j, iii) kari += V[2][j];
					rep(j, iiii) kari += V[3][j];
					saidai = max(saidai, kari);
				}
			}
		}
	}

	co(saidai);

	Would you please return 0;
}

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

vector<vector<pair<int, int> > > V(10001);
vector<int> C;
vector<int> ans(10001);
int N;
/*vector<int> res;*/

void dfs(int v, int p, vector<int> &C){
    for(int i = 0; i < V[v].size(); i++){
        if(V[v][i].first == p) continue;
        dfs(V[v][i].first , v, C);   
    }
    
    ans[v] = C.back();
    C.pop_back();
}

int main(void){
    // Your code here!
    cin >> N;
    
    int a, b;
    for(int i = 0; i < N-1; i++) {
        cin >> a >> b;
        a--;
        b--;
        V[a].push_back(make_pair(b, 0));
        V[b].push_back(make_pair(a, 0));
    }
    
    int c;
    int sum = 0;
    for(int i = 0; i < N; i++){
        cin >> c;
        C.push_back(c);
        sum += c;
    }
    
    sort(C.begin(), C.end(), greater<int>());
    sum -= C[0];
    
    
    dfs(0, -1, C);
    cout << sum << endl;
    for(int i = 0; i < N; i++){
        if(i == N-1) cout << ans[i] << endl;
        else cout << ans[i]  << " ";
    }
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#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 show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}



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

int main(int argc, const char * argv[]) {
    int a,b,c;
    cin >>a>>b>>c;
    if(a==b){
        cout<<c<<endl;
    }
    if(b==c){
        cout<<a<<endl;
    }
    if (a==c){
        cout<<b<<endl;
    }
        return 0;
}


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

int main() {
	int N, ma, mb, mix[450][450]; cin >> N >> ma >> mb;
	for(int i=0; i<450; ++i) for(int j=0; j<450; ++j) mix[i][j]=-1;
	mix[0][0]=0;
	for(int g=0; g<N; ++g){
	    int a, b, c; cin >> a >> b >> c;
	    for(int i=449-a; i>=0; --i){
	        for(int j=449-b; j>=0; --j){
	            if(mix[i][j]>=0){
	                if(mix[i+a][j+b]<0) mix[i+a][j+b]=mix[i][j]+c;
	                else mix[i+a][j+b]=min(mix[i+a][j+b], mix[i][j]+c);
	            }
	        }
	    }
	}
	int ans=4444;
	for(int i=1; i*max(ma, mb)<=N*10; ++i){
	    if(mix[ma*i][mb*i]>0) ans=min(ans, mix[ma*i][mb*i]);
	}
	if(ans==4444) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}


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

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

const int  MOD=1000000007;
const int  INF= int(1e9);
const int  MAX= 3005;

string s,t;
int dp[MAX][MAX];
char parent[MAX][MAX];


int lcs(int i , int j) {
    if( i < 0 || j < 0) {
        return 0;
    }
    if( dp[i][j] != -1) {
        return dp[i][j];
    }
    if( s[i] == t[j]) {
        parent[i][j] = 'D';
        return dp[i][j]=lcs(i-1,j-1) + 1;
    } else if(lcs(i-1,j) >= lcs(i,j-1)){
        parent[i][j] = 'U';
        return dp[i][j] = lcs(i-1,j);
    } else {
        parent[i][j] = 'L';
        return dp[i][j] = lcs(i,j-1);
    }
}



int main() {
    ios_base::sync_with_stdio(false);
    for(int i = 0; i < MAX; i++) {
        for(int j = 0; j < MAX; j++) {
            dp[i][j] = -1;
        }
    }

    cin >> s >> t;
    lcs(s.size()-1,t.size()-1) ;

    int cx = s.size()-1;
    int cy = t.size()-1;
    string res="";
    while( cx >= 0 && cy >= 0 ) {
        if ( parent[cx][cy] == 'D') {
            res += s[cx];
            cx--;
            cy--;
        } else if ( parent[cx][cy] == 'U') {
            cx--;
        } else {
            cy--;
        }
    }
    reverse(res.begin(),res.end());
    cout<<res<<"\n"; 
    return 0;
}



Measured memory_bytes: 44800