akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1000000007;
ll INF=300000;
//ll MAX_N=510;
//ll MAX_A=1000100;
//ll PrimeListMax=0;
//vector<ll> PrimeList(10000, 0);
vector<ll> YakuList(0);
//vector<ll> Prime(0);

int main(){
    ll N, K;
    cin>>N>>K;
    vector<ll> A(N);
    ll Sum=0;
    for(int i=0; i<N; i++){
        cin>>A[i];
        Sum+=A[i];
    }
  	//cout<<"Sum="<<Sum<<endl;
    ll RtSum=pow(Sum, 0.5);
  	//cout<<"RtSum="<<RtSum<<endl;
    ll YakuCou=0;
    bool Half=false;
    if(Sum==RtSum*RtSum){
        YakuList.push_back(RtSum);
        Half=true;
        YakuCou++;
    }
    for(ll i=1; i<=RtSum; i++){
        if(i==RtSum&&Half)break;
        if(Sum%i==0){
            YakuCou +=2;
            YakuList.push_back(i);
            YakuList.push_back(Sum/i);
          	//cout<<i<<endl<<Sum/i<<endl;
        }
    }
    ll Max=1;
    for(ll i=0; i<YakuCou; i++){
        vector<ll> B(N);
        ll BSum=0;
        for(ll j=0; j<N; j++){
            B[j]=A[j]%YakuList[i];
            BSum+=B[j];
        }
        sort(B.begin(), B.end());
        BSum/=YakuList[i];
        ll Cnt=0;
        for(ll j=0; j<BSum; j++){
            Cnt += -1*(B[N-1-j]-YakuList[i]);
        }
        if(Cnt<=K){
            Max=max(Max, YakuList[i]);
        }
        
    }
	cout<<Max<<endl;
    return 0;

}

Measured memory_bytes: 256
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n=int(arr_data[0][0])
m=int(arr_data[0][1])
x=int(arr_data[0][2])
y=int(arr_data[0][3])

arr_x=list(map(int, arr_data[1]))
arr_y=list(map(int, arr_data[2]))
max_x=max(arr_x)
min_y=min(arr_y)

print("No War" if x<max_x and min_y<y and max_x<min_y else "War")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k;//ｋは長さ
  cin >> k;
  
  string s; //ｓは文字列
  cin >> s;
  
  if(k < s.size()){
    for(int i=0; i < k;i++){
      cout << s.at(i);
    }
    cout << "..." << endl;
  }else{
    cout << s << endl;
  }
    


}


Measured memory_bytes: 3628
import java.util.Scanner

import scala.collection.mutable.ArrayBuffer

object Main extends App {
  val sc = new Scanner(System.in)

  def taskA() = {
    val ans = sc.nextInt() match {
      case 7 | 5 | 3 => "YES"
      case _ => "NO"
    }
    println(ans)
  }

  def taskB() = {
    val s = sc.next()
    val n = s.length
    val ans = 0.until(n - 2).fold(10000) { (acc, x) =>
      val y = s.substring(x, x + 3).toInt
      Math.min(acc, Math.abs(y - 753))
    }
    println(ans)
  }

  def taskC() = {
    val s = sc.next()
    val n = s.toInt

    def rec(pos: Int, l: Int, ab: ArrayBuffer[Int]): Int = {
      if (pos == l) {
        val ok = Seq(7, 5, 3).forall(ab.contains(_)) && ab.mkString.toInt <= n
        if (ok) 1 else 0
      } else {
        Seq(7, 5, 3).map { i =>
          ab(pos) = i
          rec(pos + 1, l, ab)
        }.sum
      }
    }

    val l = s.length

    val ans = 3.to(l).map { i =>
      val ab = ArrayBuffer.fill(i)(0)
      rec(0, i, ab)
    }.sum
    println(ans)
  }


  taskC()
}


Measured memory_bytes: 57204
<?php
$ac = 0;
$wa = 0;
$tle = 0;
$re = 0;
 // 入力を受け取る
while($input = fgets(STDIN)){
    if(preg_match("/AC$/", $input)){
        $ac++;
    }
    if(preg_match("/WA$/", $input)){
        $wa++;
    }
    if(preg_match("/TLE$/", $input)){
        $tle++;
    }
    if(preg_match("/RE$/", $input)){
        $re++;
    }
}
echo "AC x " . $ac . "\n";
echo "WA x " . $wa . "\n";
echo "TLE x " . $tle . "\n";
echo "RE x " . $re . "\n";
?>

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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl

const long long MOD = 1000000007;


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

    int len = s.size();
    int ans[len];
    fill(ans, ans+len, 0);

    int c = 0;
//    bool con = false;
    rep(i, len){
        if(s[i] == 'R'){
//            con = true;
            c++;
        }else{
//            con = false;
            ans[i-1] += c/2 + c%2;
            ans[i] += c/2;
            c = 0;
        }
    }
    c = 0;
    REP(i, len){
        if(s[i] == 'L'){
            c++;
        }else{
            ans[i+1] += c/2 + c%2;
            ans[i] += c/2;
            c = 0;
        }
    }

    rep(i, len){
        cout << ans[i] << " ";
    }
    
    return 0;
}


