akhauriyash/Code-Regression huggingface dataset:
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        var q = int.Parse(line[2]);
        var a = new int[n + 1];
        for (int i = 0; i < q; i++)
        {
            var t = int.Parse(Console.ReadLine().Trim()) - 1;
            if (t == 0) { a[1]++; a[n]--; }
            else if (t == n - 1) { a[0]++; a[n - 1]--; }
            else
            {
                a[0]++; a[t]--;
                a[t + 1]++; a[n]--;
            }
        }
        getAns(a, n, k);
    }
    static void getAns(int[] a, int n, int k)
    {
        var w = 0;
        for (int i = 0; i < n; i++)
        {
            w += a[i];
            Console.WriteLine(k - w > 0 ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 17600
while True:
    r, a = raw_input().split()
    if r == a == '0': break
    h = 0
    _r = []
    _a = []
    for i in range(4):
        if a[i] == r[i]:
            h += 1
        else:
            _r.append(r[i])
            _a.append(a[i])
    else:
        print h, len(set(_r)&set(_a))

Measured memory_bytes: 4216
#include <bits/stdc++.h>
using namespace std;
void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}
int fr[205];
int main()
{   init();
    int n;
    cin>>n;
    map<string ,int>mp;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        mp[s]++;}
        cout<<"AC x "<<mp["AC"]<<endl<<"WA x "<<mp["WA"]<<endl<<"TLE x "<<mp["TLE"]<<endl<<"RE x "<<mp["RE"];

}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N], k;

