akhauriyash/Code-Regression huggingface dataset:
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

// vars
int k;

void input(){
    cin >> k;
}

void solve(){
    lint ans = 0;
    vector<int> num;
    for (int a = 1; a <= k; ++a){
        for (int b = 1; b <= k; ++b){
            for (int c = 1; c <= k; ++c){
                num.clear();
                num.push_back(a);
                num.push_back(b);
                num.push_back(c);
                sort(ALL(num));
                lint gcd_1 = gcd(a, b);
                lint gcd_2 = gcd(gcd_1, c);
                ans += gcd_2;
            }
        }
    }
    cout << ans << endl;
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j = 0, n, m, ans = 0;
  scanf("%lld%lld", &n, &m);
  pair<ll, ll> p[n];
  priority_queue<ll> q;
  for(i = 0; i < n; ++i) scanf("%lld%lld", &p[i].first, &p[i].second);
  sort(p, p + n);
  for(i = 1; i <= m; ++i) {
    for(; j < n; ++j) {
      if(p[j].first <= i) {
        q.push(p[j].second);
        continue;
      }
      break;
    }
    if(q.size()) ans += q.top(), q.pop();
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 2936
a, v = gets.chomp.split.map(&:to_i)
b, w = gets.chomp.split.map(&:to_i)
t = gets.to_i
d = (a - b).abs
if w > v
  puts "NO"
elsif d - t * (v - w) <= 0
  puts "YES"
else
  puts "NO"
end


Measured memory_bytes: 14336
import sys
from functools import reduce,lru_cache
import math
from operator import mul

def main():
  #sys.setrecursionlimit(10 ** 5 + 1)
  N,M = map(int,input().split())
  
  @lru_cache(maxsize = None)
  def recur(n):
    if n == 0:
      return 1
    else:
      m = n * recur(n - 1)
      return m
      
  if N == M:
    L = [i for i in range(1,N + 1)]
    #ans = (reduce(mul,L) ** 2) * 2  % (10 ** 9 + 7)
    ans = (math.factorial(M) ** 2) * 2 % ((10 ** 9) + 7)
    print(ans)
  elif abs(M - N) == 1: 
    ans = math.factorial(N) * math.factorial(M) % ((10 ** 9) + 7)
    print(ans)
    
  else:
    print(0)
    
main()

Measured memory_bytes: 9220
#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
int main() {
    int A, B, C,x;
    cin >> A >> B >> C;
    x = B / A;
    if (C > x) {
        cout << x << endl;
    }
    else {
        cout << C << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mem(a, val) memset(a, val, sizeof(a))
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;
int G[101][101], E[1000][4];
int N, M;

void WarshallFloyd(){
    REP(i, N) REP(j,N) REP(k, N) G[j][k] = min(G[j][k], G[j][i] + G[i][k]);
}

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

    cin >> N >> M;
    REP(i, N)REP(j, N) 
    {
        G[i][j] = INF;
        G[i][i] = 0;
    }
    REP(i, M){
        int a,b,c;
        cin >> a >> b >> c;
        a--; b--;
        G[a][b]=c;
        G[b][a]=c;
        E[i][0] = a;
        E[i][1] = b;
        E[i][2] = c;
        E[i][3] = 1;
    }
    WarshallFloyd();

    REP(k, M){
        REP(i, N){
            REP(j, N){
                //cout << G[i][E[k][0]] + E[k][2] + G[E[k][1]][j] << " " <<  G[i][j] << "\n";
                if(G[i][E[k][0]] + E[k][2] + G[E[k][1]][j] == G[i][j]) E[k][3] = 0;
                if(G[i][E[k][1]] + E[k][2] + G[E[k][0]][j] == G[i][j]) E[k][3] = 0;
            }
        }
    }
    int ans = 0;
    REP(k, M){
        ans += E[k][3];
    }
    cout << ans << "\n";


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define REPR(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1001001001;

int H, W;
int field[1410][1410];

struct Rectangle { int height, pos; };

int main(){
  cin >> H >> W;

  rep(h, H){
    rep(w, W){
      char c; cin >> c;
      if(c == '0') field[h][w] = 1;
      else if(c == '1') field[h][w] = 0;
    }
  }
  rep(w, W){
    REP(h, 1, H-1){
      if(field[h][w] == 0) continue;
      field[h][w] += field[h-1][w];
    }
  }
  rep(h, H) field[h][W] = 0;

  int ma = 0;
  rep(h, H){
    stack<Rectangle> S;
    rep(w, W+1){
      Rectangle rect;
      rect.height = field[h][w];
      rect.pos = w;
      if(S.empty()) S.push(rect);
      else if(rect.height > S.top().height){
        S.push(rect);
      }
      else if(rect.height < S.top().height){
        int target = w;
        while(!S.empty() && rect.height <= S.top().height){
          Rectangle pre = S.top(); S.pop();
          int area = pre.height * (w - pre.pos);
          chmax(ma, area);
          target = pre.pos;
        }
        rect.pos = target;
        S.push(rect);
      }
    }
  }
 
  cout << ma << endl;

  return 0;

}




Measured memory_bytes: 10812
#include<iostream>

using namespace std;

int main()
{
  int k,a,b;
  
  cin>>k;
  cin>>a >> b;
  
  bool flag =false;
  
  for(int i = a; i <=b && flag==false; ++i)
  {
    if(i%k==0)
    {
      flag = true;
    }
  }
  
  if(flag)
  {
    cout << "OK" << endl;
  }
  else
  {
    cout << "NG" << endl;
  }
  
}

Measured memory_bytes: 3636
#include <stdio.h>

int Con(int n, int k, int s){
	if(s < 0) return 0;
	if(k > n) return 0;
	if(k == 0) return s == 0 ? 1 : 0;
	return Con(n - 1, k - 1, s - n) + Con(n - 1, k, s);
}

int main (){
	int n, k, s;

	while (1) {
		scanf("%d %d %d", &n, &k, &s);
		if(n == 0 && k == 0 && s == 0)
			return 0;
		printf("%d\n", Con(n, k, s));
	}
}



Measured memory_bytes: 2028
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
const int MOD = 1000000007;


int main(){
    string S;cin >> S;
    int ans = 0;
    if (S[0] == 'R' && S[1] == 'R' && S[2] == 'R'){
        ans = 3;
    }
    else if (S[0] == 'R' && S[1] == 'R'){
        ans = 2;
    }
    else if (S[1] == 'R' && S[2] == 'R'){
        ans = 2;
    }
    else if (S[0] == 'R' || S[1] == 'R' || S[2] == 'R'){
        ans = 1;
    }

    cout << ans << endl;

}

Measured memory_bytes: 3616
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::collections::BTreeMap;

fn can_trans(sv: &Vec<char>, tv: &Vec<char>) -> bool {
    let mut map = BTreeMap::new();
    for i in 0..sv.len() {
        map.insert(sv[i], tv[i]);
    }
    for i in 0..sv.len() {
        if let Some(x) = map.get(&sv[i]) {
            if *x != tv[i] {
                return false;
            }
        }
    }
    true
}

fn main() {
    let s: String = read();
    let t: String = read();

    let sv: Vec<char> = s.chars().collect();
    let tv: Vec<char> = t.chars().collect();

    if can_trans(&sv, &tv) && can_trans(&tv, &sv) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 6396
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <algorithm>
using namespace std;


int main()
{
	int n,q;
	cin >> n >> q;

	vector<vector<int> > tree(n);
	vector<int> cnt(n, 0);

	for(int i=0;i<n-1;i++){
		int a,b;
		cin >> a >> b;
		a--; b--;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}

	for(int i=0;i<q;i++){
		int  p,x;
		cin >> p >> x;
		cnt[p-1] += x;
	}

	stack<int> stk;
	stk.push(0);
	vector<int> visited(n, -1);
	while(!stk.empty()){
		int u = stk.top(); stk.pop();
		visited[u] = 0;
		for(int i=0;i<tree[u].size();i++){
			int v = tree[u][i];
			if(visited[v] == -1){
				stk.push(v);
				cnt[v] += cnt[u];
			}
		}
	}

	for(int i=0;i<n;i++){
		cout << cnt[i] << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 16372
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, c, k, t[100008];

int main(){
	cin >> n >> c >> k;
	for(ll i = 0; i < n; i++){cin >> t[i];}
	
	sort(t, t+n);
	
	ll bt = 0;
	ll machi = 0;
	ll ans = 0;
	for(ll i = 0; i < n; i++){
		if(machi == 0){
			bt = t[i];
			machi++;
		}
		else{
			if(t[i]-bt <= k && machi < c){
				machi++;
			}
			else{
				bt = t[i];
				machi = 1;
				ans++;
			}
		}
	}
	if(machi > 0){ans++;}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
int dis(int a,int b,int c,int d){
  return abs(a-c)+abs(b-d);
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int m,n;
  cin >> n >> m;
  vi a(n),b(n),c(m),d(m);
  REP(i,n) cin >> a[i] >> b[i];
  REP(i,m) cin >> c[i] >> d[i];
  REP(i,n){
    int ans = 0,md = INT_MAX;
    REP(j,m){
      if(md>dis(a[i],b[i],c[j],d[j])){
        ans = j;
        md = dis(a[i],b[i],c[j],d[j]);
      }
    }
    cout << ans+1 << endl;
  }       
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using static System.Math;

class Pair
{
    public long b;
    public long c;

    public Pair(long b,long c)
    {
        this.b = b;
        this.c = c;
    }
}

class Program
{
    static int n;
    static int m;
    static long[] a;
    static List<Pair> bc;

    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        n = int.Parse(s[0]);
        m = int.Parse(s[1]);
        a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        bc = new List<Pair>();
        for (int i = 0;i < m; i++)
        {
            s = Console.ReadLine().Split();
            int b = int.Parse(s[0]);
            int c = int.Parse(s[1]);
            bc.Add(new Pair(b,c));
        }
        Array.Sort(a);
        bc.Sort((p,q) => (int)(q.c-p.c));
        int j = 0;
        for (int i = 0;i < n; i++)
        {
            if (a[i] >= bc[j].c) break;
            bc[j].b--;
            a[i] = bc[j].c;
            if (bc[j].b == 0) j++;
            if (j == m) break;
        }
        Console.WriteLine(a.Sum());
    }
}

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

#define int long long 

#define fs first
#define sc second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define pb push_back
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MP make_pair
#define sqr(x) ((x) * (x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e5 + 100;
vector<pair<int, int>> g[N];
int dp[2][N], dist[2][N];
int n, m, s, t;

void add(int &a, int b) {
	a += b;
	if (a >= MOD) 
		a -= MOD;
}

int mul(int a, int b) {
	return 1ll * a * b % MOD;
}

void dijkstra(int start, int *d, int *dp) {
	fill(d, d + N, INF);
	d[start] = 0;
	dp[start] = 1;
	priority_queue<pair<int, int>> q;
	q.push(MP(-d[start], start));
	while (sz(q)) {
		int v = q.top().sc, cur_d = -q.top().fs;
		q.pop();
		if (cur_d > d[v]) continue;
		for (auto i : g[v]) {
			int u = i.fs, c = i.sc;
			if (d[u] > d[v] + c) {
				d[u] = d[v] + c;
				dp[u] = dp[v];
				q.push(MP(-d[u], u));
			} else if (d[u] == d[v] + c) {
				add(dp[u], dp[v]);
			}
		}
	}
}

signed main() {
	fastio;
	#ifdef FlameDragon
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	
	cin >> n >> m >> s >> t;
	s--; t--;
	for (int i = 0; i < m; i++) {
		int v, u, c;
		cin >> v >> u >> c;
		v--; u--;
		g[v].pb(MP(u, c));
		g[u].pb(MP(v, c));
	}
	dijkstra(s, dist[0], dp[0]);
	dijkstra(t, dist[1], dp[1]);
	if (dist[0][t] == INF) {
		cout << "0\n";
		return 0;
	}
	int D = dist[0][t];
	int ans = mul(dp[0][t], dp[1][s]);
	for (int i = 0; i < n; i++) {
		if (dist[0][i] * 2 == D) 
			ans = (ans - mul(mul(dp[0][i], dp[0][i]), mul(dp[1][i], dp[1][i])) + MOD) % MOD;
	}

	for (int v = 0; v < n; v++) {
		for (auto i : g[v]) {
			int u = i.fs, c = i.sc;
			if (2 * dist[0][v] < D && 2 * dist[1][u] < D && dist[0][v] + dist[1][u] + c == D) {
				ans = (ans - mul(mul(dp[0][v], dp[0][v]), mul(dp[1][u], dp[1][u])) + MOD) % MOD;
			}
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 21800
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
//#include <bits/stdc++.h>

#define all(v) v.begin(), v.end()
typedef long long ll;
#define rep(i, z, n) for(int i = z; i < n; i++)
//const int INF = 1<<29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    int N;
    cin >> N;
    double ans = 0;
    rep(i, 0, N){
        double A;
        cin >> A;
        ans += 1/A;
    }
    ans = 1/ans;
    cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 3756
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define rep(i,a,n) for( int i = a ; i < n ; i++ )
#define prep( i, a , n ) for ( int i = a ; i>= n ; i--)
#define   pr pair<int,int>
const int N = 1e5 + 5 , M=N,inf=(int)1e9;
const int mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
ll ans ;
map< pair<int,int> , int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
vector < int > h[N];
void solve(){
    int n , a ,b ;
    cin >>  n >> a >> b ;
    for( int i = 0 ; i < n ;i++){
        int x , y ;
        cin >> x >> y ;
        if(x>=a && y>=b)    ans++;
    }
    cout << ans ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
   //cin >> q;
    while(q--)
        solve();
}
/*
    ---------------- lemmas-----------------------------------
   1)
   2)
   3)

*/


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

int main(void){
    int N;
    vector <int> a;
    int sub;
    bool judge = false;
    int cnt = 0;
    int two_cnt = 0;
    int four_cnt = 0;
    
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> sub;
        a.push_back(sub);
    }
    
    for(int i = 0; i < N; i++){
        if(a[i] % 2 == 0)       two_cnt++;
        if(a[i] % 4 == 0)       four_cnt++;
    }
    two_cnt -= four_cnt;            // two_cntは2で割り切れるが4では割り切れない要素の個数を表す
    
    if(four_cnt >= N / 2)       judge = true;
    else{
        if(two_cnt >= N - four_cnt * 2)     judge = true;
    }
    
    if(judge)           cout << "Yes\n";
    else                cout << "No\n";
}

Measured memory_bytes: 892
N=int(input())
shoplist=[]
for i in range(N):
    a,b=input().split()
    #得点を-1倍して、ソートをやりやすくする。
    temp=[i+1,a,-1*int(b)]
    shoplist.append(temp)
    
#多次元リストを複数キーでソートする。
#print(shoplist)
shoplist.sort(key=lambda x:(x[1],x[2]))

#print(shoplist)

for i in shoplist:
    print(i[0])

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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


int k, a, b;
bool j = false;

int main() {

	cin >> k >> a >> b;

	REP(i, a, b + 1) {
		if (i % k == 0)j = true;
	}

	if (j)cout << "OK" << endl;
	else cout << "NG" << endl;

	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, m;
  cin>>n>>m;
  vector<bool> flag(n,false);
  for(int i = 0; i < m; i++){
    int a, b;
    cin>>a>>b;
    flag[a-1] = !flag[a-1];
    flag[b-1] = !flag[b-1];
  }
  bool ans = true;
  for(int i=0; i<n; i++){
    ans &= !flag[i];
  }
  cout << (ans ? "YES":"NO") << endl;
}

Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto s = readln.split.map!(to!long);
    auto N = s[0].to!int;
    auto K = s[1];
    auto A = readln.split.map!(to!long).array;

    long X = 0;
    auto B = K.bsr + 1;
    bool less = false;

    foreach_reverse (i; 0..B) {
        if (!less && !(K & (1L << i))) {
            continue;
        }

        long y = 0;
        long z = 0;
        foreach (a; A) {
            if (a & (1L << i)) {
                y += 1;
            } else {
                z += 1;
            }
        }

        if (y > z) {
            if (!less) less = true;
        } else {
            X += (1L << i);
        }
    }

    long ans = 0;
    foreach (a; A) ans += (X ^ a);
    ans.writeln;
}


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

const int MOD = 1000000007;

ll  F(const ll &n, const ll &k, const vector<vector<ll>> &DP) {
    ll S=0;
    if (n>=k)
        S=DP.at(n-k).at(k);
    if (0<k)
        S +=DP.at(n).at(k-1);
    S %=MOD;
    return S;
}

int main() {
    ll n, k;
    cin >>n >>k;
    vector<vector<ll>> DP(n+1, vector<ll> (k+1, 0));
    for (ll i=0; i<=k; i++)
        DP.at(0).at(i)=1;
    for (ll i=1; i<=n; i++)
        for (ll j=1; j<=k; j++)
            DP.at(i).at(j) = F(i, j, DP);
    cout <<DP.at(n).at(k) <<endl;
    return 0;
}


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

int main(void){

    long long N, K;

    scanf("%lld%lld", &N, &K);

    long long ans = 0;

    if(K != 0){
    for(long long b = K + 1; b <= N; b++){
        if(N % b < K){
            ans += (N / b) * (b-K);
        }else{
            ans += (N / b) * (b-K) + (N % b - K + 1);
        }
    }
    }else{
        ans = N * N;
    }

    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define mod 1000000007
#define pb push_back
#define csl ios_base::sync_with_stdio(false); cin.tie(NULL)
#define reps(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) for(int i=0;i<int(b);i++)
#define first ff
#define second ss
#define size sz
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
typedef vector<int> vi;
const int INF = 1e9 + 5;
int main()
{
    csl;
    int n,k;
    cin >> n >> k;
    int a[n];
    rep(i,n)
    {
        cin >> a[i];
    }
    vector<int> dp(n,INF);
    dp[0] = 0;
    rep(i,n)
    {
        for(int j=i+1;j<=i+k;j++){
            if(j<n)
            {
                dp[j] = min(dp[j],dp[i]+abs(a[i]-a[j]));
            }
        }
    }

    cout << dp[n-1] << endl;
}



Measured memory_bytes: 4036
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd

def lcm(n,m):
    return int(n*m/gcd(n,m))

import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace

from queue import PriorityQueue as pq

def reduce(p, q):
    common = fractions.gcd(p, q)
    return (p//common , q//common )
# from itertools import accumulate
# from collections import deque

from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

import random


def main():
    S = input().strip()
    # eprint(S[0])
    n=len(S)
    cnt1=0
    for i in range(0,n//2):
        # eprint("i ",end=": ")
        # eprint(i)
        # eprint("S[i], S[-i] ",end=": ")
        # eprint(S[i], S[-(i+1)])
        if S[i]!=S[-(i+1)]:
            # eprint(S[i])
            cnt1+=1
    print(cnt1)
    # cnt2=0
    # for i in range(2/n,n):
        
    return

if __name__ == '__main__':
    main()


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

#define int long long
#define max(a,b) max((signed)a,(signed)b);
#define min(a,b) min((signed)a,(signed)b);

using namespace std;

int dp[100005]={0};
//int dp[100005]={0};

signed main(){
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	// dp[i][j] = True if First wins with i stones using a[0] -> a[j] moves
	for(int i=0;i<=k;i++){
		for(int j=0;j<n;j++){
			if(i>=a[j] && !dp[i-a[j]]){
				dp[i] = true;
			}
		}
	}
	// for(int i=0;i<=k;i++){
	// 	cout<<dp[i]<<" ";
	// }
	cout<<(dp[k]==1 ? "First":"Second");
}


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

int main(){
  int n,a,b; cin >> n >> a >> b;
  int ans = min(a*n, b);
  cout << ans << 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 rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
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; }

int main(){
    ll n; cin >> n;
    ll ans = n*(n+1)*(n+2)/6;
    rep(i,n-1){
        ll u,v; cin >> u >> v;
        if(u > v) swap(u,v);
        ans -= u*(n+1-v);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int x, a, b;
    cin >> x >> a >> b;
    
    if(a-b >=0){
        cout << "delicious" << endl;
    }
    else{
        if(b-a <=x){
            cout << "safe" << endl;
        }
        else{
            cout << "dangerous" << endl;
        }
    }
}


Measured memory_bytes: 3624
#include <iostream>
#include <cmath>
#include <tuple>

using namespace std;

int isVertex(int x, int y, int H, int *xs, int *ys, int *hs, int N) {
  for (int i=0; i<N; i++) {
    if (hs[i] != max(H - abs(xs[i] - x) - abs(ys[i] - y), 0)) {
      return 0;
    }
  }
  return 1;
}

int main() {
  int N;
  cin >> N;
  int x[N], y[N], h[N];
  int x1, y1, h1 = 0;
  for (int i=0; i<N; i++) {
    cin >> x[i] >> y[i] >> h[i];
    if (h1 == 0 && h[i] > 0) {
      h1 = h[i];
      x1 = x[i];
      y1 = y[i];
    }
  }
  
  for (int xv=0;xv<=100;xv++) {
    for (int yv=0;yv<=100;yv++) {
      int hv = abs(x1 - xv) + abs(y1 - yv) + h1;

      if (isVertex(xv, yv, hv, x, y, h, N)) {
        cout << xv << " " << yv << " " << hv << endl;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=2e5;
const int inf=1e9;
int main(){
	int N,K;cin>>N>>K;
	int V[N];
	rep(i,0,N) cin>>V[i];
	int L[N+1][2*N] = {},R[N+1][2*N] = {};
	for(int j = 1; j <= N; j++){
		priority_queue<int> pq;
		int sum = 0;
		for(int i = 0; i < j; i++){ pq.push(-V[i]); sum += V[i]; }
		L[j][j] = sum;
		for(int i = j; i < N; i++){
			if(V[i] > -pq.top()){
				sum += V[i] + pq.top();
				pq.pop();
				pq.push(-V[i]);
			}L[i+1][2*i+2-j] = sum;
		}
	}
	for(int j = 1; j <= N; j++){
		priority_queue<int> pq;
		int sum = 0;
		for(int i = N-1; i >= N-j; i--){ pq.push(-V[i]); sum += V[i]; }
		R[N-j][j] = sum;
		for(int i = N-j-1; i >= 0; i--){
			if(V[i] > -pq.top()){
				sum += V[i] + pq.top();
				pq.pop();
				pq.push(-V[i]);
			}R[i][2*(N-i)-j] = sum;
		}
	}
    rep(j,0,2*N){
        for(int i = 0; i < N; i++) L[i+1][j] = max(L[i+1][j], L[i][j]);
        for(int i = N; i > 0; i--) R[i-1][j] = max(R[i-1][j], R[i][j]);
    }
    //pprint(L,,N+1,2*N);pprint(R,,N+1,2*N);
	int ans = 0;
	rep(i,0,N+1){
		rep(j,0,2*N)rep(k,0,2*N){
			if(j + k <= K) ans = max(ans, L[i][j] + R[i][k]);
		}
	}cout<<ans<<endl;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=LI()
    ans=1
    A.sort()
    L=[]
    if N%2==1:
        L.append(0)
        for i in range(N//2):
            for _ in range(2):
                L.append(2*(i+1))
                
    else:
        for i in range(N//2):
            for _ in range(2):
                L.append(2*i+1)
                
    if L==A:
        ans=pow(2,N//2,mod)
    else:
        ans=0
        
    print(ans)
        

main()


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

int main(void){
    string s;
    cin >> s;
    int check = 0;
    rep(i,s.size()){
        if((i+1)%2==1){
            if(s[i]=='L'){
                check = 1;
            }
        }
        else{
            if(s[i]=='R'){
                check = 1;
            }
        }
    }
    if(check == 0){
        cout <<"Yes";
    }
    else{
        cout <<"No";
    }
    
    
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#include<chrono>
#include<random>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=100005;
vector<int> nxt[MAXN];
void ins(int x,int y){nxt[x].emplace_back(y);}
int id[MAXN],n;LL D[MAXN],C[MAXN];
bool cmp(int n1,int n2){return D[n1]<D[n2];} 
int siz[MAXN];
void gg(){pr2(-1);exit(0);}
LL dis[MAXN],tot[MAXN];
void getdis(int x,int fa)
{
	tot[x]=1;
	for(auto y:nxt[x])if(y^fa)getdis(y,x),tot[x]+=tot[y],dis[x]+=dis[y]+tot[y];
}
void query(int x,int fa,LL d1,LL d2)
{
	if(dis[x]+d1!=D[x])gg();
	for(auto y:nxt[x])if(y^fa)query(y,x,dis[x]-(dis[y]+tot[y])+d1+(n-tot[y]),n-tot[y]);
}
void answer(int x,int fa){for(auto y:nxt[x])if(y^fa)pr1(x),pr2(y),answer(y,x);}
int main()
{
	n=read();for(int i=1;i<=n;i++)D[i]=C[i]=read(),id[i]=i;
	sort(id+1,id+1+n,cmp);
	sort(C+1,C+1+n);
	for(int i=n;i>=1;i--)
	{
		int u=id[i];++siz[u];
		if(siz[u]>n)gg();if(i==1)break;
		if(2*siz[u]>=n)ins(id[1],u),ins(u,id[1]),siz[1]+=siz[u];
		else
		{
			LL nx=D[u]-(n-2*siz[u]);
			if(D[id[i-1]]<nx)gg();
			int v=lower_bound(C+1,C+1+(i-1),nx)-C;
			if(C[v]!=nx)gg();ins(id[v],u),ins(u,id[v]);siz[id[v]]+=siz[u];
		}
	}if(siz[id[1]]!=n)gg();
	getdis(1,0);query(1,0,0,0);
	answer(1,0);
	return 0;
}

Measured memory_bytes: 18432
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 998244353, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz");
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q, s;
ll dp[3001][3001], rui[ohara];

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

  cin >> n >> s;
  rep(i, n) cin >> a[i];
  rui[0] = 1;
  rrep(i, 1, n + 10) {
    rui[i] = rui[i - 1] * 2;
    rui[i] %= MOD;
  }
  dp[0][a[0]] = 1;
  // dp[0][0] = 1;
  rrep(i, 1, n) {
    dp[i][a[i]] = rui[i];
    // dp[i][0] = 1;
    rrep(j, 0, s + 1) {
      (dp[i][j] += (j < a[i] ? 0LL : (dp[i - 1][j - a[i]] % MOD)) +
                   dp[i - 1][j] * 2) %= MOD;
    }
  }
  ans = dp[n - 1][s];
  // Cout(dp[1][4]);
  Cout(ans);
  return 0;
}


Measured memory_bytes: 73992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int N;
	cin >> N;
	vector<string> s(N);
	vector<int> aw(N,0);
	for (int i = 0; i < N; i++) {
		cin >> s[i];
	}
	int c;
	int nb = 0;
	bool b = false;
	for (int j = 0; j < N; j++) {
		c = 0;
		for (int i = 0; i < N; i++) {
			if (s[i][j] == '#') {
				c++;
				b = true;
			}
		}
		if (c == 0) {
			aw[j] = 1;
		}
		else if (c == N) {
			nb++;
		}
	}
	
	if (!b) {
		cout << -1 << endl;
	}
	else {
		int k = 100000;
		for (int i = 0; i < N; i++) {
			c = 0;
			for (int j = 0; j < N; j++) {
				
				if (s[i][j] == '.') {
					c++;
				}
			}
			if (aw[i] == 1) {
				c++;
			}
			k = min(k, c);

		}
		//cerr << k << " " << nb << endl;
		cout << k + N - nb << endl;
	}

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
int n,a[100000];
int main(){
    cin>>n;
    bool zero=true;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]!=0)zero=false;
    }
    if(zero){
        cout<<"Yes";
        return 0;
    }
    if(n%3){
        cout<<"No";
        return 0;
    }
    sort(a,a+n);
    int x=0;
    for(int i=0;i<n;i+=(n/3)){
        x=x^a[i];
        for(int j=i;j<i+n/3;j++){
            if(a[i]!=a[j]){
                cout<<"No";
                return 0;
            }
        }
    }
    if(x)cout<<"No";
    else cout<<"Yes";
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
 
int main() {
	int x;
	cin >> x;
	cout << !x << endl;
	return 0;
}

Measured memory_bytes: 3620
int main(void) {
    int a,b,c;
    while(scanf("%d%d%d", &a,&b,&c)){
        if(a == -1 && b == -1 && c == -1) break;
        if(a == -1 || b == -1) printf("F\n");
        else if(a+b >= 80) printf("A\n");
        else if(a+b >= 65) printf("B\n");
        else if(a+b >= 50) printf("C\n");
        else if(a+b >= 30){
            if(c >= 50) printf("C\n");
            else printf("D\n");
        }
        else printf("F\n");
         
    }
    return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int num[10];
int main()
{
    int n,m;
    cin >> n >> m;
    memset(num,-1,sizeof(num));
    int s,c;
    bool flag=true;
    for(int i =0;i<m;++i)
    {
        cin >> s >> c;
        if(s>n)
            continue;
        if(num[s-1]==-1)
        {
            num[s-1] = c;
        }
        if(num[s-1]!=c)
        {
            flag = false;
        }
    }
    if(!flag)
    {
        printf("-1\n");
        return  0;
    }
    if(n==1)
    {
        printf("%d\n",max(0,num[0]));
        return 0;
    }
    if(num[0]==0)
    {
        printf("-1\n");
        return 0;
    }
    for(int i = 0;i<n;++i)
    {
        if(num[i]==-1)
        {
            if(num[0]==-1)
            {
                num[i] = 1;
            }
            else
                num[i] = 0;
        }
    }
    for(int i = 0;i<n;++i)
        printf("%d",num[i]);

}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#include <list>
#include <cassert>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
#define endl "\n"
#define pi 3.14159265358979
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    map<int, int> mp;
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        mp[a]++;
    }
    priority_queue<int,vector<int>,less<int>> pq;
    for (auto iter = mp.begin(); iter != mp.end(); iter++) {
        pq.push(iter->second);
    }
    int cnt = 0;
    while (!pq.empty()) {
        int duplicates = pq.top(); pq.pop();
        if (duplicates == 1) {
            break;
        }
        else {
            if (duplicates > 2) {
                duplicates -= 2;
                pq.push(duplicates);
                cnt += 1;
            }
            else {
                if (!pq.empty()) {
                    int dup2 = pq.top(); pq.pop();
                    duplicates -= 1;
                    dup2 -= 1;
                    pq.push(duplicates);
                    if (dup2 > 0) {
                        pq.push(dup2);
                    }
                }
                cnt += 1;
            }
        }
    }
    cout << N -2 * cnt << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n,t;
    cin>>n>>t;
    ll ans=INF;

    rep(i,n){
        ll a,b;
        cin>>a>>b;
        if(b<=t){
            ans = min(ans,a);
        }
    }

    if(ans<INF){
        cout<<ans<<endl;
    }else{
        cout<<"TLE"<<endl;
    }
    return  0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
inline int read(){
	int f=1,ans=0;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
	return ans*f;
}
const int MAXN=2001;
vector<int> vec[MAXN];
priority_queue<int> que;
int N,A[MAXN],M[MAXN][MAXN],vis[MAXN],d[MAXN];
void dfs(int u){
	vis[u]=1;
	for(int i=1;i<=N;i++){
		if(!vis[i]&&M[u][i]){
			vec[u].push_back(i);
			vis[i]=1,d[i]++;dfs(i);
		}
	}return;
}
int main(){
	N=read();for(int i=1;i<=N;i++) A[i]=read();sort(A+1,A+N+1);
	for(int i=1;i<=N;i++) for(int j=2;j<=N;j++) if(__gcd(A[i],A[j])!=1) M[i][j]=M[j][i]=1;
	for(int i=1;i<=N;i++) if(!vis[i]) dfs(i);
	for(int i=1;i<=N;i++) if(!d[i]) que.push(i);
	while(!que.empty()){
		int xx=que.top();que.pop();printf("%d ",A[xx]);
		for(int i=0;i<vec[xx].size();i++){
			int v=vec[xx][i];
			d[v]--;if(!d[v]) que.push(v);
		}
	}printf("\n");return 0;
}


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

int main() {
  int n;
  const char *label[5] = {"pre-meiji", "meiji", "taisho", "showa", "heisei"};
  int date[4][3] = {{1868, 9, 8}, {1912, 7, 30}, {1926, 12, 25}, {1989, 1, 8}};
  vector<int> vdate[4], d(3);
  for (int i=0; i<4; i++) {
    vdate[i].assign(date[i], date[i]+3);
  }
  while (cin >> d[0] >> d[1] >> d[2]) {
    for (n=0; n<4; n++) {
      if (d < vdate[n]) break;
    }
    cout << label[n];
    if (n) {
      cout << ' ' << d[0]-date[n-1][0]+1 << ' ' << d[1] << ' ' << d[2];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {
	
	int N,K; cin >> N >> K;


	vector<int> sunuke(N,0);
	for (int i = 0; i < K; i++) {
		int d; cin >> d;
		for (int j = 0; j < d; j++) {
			int A; cin >> A;
			sunuke[A-1]++;
		}
	}

	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (sunuke[i] > 0) {
			ans++;
		}
	}

	cout << N - ans << endl;


	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>
#include <cassert>
#include <memory>


int main() {
	std::string str; std::cin >> str;
	for (auto i = 0; i < str.size(); ++i) {
		if (i + 1 < str.size() && str[i] == str[i + 1]) {
			std::cout << i + 1 << ' ' << i + 2 << std::endl;
			return 0;
		}
		else if (i + 2 < str.size() && str[i] == str[i + 2]) {
			std::cout << i + 1 << ' ' << i + 3 << std::endl;
			return 0;
		}
	}
	std::cout << "-1 -1\n";
}


Measured memory_bytes: 512
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int a, b, l, c[10], j, cnt, ans = 0;
  scanf("%d %d", &a, &b);
  
  for(int k = a; k <= b; k++){
    l = k; j = 0; cnt = 0;
    while(l > 0){
      c[j++] = l % 10;
      l /= 10;
    }
    for(int i = 0; i < j; i++){
      if(c[i] == c[j - 1 - i]) cnt++;
    }
    if(cnt == j) ans++;
  }
  
  printf("%d\n", ans);
  
  return 0;
}
    
      

Measured memory_bytes: 128