Measured memory_bytes: 1024
#E
N,P = map(int,input().split())
S = list(str(input()))

zcount = S.count("0")

U = []
for i in range(N):
    u = int(S[N-i-1])
    U.append(u)
    
npow = 1
T = [0]
now = 0
for i in range(N):
    now += U[i]*npow
    now %= P
    T.append(now)
    npow*=10
    npow%=P
    
pmod = [0]*P
for t in T:
    pmod[t]+=1
    
ans1 = 0
for p in pmod:
    ans1 += (p*(p-1))//2
    
if P != 2 and P != 5:
    print(ans1)
else:
    ans2 = 0
    for i in range(N):
        u = U[i]
        if u%P == 0:
            ans2+=N-i
    print(ans2)



Measured memory_bytes: 14236
import java.util.Scanner;

public class Main implements Runnable {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Thread(null, new Main(), "", 128 * 1024 * 1024).start();
    }

    public void run() {
        int c[][] = new int[3][3];
        int a1, a2, a3, b1, b2, b3;

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                c[i][j] = sc.nextInt();
            }
        }
        a1 = Math.min(c[0][0], Math.min(c[0][1], c[0][2]));
        a2 = Math.min(c[1][0], Math.min(c[1][1], c[1][2]));
        a3 = Math.min(c[2][0], Math.min(c[2][1], c[2][2]));

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                int min = i == 0 ? a1 : i == 1 ? a2 : a3;
                c[i][j] -= min;
            }
        }

        for (int j = 0; j < 3; j++) {
            int tmp = c[0][j];
            for (int i = 1; i < 3; i++) {
                if (c[i][j] != tmp) {
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 24148
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

int main()
{
	int a,b,c;
	while(cin >>a >>b){
	c = a+b;
	int ret = 1;
	for(int i=1;;i++){
		if( c/pow(10,i)>=1){
			ret++;
		}else{
			break;
		}
	}
	cout <<ret <<endl;
    }
	return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

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

    vector <long long> comb(N+1);
    vector <bool> notPrime(N+1);
    vector <int> primes;
    long long ans = 1;

    for (long long v = 2; v <= N; ++v) {
        if (!notPrime[v]) {
            comb[v] = 2;
            primes.push_back(v);
        }

        ans += v * comb[v];
        // cout << "COMB " << v << " " << comb[v] << endl;

        for (int i = 0; primes[i] * v <= N; ++i) {
            long long val = primes[i] * v;
            long long temp = val;

            notPrime[val] = true;

            // decomposition
            long long count = 0;
            while (temp % primes[i] == 0) {
                temp /= primes[i];
                ++count;
            }

            comb[val] = comb[v] * (count+1) / count;

            if (v % primes[i] == 0) {
                break;
            }
        }

    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 86808
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const long long int infLL = 9000000000000000000;
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(a) (a).begin(),(a).end()
#define mx_int_prime 999999937
const int inf = 2000000000;
const double PI = acos(-1);
const double eps = 1e-9;
typedef long double ld;
#define MOD 1000000007
typedef long long ll;
const int mx=2e5+125;
ll p[mx],a[mx],b[mx];
#define PB push_back
#define endl '\n'
#define S second
#define F first
int main()
{
    faster();
    int m1,d1;
    cin>>m1>>d1;
    int m2,d2;
    cin>>m2>>d2;
    if(m1==1 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==1 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==2 && d1==28)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==3 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==4 && d1==30)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==5 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==6 && d1==30)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==7 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==8 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==9 && d1==30)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==10 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==11 && d1==30)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==12 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    else
        cout<<0<<endl;

    return  0;
}


Measured memory_bytes: 3652
#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++){
				if (i == 0 || j == 0 || i == H - 1 || j == W - 1){
					cout << "#";
				}
				else cout << ".";
			}
			cout <<endl;
		}
		cout << endl;
			}
				
				return 0;
			}

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

#define INF INT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

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

    int n;
    cin >> n;

    vector<double> v(n);
    REP(i,n)cin >> v[i];
 
    while(v.size() > 1){
        sort(v.begin(),v.end(),std::greater<double>());
        // cout << v[v.size()-1] << " " << v[v.size()-2] << endl;
        double temp = (v[v.size()-1] + v[v.size()-2])/2.0;
        v.pop_back();
        v.pop_back();
        v.push_back(temp);
    }

    printf("%.5lf\n",v[0]);
    return 0;
}    

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