int32_t main(){_
   
   cin >> n >> k;

   int ans = 0;
   while(n){
      ans++;
      n /= k;
   }

   cout<<ans;
   

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
int main(){
    int a,b;
    int sum = 0;
    std::cin >> a >> b;
    for(int i=0;i < 2; ++i){
        if(a >= b){
            sum += a;
            a-- ;
        }else{
            sum += b;
            b-- ;
        }
    }
    std::cout << sum << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace fdata
{
inline char nextchar()
{
    static const int BS = 1 << 21;
    static char buf[BS], *st, *ed;
    if (st == ed)
        ed = buf + fread(st = buf, 1, BS, stdin);
    return st == ed ? -1 : *st++;
}
#ifdef lky233
#define nextchar getchar
#endif
template <typename Y>
inline void poread(Y &ret)
{
    ret = 0;
    char ch;
    while (!isdigit(ch = nextchar()))
        ;
    do
        ret = ret * 10 + ch - '0';
    while (isdigit(ch = nextchar()));
}
#undef nextcar
} // namespace fdata
using fdata::poread;
const int MAXN = 5e5 + 10;
const int MOD = 1e9 + 7;
#define int long long 
int n, m; 
int tree[MAXN];
inline void add(int x, int d)
{
	for(; x <= n; x += (x & -x))
		tree[x] += d;
}
inline int ask(int x)
{
	register int res = 0;
	for(; x; x -= (x & -x))
		res += tree[x];
	return res;
}
int a[MAXN];
int s[MAXN], suf[MAXN];
int fac[MAXN];
signed main()
{
	poread(n);
	fac[0] = 1;
	for(register int i = 1; i <= n; ++i)
		fac[i] = (long long)fac[i - 1] * i % MOD;
	int m = n;
	for(register int i = 1; i <= n; ++i)
	{
		poread(a[i]);
		if(a[i])
			++s[a[i]], --m;
	}
	for(register int i = 1; i <= n; ++i)
		suf[i] = s[i] = 1 - s[i], s[i] += s[i - 1];
	for(register int i = n; i >= 1; --i)
		suf[i] += suf[i + 1];
	register int sum = 0, cnt = 0;
	register int res = 0;
	for(register int i = n; i >= 1; --i)
	{
		if(a[i])
		{
			sum = (long long)ask(a[i] - 1) * fac[m] % MOD;
			if(cnt)
				sum = (sum + (long long)cnt * s[a[i]] % MOD * fac[m - 1] % MOD) % MOD;
			res = (res + (long long)sum * fac[n - i] % MOD) % MOD;
			add(a[i], 1);
		}
		else
		{
			++cnt;
		}
	}
	cnt = sum = 0;
	for(register int i = 1; i <= n; ++i)
	{
		if(a[i])
		{
			if(cnt)
				res = (res + (long long)sum * suf[a[i]] % MOD * fac[m - 1] % MOD) % MOD;
		}
		else
		{
			sum = (sum + fac[n - i]) % MOD;
			++cnt;
		}
	}
	sum =  (long long)(m * (m - 1) >> 1 ) % MOD, cnt = 0;
	if(m >= 2)	
		for(register int i = 1; i <= n; ++i)
		{
			if(!a[i])
			{
				++cnt;
				res = (res + (long long)sum * (m - cnt) % MOD * fac[m - 2] % MOD * fac[n - i] % MOD);
			}
		}
	res = (res + fac[m]) % MOD;
	cout << res << endl;
}

Measured memory_bytes: 21760
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int n;
	cin >> n;
	vector<pair<int,int>> v(n);
	for(auto &x : v)
		cin >> x.F >> x.S;
	
	vector<int> a;
	int fac = 1;
	for(int i = 0; i < n; i++){
		a.push_back(i);
		fac *= (i+1);
	}
	
	long double dist = 0;
	
	do{
		for(int i = 1; i < n; i++){
			dist += sqrt(1.0*abs(v[a[i]].F-v[a[i-1]].F)*abs(v[a[i]].F-v[a[i-1]].F) + 1.0*abs(v[a[i]].S-v[a[i-1]].S)*abs(v[a[i]].S-v[a[i-1]].S));
		}
	}
	while(next_permutation(a.begin(),a.end()));
	
	cout << setprecision(10) << fixed << dist / fac;

	return 0;
}



Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>

using namespace std;

typedef long long int lo;
#define fast ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0);
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define inf (int)1e9
#define N (int)1e5 * 5
#define mod (int)1e9 + 7
#define all(x) (x).begin(), (x).end()
int in(){
    int a;
    cin >> a;
    return a;
}
int gcd(int a, int b){
    if(b == 0){
        return a;
    }
    return gcd(b, a % b);
}

void solve(){
    int x, y;
    cin >> x >> y;
    cout << x * y << endl;
}

int main(){
    // freopen("gir.gir", "r", stdin);
    // freopen("cik.cik", "w", stdout);
    fast
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
/*

*/


Measured memory_bytes: 3684
open Printf
open Scanf

type node = { p : int option; l : int option; r : int option; d : int; h : int}
              
let id x = x

let parent_of_node = function
    {p = Some x} -> x
  | _ -> (-1)

let sibling_of_node tr i = match tr.(i) with
    {p = Some x} -> let pn = tr.(x) in
                    begin
                      match pn with
                        {l = Some y; r = Some z} when y = i -> z
                      | {l = Some y; r = Some z}  -> y
                      | _ -> (-1)
                    end
  | _ -> (-1)
           
let degree_of_node = function
    {l = Some _; r = Some _} -> 2
  | {l = Some _} -> 1
  | {r = Some _} -> 1
  | _ -> 0

let type_of_node = function
    {p = None} -> "root"
  | {l = None; r = None} -> "leaf"
  | _ -> "internal node"

let find_root tr =
  let l = Array.length tr in
  let rec iter i =
    if i = l then failwith "find_root"
    else if tr.(i).p = None then i
    else iter (i+1)
  in iter 0

let set_depth tr n =
  let rec iter d = function
      Some x -> tr.(x) <- {tr.(x) with d = d}; iter (d+1) tr.(x).l; iter (d+1) tr.(x).r
    | None -> ()
  in iter 0 (Some n)

let set_height tr n =
  let rec iter = function
      Some x -> let lh = iter tr.(x).l and rh = iter tr.(x).r in
                let h = max lh rh in
                tr.(x) <- {tr.(x) with h = h}; h+1
    | None -> 0
  in
  iter (Some n) |> ignore
       
let () =
  let n = scanf "%d\n" id in
  let btree = Array.make n {p = None; l = None; r = None; d = 0; h = 0} in
  let rec read n =
    if n = 0 then ()
    else begin
        let i, l, r = scanf "%d %d %d\n" (fun x y z -> (x, y, z)) in
        begin
          btree.(i) <- {btree.(i) with l = (if l <> (-1) then Some l else None);
                                       r = (if r <> (-1) then Some r else None)};
          if l <> (-1) then btree.(l) <- {btree.(l) with p = Some i};
          if r <> (-1) then btree.(r) <- {btree.(r) with p = Some i}
        end;
        read (n-1)
      end
  in
  read n;
  let r = find_root btree in
  set_depth btree r;
  set_height btree r;
  Array.iteri (fun i n ->
               printf "node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n"
                      i (parent_of_node n) (sibling_of_node btree i) (degree_of_node n)
                      (n.d) (n.h) (type_of_node n)
             ) btree

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

int main(void){

    int h, n;
    int a;
    int i, j;

    scanf("%d%d",&h, &n);
    for(i=1;i<=n;i++){
        scanf("%d",&a);
        h -= a;
    }

    if(h <= 0) printf("Yes");
    else printf("No");

    return 0;
}

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

int main(){
  int sum[2] = {0};

  for(int i = 0; i < 2; i++){
    int x[10];
    for(int j = 0; j < 10; j++){
      cin >> x[j];
    }
    sort(x, x + 10);
    sum[i] += x[9] + x[8] + x[7];
  }
  cout << sum[0] << " " << sum[1] << endl;
}

Measured memory_bytes: 1180
n,m = list(map(int, input().split()))

gates = [0] * (n + 2)

for _ in range(m):
    l,r = list(map(int, input().split()))
    gates[l] += 1
    gates[r+1] -= 1

from itertools import accumulate
gates = list(accumulate(gates))

print(gates.count(m))

Measured memory_bytes: 13852
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >


int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
ll po(ll b,ll p){
    ll res=1;
    while(p){
        res*=b;
        p--;
    }
    return res;
}
ll lg2(ll x){
    ll res=0;
    while(x>1){
        res++;
        x/=2ll;
    }
    return res;
}
void solve(){
    ll x;
    cin>>x;
    ll lg=1;
    //cout<<lg<<endl;
    ll sum=0;
    while(lg<=x){
        sum+=lg;
        lg<<=1;
    }
    cout<<sum<<endl;
}

signed main()

{
    IOS;
    /*#ifndef ONLINE_JUDGE
        freopen ("data.in","r",stdin);
        freopen ("data.out","w",stdout);
    #endif*/
    int t;
    t=1;
    while(t--){
        solve();
    }

     return 0;

}
///Alhamdulillah




Measured memory_bytes: 256
#include<stdio.h>
#define N 101
#define WHITE -3
#define GRAY -2
#define BLACK -1

typedef struct{
  int Adj[N];
  int color;
  int k;
  int d;
  int f;
}Node;

Node node[N];
int n, time;

void visit(int u){
  int i;
  node[u].color = GRAY;
  node[u].d = ++time;
  for(i = 0;i < node[u].k;i++){
    if(node[node[u].Adj[i]].color == WHITE)
      visit(node[u].Adj[i]);
  }
  node[u].color = BLACK;
  node[u].f = ++time;
}

void DFS(void){
  int i;
  for(i = 1;i < n+1;i++){
    node[i].color = WHITE;
    time = 0;
  }
  for(i = 1;i < n+1;i++)
    if(node[i].color == WHITE)
      visit(i);
}

int main(){
  int i, j, l, id;
  scanf("%d", &n);
  for(i = 1;i < n+1;i++){
    scanf("%d%d", &id, &node[i].k);
    for(j = 0;j < node[i].k;j++)
      scanf("%d", &node[i].Adj[j]);
  }
  DFS();
  for(i = 1;i < n+1;i++)
    printf("%d %d %d\n", i, node[i].d, node[i].f);
  
  return 0;
}

Measured memory_bytes: 636
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	string S,T;
	cin >> S >> T;
	bool ok=false;
	ll itr = 0;
	ll end = 0;
	ll go = S.size() - T.size();
	if (go>=0) {
		for (int i = 0;i <= S.size() - T.size();i++) {
			itr = i;
			for (int u = 0;u < T.size();u++) {
				if (S[itr] == T[u] || S[itr] == '?') itr++;
				else break;
				if (u == T.size() - 1) {
					ok = true;
					end = itr;
				}
			}
		}
	}
	if (!ok)cout << "UNRESTORABLE" << endl;
	else {
		ll begin = end - T.size();
		ll o = 0;
		for (int i = begin;i < end;i++) {
			S[i] = T[o];
			o++;
		}
		for (int i = 0;i < S.size();i++) {
			if (S[i] != '?')cout << S[i];
			else cout << "a";
		}
	}
}

Measured memory_bytes: 256
from collections import deque

N,X,Y = map(int,input().split())
X -= 1
Y -= 1

num = [0]*(N-1)

G = [set() for x in range(N)]
for i in range(N-1):
    G[i].add(i+1)
    G[i+1].add(i)

G[X].add(Y)
G[Y].add(X)

def bfs(x):
    search = [0]*N
    nu = 1
    q = deque()
    q.append((x,-1))
    search[x] = 1
    while nu != 0:
        xx,d = q.pop()
        nu -= 1
        if x < xx:
            num[d] += 1
        for g in G[xx]:
            if search[g]:
                continue
            q.appendleft((g,d+1))
            search[g] = 1
            nu += 1

for i in range(N-1):
    bfs(i)

print(*num,sep="\n")

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

int main() {
  string w;
  int cnt = 0;
  char c = 'a';
  bool TF = true;
  cin >> w;
  for(int j=0;j<26;j++){
    for(int i=0;i<w.size();i++){
      if(w.at(i) == c){
        cnt += 1;
      }
    }
    if(cnt%2 != 0){
      TF = false;
      break;
    }
    c += 1;
  }
  if(TF == true){
    cout << "Yes" << endl;
  }
  else if(TF == false){
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a, b, d, r;
	double f;
	
	scanf("%d%d", &a, &b);
	
    	//a/b(整数)
    	d = a / b;
    	//a/bの余り
    	r = a % b;
	    //a/b(浮動小数点数)
	   // f = (float)a / (float)b;
	    f = (0.1*a) / (0.1*b);
	    
	    printf("%d %d %lf\n", d, r, f);
	return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#include <cstdio>
 
using namespace std;
using ll = long long;
 
#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS resize
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);
 
#define MOD 1000000007
void init();
void solve();

signed main()
{
    init();
    solve();
}

int N;

void init()
{
	cin >> N;
}

void solve()
{
	int sum = 0;
	int i;
	for (i = 1; sum < N; i++) {
		sum += i;
	}
	i--;
	reps(j, 1, i+1) {
		if (j + N != sum) cout << j << endl;
	}
}

Measured memory_bytes: 256
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		line := scanner.Text()
		base, err := strconv.Atoi(line)
		if err != nil {
			return
		}
		fmt.Println(base * base * base)
	}

	if err := scanner.Err(); err != nil {
		// log.Println(err)
		return
	}
}



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

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);

