akhauriyash/Code-Regression huggingface dataset:
<?php

//----------------------------------------------------------------------------------
// Input
//----------------------------------------------------------------------------------
$sc = new Scanner();
$a = $sc->nextInt();
$b = $sc->nextInt();

//  $t = array();
//  $d = array();
//  for ($i = 0; $i < $n; $i++) {
//    $t[] = $sc->next();
//    $d[] = $sc->next();
//  }



//----------------------------------------------------------------------------------
// Main
//----------------------------------------------------------------------------------

$ans = 0;

if ($a == $b) { $ans = $a*2; }
if ($a >= $b+1) { $ans = $a*2-1; }
if ($a+1 <= $b) { $ans = $b*2-1; }



//----------------------------------------------------------------------------------
// Output
//----------------------------------------------------------------------------------
$is_large_int_ans = 0;
$is_multi_ans = 0;

if ($is_multi_ans) {
  for ($i = 0; $i < count($ans); $i++) {
    out::println($ans);
  }
} else {
  out::println($ans);
}



//----------------------------------------------------------------------------------
// Ref: https://qiita.com/yoshikyoto/items/6924478283dbdd549e4b
//----------------------------------------------------------------------------------
class Scanner {
  private $arr = array();
  private $count = 0;
  private $pointer = 0;

  private $fp = NULL;

  function __construct() {
    $folder = explode("\\", getcwd());
    if (end($folder) == 'AtCoder') {
      error_reporting(E_ERROR | E_WARNING | E_PARSE);
      $this->fp = fopen('./Input.dat' , 'r');
    } else {
      error_reporting(0);
    }
  }

  public function next() {
    if($this->pointer >= $this->count) {
      $folder = explode("\\", getcwd());
      if (end($folder) == 'AtCoder') {
        $str = trim(fgets($this->fp));
      } else {
        $str = trim(fgets(STDIN));
      }
      $this->arr = explode(' ', $str);
      $this->count = count($this->arr);
      $this->pointer = 0;
    }
    $result = $this->arr[$this->pointer];
    $this->pointer++;
    return $result;
  }
  public function hasNext() {
    return $this->pointer < $this->count;
  }
  public function nextInt() {
    return (int)$this->next();
  }
  public function nextDouble() {
    return (double)$this->next();
  }
}

class out {
  public static function println($str = "") {
    global $is_large_int_ans;
    if ($is_large_int_ans) {
      echo sprintf("%d", $str) . PHP_EOL;
    } else {
      echo $str . PHP_EOL;
    }
  }
}

?>


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std; 
int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int K;
    int csum = 7, M = 1e9+9;
    cin >> K;
    unordered_map<int, int> store;
    bool found = false;
    for (int i=1; ; i++){
        int rem = csum%K;
        if (rem==0){
            cout << i << "\n";
            found = true;
            break;
        }
        if (store.find(rem)!=store.end())
            break;
        csum = (1ll*csum*10+7)%K;
        store[rem]++;
    }
    if (!found)
        cout <<"-1\n";
}

Measured memory_bytes: 42556
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nums = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);

            var A = nums[0];
            var B = nums[1];
            if ((A + B) % 2 == 1)
            {
                Console.WriteLine("IMPOSSIBLE");
               }
            else if (A == B)
            {
                Console.WriteLine(0);
            }
                else
            {
            var Ans = (A + B) / 2;
            Console.WriteLine(Ans);

            }


        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
    int n,k,ans=0;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++)
        cin>>h[i];
    sort(h,h+n,greater<int>());
    if(k>=n)
        cout<<0;
    else
    {
        for(int i=k;i<n;i++)
            ans+=h[i];
        cout<<ans;
    }
}


Measured memory_bytes: 1792
let cnt = ref 0

let print_array a =
  Array.iteri (fun i n -> Printf.printf (if i = 0 then "%d" else " %d") n) a;
  print_newline ()

let bubble_sort a n =
  let swap i j = let tmp = a.(i) in a.(i) <- a.(j); a.(j) <- tmp in
  let rec bubble j flag =
    if j <= 0 then flag
    else if a.(j - 1) <= a.(j) then bubble (j - 1) flag
    else (swap j (j - 1); incr cnt; bubble (j - 1) true)
  in
  let rec doit flag =
    if not flag then ()
    else doit (bubble (n - 1) false)
  in
  doit true

let () =
  let n = read_int () in
  let a = Array.of_list (List.map int_of_string (Str.split (Str.regexp " ") (read_line ()))) in
  bubble_sort a n;
  print_array a;
  Printf.printf "%d\n" !cnt

Measured memory_bytes: 2368
n = int(input())
a = []
b = []
for _ in range(n):
    k, l = map(int, input().split())
    a.append(k)
    b.append(l)
