akhauriyash/Code-Regression huggingface dataset:
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	tt := make([]float64, n)
	vv := make([]float64, n+1)
	for i := 0; i < n; i++ {
		tt[i] = float64(getNextInt(scanner))
	}
	for i := 0; i < n; i++ {
		vv[i] = float64(getNextInt(scanner))
	}
	vv[n] = 0
	ans := solve(n, tt, vv)
	fmt.Fprintln(writer, ans)

	writer.Flush()
}

func solve(n int, tt, vv []float64) float64 {
	ans := 0.0
	xx := make([]float64, n+1)
	for i := 0; i < n; i++ {
		xx[i+1] = xx[i] + tt[i]
	}

	// 終端まで考慮した時の減速対象区間インデックス
	limits := make([]int, n+1)
	for s := 1; s <= n; s++ {
		limits[s] = s
		for t := s + 1; t <= n; t++ {
			if xx[t]+vv[t] < xx[limits[s]]+vv[limits[s]] {
				limits[s] = t
			}
		}
	}

	y := 0.0

	for i := 1; i <= n; i++ {
		// y=x+a
		a := y - xx[i-1]
		nexty := vv[limits[i]] + xx[limits[i]] - xx[i]
		// y=-x+b
		b := nexty + xx[i]

		// 加速直線と減速直線が交わるx座標
		cross := (b - a) / 2.0
		// 加速区間
		// 制限速度に達するまで
		incx := vv[i-1] - a
		// 制限速度に達する前に次の区間に到達
		if incx > xx[i] {
			incx = xx[i]
		}
		// 制限速度に達する前に減速開始
		if incx > cross {
			incx = cross
		}

		// 減速区間
		// 制限速度から
		decx := b - vv[i-1]
		// 制限速度に達する前に減速開始
		if decx < cross {
			decx = cross
		}
		// 減速の必要がない場合
		if decx > xx[i] {
			decx = xx[i]
		}
		ans += (incx - xx[i-1]) * (y*2 + incx - xx[i-1]) / 2.0
		ans += (decx - incx) * (y + incx - xx[i-1])
		nexty = y + (incx - xx[i-1]) - (xx[i] - decx)
		ans += (xx[i] - decx) * (nexty*2 + xx[i] - decx) / 2.0

		y = nexty
	}

	return ans
}


Measured memory_bytes: 640
N = int(input())
p = input().split()
for i in range(N):
  p[i] = int(p[i])
sorted_p = sorted(p)
count = 0
for i in range(N):
  if p[i] != sorted_p[i]:
    count += 1
  if count == 3:
    print("NO")
    break
if count != 3:
  print("YES")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    string S; cin >> S;
    int N = S.size();
    string ans = "NO";
    REP(i,N) {
        for(int j = 0; j <= N - i; j++) {
            string tmp = S.substr(0,i) + S.substr(i+j,N-(i+j));
            if(tmp == "keyence") {
                ans = "YES";
            }
        }
    }
    cout << ans << endl;
} 

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>

int main(){

    size_t n, m;
    std::cin >> n >> m;
    auto p = std::minmax(n, m);

    if(p.first == 1){
        if(p.second == 1){
            std::cout << 1 << std::endl;
        }else{
            std::cout << p.second - 2 << std::endl;
        }
    }else{
        std::cout << (p.first - 2) * (p.second - 2) << std::endl; 
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
using ull =unsigned long long;
const ll INF =1001001001;

//10億7。　　　100000007

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}


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


  int R;
  cin>>R;
  cout<<R*2*6.28318530717958623200/2<<endl;
  
  
}



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

public class Main {
	static int n;
	
	static class Team implements Comparable<Team>{
		int id, u, a, p;
		
		Team(int id, int u, int a, int p) {
			this.id = id;
			this.u = u;
			this.a = a;
			this.p = p;
		}