template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const {
    return mint(-x);
  }
  mint &operator+=(const mint a) {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    return mint(*this) += a;
  }
  mint operator-(const mint a) const {
    return mint(*this) -= a;
  }
  mint operator*(const mint a) const {
    return mint(*this) *= a;
  }
  mint pow(ll t) const {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a) {
    return *this *= a.inv();
  }
  mint operator/(const mint a) const {
    return mint(*this) /= a;
  }
};
istream &operator>>(istream &is, const mint &a) {
  return is >> a.x;
}
ostream &operator<<(ostream &os, const mint &a) {
  return os << a.x;
}

mint dp[200005];

void solve(long long N, long long K, std::vector<long long> L, std::vector<long long> R) {
  REP(i, K) {
    dp[L[i]] += 1;
    dp[R[i] + 1] -= 1;
  }
  mint cur = 0;
  FOR(j, 1, N) {
    cur += dp[j];
    REP(i, K) {
      if (L[i] + j < 200005)
        dp[L[i] + j] += cur;
      if (R[i] + 1 + j < 200005)
        dp[R[i] + 1 + j] -= cur;
    }
  }
  cout << cur << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> L(K);
  std::vector<long long> R(K);
  for (int i = 0; i < K; i++) {
    scanf("%lld", &L[i]);
    scanf("%lld", &R[i]);
  }
  solve(N, K, std::move(L), std::move(R));
  return 0;
}


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