int main() {
  int n[4];
  int cnt = 0;
  const int total = 21;
  cin >> n[0] >> n[1] >> n[2] >> n[3];
  
  if (n[0]+n[1]+n[2]+n[3] != 21) {
  	cout << "NO" << endl;
  	return 0;
  } 

  for (int i = 0; i < 4; i++) {
    for (int c = 0; c < 4; c++) {
      if (n[c] == 1 || n[c] == 9 || n[c] == 7 || n[c] == 4) {
      	
        n[c] = 0;
        cnt++;
        break;
      }
    }
  }

  if (cnt == 4) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

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

ll dp[10010];

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

    int H, N;
    cin >> H >> N;

    vector<P> ab(N);

    rep(i, N)   
    {
        cin >> ab[i].first >> ab[i].second;
    }

    rep(i, 10010)
    {
        dp[i]=ll(1e8);
    }

    dp[0]=0;
    
    rep(i, N)
    {
        rep(j, H+1)
        {
            if(j-ab[i].first>=0) //ピッタリ
            {
                chmin(dp[j], ab[i].second+dp[j-ab[i].first]);
            }
            else //以上
            {
                chmin(dp[j], ab[i].second);
            }
        }
    }
  
    cout << dp[H] << endl;

    return 0;
}
 

//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find



Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <algorithm>
#include <map>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <stack>
#include <cassert>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie();
    
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if(u == s) a--;
    if(u == t) b--;
    cout << a << " " << b << endl;
}


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

int main()
{
  // 標準入力
  int H,N;
  cin >> H >> N;

  int A;
  for (int i; i < N; i++) {

    cin >> A;

    H -= A;
    if (H <= 0) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";

  return 0;

}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define min(x,y) ((x)<(y)?(x):(y))
using namespace std;

const int maxn=3e6+5;

int fi[maxn],ne[maxn*2],dui[maxn*2],dui1[maxn*2],qc[maxn];
int a[105][105],de[20005],h[maxn];
char s[105];
int i,j,k,l,m,n,x,y,now,p,be,ed,ans;
bool bq;

void add(int x,int y,int z){
    if (fi[x]==0) fi[x]=++now; else ne[qc[x]]=++now;
    dui[now]=y; dui1[now]=z; qc[x]=now;
}
bool bfs(){
    memset(de,255,sizeof(de));
    de[be]=0;
    h[1]=be; i=1; j=0;
    while (i>j){
        x=h[++j];
        for(int k=fi[x];k;k=ne[k]){
            if (de[dui[k]]!=-1 || dui1[k]==0) continue;
            de[dui[k]]=de[x]+1;
            h[++i]=dui[k];
        }
    }
    if (de[ed]==-1) return false; else return true;
}
int dinic(int x,int w){
    int i=fi[x],now=0,p;
    if (x==ed) return w;
    for(;i;i=ne[i]){
        if (dui1[i]==0 || de[dui[i]]!=de[x]+1) continue;
        p=dinic(dui[i],min(w-now,dui1[i]));
        if (p){
            dui1[i]-=p; dui1[i xor 1]+=p; now+=p;
        }
    }
    return now;
}
int main(){
//  freopen("074f.in","r",stdin);
    scanf("%d%d",&n,&m);
    fo(i,1,n){
        scanf("%s",&s);
        fo(j,0,m-1){
            if (s[j]=='.') continue;
            a[i][j+1]=++p;
            if (s[j]=='S') be=p;
            if (s[j]=='T') ed=p;
        }
    }
    now=1;
    fo(i,1,n)
        fo(j,1,m) if (a[i][j]>0 && a[i][j]!=ed){
            fo(k,1,m) if (a[i][k]>0 && a[i][k]!=a[i][j] && a[i][k]!=be){
                add(a[i][j]+p,a[i][k],1234567);
                if (a[i][j]==be && a[i][k]==ed){
                    printf("-1\n"); return 0;
                }
            }
            fo(k,1,n) if (a[k][j]>0 && a[k][j]!=a[i][j] && a[k][j]!=be){
                add(a[i][j]+p,a[k][j],1234567);
                if (a[i][j]==be && a[k][j]==ed){
                    printf("-1\n"); return 0;
                }
            }
        }
    fo(i,1,p){
        if (i==be || i==ed) add(i,i+p,1234567); else add(i,i+p,1);
        add(i+p,i,0);
    }
    ed=ed+p;
    while (bfs()) 
        ans=ans+dinic(be,1234567);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 35200
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[]) {
	int h, n;
	cin >> h >> n;
	vector<int> va, vb;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		va.push_back(a);
		vb.push_back(b);
	}

	unordered_map<int, int> um;
	for (int i = 0; i < n; i++) {
		if (um.find(va[i]) == um.end()) {
			um[va[i]] = vb[i];
		}
		else {
			um[va[i]] = min(um[va[i]], vb[i]);
		}
	}

	for (int i = 1; i < h; i++) {
		if (um.find(i) == um.end()) continue;
		for (int j = 0; j < n; j++) {
			int a = i + va[j], b = um[i] + vb[j];
			if (um.find(a) == um.end()) {
				um[a] = b;
			}
			else {
				um[a] = min(um[a], b);
			}
		}
	}

	int res = 0x3f3f3f3f;
	for (auto p : um) {
		if (p.first >= h) {
			res = min(res, p.second);
		}
	}
	cout << res << endl;
}