s = 0
for i in range(n):
    j = n-1-i
    a[j] += s
    if a[j] % b[j] == 0:
        continue
    s += (a[j]//b[j] + 1) * b[j] - a[j]
print(s)

Measured memory_bytes: 15016
using System;

class Aoj
{
	public static void Main()
	{
		var dataCount = int.Parse(Console.ReadLine());
		var maxProfit = int.MinValue;
		var minValue = int.Parse(Console.ReadLine());

		for (int i = 1; i < dataCount; i++)
		{
			var value = int.Parse(Console.ReadLine());
			maxProfit = Math.Max(maxProfit, value - minValue);
			minValue = Math.Min(minValue, value);
		}

		Console.WriteLine(maxProfit);
	}
}

Measured memory_bytes: 9096
#include <bits/stdc++.h>
using namespace std;
int H,W,sx,sy,gx,gy,d[1000][1000];
string s[1000];
int INF=1<<30;
main()
{
    cin>>H>>W;
    cin>>sx>>sy;
    cin>>gx>>gy;
    --sx;--sy;--gx;--gy;
    for(int i=0;i<H;++i)cin>>s[i];
    for(int i=0;i<H;++i)for(int j=0;j<W;++j)d[i][j]=INF;
    d[sx][sy]=0;
    deque<pair<int,int>>q;
    q.push_back({sx,sy});
    while(!q.empty())
    {
        int x=q.front().first;
        int y=q.front().second;
        q.pop_front();
        for(int i=-2;i<=2;++i)for(int j=-2;j<=2;++j)
        {
            int nx=x+i;
            int ny=y+j;
            if(nx<0||ny<0||nx>=H||ny>=W||s[nx][ny]=='#')continue;
            if(abs(i)+abs(j)<=1&&d[nx][ny]>d[x][y])
            {
                d[nx][ny]=d[x][y];
                q.push_front({nx,ny});
            }else if(d[nx][ny]>d[x][y]+1)
            {
                d[nx][ny]=d[x][y]+1;
                q.push_back({nx,ny});
            }
        }
    }
    cout<<(d[gx][gy]==INF?-1:d[gx][gy])<<endl;
}

Measured memory_bytes: 9436
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i,l,r) for(int i = (int)l;i<(int)r;i++)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline ll mod(ll n, ll m){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

const int N = 2e6  +100;
int fat[N],inv[N];
// long long ? ?
const int M = 1e9 + 7;

int C(int n,int k){
	if(k>n)return 0;
	return mod(fat[n]*mod(inv[k]*inv[n-k],M),M);
}

int32_t main(){
  fastio;
  int r;
  cin>>r;
  cout<<r*r<<endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> p(4),t(n);
    for(int i=0; i<4; i++){
        cin >> p[i];
    }
    for(int i=0; i<4; i++){
        cin >> t[i];
    }
    int ans = 1e9;
    for(int i=0; i<=100; i++){
        for(int j=0; i+j<=100; j++){
            for(int k=0; i+j+k<=100; k++){
                int sub = p[0]*i +p[1]*j +p[2]*k;
                int num = t[0]*i +t[1]*j +t[2]*k;
                int rem = n-num;
                if(rem > 0){
                    sub += (rem +t[3] -1)/t[3] *p[3];
                }
                ans = min(ans, sub);
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
typedef long long ll;
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
long long modpow(long long a,long long n,long long p)
{
    if(n==1)
    {
        return a%p;
    }
    if(n%2==1)
    {
        return a*modpow(a,n-1,p)%p;
    }
    long long t = modpow(a,n/2,p);
    return t*t%p;
}
int main()
{
    /*A
    int n,k;
    cin>>n>>k;
    vector <char> a(n);
    rep(i,n)
    {
        cin>>a[i];
    }
    a[k-1]=a[k-1]+32;

    rep(i,n)
    {
        cout<<a[i];
    }
    cout<<endl;
    */
    /*B
    int s;
    cin>>s;
    

    int L = s/100;
    int R = s%100;

    if(L>=1 && L<=12)
    {
        if(R>=1 && R<=12)
        {
            cout<<"AMBIGUOUS"<<endl;
        }
        else
        {
            cout<<"MMYY"<<endl;
        }
    }
    else
    {
        if(R>=1 && R<=12)
        {
            cout<<"YYMM"<<endl;
        }
        else
        {
            cout<<"NA"<<endl;
        }
    }
    */

    int n,k;
    cin>>n>>k;
    double count[n];
    rep(i,n)
    {
        count[i]=(double)1/n;
    }
    
    for(int i=0;i<n;i++)
    {
        int num = i+1;
        while(num<k)
        {
            num*=2;
            count[i]*=(double)1/2;
        }
    }

    double sum;
    rep(i,n)
    {
        sum+=count[i];
    }

    cout<<setprecision(12)<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 2e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
int tc;

int main()
{
    FIO
    string n; cin>>n;
    ll sum = 0;
    for(int i = 0 ; i< n.length(); i++) sum+= n[i] - '0';
    (sum%9) ? cout<<"No" : cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3692
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    var nh = input[0].split(' ');
    var n = parseInt(nh[0], 10);
    var h = parseInt(nh[1], 10);
    var a = new Array(n);
    var b = new Array(n);
    for (var i = 0; i < n; i++) {
        var ab = input[i + 1].split(' ');
        a[i] = parseInt(ab[0], 10);
        b[i] = parseInt(ab[1], 10);
    }

    var maxa = Math.max.apply(null, a);
    var sortb = b.sort(function(a, b) {
        if (a > b) {
            return -1;
        }
        if (a < b) {
            return 1;
        }
        return 0;
    });

    var ans = 0;
    var restHP = h;
    for (var i = 0; i < n; i++) {
        if (b[i] > maxa) {
            restHP -= b[i];
            ans++;
            if (restHP <= 0) {
                break;
            }
        }
    }

    if (restHP > 0) {
        ans += Math.ceil(restHP / maxa);
    }
    console.log(ans);

    return 0;
}


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

int gcd(int a,int b){
  if(abs(a-b)==1){
    return 1;
  }else if(a==b){
    return a;
  }else{
    if(a>b){
      return gcd(a-b,b);
    }else{
      return gcd(a,b-a);
    }
  }
}

int main(){
  int N;
  cin>>N;
  vector<int> x(N+1);
  for(int i=0;i<N+1;i++){
    cin>>x.at(i);
  }
  if(N==1){cout<<abs(x.at(1)-x.at(0))<<endl;
          }else{
  sort(x.begin(),x.end());
  vector<int> sa(N);
  for(int i=0;i<N;i++){
    sa.at(i)=x.at(i+1)-x.at(i);
  }
  int sum;
  for(int i=0;i<N-1;i++){
    if(i==0){
      sum=gcd(sa.at(i),sa.at(i+1));
    }else{
      sum=gcd(sum,sa.at(i+1));
    }
  }
  cout<<sum<<endl;}
  
}

Measured memory_bytes: 1024
N = int(input())
ans = 0

#Pythonのfor文range()の右側<最大値>は書いている値から-1されるものなので、注意する。(+1する)

for i in range(1, N + 1):

    if len(str(i)) % 2 == 1:
        ans += 1

print(ans)


Measured memory_bytes: 2940
//BISMILLAHIR-RAH-MANIR-RAHIM.
//ABU AYUB MD AHMADUL(CEO-PEREGRINE SPHERE).
//FORMER CEO-SPACEH(2019).
//DEPT.OF CSE,SUST//2018-19.
//------------------------------------------\\
//PRE-CODE========>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#include<vector>
#include<math.h>
#include<numeric>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>
#include<map>
#define mp make_pair
#define ins insert
#define lli long long int
#define ll long long
#define pb push_back
#define loop1(i,l,n) for(i=l;i<=n;i++)
#define loop0(i,l,n) for(i=l;i<n;i++)
#define inf (1<<28)
#define pi 3.1415926536
const int MAX=1e6+9;
set<int>ist;
map<string,int>msi;
map<string,string>mss;
map<int,string>mis;
map<int,int>mii;
pair<int,int>pii;
vector<int>v;
vector<pair<int,int> >vv;
int cc[]= {1,-1,0,0};
int rr[]= {0,0,1,-1};
//BIPARTITE GRAPH FUCTION========>
/*
int cnt[2];
int vertices[MAX];
void Bipartite(int node,int pnode,int color)
{
    cnt[color]++;
    for (int i=0;i<vertices[node].size();i++)
    {
        if (vertices[node][i]!=pnode)
        {
            Bipartite(vertices[node][i],node,!color);
        }

    }
}
*/
//REAL TIME BINARY SERACH FUNCTION========>
/*
int Bsearch(int left,int right,int query,int n)
{
    int mid=left+(right-left)/2;
    if(query<mid)
    {
        return Bsearch(left,mid-1,query,n);
    }
    else if(query>mid)
    {
        return Bsearch(mid+1,right,query,n-1);
    }
    else
    {
        return n;
    }
}
*/
//DECIMAL TO BINARY DECODING========>
/*
ll D2B(ll dec)
{
    ll digit[32]={};
    ll i = 0;
    while (dec > 0)
    {
        [i] = n % 2;
        n = n / 2;
        i++;
    }

}
*/
//BINARY TO DECIMAL DECODING========>
/*
ll b2d(ll bin)
{
    ll digit,sum=0,h=0;
    while(bin!=0)
    {
        digit=bin%10;
        sum+=digit*pow(2,h++);
        bin/=10;
    }
    return sum;
}
*/
//DFS FUNCTION=========>
/*
int visited[MAX];
vector<int>adj[MAX];
int weight[MAX];
void dfs(int v)
{
    visited[v] = 1;
    for (auto j: adj[v])
    {
        if (!visited[j])
        {
            dfs(j);
        }
    }
}
*/
//------------------------------------------\\
//LAUNCHING SHARK-20========>
void FIRST_ATC()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t;
    int n;
    cin>>n;
    int ahm[n+1]={};
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        cin>>ahm[i];
        if(i%2)
        {
            if(ahm[i]%2)
            {
                cnt++;
            }
        }
    }
    cout<<cnt<<endl;



}
//MAIN FUNCTION========>
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    FIRST_ATC();

    return 0;
}
//------------------------------------------\\
//ABOUT THE SERIES========>
//THE BUTTERFLY SERIES-(MAY-2020).
//SPONSERED BY QUANTUM SPACE(CEO-NAIMUL ISLAM).
//CONTROLLER=>SAFIA BEGUM(CEO-BACKS/ASH).
//ADVISOR=>NASRULLAH SAMI(CEO-FALCON AXIS).
//CO-CHIEF ADVISOR=>G.M NAYEEM(CEO-TECH FRIGATE).
//PRESIDENT=>SAMIA PREITY(CEO-FASTEX AND SPAIT).



Measured memory_bytes: 3648
import java.io.*;
import java.util.*;

public class Main {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	void solve() throws IOException {
		int a = nextInt();
		int b = nextInt();
		if (b >= a) {
			out.println("Impossible");
			out.flush();
			return;
		}
		
		int[] arr = new int[a + b];
		int sz = 0;
		
		for (int i = 0; i < a + b; i++) {
			if (sz == 0) {
				arr[sz++] = i;
				continue;
			}
			int top = arr[sz - 1];
			out.println("? " + top + " " + i);
			out.flush();
			String resp = nextToken();
			if (resp.equals("Y")) {
				arr[sz++] = i;
			} else {
				sz--;
			}
		}
		
		int honest = arr[sz - 1];
		
		char[] ans = new char[a + b];
		for (int i = 0; i < a + b; i++) {
			out.println("? " + honest + " " + i);
			out.flush();
			String resp = nextToken();
			ans[i] = resp.equals("Y") ? '1' : '0';
		}
		
		out.print("! ");
		out.println(ans);
		out.flush();
	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

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

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

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

int main(){
int N, cnt;
  cin >> N;
  int a[N];
  for(int i = 0;i < N;i++){
  cin >> a[i];
  }
  bool b = true;
  cnt = 0;

  while(b){
  for(int i = 0;i < N;i++){
    if(a[i] % 2 == 1){
      b = false;
      break;
    }
    else a[i] /= 2;  
  }
  cnt++;
  }
  
  cout << cnt - 1 << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

long long N;

int main(){
	cin >> N;
	for(long long i = 1; i < 10; i++) {
	for(long long j = 1; j < 10; j++) {
		if(i * j == N) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	}

	cout << "No" << endl; return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int T,i,cnt=0;
    cin>>T;
    long long int a[T+5];
    for(i=0;i<T;i++)
    {
        cin>>a[i];
    }
    sort(a,a+T);
    for(i=0;i<T-1;i++)
    {
        if(a[i]==a[i+1])
        {
            cnt=1;
            break;
        }
    }
    if(cnt==1)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 1792
// Standard I/O
#include <iostream>
#include <sstream>
#include <cstdio>
// Standard Library
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
// Template Class
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
// Container Control
#include <algorithm>

using namespace std;

#define rep( i, n ) for( int i = 0; i < n; ++i )
#define irep( i, n ) for( int i = n-1; i >= 0; --i )
#define reep( i, s, n ) for ( int i = s; i < n; ++i )
#define ireep( i, n, s ) for ( int i = n-1; i >= s; --i )
#define foreach(itr, x) for( typeof(x.begin()) itr = x.begin(); itr != x.end(); ++itr)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all( v ) v.begin(), v.end()
#define fs first
#define sc second
#define vc vector

// for visualizer.html
double SCALE = 1.0;
double OFFSET_X = 0.0;
double OFFSET_Y = 0.0;
#define LINE(x,y,a,b) cerr << "line(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(a) + OFFSET_X << ","										\
	<< SCALE*(b) + OFFSET_Y << ")" << endl;
#define CIRCLE(x,y,r) cerr << "circle(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(r) << ")" << endl;

typedef long long ll;
typedef complex<double> Point;

typedef pair<int, int> pii;
typedef pair<int, pii> ipii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector< vector<int> > vii;
typedef vector< vector<double> > vdd;

typedef vector<int>::iterator vi_itr;

const int IINF = 1 << 28;
const int MOD = 1e9+7;
const double INF = 1e30;
const double EPS = 1e-10;
const double PI = acos(-1.0);

// Direction : L U R D
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1 };

int main()
{
    int a, b;

    cin >> a >> b;

    ll n = b-a-1;
    
    cout << (n*(n+1)/2 - a) << endl;
}


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

int main() {
    int N = 100001;
    vector<bool> is_prime( N + 1 );
    for( int i = 0; i <= N; i++ ) {
        is_prime[ i ] = true;
    }
    vector<int> P;
    for( int i = 2; i <= N; i++ ) {
        if( is_prime[ i ] ) {
            for( int j = 2 * i; j <= N; j += i ) {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }

  vector<bool> like( N + 1 , false);
  rep(i,P.size()) {
    if (i==0) continue;
    if (is_prime[ (P[i]+1)/2 ]) {
      like[ P[i] ] = true;
    }
  }
  vector<int> left(N+1, 0);
  rep(i,N) left[i+1] = left[i] + like[i+1];
  
  int q;cin>>q;
  int l,r;
  rep(i,q) {
    cin>>l>>r;
    cout << left[r] - left[l-1] << endl;
  }
}


Measured memory_bytes: 1152
n = int(input())
m = 10**9+7
primes = [2,3,5,7,11,13,17,19,23,29,31]
D = [0]*1001


for i in range(2, n+1):
    v = i
    for p in range(2, 1000):
        while(v % p == 0):
            D[p] += 1
            v //= p
        if v == 1:
            break
    if(v == i):
        D[i] += 1

score = 1
for d in D:
    score = score * (d + 1)
print(score % m)


Measured memory_bytes: 3064
#include<stdio.h>
#define N 8

int putQ(int);
void print(void);

int row1[15],x[8],n,row[15],col[15],dp[15],dn[15];


int main(){
  int i,y,e,m=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&x[i],&y);
    row1[x[i]]=y;

    if(x==0){
      m = 1;
    }
  }
  if(m == 1){
    e=putQ(1);
  }
  else e=putQ(0);


  return 0;
}

int putQ(int i){
  int a,c=0,j;

  if(i == N){
    for(j=0;j<n;j++){
      a=x[j];
      if(row1[a]==row[a]){
        c++;
      }

    }
    if(c == n){
      print();

      return 0;
    }

    c=0;
  }

  for(j=0;j<N;j++){
    if (col[j] == -1 || dp[i+j] == -1 || dn[i-j+N-1] == -1 ) continue;
    
    row[i] = j;
    col[j] = dp[i+j] = dn[i-j+N-1] = -1;

    putQ(i+1);
    col[j] = dp[i+j] = dn[i-j+N-1] = 0;
  }
}


void print(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){

      if(row[i] != j)printf(".");

      else printf("Q");
    }

    printf("\n");
  }
}



Measured memory_bytes: 2108
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
#include<numeric>
#include<set>
#include<iterator>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)
int INF=1e9;
const long long mod=1e9+7;
typedef long long ll;
main(){
    ll x;
    cin>>x;
    bitset<32>b(x);
    cout<<b<<endl;
    cout<<(~b)<<endl;
    cout<<(b<<1)<<endl;
    cout<<(b>>1)<<endl;
    return 0;
}


Measured memory_bytes: 3168
N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))  
C = list(map(int, input().split()))  

ans = 0
for i in range(N-1):
  if A[i] + 1 == A[i+1]:
    ans += C[A[i]-1]
print (sum(B) + ans)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int a[6] = { 0 }, i, sum=0,avg = 0;
	for (i = 1; i <= 5; i++)
	{
		scanf("%d", &a[i]);
		if (a[i] >= 40)
		{
			sum = sum + a[i];
		}
		else
		{
			sum = sum + 40;
		}
	}
	avg = sum / 5;
	printf("%d\n", avg);
	return 0;
}

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

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

using namespace std;

int main() {
    int n,m,c;
    cin >> n >> m >> c;
    int b[20];
    rep(i, m){
        cin >> b[i];
    }
    int a, eval, cnt = 0;
    rep(i, n){
        eval = 0;
        rep(j, m){
            cin >> a;
            eval += a * b[j];
        }
        if((eval + c) > 0){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int (i)=0;(i) < (N); (i)++)
#define all(V) V.begin(), V.end()
using i64 = long long;
using P = pair<int,int>;

int N, ans, checkedMatches;
vector<vector<int>> edges;
vector<int> inDegree;
vector<int> order;

int getMatchNumber(int A, int B){
    if(A < B) swap(A,B);
    return A * N + B;
}

void addEdge(int from, int to){
    edges[from].emplace_back(to);
    inDegree[to]++;
}

void dfs(int match){
    if(inDegree[match] != 0) return;

    inDegree[match] = -1;
    checkedMatches++;
    ans = max(ans, order[match] + 1);
    
    for(int next : edges[match]){
        order[next] = max(order[next], order[match] + 1);
        inDegree[next]--;
        dfs(next); 
    }
}

int main(){
   cin >> N;

    const int allMatch = N*N + 1;
    edges.resize(allMatch);
    inDegree.assign(allMatch, 0);
    order.assign(allMatch, 0);
    
    for(int i = 0; i < N; i++){
        vector<int> A(N-1);
        for(int j = 0; j < N-1; j++) cin >> A[j], A[j]--;
        for(int j = 0; j < N-2; j++) {
            int k = getMatchNumber(i, A[j]);
            int l = getMatchNumber(i, A[j+1]);
            addEdge(k ,l);
        }
    }

    for(int i = 0; i < N*N; i++) dfs(i);
    if(checkedMatches != N*N) ans = -1;
    cout << ans << endl;
}


Measured memory_bytes: 47232
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
long long gcd(long long a, long long b) {
  // the greatest common divisor
	while (b != 0) {
		long long r = a%b;
		a = b;
		b = r;
	}
	return a;
}
long long lcm(long long a, long long b) {
  //the least common multiple
	return (a / gcd(a, b))*b;
}
#include <cmath>
#include <map>
std::map<long long, long long> primeFactorization(long long n) {
  // 素因数分解
  std::map<long long, long long> pf;
  for (long long i = 2; i * i <= n; ++i) {
    while (n % i == 0) {
      n /= i;
      ++pf[i];
    }
  }
  if (n > 1) {
    ++pf[n];
  }
  return pf;
}


int main() {
  LL n,p;
  cin>>n>>p;
  auto pf = primeFactorization(p);
  LL ans = 1;
  for(auto v:pf){
    if(v.second>=n){
      ans*=pow(v.first, v.second/n);
    }
  }
  cout<<ans<<endl;

  return 0;
}


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

int main() {
  string s;
  cin >> s;
 
  for (int i = 0; i < s.size(); i += 2) {
  if((i == s.size()-2)||(i == s.size()-1)) cout << s.at(i) << endl;
  else cout << s.at(i);
  }
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int mod=1000000007;

int main()
{

  ios::sync_with_stdio(0);
  cin.tie(0);
  int n,x,mx=0;
  cin>>n;
  ll sum=0;
  cin>>x;
  mx=x;
  for(int i=1; i<n; i++){
    cin>>x;
    if(x<mx){sum=sum+mx-x;}
    mx=max(mx,x);
  }
  cout<<sum;
  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;



int main()
{
  int a, b, c, x ;
  cin >> a >> b >> c >> x ;
  int count = 0 ;
  
  RREP(i,a+1){
    if(x-500*i>=0){
      RREP(j,b+1){
        if(x-500*i-100*j>=0 && x-500*i-100*j<=50*c){
          count ++ ;
        }
      }
    }
  }
  
  cout << count <<endl ;
  

  return 0 ;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,k;
long long l[200010],r[200010];
long long d[400010];
long long mod=998244353;
inline long long modbez(long long a,long long b){
	register long long res=a%b;
	if(res<0)
		return res+b;
	else
		return res;
}
long long lowbit(long long x)
{
    return x&-x;
}
void update(long long x,long long v)
{
    while(x<=n)
    {
        d[x]=modbez(d[x]+v,mod);
        x+=lowbit(x);
    }
}
long long query(long long x)
{
    long long res=0;
    while(x)
    {
        res=modbez(res+d[x],mod);
        x-=lowbit(x);
    }
    return res;
}
int main()
{
	scanf("%lld%lld",&n,&k);
	for(long long i=1;i<=k;i++)
	{
		scanf("%lld%lld",&l[i],&r[i]);
	}
	update(1,1);
	for(long long i=2;i<=n;i++)
	{
		long long x=0;
		for(long long j=1;j<=k;j++)
		{
			x=modbez(query(max(i-l[j],0ll))-query(max(i-r[j]-1,0ll))+x,mod);
		}
		update(i,x);
	}
//	for(int i=1;i<=n;i++)
//		cout<<modbez(query(i)-query(i-1),mod)<<" ";
//	cout<<endl;
	printf("%lld",modbez(query(n)-query(n-1),mod));
	return 0;
}

Measured memory_bytes: 5340
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<map>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////   
/////////////////////////

int main(){
   int a,b,c;
   cin>>a>>b>>c;
   swap(a,b);
   swap(a,c);
   cout<<a<<" "<<b<<" "<<c<<endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
 
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        while (true) {
            if (c-b <= 0) {
                System.out.println("Yes");
                break;
            } else {
                c = c-b;
            }
            if (a-d <= 0) {
                System.out.println("No");
                break;
            } else {
                a = a-d;
            }
        }
    }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    
    public boolean hasNext() { 
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();
    }
    
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

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

int main(){
    int K, N;
    cin >> K >> N;
    int A[200010];
    int i,j;
    int tmp;
    int dist=0;

    for(i=0; i<N; i++){
        cin >> A[i];
    }

    for(i=0; i<N-1; i++){
        if(A[i+1]-A[i]>dist) dist=A[i+1]-A[i];
    }
    if(K+A[0]-A[N-1]>dist) dist=K+A[0]-A[N-1];

    cout << K-dist << endl;

    return 0;
}   

Measured memory_bytes: 4356
/*#include <bits/stdc++.h>
using namespace std;
int a,b,c,fr[11];
int main()
{
    cin>>a>>b>>c;
    fr[a]++;
    fr[b]++;
    fr[c]++;
    if(fr[5]==2 && fr[7]==1)
        cout<<"YES";
    else cout<<"NO";
    return 0;
}                   A
*/
/*
#include <bits/stdc++.h>
using namespace std;
int n,l,i,j;
char sir[110][110];
int main()
{
    cin>>n>>l;
    for(i=1;i<=n;i++)
        cin>>sir[i];
    for(i=1;i<n;i++)
        for(j=i+1;j<=n;j++)
            if(strcmp(sir[i],sir[j])>0)
                swap(sir[i],sir[j]);
    for(i=1;i<=n;i++)
        cout<<sir[i];
}                   B
*/
#include <bits/stdc++.h>
using namespace std;
int l,i,n,s,x,a[11],v[11],fr[11],mini=1999999999;
int comp(int poz)
{
    int x=0;
    for(int i=1;i<=poz-1;i++)
        x=x*10+a[i];
    return x;
}
void bkt(int poz)
{
    if(poz>l+2)
        return;
    if(poz>=l+1)
    {
        int k=comp(poz);
        int debug=0;
        if(k>=s)
            mini=min(k,mini);
        if(poz>l+1)
            return;
    }
    for(int i=1;i<=v[0];i++)
    {
        if(v[i]==0 && poz==1)
            continue;
        a[poz]=v[i];
        bkt(poz+1);
    }
}
int main()
{
    cin>>s>>n;
    int x=s;
    while(x)
        l++ , x/=10;
    for(i=1;i<=n;i++)
        cin>>x , fr[x]=1;
    for(i=0;i<=9;i++)
        if(!fr[i])
            v[++v[0]]=i;
    bkt(1);
    cout<<mini;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int n,k;cin >> n >> k;
    ll ans = k;
    rep(i,n-1) ans *= (k-1);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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 int INF = 2e9;
const int MOD = 1e9 + 7;

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

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

/* -------------------------------- Template -------------------------------- */

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

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

template<typename T> T inf() { assert(false); }
template<> constexpr int inf<int>() { return 1e9; }
template<> constexpr ll inf<ll>() { return 1e18; }
template<> constexpr ld inf<ld>() { return 1e30; }

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

/* -------------------------------- Library -------------------------------- */

const int mod = 1000000007;

struct Mod {
  int n;
  Mod () : n(0) {;}
  Mod (int m) : n(m) {
    if (n >= mod) n %= mod;
    else if (n < 0) n = (n % mod + mod) % mod;
  }
  operator int() { return n; }
};

bool operator==(Mod a, Mod b) { return a.n == b.n; }
Mod operator+=(Mod &a, Mod b) { a.n += b.n; if (a.n >= mod) a.n -= mod; return a; }
Mod operator-=(Mod &a, Mod b) { a.n -= b.n; if (a.n < 0) a.n += mod; return a; }
Mod operator*=(Mod &a, Mod b) { a.n = ((long long)a.n * b.n) % mod; return a; }
Mod operator+(Mod a, Mod b) { return a += b; }
Mod operator-(Mod a, Mod b) { return a -= b; }
Mod operator*(Mod a, Mod b) { return a *= b; }

/* ---------------------------------- Main ---------------------------------- */

Mod solve() {
  int n;
  cin >> n;
  vector<int> t(n), a(n);
  vector<int> lb(n, 1), ub(n, 1e9);
  for (int &i: t) cin >> i;
  for (int &i: a) cin >> i;
  for (int i = 0; i < n; ++i) {
    chmin(ub[i], t[i]);
    if (i == 0 || t[i-1] != t[i]) {
      chmax(lb[i], t[i]);
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    chmin(ub[i], a[i]);
    if (i == n - 1 || a[i+1] != a[i]) {
      chmax(lb[i], a[i]);
    }
  }
  REP(i,n) {
    if (lb[i] > ub[i]) return 0;
  }
  Mod res = 1;
  REP(i,n) res *= Mod(ub[i] - lb[i] + 1);
  return res;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha;
  cout.imbue(loc);

  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <set>

using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back
 
typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main(void){
    cin.tie(0);
   	ios::sync_with_stdio(false);
	int n, h, w;
	cin >> n >> h >> w;
	vector<int> a(n), b(n);
	int cnt = 0;
	rep(i,n){
		cin >> a[i] >> b[i];
		if(a[i]>=h&&b[i]>=w)
			cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

typedef int value_type;
 
value_type med3(value_type x, value_type y, value_type z) {
    if (x < y) {
        if (y < z) return y; else if (z < x) return x; else return z;
    } else {
        if (z < y) return y; else if (x < z) return x; else return z;
    }
}
 
void quicksort(value_type a[], int left, int right) {
    if (left < right) {
        int i = left, j = right;
        value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]);
        while (1) {
            while (a[i] < pivot) i++;
            while (pivot < a[j]) j--;
            if (i >= j) break;
            tmp = a[i]; a[i] = a[j]; a[j] = tmp;
            i++; j--;
        }
        quicksort(a, left, i - 1);
        quicksort(a, j + 1, right);
    }
}

int main(void) {
  int n, a[200001];
  int i, flag = 0;

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

  quicksort(a, 0, n - 1);
  for(i = 1; i < n; i++) {
    if(a[i] == a[i - 1]) {
      flag = 1;
      break;
    }
  }
  if(flag) {
    printf("NO\n");
  } else {
    printf("YES\n");
  }
  
  return 0;
}


Measured memory_bytes: 896
while True :
    try :
        a1, a2, a3, a4 = map(int, input().split())
        b1, b2, b3, b4 = map(int, input().split())
    except EOFError :
        break
    
    hit = 0
    brow = 0
    if a1 == b1 :
        hit += 1
    if a2 == b2 :
        hit += 1
    if a3 == b3 :
        hit += 1
    if a4 == b4 :
        hit += 1
    if a1 == b2 or a1 == b3 or a1 == b4 :
        brow += 1
    if a2 == b1 or a2 == b3 or a2 == b4 :
        brow += 1
    if a3 == b1 or a3 == b2 or a3 == b4 :
        brow += 1
    if a4 == b1 or a4 == b2 or a4 == b3 :
        brow += 1
        
    print(hit, brow)


Measured memory_bytes: 5592
#include<cstdio>
#include<cstring>
using namespace std;
long long num[100000];
long long mou[100000];
int main()
{
	int n;
	int sum=0; 
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%lld",&num[i]);
		if(i%2==0)
		{
			mou[0]+=num[i];
		}
		else
		{
			mou[0]-=num[i];
		}
		
	}
	
	printf("%d ",mou[0]);
	for(int i=1;i<n;i++)
	{
			mou[i]=(num[i-1]-mou[i-1]/2)*2;
			
		//printf("%d %d %d\n ",num[i]/2,num[i+1]/2,mou[i]);
		
		printf("%d ",mou[i]);
	}
	//printf("%d",);
}

Measured memory_bytes: 2816
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<numeric>
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    int n;
    cin >> n;
    int ans = n;
    rep(i,n)
    {
        int l,r;
        cin >> l >> r;
        ans += r-l; 
    }
    cout << ans << endl;;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,i,j,a,b,c,x,y,z,k;
string s,s1,s2;
int main(){
  cin>>s;
  s1=s[0];
  for(i=1,c=1;i<s.size();i++,c++){
    s2=s[i];
    if(s1==s2){
      if(i==s.size()-1)c--;
      i++,s2+=s[i];
    }
    s1=s2;
  }
  cout<<c;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

struct Edge {
  const int from, to;
  Edge(int from, int to) : from(from), to(to) {}
};

vector<vector<Edge>> ReadUndirectedGraph(
    int n, int m, bool is_one_indexed=false) {
  vector<vector<Edge>> graph(n);
  for (int i = 0; i < m; i++) {
    int v1, v2;
    cin >> v1 >> v2;
    if (is_one_indexed) {
      v1--;
      v2--;
    }
    graph[v1].push_back(Edge(v1, v2));
    graph[v2].push_back(Edge(v2, v1));
  }
  return graph;
}

// Verified: ABC131F, ABC126E
vector<vector<int>> ConnectedComponents(const vector<vector<Edge>>& graph) {
  int n = graph.size();
  vector<vector<int>> components;
  vector<int> visited(n);

  function<void(int)> dfs = [&](int v) {
    if (visited[v]) return;
    visited[v] = true;
    components[components.size() - 1].push_back(v);
    for (auto e : graph[v]) {
      if (visited[e.to]) continue;
      dfs(e.to);
    }
  };

  for (int s = 0; s < n; s++) {
    if (visited[s]) continue;
    components.push_back(vector<int>());
    dfs(s);
  }
  return components;
}

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

  int n, m;
  cin >> n >> m;
  auto graph = ReadUndirectedGraph(n, m, true);
  auto components = ConnectedComponents(graph);

  int64 a = 0;
  int64 b = 0;
  int64 c = 0;
  vector<int> colors(n, -1);
  function<bool(int, int, int)> is_bipartite_fn = [&](int v, int p, int color) -> bool {
    if (colors[v] >= 0) {
      return colors[v] == color;
    }

    colors[v] = color;

    for (const auto& e : graph[v]) {
      if (e.to == p) continue;
      if (!is_bipartite_fn(e.to, v, color ^ 1)) return false;
    }
    
    return true;
  };

  for (const auto& component : components) {
    if (component.size() == 1) {
      c++;
    } else {
      if (is_bipartite_fn(component[0], -1, 0)) {
        b++;
      }else {
        a++;
      }
    }
  }

  // cout << a << " " << b << " " << c << endl;

  int64 ans = 2LL * c * n - c * c + (a + b) * (a + b) + b * b;
  cout << ans << endl;
}


Measured memory_bytes: 16488
#include <stdio.h>
#include <math.h>

int main(void)
{
	double a,b,c,s,l,h;
	double pi=3.141592653589;

	scanf("%lf %lf %lf",&a,&b,&c);

	s = a*b*sin(c*pi/180)/2;

	l = a+b+sqrt(a*a+b*b-2*a*b*cos(c*pi/180));

	h = s*2/a;

	printf("%f\n%f\n%f\n",s,l,h);
 
	return 0;
}

Measured memory_bytes: 648
from heapq import heappop, heappush

import sys
input = sys.stdin.buffer.readline


def main():

    n, q = map(int, input().split())
    stx = [map(int, input().split()) for _ in range(n)]
    ds = [int(input()) for _ in range(q)]
    INF = 10 ** 9 + 1
    CHECK = 2
    START = 1
    END = 0
    NULL = 0

    tfdi = []
    for i, (s, t, x) in enumerate(stx):
        t_start = max(0, s - x)
        t_end = max(0, t - x)

        tfdi.append((t_start, START, x, i))
        tfdi.append((t_end, END, x, i))

    for d in ds:
        tfdi.append((d, CHECK, NULL, NULL))
    tfdi.append((INF, START, INF, -1))
    tfdi.sort()

    hp = [(INF, -1)]
    ans = []
    passed = set()
    for t, f, d, i in tfdi:
        if f == CHECK:
            while hp[0][1] in passed:
                heappop(hp)
            if hp[0][0] == INF:
                tmp = -1
            else:
                tmp = hp[0][0]
            ans.append(tmp)

        elif f == START:
            heappush(hp, (d, i))
        else:
            passed.add(i)

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


if __name__ == "__main__":
    main()


Measured memory_bytes: 160096