long long solve(int W, int curr_item, vector<pair<int,long long> > const &items, vector<vector<long long> > &dp)
{
    if(W<0 || curr_item==0)
    return 0;
    if(dp[W][curr_item]!=-1)
    return dp[W][curr_item];
    if(items[curr_item-1].first>W)
    return dp[W][curr_item]=solve(W,curr_item-1,items,dp);
    
    long long not_take = solve(W,curr_item-1, items, dp);
    long long take = solve(W-items[curr_item-1].first, curr_item-1, items, dp)+items[curr_item-1].second;
    return dp[W][curr_item]=max(take,not_take);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,W;
    cin>>n>>W;
    vector<pair<int,long long> > items;
    int weight,value;
    for(int i=0 ; i<n ; ++i)
    {
        cin>>weight>>value;
        items.push_back({weight,value});
    }
    vector<vector<long long> > dp(W+4,vector<long long>(items.size()+4,-1));
    cout<<solve(W,n,items,dp)<<endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, ans = 0;
  string s;
  cin >> s;

  cout << s[0] << s[1] << s[2] << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int N,Y; scanf("%d %d", &N, &Y);



	REP(x,N+1){
		int _x = 10000*x;
		REP(y,N+1){
			int z = N - (x + y);
			if(0 <= z and (_x+y*5000+1000*z) == Y){
				printf("%d %d %d\n", x, y, z);
				return 0;
			}
			
		}
	}




	printf("-1 -1 -1\n");
	return 0;

}


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

 
int main() {
int n;
 cin >> n;
 vector<int> p(n);
 rep(i, n) cin >> p[i];
 int k = 0;
 rep(i, n) if(p[i] != i + 1) k++;
 if(k <= 2) cout << "YES" << endl;
 else cout << "NO" << endl;
 return 0;
 }


Measured memory_bytes: 256
/*2020/03/15 ABC 050*/

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


int main() {
    int a, b;
    char cp;
    cin >> a >> cp >> b;
    if(cp=='+') cout << a+b << endl;
    else cout << a-b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple



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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);



int a, b;

cin >> a >> b;

if(a<=8 &&b <=8){
    cout << "Yay!" << endl;
}
else cout << ":(" << endl;





return 0;}


Measured memory_bytes: 256
N=int(input())
S=[0]*N
T=[0]*N
for i in range(N):
    S[i],T[i]=input().split()
    T[i]=int(T[i])
X=str(input())
count=0
for i in S:
    count+=1
    if(X==i):
        break
    else:
        pass
print(sum(T[count:N]))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 220
// 44

using namespace std;