Measured memory_bytes: 768
function Main(input) {
    n = parseInt(input[0], 10);
    w = input[1].split(' ');
    var p;
    for (p = 0; p < w.length; p++) {
        w[p] = parseInt(w[p], 10);
    }
    // console.log(w[0]);
    var l = 0, r = 0;
    var i,k;
    var ans = Array(n-1);
    ans.fill(0);
    for (k = 0; k < n; k++) {
        r += w[k];
    }
    // console.log(r);
    // console.log("--------");
    for (i = 0; i < n-1; i++) {
        l += w[i];
        r -= w[i];
        ans[i] = Math.abs(l-r);
        // console.log(l, r);
    }
    ans.sort((a,b) => a < b ? -1 : 1);
    // console.log(ans);
    console.log(ans[0]);
    
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

Measured memory_bytes: 7628
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define li long int
#define ll long long int
#define vec(x) vector<x> 
#define st(x) set<x> 
#define mpp(x,y) map<x,y>
#define qq(x) queue<x>
#define pqq(x) priority_queue<x> 
#define search(x,y,z) binary_search(x,y,z)
#define pi(x,y) pair<x,y>
#define forf(i,x,y) for(ll i=x;i<y;i++)
#define forl(i,x,y) for(ll i=x-1;i>=y;i--)
#define rev(x) reverse(x.begin(),x.end())
#define mem(x,a) memset(x,a,sizeof(x))
#define mod 1000000007
#define nxt_per(x) next_permutation(x.begin(),x.end())
#define pb push_back
#define pob pop_back
#define pp push
#define po pop
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define vp(x,y) vec(pi(x,y) )
#define vv(x) vector<vector<x> >
#define all(x) x.begin(),x.end()

using namespace std;

int main()
{
	fastio;
	/*#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif*/
	
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	if(y1<y2)
	{	if(x1<=x2)
			cout<<(x2-abs(y1-y2))<<" "<<(y2+abs(x1-x2))<<" "<<(x1-abs(y1-y2))<<" "<<(y1+abs(x1-x2));
		else
			cout<<(x2-abs(y1-y2))<<" "<<(y2-abs(x1-x2))<<" "<<(x1-abs(y1-y2))<<" "<<(y1-abs(x1-x2));
	}
	else if(y1>y2)
	{	if(x1>=x2)
			cout<<(x2+abs(y1-y2))<<" "<<(y2-abs(x1-x2))<<" "<<(x1+abs(y1-y2))<<" "<<(y1-abs(x1-x2));
		else
			cout<<(x2+abs(y1-y2))<<" "<<(y2+abs(x1-x2))<<" "<<(x1+abs(y1-y2))<<" "<<(y1+abs(x1-x2));		
	}
	else
	{	if(x1<x2)
			cout<<x2<<" "<<(y2+abs(x1-x2))<<" "<<x1<<" "<<(y1+abs(x1-x2));
		else
			cout<<x2<<" "<<(y2-abs(x1-x2))<<" "<<x1<<" "<<(y1-abs(x1-x2));
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
const int N = 110, M = 101000;
long long n, m, f[M], a[N], v[N]; 
int main(){
	scanf("%lld%lld", &n, &m);
	for( int i = 1; i <= n; ++i )
		scanf("%lld%lld", &a[i], &v[i]);
	for( int i = 1; i <= n; ++i )
		for( int j = m; j >= a[i]; --j )
			f[j] = max(f[j], f[j-a[i]] + v[i]);
	printf("%lld\n", f[m]);
	return 0;
}

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

public class Main {
	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int size = 100005;
		
		try {
			String[] input_str = br.readLine().split("\\s+");
			int n = Integer.parseInt(input_str[0]);
			int q = Integer.parseInt(input_str[1]);
			int elapse = 0;
			Queue queue = new Queue(size);
			StringBuilder ans = new StringBuilder();
			
			for(int i=0; i<n; i++) {
				input_str = br.readLine().split("\\s+");
				queue.push(new Process(input_str[0], Integer.parseInt(input_str[1])));
			}
			
			while(!queue.isEmpty()) {
				Process tmp = queue.pop();
				if(tmp.getTime() <= q) {
					elapse += tmp.getTime();
					ans.append(tmp.getName()).append(" ").append(Integer.toString(elapse)).append("\n");
				} else {
					elapse += q;
					tmp.setTime(tmp.getTime() - q);
					queue.push(tmp);
				}
			}
			System.out.print(ans.toString());
		} catch (NumberFormatException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
	}
}

class Process{
	private String name;
	private int t;
	
	Process(String arg_name, int arg_time){
		name = arg_name;
		t = arg_time;
	}
	
	public String getName() {
		return name;
	}
	
	public int getTime() {
		return t;
	}
	
	public void setTime(int arg_time) {
		t = arg_time;
	}
}

class Queue{
	private Process[] table;
	private int head, tail, size;
	
	Queue(int arg_size) {
		size = arg_size;
		table = new Process[size];
		head = 0;
		tail = 0;
	}
	
	boolean isEmpty() {
		return head == tail;
	}
	
	void push(Process process) {
		table[tail] = process;
		tail = (tail+1)%size;
	}
	
	public Process pop() {
		head = (head+1)%size;
		return table[(head-1+size)%size];
	}
}


Measured memory_bytes: 70588
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 998244353
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int h, w;

signed main() {
	cin >> h >> w;
	if (h == 1 || w == 1)cout << 1 << endl;
	else if ((h*w) % 2)cout << (h*w + 1) / 2 << endl;
	else cout << h * w / 2 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <iostream>

#define N 100005
#define MOD 1000000007

using ll = long long;
ll x, y;

ll p[N];
int pn;

ll solve(ll, ll);

int main()
{
	
	std::cin >> x >> y;
	ll d = solve(x, y);

	int ans = 1;
	if (d % 2 == 0) ans++;
	while (d % 2 == 0)	d /= 2;

	for (ll i = 3; i * i <= d; i += 2) {
		if (d % i == 0)
		{
			ans++;
			while (d % i == 0)	d /= i;
		}
	}
	if (d != 1) ans++;

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

inline ll solve(ll a, ll b)
{
	if (b == 0) return a;
	else return solve(b, a % b);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;


    void solve()
    {
        var X = cin.nextlong;
        var Y = cin.nextlong;

        long cnt = 0;
        while (X <= Y)
        {
            cnt++;
            X *= 2;
        }
        WriteLine(cnt);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13140
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include <cmath>
//#include <vector>
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

//vector//
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

typedef pair<int,int> P;  //q(p.first,p.second)

int main (){
    int n; cin >> n;
    vector<P> d(n);
    for(int i=0; i<n; i++){
        cin >> d[i].first >> d[i].second;
    }

    int ju = 0;
    for(int i=0; i<n; i++){
        if(d[i].first == d[i].second){
            ju++;
            if(ju == 3){
                cout << "Yes";
                break;
            }
        }else{
            ju = 0;
        }
    }
    if(ju < 3){
        cout << "No";
    }
}

Measured memory_bytes: 3628
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())
S = np.frombuffer(readline().rstrip(),'S1')
Q = int(readline())
query = map(int,read().split())

isD = S == b'D'
isM = S == b'M'
isC = S == b'C'

cumD = isD.cumsum(dtype=np.int64)
cumM = isM.cumsum(dtype=np.int64)

def F(K):
    """
    ・Cごとに数える。
    ・そのためには(i-K,i] 内のDMの個数を調べる（負インデックスには関係ない文字があると思っておく）
    ・区間内のDの個数、Mの個数が取得できれば、差分が取得できるので最後に累積和
    """
    # (i-K,i]内のDの個数、Mの個数
    D = cumD.copy(); D[K:] -= cumD[:-K]
    M = cumM.copy(); M[K:] -= cumM[:-K]
    # 最後がMのとき、Dの個数分増える
    DM = D; DM *= isM
    # 左端のDを捨てるとき、Mの個数分減る
    DM[K:] -= isD[:-K] * M[K-1:-1]
    np.cumsum(DM,out=DM)
    # Cごとに集計
    return (DM*isC).sum()

print('\n'.join(str(F(K)) for K in query))

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

int N;
int main(){
    cin >> N;
    map<int, int > T;
    int a;
    for(int i=0; i<N; i++){
        cin >> a;
        T[a-1] += 1;
        T[a] += 1;
        T[a+1] += 1;
    }
    map<int, int >::iterator iter;
    int ans;
    ans = 0;
    for(iter=T.begin(); iter!=T.end(); iter++){
        pair<int, int > item = *iter;
        if(item.second >= ans){
            ans = item.second;
        }
    }
    cout << ans << endl;
}


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

#define     F       first
#define     S       second
typedef pair<int, int>  pi;
typedef long long       ll;


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

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

    cout << ans;

    return 0;
}


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

int n;
string a,b,c;

int main() {
	cin >> n >> a >> b >> c;

	int ans = 0;
	for(int i = 0; i < n; i++) {
		if(a[i]==b[i]&&b[i]==c[i]) continue;
		if(a[i]!=b[i]&&b[i]!=c[i]&&c[i]!=a[i]) ans+=2;
		else ans+=1;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
bool cards[52];
 
int Pos(char a)
{
    if(a == 'S')
        return 0;
    if(a == 'H')
        return 1;
    if(a == 'C')
        return 2;
    if(a == 'D')
        return 3;
}
char Suit(int i)
{
    if(i/13 == 0)
        return 'S';
    if(i/13 == 1)
        return 'H';
    if(i/13 == 2)
        return 'C';
    if(i/13 == 3)
        return 'D';
}
 
int main()
{
    int cant;
    cin >> cant;
    while(cant--)
    {
        char suit;
        int num;
        cin >> suit >> num;
        cards[Pos(suit)*13 + num - 1] = true;
    }
    for(int i = 0; i < 52; ++i)
    {
        if(!cards[i])
            cout << Suit(i) << " " << (i % 13) + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3132
#include <iostream>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b > c+d) cout << "Left" << endl;
  else if(a+b == c+d) cout<< "Balanced" << endl;
  else cout << "Right" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF (1<<29)
using namespace std;
main(){
  int n,k;
  int d[150][150];
  while(cin>>n>>k,n||k){
    fill_n(*d,150*150,INF);//コストはINF(いけない)
    for(int i=0;i<=n;i++){
      d[i][i]=0;//スタートとゴールが一緒なら0
    }
    for(int i=0;i<k;i++){
      int num,s,g,c;
      cin>>num;
      if(num==0){
	cin>>s>>g;
	cout<<(d[s][g]==INF ? -1:d[s][g])<<endl;
      }
      else if(num==1){
	cin>>s>>g>>c;
	d[s][g]=d[g][s]=min(d[s][g],c);
	for(int j=1;j<=n;j++){
	  for(int l=1;l<=n;l++){
	    d[j][l]=d[l][j]=min(d[j][l],d[j][s]+d[s][g]+d[l][g]);//スタート→新しくなった線路のスタート→新しくなった線路のゴール→ゴール
	  }
	}
      }
    }
  }
}

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

public class AtCoder
{

    public static int[] ReadArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt32(m));
    }

    public static int ReadInt()
    {
        return Convert.ToInt32(Console.ReadLine());
    }

    public static string ReadStr()
    {
        return Console.ReadLine();
    }

    public static long ReadLong()
    {
        return Convert.ToInt64(Console.ReadLine());
    }

    public static long[] ReadLongArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt64(m));

    }


    public static void Main()
    {
        var s = ReadStr();

        int[] a = new int[s.Length];
        int[] b = new int[s.Length];

        int k = 0;
        for(int i = 0; i < s.Length; i++)
        {
            a[i] = k;
            k ^= 1;
            b[i] = k; 
        }

        int res1 = 0, res2 = 0;
        for(int i = 0; i < s.Length; i++)
        {
            if (s[i] - '0' != a[i])
                res1++;
            if (s[i] - '0' != b[i])
                res2++;
        }




        Console.WriteLine(Math.Min(res1,res2));

       

      
       


    }


}

Measured memory_bytes: 13208
import sys
n=int(input())
c=[int(i) for i in sys.stdin]
x=[0]*(200001)
c.append(0)
x[c[0]]+= 1
num=1
p=10**9 +7
for i in range(1,n):
  if c[i]-c[i-1]:
    x[c[i]]+= num
    x[c[i]]= x[c[i]]%p
  if c[i]-c[i+1]:
    num=x[c[i]]%p
  else:
    num=0
print(num)

Measured memory_bytes: 16556
#include<bits/stdc++.h>
using namespace std;
#define loi long long
#define pb push_back
#define run ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
#define lim 5000000000000000000
#define mxn 1000002
#define in(ar, n) for(loi i = 0; i < n; i++) cin >> ar[i];
#define out(ar, n) for(loi i = 0; i < n; i++) cout << ar[i] << " "; cout << "\n";
#define rep(i, n) for(loi i = 0; i < n; i++)
#define rep1(i, n) for(loi i = 1; i <= n; i++)
#define rev(i, n) for(loi i = n - 2; ~i; i--)
#define rep3(i, l, r) for(loi i = l; i <= r; i++)
#define rep4(i, r, l) for(loi i = r; i >= l; i--)
#define all(x) x.begin(), x.end()
#define mkp make_pair
#define vii vector<loi>
#define mii map<loi, loi>
#define sii set<loi>
#define pii pair<loi, loi>

mii dp;
loi n, a, b, c, d;

loi check(loi n)
{
    //cout << "n aya : " << n << "\n";

    if(!n) {//cout << "hua\n";
    return 0;}

    if(n == 1) {//cout << "hua\n";
    return d;}

    if(dp.find(n) != dp.end()) return dp[n];

    vii divs;
    divs.pb(2);
    divs.pb(3);
    divs.pb(5);

    vii cost;
    cost.pb(a);
    cost.pb(b);
    cost.pb(c);

    loi best = lim;
    if(n < best / d)
        best = n * d;

    rep(i, 3)
    {
      if(!(n % divs[i]))
          best = min(best, cost[i] + check(n / divs[i]));

      else
      {
          loi cl = ((n / divs[i]) + 1) * divs[i];
          loi fl = (n / divs[i]) * divs[i];

          best = min(best, ((cl - n) * d) + cost[i] + check(cl / divs[i]));
          best = min(best, ((n - fl) * d) + cost[i] + check(fl / divs[i]));
      }
    }
    //cout << "hua\n";
    return dp[n] = best;
}

int main()
{
    //run;
    loi t;
    cin >> t;
    while(t--)
    {
       dp.clear();
       cin >> n >> a >> b >> c >> d;
       loi res = check(n);
       cout << res << "\n";
    }

    return 0;
}


Measured memory_bytes: 4448
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, X = map(int, readline().split())

    if A <= X <= A + B:
        print('YES')
    else:
        print('NO')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 8888
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		int n = sc.nextInt();
		if(n == 100) {
			System.out.println((int)Math.pow(100, d) * (n + 1));
		} else {
			System.out.println((int)Math.pow(100, d) * n);
		}
	}
}


Measured memory_bytes: 23764
S = input()

N = len(S)
cnt = [0 for _ in range(N)]
r_cnt = 0
l_cnt = 0
i = 0

while i < N - 1:
    if S[i] == "R":
        r_cnt += 1
    if S[i + 1] == "L":
        buff = i
        while i < N - 1 and S[i + 1] == "L":
            l_cnt += 1
            i += 1
        cnt[buff] = (r_cnt + 1) // 2 + l_cnt // 2
        cnt[buff + 1] = r_cnt // 2 + (l_cnt + 1) // 2
        r_cnt = 0
        l_cnt = 0
    i += 1

print(*cnt)


Measured memory_bytes: 6400
// header {{{
// header {{{
#include <bits/stdc++.h>
using namespace std;
 
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
 
#define ASSERT(expr...) assert((expr))
 
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
 
using f32 = float;
using f64 = double;
// }}}
 
constexpr i64 INF = 1'010'000'000'000'000'017LL;
 
constexpr i64 MOD = 1'000'000'007LL;
 
constexpr f64 EPS = 1e-12;
 
constexpr f64 PI = 3.14159265358979323846;
 
#define M5 100007
 
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
 
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define ll long long int
#define VI vector <ll>
template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
 
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
 
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
 
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}
 
// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
 
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}
 
//--------------------------------------------------------------------
 
 
 
void solve() {
    ll H,W;
    cin >> H>>W;
    if(H == 1 || W == 1){
        cout << 1;
    } else{
    cout <<fixed << setprecision(0)<< ceil((long double)H*W/2);
    }

}
 
signed main() {
 
    solve();
 
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
   var ez = Console.ReadLine().Split();
   var a = int.Parse(ez[0]);
   var b = int .Parse(ez[1]);
   var c = int.Parse(ez[2]);
    var d = int.Parse(ez[3]);
    int i = 1;
    int kati =0;
     for(i=1;;i++){
       if(i%2 == 1){
         c = c-b;
         if(c <= 0){
           kati = 1;
           break;
         }
       }
       else{
         a=a-d;
         if(a<=0){
           kati=2;
           break;
         }
       }
     }
     if(kati == 1) Console.WriteLine("Yes");
     else Console.WriteLine("No");
  }
}

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