		public int compareTo(Team o) {
			if (this.a != o.a) {
				return o.a - this.a;
			} else if (this.p != o.p) {
				return this.p - o.p;
			} else {
				return this.id - o.id;
			}
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Team t[];
		int uni[];
		
		while (true) {
			n = sc.nextInt();
			if (n == 0) {
				break;
			}
			
			t = new Team[n];
			for (int i = 0; i < n; i++) {
				t[i] = new Team(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
			}
			
			Arrays.sort(t);
			int cnt = 0;
			uni = new int[1005];
			for (int i = 0; i < n; i++) {
				if (cnt < 10) {
					if (uni[t[i].u] < 3) {
						System.out.println(t[i].id);
						cnt++;
						uni[t[i].u]++;
					}
				} else if (cnt < 20) {
					if (uni[t[i].u] < 2) {
						System.out.println(t[i].id);
						cnt++;
						uni[t[i].u]++;
					}
				} else if (cnt < 26) {
					if (uni[t[i].u] == 0) {
						System.out.println(t[i].id);
						cnt++;
						uni[t[i].u]++;
					}
				}
			}
		}
	}
}

Measured memory_bytes: 21068
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

#define INF pow(10,10)

using namespace std;

int main(){
  int cnt=0;
  vector<int> R;
  int maxSub=-INF;
  int max=-INF;
  int min=INF;
  int n;
  cin >> cnt;
  for(int j=0;j<cnt;j++){
    cin >> n;
    R.push_back(n);

    int sub = n - min;
    if(sub > maxSub){
      maxSub = sub;
    }
    
    // first time
    if(j==0){
      min = max = n;
      continue;
    }

    if(min>n){min=n;}
    if(max<n){max=n;}

      

    
    // for(int i=0;i<R.size()-1;i++){
      // int sub = R.back() - R[i];
      // if(sub > Max){
    //    Max = sub;
    //}
    //    }

    // cout << "M: " << Max << endl;
  }

  cout << maxSub << endl;
}
    

    

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	string a,b,c; cin>>a>>b>>c;
	cout<<(char)toupper(a[0])<<(char)toupper(b[0])<<(char)toupper(c[0])<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
const ll MOD=1e9+7;
using namespace std;

int main(){
  string s,t;
  cin >> s >> t;
  bool flag = false;
  //答えとなりそうな文字列
  vector<string> ans;
  rep(i,s.size()-t.size()+1){
    string tmp = s.substr(i,t.size());
    int j = 0;
    while(j < t.size()){
      if(tmp[j]==t[j] || tmp[j]=='?'){
        j++;
      }else{
        break;
      }
    }
    if(j==t.size()){
      string key = s;
      for(int k=i;k<i+t.size();k++){
        if(key[k]=='?'){
          key[k] = t[k-i];
        }
      }
      for(int k=0;k<key.size();k++){
        if(key[k]=='?'){
          key[k] = 'a';
        }
      }
      ans.push_back(key);
      flag = true;
    }
  }
  if(!flag){
    cout << "UNRESTORABLE" << endl;
    return 0;
  }
  sort(All(ans));
  cout << ans[0] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int data[100005];
int main()
{
	int a,n;
	long long int sum=0;
	cin>>a>>n;
	for(int i=0;i<n;i++)
	{
		cin>>data[i];
		sum+=data[i];
	}
	if(sum>=a) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

Measured memory_bytes: 640
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
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 = 100100100100;
const long long MOD = 1000000007;
typedef pair<double,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

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

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    int N,X;cin >> N >> X;
    vector<int> retu(N);
    for(int i = 0;i<N;i++) cin >> retu.at(i);
    sort(retu.begin(),retu.end());
    int ans = 0;
    for(int i = 0;i<N;i++){
        if(i == N-1) {
            if(retu.at(i) == X) {
                ans++;
                break;
            }
            else break;
        }
        if(retu.at(i) <= X) {
            ans++;
            X -= retu.at(i);
        }
        else {
            break;
        }
    }
    cout << ans << endl;
}


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

int n,mod;
vector<int> e[100005];
int dpc[100005],dpp[100005];
int pre[100005],suf[100005];

void dochild(int at,int par) {
	LL ans = 1;
	for (int i=0; i<e[at].size(); i++) {
		int c = e[at][i];
		if (c == par) continue;
		dochild(c,at);
		ans *= dpc[c]+1; ans %= mod;
	}
	//printf("At %d = %d\n",at,ans);
	dpc[at] = ans;
}

void doparent(int at,int par) {
	LL ans = 1;
	for (int i=0; i<e[at].size(); i++) {
		int c = e[at][i];
		if (c == par) continue;
		ans *= dpc[c]+1; ans %= mod;
		pre[i] = ans;
	}
	ans = 1;
	for (int i=((int)e[at].size())-1; i>=0; i--) {
		int c = e[at][i];
		if (c == par) continue;
		ans *= dpc[c]+1; ans %= mod;
		suf[i] = ans;
	}
	for (int i=0; i<e[at].size(); i++) {
		int c = e[at][i];
		if (c == par) continue;
		int prev = 1,next = 1;
		int pid = i-1,nid = i+1;
		if (pid >= 0 && e[at][pid] == par) pid--;
		if (nid < e[at].size() && e[at][nid] == par) nid++;

		if (pid >= 0) prev = pre[pid];
		if (nid < e[at].size()) next = suf[nid];
		//printf("  c = %d: d %d p %d n %d\n",c,dpp[at],prev,next);
		dpp[c] = (((prev*1LL*next)%mod)*dpp[at]+1)%mod;
	}

	for (int i=0; i<e[at].size(); i++) {
		int c = e[at][i];
		if (c == par) continue;
		doparent(c,at);
	}
}

int main() {
	scanf("%d%d",&n,&mod);
	for (int i=0; i<n-1; i++) {
		int a,b;
		scanf("%d%d",&a,&b);
		e[a].push_back(b);
		e[b].push_back(a);
	}

	dochild(1,-1);
	dpp[1] = 1;
	doparent(1,-1);
	for (int i=1; i<=n; i++) {
		printf("%d\n",(dpc[i]*1LL*dpp[i])%mod);
	}
	return 0;
}


Measured memory_bytes: 13056
#include<iostream>
#include<cstring>
#include<list>
using namespace std;


int main(){
    
    int n,input;
    list<int> num;
    int sum_Alice = 0;
    int sum_Bob = 0;
    list<int>::iterator itr;

    scanf("%d", &n);

    for(int i = 0;i < n; i++){
        scanf("%d", &input);
        num.push_front(input);
    }
    num.sort();

    while(num.size() != 0){
        itr = num.end();
        --itr;
        sum_Alice += *itr;
        num.pop_back();
        if(num.size()==0){
            break;
        }
        itr=num.end();
        --itr;
        sum_Bob += *itr;
        num.pop_back();
    }

    printf("%d", sum_Alice - sum_Bob);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int h,w;
    while(1){
        cin >> h >> w;
        if (h == 0 && w == 0) break;
        for (int i = 0;i < h;i++){
            for (int j = 0;j < w;j++){
                cout << "#";
            }
            cout << "\n";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
s = $stdin.readline.chomp
n = s.size
hs = Hash.new

n.times do |i|
  next if i == 0
  hs[s[i]] ||= [-1, n]
  hs[s[i]] << i
end

if hs.keys.size < 2
  res = 0
else
  res = n
end
("a".."z").each do |c|
  next if hs[c].nil?
  v = hs[c].sort
  cnt = v.each_cons(2).map {|x, y| y - x - 1 }.max
  res = [res, cnt].min
end
puts res

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

using namespace std;
using ll = long long;
using ld = long double;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define per(i, a, b) for (auto i = (b); i-- > (a); )
#define eb(x...) emplace_back(x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int((x).size())
#define lb(x...) lower_bound(x)
#define ub(x...) upper_bound(x)

template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T> T gcd(T a, T b) { return b != T(0) ? gcd(b, a % b) : a; }

#pragma GCC optimize ("trapv")

const int N = 1 << 18, B = 44;
const ll mul = 1e9;
int g[B][B];

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

	int n; cin >> n;
	ll ans = 0;
	rep(i, 0, n) {
		ll a = 0;
		string s; cin >> s;

		int j = -1;
		rep(i, 0, sz(s)) {
			if (s[i] == '.') { j = i; break; }
			a = 10 * a + (s[i] - '0');
		}
		if (j != -1) {
			rep(i, j + 1, sz(s)) a = 10 * a + (s[i] - '0');
			int x = sz(s) - j - 1;
			while (x < 9) a *= 10, ++x;
		} else a *= mul;
		// cout << a << '\n';
		ll b = a;
		int c2 = 0, c5 = 0;
		while (a % 2 == 0) a /= 2, ++c2;
		while (b % 5 == 0) b /= 5, ++c5;
		assert(c2 < B && c5 < B);
		rep(i, 0, B)
			rep(j, 0, B)
				if (c2 + i >= 18 && c5 + j >= 18)
					ans += g[i][j];
		++g[c2][c5];
	}
	cout << ans;
}

Measured memory_bytes: 3584
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

vector<char> answer;

bool dfs(int sum,vector<char>& cards,vector<char>& order){
  if(sum == 0){
    reverse(order.begin(),order.end());
    answer = order;
    return true;
  }
  bool res = false;

  for(int i = 1; i <= 13; i++){
    if(cards[i] > 0 && (sum - i) % i == 0){
      cards[i]--;
      order.push_back(i);
      res |= dfs(sum - i,cards,order);
      if(res) return true;
      order.pop_back();
      cards[i]++;
    }
  }
  return res;
}

int main(){
  int num_of_cards;
  while(~scanf("%d",&num_of_cards)){
    if(num_of_cards == 0) break;

    vector<char> cards(14);
    int total_rank = 0;
    for(int i = 0; i < num_of_cards; i++){
      int rank;
      scanf("%d",&rank);
      cards[rank]++;
      total_rank += rank;
    }
    vector<char> order;
    bool isok = dfs(total_rank,cards,order);
    bool is_first = true;

    if(isok){
      for(int i = 0; i < answer.size(); i++){
        printf("%s%d",is_first ? "" : " ",answer[i]);
        is_first = false;
      }
      printf("\n");
    }
    else{
      printf("No\n");
    }
  }
}

Measured memory_bytes: 1228
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<sstream>
#include<iomanip>
#define forn(i,n) for(int (i)=0;i<(n);i++)
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int MAXN=100005;
const int INF=2147483647;
const ll LINF=9223372036854775807;
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
ll a,b,c,d;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>a>>b>>c>>d;
	cout<<max(max(a*c,a*d),max(b*c,b*d));
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

const ll MAX_A=1e14;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin>>n;
  n++;
  vll d(n);
  REP(i,n)cin>>d[i];
  if(1<d[0]){
    cout<<-1<<endl;
    return 0;
  }

  vll lim(n);
  lim[0]=1;
  REP(i,n-1)lim[i+1]=min(2*(lim[i]-d[i]),MAX_A);

  vll v(n);
  v[n-1]=d[n-1];
  ll ans=d[n-1];
  for(ll i=n-1; i>=1; i--){
    ll l=v[i]/2+v[i]%2+d[i-1];
    ll r=v[i]+d[i-1];
    if(lim[i-1]<l){
      cout<<-1<<endl;
      return 0;
    }
    v[i-1]=min(lim[i-1],r);
    ans+=v[i-1];
  }
  cout<<ans<<endl;
}




Measured memory_bytes: 5596
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string.h>
#include <iomanip>
using namespace std;
#define int long long
#define ull unsigned long long
#define F first
#define S second
#define nl "\n"
#define ld long double
#define div 1000000007
#define pi 3.14159265358979323846
#define pb push_back

void solve()
{
    int k;cin>>k;
    int num=7;
    for(int i=1;i<=k;i++)
    {
        if(num%k==0)
        {
            cout<<i<<nl;
            return;
        }
        num*=10;num+=7;
        num%=k;
    }
    cout<<-1<<nl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3656
/*
 *  I wish I could travel by the road that crosses baby's mind,
 *  and out beyond all bounds;
 *  Where messengers run errands for no cause
 *  between the kingdoms of kings of no history;
 *  Where Reason makes kites of her laws and flies them,
 *  and Truth sets Fact free from its fetters.
 *                                           Rabindranath Tagore
 */

#include <bits/stdc++.h>
using namespace std;

#ifndef ORZ_EVERYBODY_BUT_ME
#define ORZ_EVERYBODY_BUT_ME
#endif

#ifndef SOCIALISM
#define SOCIALISM
#endif

unsigned long long operator "" _love(unsigned long long literal) {
    return literal;
}

const size_t MAX_N = 100000 + 5;

int n, k, a[MAX_N], res;

int main() {
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++i)
        scanf("%d", a + i);
    int mn = INT_MAX, pos = -1;
    for (int i = 0; i < n; ++i)
        if (a[i] < mn) {
            mn = a[i];
            pos = i;
        }
    int res = (n + k - 3) / (k - 1);
    printf("%d\n", res);
    return 0;
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

typedef long long ll;

using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> a(N, 0);
    REP(i, N)
    {
        cin >> a[i];
    }

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

    // p, q, r : X の候補
    // q = p - 1, r = q + 1を満たす
    int p, q, r;
    int countP, countQ, countR;
    vector<int> countVec;

    // 初期化
    q = a[0];
    p = q - 1;
    r = q + 1;
    countP = 1;
    countQ = 1;
    countR = 1;
    for(int i = 1; i < N; ++i)
    {
        if (a[i] == q)
        {
            countP++;
            countQ++;
            countR++;
        }
        else if (a[i] == q + 1)
        {
            countVec.push_back(countP);
            countP = countQ + 1;
            countQ = countR + 1;
            countR = 1;
        }
        else if (a[i] == q + 2)
        {
            countVec.push_back(countP);
            countVec.push_back(countQ);
            countP = countR + 1;
            countQ = 1;
            countR = 1;
        }
        else
        {
            countVec.push_back(countP);
            countVec.push_back(countQ);
            countVec.push_back(countR);
            countP = 1;
            countQ = 1;
            countR = 1;
        }
        q = a[i];
        p = q - 1;
        r = q + 1;
    }
    countVec.push_back(countP);
    countVec.push_back(countQ);
    countVec.push_back(countR);

    int ans;
    if (N == 1)
    {
        ans = 1;
    }
    else
    {
        sort(countVec.begin(), countVec.end());
        ans = countVec[countVec.size() - 1];
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 1276
import java.util.*;

public class Main{
	private static Scanner sc=new Scanner(System.in);
	
	public static void main(String[] args){
		String s=sc.next();
        int k=readInt();
        Set<String> set=new TreeSet<>();
        int l=s.length();
        for(int t=0;t<26;t++){
            if(set.size()>=k)break;
            for(int i=0;i<l;i++){
                if('a'+t==s.charAt(i)){
                    for(int j=i+1;j<=l&&j-i<=k;j++)
                        set.add(s.substring(i,j));
                }
            }
        }
        int i=1;
        for(String t:set){
            if(i==k){
                System.out.println(t);
                break;
            }
            i++;
        }
	}
	
	private static int readInt(){
		return Integer.parseInt(sc.next());
	}
	private static long readLong(){
		return Long.parseLong(sc.next());
	}
}

Measured memory_bytes: 24404
fun main (args: Array<String>) {
	val A = readLine()
	val B = readLine()
	val C = readLine()
	val X = readLine()
	
	val coin1 : Int = A!!.toInt()
	val coin2 : Int = B!!.toInt()
	val coin3 : Int = C!!.toInt()
	val money : Int = X!!.toInt()
	
	var num1 : Int = 0
	var num2 : Int = 0
	var num3 : Int = 0
	var total : Int = 0
	var count : Int = 0
	
	for (h in 0..coin1) {
		
		num1 = 500 * h
		total = num1
		
		if (total == money) {
			count++
			break
		}
		
		for (i in 0..coin2) {
			
			num2 = 100 * i
			total = num1 + num2
			
			if (total == money) {
				count++
				break
			}
			
			for (j in 0..coin3) {
				
				num3 = 50 * j
				total = num1 + num2 + num3
				
				if (total == money) {
					count++
					break
				}
				
			}
			
		}
		
	}
	
	println("${count}")
	
}

Measured memory_bytes: 31896
Nc = input()
N = int(Nc)
c = map(int,input().split())
cor = ''
l = list(c)
l2 = []
maxL = 0
gambiarra = 0
m = 0

for num in l:
    if 1 <= N <= 100 and 1 <= num <= 4800 and type(num) == int and len(l) == N:
        if  1 <= num <= 399:
            cor = 'cinzento'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 400 <= num <= 799:
            cor = 'a'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 800 <= num <= 1199:
            cor = 'b'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1200 <= num <= 1599:
            cor = 'c'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1600 <= num <= 1999:
            cor = 'd'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m +1
        elif 2000 <= num <= 2399:
            cor = 'e'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2400 <= num <= 2799:
            cor = 'f'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2800 <= num <= 3199:
            cor = 'g'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
        elif 3199 <= num <= 4800:
            maxL = maxL + 1
            cor = 'escolha'
            if cor not in l2:
                l2.append(cor)
                m = m + 1
            else:
                l2.append(cor)
                gambiarra = gambiarra + 1
            
            
           
print(m, maxL)

Measured memory_bytes: 3188
#include <stdio.h>

int main() {
    int i=0,x,y;
    
    while(i<=3000){
        i++;
        scanf("%d %d",&x,&y);
        if(x==0 && y==0){
            break;
        }else{
            if(x>=y)
                printf("%d %d\n",y,x);
            else
                printf("%d %d\n",x,y);
        }
    }
    return 0;
}



Measured memory_bytes: 2100
#include <stdio.h>
  
using namespace std;
  
int main(){
    int m,f,r;
    char grade;
    while(true){
        scanf("%d %d %d",&m,&f,&r);
        if(m == -1 && f == -1 && r == -1) break;
        if(m == -1 || f == -1){
            grade = 'F';
        }else if(m+f >= 80){
            grade = 'A';
        }else if(m+f >= 65){
            grade = 'B';
        }else if(m+f >= 50){
            grade = 'C';
        }else if(m+f >= 30){
            grade = (r >= 50)? 'C':'D';
        }else{
            grade = 'F';
        }
        printf("%c\n",grade);
    }
}


Measured memory_bytes: 2760
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);

int main(){
    IOS;
    ll n,m;cin>>n>>m;
    ll one=(n*(n-1))/2;
    ll two=(m*(m-1))/2;
    cout<<one+two;
    return 0;  
} 





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

    #define ll long long
    #define ff first
    #define ss second
    #define pb push_back
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define MOD 1000000007
    #define pll pair<ll,ll>
    #define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
    ll power(ll x,ll y)
    {
    	ll res=1;
    	x=x%MOD;
    	while(y>0)
    	{
    		if(y&1)
    			res=(res*x)%MOD;
    		y=y>>1;
    		x=(x*x)%MOD;
    	}
    	return res;
    }
    ll modinverse(ll n)
    {
    	return power(n,MOD-2);
    }
    ll NCR(ll n,ll r)
    {  if(r==0)
    	return 1;
    	ll fac[n+1];
    	fac[0]=1;
    	for(int i=1;i<=n;i++)
    	{
    		fac[i]=(fac[i-1]*i)%MOD;
    	} 
    	return (fac[n]* modinverse(fac[r]) % MOD * 
			modinverse(fac[n-r]) % MOD) % MOD; 
    }
    int main() {
    	fastio;
    	ll x,y;
    	cin>>x>>y;
    	if((x+y)%3==0)
    	{
    		ll n=(x+y)/3;
    		ll ma=max(x,y);
    		if(ma<=2*n)
    		{ 
                ll r=2*n-x;
                cout<<NCR(n,r)<<endl;
    		}
    		else
    			cout<<0<<endl;
    	}
    	else
    		cout<<0<<endl;
    }

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

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0033
public class Main {

    boolean[] flags;
    int[] nums;
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        flags = new boolean[10];
        for (int i = 0; i < n; i++) {
            nums = new int[10];
            for (int j = 0; j < 10; j++) {
                nums[j] = sc.nextInt();
            }
            System.out.println(dfs(0) ? "YES" : "NO");
        }
    }

    boolean dfs(int index) {
        if (index >= nums.length) {
            return isOk();
        }

        flags[index] = true;
        boolean b1 = dfs(index + 1);
        flags[index] = false;
        boolean b2 = dfs(index + 1);
        return b1 || b2;
    }

    boolean isOk() {
        int l = 0;
        int r = 0;
        for (int i = 0; i < 10; i++) {
            if (flags[i] && l < nums[i]) {
                l = nums[i];
            } else if (!flags[i] && r < nums[i])  {
                r = nums[i];
            } else {
                return false;
            }
        }
        return true;
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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

}



Measured memory_bytes: 27916
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,a,b=0;
  long shou,amari=0;
  cin>>n>>a>>b;
  
  shou=n/(a+b);
  amari=n%(a+b);
  
  if(amari<=a){
    cout<<shou*a+amari;
  }else{
    cout<<shou*a+a;
  }
}

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

using namespace std;

/**
 *  Name: Chris M. Perez
 *  University: Interamerican University Metro Campus
 *
**/

#define endl '\n'
#define MOD 10e18
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define gcd(x , y) __gcd(x , y)
#define all(x) (x).begin() , (x).end()
#define forn(i , a , b) for(int i=(a);i<(b);i++)
#define forrange(j , a , b) for(int j=(a);j<=(b);j++)
#define nestedforn(i , a , b , j , c , d) for(int i=(a);i<=(b);i++) for(int j=(c);j<=(d);j++)
#define sort_all(x) sort(all(x))
#define zeros_at_beginning(x) __builtin_clz(x)
#define zeros_at_end(x) __builtin_ctz(x)
#define ones(x) __builtin_popcount(x)
#define parity_even_or_odd_ones __builtin_parity(x)

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef tuple<int , int , int> tiii;
typedef vector<pii> vpii;
typedef vector<tiii> vtiii;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef long long int lli;

             
inline int input(){
  int n;
  scanf("%d" , &n);
  return n;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;

#ifdef LOCAL_DEFINE
  freopen("input.txt" , "rt" , stdin);
#endif
  
  int a; cin >> a;
  int b; cin >> b;
  int c; cin >> c;
  cout <<  (b + min(c , a + b + 1)) << endl;    
 
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif  
  return 0;
}

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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 5e6 + 5;

typedef pair<int,int>   ii;

int a[N], t[N];
int f1[N], f2[N];
int s1[N], s2[N];

int pre[N];
int nxt[N];

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

    int n;  cin >> n;
    int L;  cin >> L;

    priority_queue<ii,vector<ii>,greater<ii> >  pq;

    for(int i = 1 ; i <= n ; ++i)   {
        cin >> a[i];
        f1[i] = f2[i] = 1;
        pre[i] = i - 1;
        nxt[i] = i + 1;

        pq.push(ii(a[i],i));
    }
    nxt[n] = 0;

    int tot = n;
    ll  ans = 0;

    while (pq.size())   {
        int p = pq.top().Y;
        int v = pq.top().X;

        pq.pop();

        if (t[p])   continue;

        int l = p;
        int r = p;

        while (a[pre[l]] == a[l])   l = pre[l];
        while (a[nxt[r]] == a[r])   r = nxt[r];

        int cnt = 0;
        int prv = 0;

        for(int i = l ; i != nxt[r] ; t[i] = 1, i = nxt[i]) {
            cnt++;

            if (i <= n) prv = cnt;

            s1[cnt] = s1[cnt - 1] + f1[i];
            s2[cnt] = s2[cnt - 1] + f2[i];

            if (prv && cnt >= L)
                ans += 1ll * f2[i] * s1[min(prv,cnt - L + 1)];
        }
        if (cnt < L)    {
            nxt[pre[l]] = 0;
            pre[nxt[r]] = 0;
            continue;
        }
        int S = cnt / L;

        for(int i = 1 ; i < S ; ++i)    {
            nxt[tot + i] = 1 + tot + i;
            pre[tot + i + 1] = tot + i;
        }
        for(int i = 1 ; i <= S ; ++i)
            a[tot + i] = a[p] + 1;

        nxt[pre[l]] = tot + 1;  pre[tot + 1] = pre[l];
        pre[nxt[r]] = tot + S;  nxt[tot + S] = nxt[r];

        for(int i = 1 ; i <= S ; ++i)   {
            int j = S - i + 1;

            f2[tot + i] = s2[min((i + 1) * L - 1,cnt)] - s2[i * L - 1];
            f1[tot + i] = s1[cnt - j * L + 1] - s1[max(cnt - j * L - L + 1,0)];
        }
        pq.push(ii(a[tot + 1],tot + 1));
        tot += S;
    }
    cout << ans + n << endl;
}

Measured memory_bytes: 23792
"use strict"
const input = require('fs').readFileSync('/dev/stdin','utf8');
const arr = input.split('\n');
const n = parseInt(arr[0]);
const list = arr[1].split(' ');
let ans = list[n-1];
for (let i = n-2; i >= 0; i--) {
	ans += ' ' + list[i];
}
console.log(ans);


Measured memory_bytes: 15096
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int[] e = new int[3];
        e[0] = int.Parse(input[0]);
        e[1] = int.Parse(input[1]);
        e[2] = int.Parse(input[2]);
        Array.Sort(e);
        Console.WriteLine(e[0] * e[1]  / 2);
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;
#define ll long long

const int MAXN = 2e5 + 7;
int a[MAXN];

int main(){
    int N;
    cin>>N;
    for(int i = 1; i <= N; i++){
        scanf("%d", &a[i]);
        a[i] -= i;
    }
    sort(a+1, a+1+N);
    int target;
    if(N % 2) target = a[N/2+1];
    else target = a[N/2];
    ll ans = 0;
    for(int i = 1; i <= N; i++)
        ans += abs(a[i] - target);
    cout<<ans<<endl;
    
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
N = int(input())

a, b, c, d = 0, 0, 0, 0
for _ in range(N):
    s = input()
    if s.startswith('B') and s.endswith('A'):
        a += 1
    elif s.startswith('B'):
        b += 1
    elif s.endswith('A'):
        c += 1

    d += s.count('AB')

# print(a, b, c, d)

if a == 0:
    print(d + min(b, c))

elif b == 0 and c == 0:
    print(d + a -1 )

else:
    print(d + a + min(b, c))

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

int main(){
    int N; cin >> N;
    vector<int> b(N,0);
    for (int i = 0; i < N-1; i++)
    {
        int x; cin >> x;
        x--;
        b[x]++;
    }

    for(int i: b){
        cout<< i << '\n';
    }
    
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  map<int,int> A;
  for(int i=0;i<N;i++){
    int j;
    cin>>j;
    A[j]++;
  }
  vector<int> B(0);
  for(pair<int,int> p:A)
    B.push_back(p.second);
  sort(B.begin(),B.end());
  int j=0;
  for(int i=0;i<(int)B.size()-K;i++){
    j+=B[i];
  }
  cout<<j<<endl;
}

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

using namespace std;

const int N = 2048; 
using V=bitset<N>;
V a[N], L[N], R[N];

void solve() {
    int n; cin >> n;
    for (int i = 1; i < n; i++) {
        string s; cin >> s;
        for (int j = 0; j < i; j++) {
            int x = s[j]-'0';
            a[i][j] = x;
            a[j][i] = x^1;
        }
    }
    for (int i = 0; i < n; i++) {
        L[i][i] = R[i][i] = 1;
    }
    for (int d = 1; d < n; d++) {
        for (int l = 0, r; (r=l+d) < n; l++) {
            if ((L[l] & R[r-1] & a[r]).count()) L[l][r] = 1;
            if ((L[l+1] & R[r] & a[l]).count()) R[r][l] = 1;
        }
    }
    int res = (L[0] & R[n-1]).count();
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;
int main()
{
    // 文字列の入力
	int N;
	int ac = 0, wa = 0, tle = 0, re = 0;
	
    cin >> N;
	string S;
	for(int i =0; i < N; i++) {
		cin >> S;
		if(S == "AC") ac++;
		if(S == "WA") wa++;
		if(S == "TLE") tle++;
		if(S == "RE") re++;
	}
	
	printf("AC x %d\n", ac);
	printf("WA x %d\n", wa);
	printf("TLE x %d\n", tle);
	printf("RE x %d\n", re);
    return 0;
}

Measured memory_bytes: 3724
n,m = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse=True)
s = sum(A)
cnt=0
for a in A:
    if a >=s/(4*m):
        cnt+=1
    else:
        break
if cnt >=m:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38384
#include"iomanip"
#include"iostream"
#include"limits"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"queue"
#include"stack"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"assert.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define mset(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll x,ll y)
{
	return y==0?x:gcd(y,x%y);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n,k;
	cin>>n>>k;
	ll x;cin>>x;
	ll g=x;
	ll max1=x;
	for(int i=0;i<n-1;++i)
	{
		cin>>x;
		max1=max(max1,x);
		g=gcd(g,x);
	}
	if(k>max1||k%g!=0)
	{
		cout<<"IM";
	}
	cout<<"POSSIBLE\n";
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1e9+7;
ll mod_pow(ll x, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n & 1)
        {
            res = res * x % MOD;
        }
        x = x * x % MOD;
        n >>= 1;
    }
    return res;
}
int main()
{
    ll n;
    cin >> n;
    ll ans = mod_pow(10, n);
    ll num = mod_pow(9, n);
    ll eight = mod_pow(8, n);
    ans = (ans - num + MOD) % MOD;
    ans = (ans - num + MOD) % MOD;
    ans = (ans + eight) % MOD;
    ans = (ans + MOD) % MOD;
    cout << ans << endl;
}



Measured memory_bytes: 3620
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

typedef unsigned long long LL;

LL N;
vector<LL> D;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL N, H, W;
	cin >> N >> H >> W;
	LL ans = 0;
	for(int i=0; i<N; i++){
		LL a, b;
		cin >> a >> b;
		if(a >= H && b >= W){
			ans++;
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 3676
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <map>

using namespace std;

typedef long long ll;

const ll INF = 1e18;
ll T;
ll n, a, b, c, d;
map<ll, ll> mp;

ll dfs(ll x) {
	if (mp.count(x)) return mp[x];
	if (x == 0) return mp[0] = 0;
	if (x == 1) return mp[1] = d;

	ll res = INF;
	if (x <= n / d) res = min(res, x*d);
	res = min(res, dfs(x / 2) + a + x % 2 * d);
	res = min(res, dfs((x + 1) / 2) + a + (2 - x % 2)*d);
	res = min(res, dfs(x / 3) + b + x % 3 * d);
	res = min(res, dfs((x + 2) / 3) + b + (3 - x % 3)*d);
	res = min(res, dfs(x / 5) + c + x % 5 * d);
	res = min(res, dfs((x + 4) / 5) + c + (5 - x % 5)*d);
	return mp[x] = res;
}

int main() {
	cin >> T;
	while (T--) {
		cin >> n >> a >> b >> c >> d;
		mp.clear();
		cout << dfs(n) << endl;
	}

	return 0;
}


Measured memory_bytes: 4500
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e18
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

vi adjList[111111];
ll a[111111];
bool visited[111111];
multiset <ll> cur;
vector< multiset <ll> > cc;

bool cmp(multiset<ll> a, multiset<ll> b){
	 return a.size()>b.size();
}

void dfs(int x){
	cur.insert(a[x]);
	visited[x]=1;
	for(int i = 0; i < adjList[x].size(); i++){
		if(!visited[adjList[x][i]]){
			dfs(adjList[x][i]);
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, m, u, v;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = 0; i < m; i++){
		cin >> u >> v;
		adjList[u].pb(v);
		adjList[v].pb(u);
	}
	for(int i = 0; i < n; i++){
		if(!visited[i]){
			cur.clear();
			dfs(i);
			cc.pb(cur);
		}
	}
	sort(cc.begin(),cc.end(),cmp);
	cur=cc[0];
	ll ans = 0;
	for(int i = 1; i < cc.size(); i++){
		if(cur.size()<cc[i].size()){
			swap(cur,cc[i]);
		}
		ans+=*cur.begin();
		cur.erase(cur.begin());
		ans+=*cc[i].begin();
		cc[i].erase(cc[i].begin());
		for(auto it: cc[i]){
			cur.insert(it);
		}
		if(cur.size()==0 && i < cc.size()-1){
			cout << "Impossible" << endl;
			return 0;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 16256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

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

  for(ll i = a; i <= b; i++){
    if(i % k == 0){
      cout<<"OK"<<endl;
      return 0;
    }
  }
  cout<<"NG"<<endl;

}


Measured memory_bytes: 3644
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n,i;
  cin >> n >> i;
  cout << n - i + 1;


  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 10099
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define LL long long
using namespace std;
int n;
LL S;
int main()
{
    cin >> S;
    LL t = sqrt(S);
    t++;
    if (t > 1000000000)
        t = 1000000000;
    LL cha = t * t - S;
    printf("0 0 %lld 1 %lld %lld\n", t, cha, t);
    return 0;
}


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

using namespace std;

typedef long long ll;

#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

// pow
ll pow(ll a, ll b){
	if(b == 0) return 1;
	if(b & 1) {
		return a * pow(a, b - 1);
	} else {
	ll d = pow(a, b / 2);
	return d * d;
	}
}

// mod calc
// by abc024d husenn
typedef long long ll;
const ll MOD = 1e9 + 7;

ll powmod(ll a, ll b){
	if(b == 0) return 1;
	if(b & 1) {
		return a * powmod(a, b - 1) % MOD;
	} else {
		ll d = powmod(a, b / 2) % MOD;
		return d * d % MOD;
	}
}

ll sub(ll a, ll b){
	return a + MOD - b;
}

ll inv(ll a){
	return powmod(a, MOD - 2);
}

// X^(-1) = X^(p-2) (mod p) (Fermat's little theorem)

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

	ll n, k;
	cin >> n >> k;

	ll ans = 0;
	for(ll i = k; i <= n + 1; i++){
		ans += i * (n - i + 1) + 1;
		ans %= MOD;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3652