const int MOD = 998244353;
const int MAXN = (int) 3e5;

int fact[MAXN + 1];
int invfact[MAXN + 1];

inline int lgput(int a, int b) {
    int ans = 1;
    while(b > 0) {
        if(b & 1)
            ans = (1LL * ans * a) % MOD;
        b >>= 1;
        a = (1LL * a * a) % MOD;
    }
    return ans;
}

inline void prec() {
    int i;
    fact[0] = 1;
    for(i = 1; i <= MAXN; i++) {
        fact[i] = (1LL * fact[i - 1] * i) % MOD;
    }
    invfact[MAXN] = lgput(fact[MAXN], MOD - 2);
    for(i = MAXN - 1; i >= 0; i--) {
        invfact[i] = (1LL * invfact[i + 1] * (i + 1)) % MOD;
    }
}

inline int comb(int n, int k) {
    return (1LL * fact[n] * ((1LL * invfact[k] * invfact[n - k]) % MOD)) % MOD;
}

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int n, a, b, i;
    ll k;
    ios::sync_with_stdio(false);
    cin >> n >> a >> b >> k;
    int ans = 0;
    prec();
    for(i = 0; i <= n; i++) {
        ll val = 1LL * a * i;
        if(val <= k && (k - val) % b == 0 && (k - val) / b <= n) {
            ans = (ans + 1LL * comb(n, i) * comb(n, (k - val) / b)) % MOD;
        }
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 2688
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {


    public static void main(String args[] ) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String Origin = br.readLine();
        String Serch = br.readLine();

        String[] origin = Origin.split("");
        String[] serch = Serch.split("");
        int plusi = PlusI(serch);

        int Origin_length = origin.length;
       // System.out.println( SameString(serch) );
        for(int i = 0 ; i < origin.length; ){


           int equal_point = Origin.indexOf(Serch , i);

           if(equal_point>-1){
        	   System.out.println(equal_point);
        	   i = equal_point+1;
           }
           else{
        	    i += plusi;
           }

        }


    }


    public static int PlusI(  String[] Serch ){


    	for(int j = 0; j < Serch.length; j++ ){

    	    if( Serch[j].equals(Serch[0]) && 0 < j){
    	    	return j;
    	    }

    	}


        return Serch.length;


    }


    public static boolean SearchWord(String[] Origin , String[] Serch , int i){


    	boolean SerchCheck = false;
    	for(int j = i , k = 0; k < Serch.length; j++ , k++){

    	    if( Serch[k].equals(Origin[j]) ){
    	    	SerchCheck = true;
    	    }
    	    else{
    	    	return false;
    	    }



    	}


    	return SerchCheck;

    }


    public static boolean SameString(String[] Serch ){


    	boolean SerchCheck = false;
    	for(int i = 0 ; i < Serch.length; i++){

    	    if( Serch[0].equals(Serch[i]) ){
    	    	SerchCheck = true;
    	    }
    	    else{
    	    	return false;
    	    }



    	}


    	return SerchCheck;

    }



}

Measured memory_bytes: 24984
#include <bits/stdc++.h>
#define int long long
using namespace std;

int n;
string s;
int dp[200005][2];
const int INF = 1e9;

signed main(){
  
  cin>>n;
  
  cin>>s;
  
  for(int i=0;i<=n;i++){
    for(int j=0;j<2;j++) dp[i][j] = INF;
  }
  
  dp[0][0] = 0;
  
  for(int i=0;i<n;i++){
    
    for(int j=0;j<2;j++){
      
      if( dp[i][j] == INF ) continue;
      
      if( j == 0 ){
	
	if( s[i] == '.' ){
	  dp[i+1][0] = min( dp[i+1][0], dp[i][j] );
	  dp[i+1][1] = min( dp[i+1][1], dp[i][j] + 1 );
	}
	else{
	  dp[i+1][0] = min( dp[i+1][0], dp[i][j] + 1 );
	  dp[i+1][1] = min( dp[i+1][1], dp[i][j] );
	}
	
      }
      else{

	if( s[i] == '.' ){
	  dp[i+1][1] = min( dp[i+1][1], dp[i][j] + 1 );
	}
	else dp[i+1][1] = min( dp[i+1][1], dp[i][j] );
      }
      
    }
        
  }
  
  cout<<min( dp[n][0], dp[n][1] )<<endl;
  
  return 0;
}


Measured memory_bytes: 3716
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>

#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define INF 1000000000

int main()
{
	int n, m;
	int mat[100][100];
	int ans[100] = { 0 };
	int vec[100];

	scanf("%d%d", &n, &m);

	int i, j,k;

	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
			scanf("%d", &mat[i][j]);
	}

	for (i = 0; i < m; i++)
		scanf("%d", &vec[i]);

	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			ans[i] += vec[j] * mat[i][j];
		}
	}

	for (i = 0; i < n; i++)
		printf("%d\n", ans[i]);

	return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}