long long int gcd(long long int a, long long int b)
{
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

long long int lcm(long long int a, long long int b)
{
  long long int g = gcd(a, b);
  return a / g * b;
}

int main()
{
  int N;
  cin >> N;
  vector<long long int> T(N);
  for (int i = 0; i < N; i++)
  {
    cin >> T[i];
  }
  long long int ans = T[0];
  for (int i = 1; i < N; i++)
  {
    ans = lcm(ans, T[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import bisect
n = int(input())
l = [int(i) for i in input().split()]
l.sort()
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        t = bisect.bisect_left(l, l[i] + l[j])
        if (t > j):
            ans += t - j - 1
print(ans)

Measured memory_bytes: 3188
#include<stdio.h>
long size=0;
int main(){
  int n;
  int q;
  int i;
  int j;
  int binarySearch(int *,int);
  int count=0;
  int S[100000];
  int T[50000];

  scanf("%d",&n);  
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  size = i;
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }

  for(i=0;i<q;i++){
    if(binarySearch(S,T[i]) == 1) count++;
  }
  printf("%d\n",count);
  return 0;
}

int binarySearch(int *A,int key){
  int left = 0;
  long right = size;
  int mid;
  
  while(left < right){
    mid = (left + right)/2;
    if(A[mid] == key) return 1;
    else if(key < A[mid]) right = mid;
    else  left = mid + 1;
  }
  return 0;
}



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

int main() {
	int a, b, x;
	cin >> a >> b >> x;
	if (a > x) {
		cout << "NO" << endl;
	}
	else if (a + b < x&&a < x) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
string a;
cin >> a;
for (int tmp = 0; tmp < (1 << 3); tmp++) {
  bitset<3> s(tmp);
  int ans = a.at(0)-'0';
  vector<char> vec(3);
  for (int i = 0;i < 3;i++) {
      if (s.test(i)) {
          ans += a.at(i+1) - '0';
          vec.at(i) = '+';
      } else {
          ans -= a.at(i+1) - '0';
          vec.at(i) = '-';
      }
  }
  if (ans == 7) {
      cout << a.at(0) << vec.at(0) << a.at(1) << vec.at(1) <<a.at(2) << vec.at(2) << a.at(3) << "=7" << endl;
      return 0;
  }
}




}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int n;
	bool ans= false;

	cin>>n;

	while(n!=0){
		if(n%10==9)
			ans=true;

		n/=10;
	}

	if(ans)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;

	return 0;
}

Measured memory_bytes: 256
kisuu = ["R", "U", "D"]

guusuu = ["L", "U", "D"]

S = str(input())


flag = True
for i in range(len(S)):
    if i % 2 == 0:  # 奇数文字目なら
        if S[i] not in kisuu:
            flag = False

    if i % 2 == 1:
        if S[i] not in guusuu:
            flag = False

if flag:
    print("Yes")
else:
    print("No")


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n;
    ll h, w;
    cin >> n >> h >> w;
    int ans = 0;
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        if (a >= h && b >= w) {
            ans++;
        }
    }
    cout << ans << endl;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int A[3][3];
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			A[i][j] = in();
		}
	}

	for(int i=0;i<3;i++){
		int B[3];
		for(int j=0;j<3;j++){
			B[j] = A[i][j]-A[(i+1)%3][j];
		}
		if(B[0]!=B[1] || B[0]!=B[2] || B[1]!=B[2]){
			out("No");
			return 0;
		}
	}
	
	out("Yes");
	return 0;
}


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