int main (){
    int n;
    cin >> n;
    double mn=inf;
    double sum=0;
    int ans;
    vector<double>a(n);
    rep(i,n){
        double x;
        cin >> x;
        a[i]=x;
        sum+=x;
    }
    sum/=n;
    rep(i,n){
        double sub=abs(a[i]-sum);
        if(sub<mn) {
            mn=sub;
            ans=i;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  int d, n;
  int ans = 1;
  cin >> d >> n;
  
  for ( int i = 0; i < d; i++ ){
    ans *= 100;
  }
  if ( n != 100 )
    ans *= n;
  else
    ans *= 101;
  cout << ans << endl;
}

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

int main(){
  int N;cin>>N;
  vector<pair<string,int>> m(N);
  rep(i,N){
    string s;int t;cin>>s>>t;
    m[i] = {s,t};
  }
  string X;cin>>X;
  bool flag = false;
  ll ans = 0;
  rep(i,N){
    if(flag) ans += m[i].second;
    if(m[i].first==X) flag = true;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
const int maxn = 100010;

int pow5(int x) {
	return x * x * x * x * x;
}

int X;
int32_t main() {
	FAST	
	cin >> X;
	for (int a = -150; a <= 150; a++) {
		for (int b = -150; b <= 150; b++) {
			if (pow5(a) - pow5(b) == X) {
				cout << a << " " << b;
				return 0;
			}
		}
	}
	assert(0);
	
}



Measured memory_bytes: 3652
#include<stdio.h>
#include<string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
    int n,i,a[10005];
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    int num=1,j;
    for(i=i-1;i>=1;i--)
    {
        int flag=0;
        for(j=i-1;j>=0;j--)
           if(a[i]<a[j])
            {flag=1;break;}
        if(flag==0)
            num++;
        else
            flag=0;
    }
    printf("%d\n",num);
	return 0;
}


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

struct Node{
  int key;
 struct Node *prev,*next;
};

void init();
void insert(int );
struct Node* listSearch(int );
void delete_N(struct Node *);
void delete_K(int );
void deleteFirst();
void deleteLast();

struct Node *nil;

int main(){
  int n=0;
  int key=0;
  int i=0;
  char order[20];
  char space[2];
  struct Node *now;

  scanf("%d%c",&n,&space[0]);
  init();
  for(i=0;i<n;i++){
    scanf("%s%d%c",order,&key,&space[0]);
    if(order[0]=='i'){
      insert(key);
    }
    else if(order[0]=='d')
      {
	if(order[6]=='F')deleteFirst();
	else if(order[6]=='L')deleteLast();
	else {
	  delete_K(key);
	}
      }
  }
  now=nil->next;
  i=0;
  while(1){
    if(now==nil)break;
    if(i!=0) printf(" ");
    printf("%d",now->key);
    now=now->next;
    i++;
  }
  printf("\n");
  return 0;
}

void init(){
  nil=(struct Node *)malloc(sizeof(struct Node));
  nil->next=nil;
  nil->prev=nil;
}

void insert(int k){
  struct Node *x;
  x=(struct Node *)malloc(sizeof(struct Node));
  x->key=k;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}

struct Node* listSearch(int k){
  struct Node *now;
  now=nil->next;
  while(now != nil && now->key !=k) now=now->next;

  return now;
}

void delete_N(struct Node *t){
  if(t!=nil){
    t->prev->next=t->next;
    t->next->prev=t->prev;
    free(t);
  } 
}

void delete_K(int k){
  delete_N(listSearch(k));
}

void deleteFirst(){
  delete_N(nil->next);
}

void deleteLast(){
  delete_N(nil->prev);
}



Measured memory_bytes: 33044
#include <set>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    int tmp = n;
    int d[k];
    for (int i = 0; i < k; i++)
    {
        cin >> d[i];
    }
    while (n < 100000)
    {
        set<int> s;
        while (tmp != 0)
        {
            s.insert(tmp % 10);
            tmp /= 10;
        }
        bool flag = true;

        for (int i = 0; i < k; i++)
        {
            if (s.count(d[i]) == 1)
            {
                flag = false;
            }
        }
        if (flag)
        {
            cout << n << endl;
            break;
        }
        n++;
        tmp = n;
    }
    return 0;
}

Measured memory_bytes: 256
class dr_count(object):
    def __init__(self):
        self.w = 0
        self.e = 0


N = int(input())
S = input()
count = []
minn = 300000 
for x in range(0,N):  
    count.append(dr_count())
    if x == 0:
        if S[x] == 'E':
            count[x].e += 1
    else:
        if S[x] == 'E':
            count[x].e = count[x-1].e + 1
        else:
            count[x].e = count[x-1].e
a = N-1
while a>=0:
    if a == N-1:
        if S[a] == 'W':
            count[a].w += 1
    else:
        if S[a] == 'W':
            count[a].w = count[a+1].w + 1
        else:
            count[a].w = count[a+1].w
    a -= 1
for x in range(0,N):
    if x == 0:
        num = N - x - 1 - count[x+1].w
    elif x == (N-1):
        num = x - count[x-1].e
    else:
        num = N - x - 1 - count[x+1].w + x - count[x-1].e
    minn = min(num,minn)
print(minn)

Measured memory_bytes: 66976
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        int x,a,b;
        Scanner sc = new Scanner(System.in);
        x = sc.nextInt();
        a = sc.nextInt();
        b = sc.nextInt();
        System.out.println((x-a)%b);
    }
}

Measured memory_bytes: 21716
N, T = [int(i) for i in input().split()]
t = [int(t) for t in input().split()]

total = T
for i in range(N-1):
    if t[i+1] - t[i] < T:
        total += t[i+1] - t[i]
    else:
        total += T
print(total)



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

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

int main() {
  int N;
  cin >> N;
  map<string, int> data;

  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    data[s]++;
  }
  int M;
  cin >> M;
  for (int i = 0; i < M; i++) {
    string s;
    cin >> s;
    data[s]--;
  }
  int ans = 0;
  for (auto tmp : data) {
    if (tmp.second >= 0) chmax(ans, tmp.second);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define ll long long
using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	int ridable = 0;

	for (int i = 0; i < n; i++) {
		int hi;
		cin >> hi;
		if (hi >= k)ridable++;
	}

	printf("%d", ridable);

	return 0;
}




Measured memory_bytes: 256
from collections import defaultdict
from math import gcd
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
dic=defaultdict(lambda: [0,0])
c=0
d=0
e=0
for i in [0]*N:
 A,B = map(int,input().split())
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
  g=gcd(A,B)
  A//=g
  B//=g
  if A*B>0:
   dic[(abs(A),abs(B))][0]+=1
  else:
   dic[(abs(B),abs(A))][1]+=1
ans=1
for k in dic:
 ans=ans*(pow(2,dic[k][0],mod)+pow(2,dic[k][1],mod) -1)
ans=ans*(pow(2,c,mod)+pow(2,d,mod)-1)
print((ans-1+e)%mod)

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

int main() {
  int h,w;
  cin>>h>>w;
  vector<vector<int>> a(h, vector<int>(w));
  int sum=0;
  rep(i, h) {
    rep(j, w) {
      cin>>a[i][j];
      if (a[i][j]%2==1) sum++;
    }
  }
  vector<int> a1,a2,a3,a4;
  rep(i, h-1) {
    rep(j, w) {
      if (a[i][j]%2==1) {
        a[i][j]--;
        a[i+1][j]++;
        a1.push_back(i+1);
        a2.push_back(j+1);
        a3.push_back(i+2);
        a4.push_back(j+1);
      }
    }
  }
  rep(j, w-1) {
    if (a[h-1][j]%2==1) {
      a[h-1][j]--;
      a[h-1][j+1]++;
      a1.push_back(h);
      a2.push_back(j+1);
      a3.push_back(h);
      a4.push_back(j+2);
    }
  }
  printf("%d\n", a1.size());
  rep(i, a1.size()) {
    printf("%d %d %d %d\n", a1[i],a2[i],a3[i],a4[i]);
  }
  return 0;
}


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

int main()
{
  vector<int> vec(3);
  cin >> vec.at(0) >> vec.at(1) >> vec.at(2);

  sort(vec.begin(), vec.end());

  if ((vec.at(0) == vec.at(1) && vec.at(1) != vec.at(2)) || (vec.at(0) != vec.at(1) && vec.at(1) == vec.at(2)))
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
while !((n = gets.to_i).zero?)
  s = gets.split.map(&:to_i)
  m = s.sum.fdiv(s.length)
  s_sq = s.map {|s| s ** 2}
  m_sq = s_sq.sum.fdiv(s_sq.length)
  puts Math.sqrt(m_sq - m ** 2)
end


Measured memory_bytes: 6948
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE long long
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
	return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}
long long gcd(long long x,long long y){
	return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
	return x/gcd(x,y)*y;
}

long long fact_mod(long long x){
	if(x<=1)return 1;
	return x*fact_mod(x-1)%mod;
}

int n;
long long t[5];
long long m[3];
long long ans;

void search(int i,int k){
	if(k==3){
		ans+=t[m[0]]*t[m[1]]*t[m[2]];
		return;
	}
	if(i==5)return;
	search(i+1,k);
	m[k]=i;
	search(i+1,k+1);
}

int main(void){
	int i,j;
	char s[11];
	n=in();
	rep(i,n){
		chin(s);
		switch(s[0]){
			case 'M':t[0]++;break;
			case 'A':t[1]++;break;
			case 'R':t[2]++;break;
			case 'C':t[3]++;break;
			case 'H':t[4]++;break;
			default :break;
		}
	}
	search(0,0);
	llprint(ans);
	return 0;
}

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