using namespace std;
void print(vector<int>V){
  for (int i=0;i<V.size();i++){
    cout << V[i] << " ";
  }
  cout << endl;
}

vector<int>V;

int main(){
  int K, N;
  int q;
  cin >> K >> N;
  for (int i=0;i<2;i++){
    cin >> q;
    V.push_back(q);
  }
  int length = V[1] - V[0];
  int base_total = K - length;
  int total;
  if (N >= 2){
    for (int i=2;i<=N;i++){
      if (i<=N-1){
        cin >> q;
        V.push_back(q);
        total = K - (V[2] - V[1]);
        V.erase(V.begin()+1);
      }else if (i==N){
        total = V[1] - V[0];
      }
      if (base_total > total){
        base_total = total;
      }
    }
  }
  cout << base_total << endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ans := n - 1
	if n <= 2 {
		fmt.Println(0)
		return
	}
	mp := map[int]bool{}
	for i := 2; i <= 1000000; i++ {
		v := n/i - 1
		if v <= 0 {
			continue
		}
		if n/v == n%v {
			if mp[v] {
				continue
			}
			mp[v] = true
			ans += v
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 768
#include<stdio.h>
int MAX(int a,int b){return a<b?b:a;}
int main(){
  int n,i,j,a,b,m,w,h;
  while(scanf("%d",&n),n){
    int d[510][510]={};
    scanf("%d %d",&w,&h);
    while(n--){
      scanf("%d %d",&a,&b);
      d[b][a]++;
    }
    for(i=0;i<h;i++){
      for(j=0;j<w;j++)d[i+1][j+1]+=d[i][j+1]+d[i+1][j]-d[i][j];
    }
    /*for(i=0;i<=h;i++){
      for(j=0;j<=w;j++)printf("%d ",d[i][j]);
      printf("\n");
      }//*/
    scanf("%d %d",&a,&b);
    for(i=m=0;i+b<=h;i++){
      for(j=0;j+a<=w;j++)m=MAX(m,d[i][j]+d[i+b][j+a]-d[i][j+a]-d[i+b][j]);
    }
    printf("%d\n",m);
  }
  return 0;
}

Measured memory_bytes: 1624
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;
const int MAX = 510000;

void Main() {
  string s;
  cin >> s;
  while (true) {
    s.pop_back();
    int n = s.size();
    if (n % 2 != 0) continue;
    int cnt = 0;
    rep(i, 0, n / 2) {
      if (s[i] == s[i + n / 2])
        cnt++;
      else
        break;
    }
    if (cnt == n / 2) {
      cout << n << endl;
      return;
    }
  }
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

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

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<PII> VP;


//REPEAT
//------------------------------------------
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i > n;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,m)  RFOR(i,m,0)

//container util
//------------------------------------------
#define pb(a) push_back(a)
#define fst first
#define snd second
#define SORT(V) sort((V).begin(),(V).end())
#define REV(V) reverse((V).begin(),(V).end())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//grobal variable
//------------------------------------------
int dp[101][4][4][4]; //AGCT -> 0123

//def function
//------------------------------------------

//main
//------------------------------------------

signed main(){
  int N, M;
  cin >> N >> M;
  VP AB(N);
  REP(i, N) cin >> AB.at(i).fst >> AB.at(i).snd;

  SORT(AB);

  int ans=0, count=0, t=0;
  REP(i, N){
    count+=AB.at(i).snd;
    ans+=AB.at(i).fst*AB.at(i).snd;
    if(count>=M) break;
    t++;
  }

  ans-=(count-M)*AB.at(t).fst;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define rep(n) for (ll i = 0; i < n; i++)
#define repc(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b)/gcd(a, b)
#define int long long int
#define ull unsigned long long

using namespace std;
const int MOD = 1e9 + 7;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k;
    cin>>n>>k;
    int ans = 0;
    for(int i = 0;i<n;i++){
    	int t;
    	cin>>t;
    	if(t >= k){
    		ans++;
    	}
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256