int main()
{
    ll n;
    cin >> n;
    vector<ll> H(n);

    for(ll i=0;i<n;i++){
        cin >>H[i];
    }
    ll cnt =0;
    ll cnt_max=0;
    for(ll i=0;i<n-1;i++){
        if(H[i]>=H[i+1]){
            cnt++;
        }
        cnt_max=max(cnt,cnt_max);
        if(H[i]<H[i+1]){
            cnt=0;
        }
    }
    cout << cnt_max << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
  int saidai=0;
  for(int i=0;i<n;i++){
  saidai=max(saidai,vec.at(i));
  }
  vector<int> vect(n);
  for(int i=0;i<n;i++){
    vect.at(i)=vec.at(i);
  }
  sort(vect.begin(),vect.end());
  int nibanme=0;
  nibanme=vect.at(n-2);
    for(int i=0;i<n;i++){
      if(vec.at(i)==saidai){
        cout<<nibanme<<endl;
      }
      else{
        cout<<saidai<<endl;
      }
  }
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, a, max, min;
    long sum;
    cin >> n >> a;
    max = a;
    min = a;
    sum = a;

    for(int i=1; i<n; i++){
        cin >> a;
        if(a > max) max = a;
        if(a < min) min = a;
        sum += a;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
}

Measured memory_bytes: 3084
#include <stdio.h>
int main(void){
    char yj[114],snpi[514];
    char tmp;
    int i,j,length=0;
    gets(yj);
    gets(snpi);
    while(yj[i]>'a'-1){
        length++;
        i++;
    }
    for(i=0;i<length;i++){
        tmp=yj[0];
        for(j=0;j<length;j++){
            yj[j]=yj[j+1];
        }
        yj[length-1]=tmp;
        for(j=0;j<length;j++){
            if(yj[j]!=snpi[j]){break;}
        }
        if(j==length){puts("Yes");return 0;}
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
pll dat[400010];
ll u;
void seginit(ll n){
    for(int i=0;;i++){
        ll y=pow(2,i);
        if(y>=n){
            u=y;
            break;
        }
    }
    fill(dat,dat+2*u,make_pair(-inf,-inf));
}
void add(ll n,ll x){
    ll i=n+u-1;
    dat[i]=make_pair(x,n);
    while(i>0){
        i=(i-1)/2;
        dat[i]=max(dat[2*i+1],dat[i*2+2]);
    }
}
pll que(ll a,ll b,ll k,ll l,ll r){
    if(a>=r||b<=l)return make_pair(-inf,-inf);
    if(a<=l&&b>=r)return dat[k];
    pll m1=que(a,b,2*k+1,l,(l+r)/2);
    pll m2=que(a,b,2*k+2,(l+r)/2,r);
    return max(m1,m2);
}
ll d[2510];
ll n,m,p;
ll jud=0;
struct edge{ll from,to,cost;};
edge es[5010];
void bellmanford(ll s){
    
    
    for(int j=0;;j++){
        int c=0;
        for(int i=0;i<m;i++){
            edge e=es[i];
            if(d[e.from]<1000000000000){
                if(d[e.to]>d[e.from]+e.cost+p){
                    d[e.to]=d[e.from]+e.cost+p;
                    c=1;
                }
            }
            
        }
        if(c==0)break;
        if(j==2*n){
            jud=1;
            break;
        }
    }
    return;
}


int main(){
    cin>>n>>m>>p;
    vector<pll> v[n+1];
    rep(i,0,m){
        ll a,b,c;cin>>a>>b>>c;
        es[i]={a,b,-c};
    }
    rep(i,1,n+1)d[i]=inf;
    d[1]=0;
    bellmanford(1);
    //rep(i,0,2)cout<<d[i]<<" ";
    if(jud==0){
        cout<<max((ll)0,-d[n])<<endl;
        return 0;
    }
    ll now=d[n];
    jud=0;
    bellmanford(1);
    //cout<<d[1]<<" "<<d[2]<<endl;
    if(d[n]==now){
        cout<<max((ll)0,-d[n])<<endl;
        
    }
    else cout<<-1<<endl;
}


Measured memory_bytes: 384
N,A,B = map(int,input().split())
h_list = []
h_max = 0
for i in range(N):
    h = int(input())
    h_list.append(h)
    h_max = max(h, h_max)

def judge(n):
    H = [h - n*B for h in h_list]
    H_2 = [int((h-1)/(A-B)) + 1 if h > 0 else 0 for h in H]
    return sum(H_2) <= n

M = int(h_max / B) + 1
m = 0

while M-m > 1:
    n = int((M+m)/2)
    if judge(n):
        M = n
    else:
        m = n

print(M)

Measured memory_bytes: 15004