akhauriyash/Code-Regression huggingface dataset:
/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ios_base :: sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n; cin >> n;
  vector<int> f(n + 1, 0), a(n);
  for(int& i : a) {
    cin >> i;
    f[i]++;
  }
  ll res = 0;
  for(int i = 1; i <= n; i++) {
    ll tmp = max(0, f[i] - 1);
    res += (tmp * tmp + tmp) / 2;
  }
  for(int i : a) {
    ll tmp = max(0, f[i] - 1), tmp1 = res;
    res -= (tmp * tmp + tmp) / 2;
    tmp = max(0, f[i] - 2);
    res += (tmp * tmp + tmp) / 2;
    cout << res << "\n";
    res = tmp1;
  }
}


Measured memory_bytes: 4224
#include <stdio.h>

int main(void){
    int n;
    int p[100];

    scanf("%d", &n);
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        scanf("%d", &p[i]);
        if((i + 1) != p[i]) cnt++;
    }

    if(cnt == 0 || cnt == 2) puts("YES");
    else puts("NO");

    return 0;
}

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

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  int a;

  cin>>a;

  string str;

  cin>>str;

  if(a<3200){
    str="red";
  }

  cout<<str<<endl;
    

  return 0;

}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define MAX_N 100'000
#define MAX_M 100'000
typedef pair<i64, i64> P;
vector<i64> City[MAX_N + 1];
P py[MAX_M];

int main() {
    i64 N, M; cin >> N >> M;
    i64 pref, year;

    REP(i, M) {
        cin >> pref >> year;
        City[pref].pb(year);
        py[i] = mp(pref, year);
    }
    REPS(i, N) {
        sort(City[i].begin(), City[i].end());
    }

    REP(i, M) {
        pref = py[i].F; year = py[i].S;
        i64 idx = distance(City[pref].begin(), lower_bound(City[pref].begin(), City[pref].end(), year));
        cout << std::setfill('0') << std::right << std::setw(6) << pref;
        cout << std::setfill('0') << std::right << std::setw(6) << (idx + 1);
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 8576
#include<stdio.h>
#define N 100
int main(){
  int i,j,a[N],v,n,m;
  
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&a[i]);
  }

  for(i=0;i<m-1;i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[m-1]);

  for(i=1;i<=m-1;i++){
    v=a[i];
    j=i-1;
    while (j>=0&&a[j]>v){
      a[j+1]=a[j];
      j--;
      a[j+1]=v;  
    }
   
    for(n=0;n<m-1;n++){
      printf("%d ",a[n]);
    }
    printf("%d\n",a[m-1]);
  }
  
  
  return 0;
  
}


Measured memory_bytes: 2128
#include <cstdio>
#include <cstring>
using namespace std;
char s[30];
bool t;
int len;
int main() {
	scanf("%s",s);
	t=true;
	len=strlen(s);
	for (int i=0;i<len;i++)
		for (int j=i+1;j<len;j++)
			if (s[i]==s[j]) {
				t=false;
				break;
			}
	if (t)
		printf("yes\n");
	else printf("no\n");
	return 0;
}

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

int main() {
  int n; cin >>n;
  int N = sqrt(n);
  vector<int> cnt(n+1);
  for(int i = 1; i<=N; i++){
    for(int j = 1; j<=N; j++){
      for(int k = 1; k<=N; k++){
        int v = i*i+j*j+k*k+i*j+j*k+k*i;
        if(v>n) break;
        cnt[v]++;
      }
    }
  }
  for(int i = 1; i<=n; i++){
    cout << cnt[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    int a,b,c;
    cin >> a >> b >> c;
    cout << c << ' ' << a << ' ' << b;
 
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;


void solve() {
	ll ans = 0;
	int n; ll k; cin >> n >> k;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		Rep(j, i + 1, n) {
			if (a[i] > a[j]) {
				ans += k * (k + 1) / 2;
				ans %= mod;
			}
			else if (a[i] < a[j]) {
				ans += k * (k - 1) / 2;
				ans %= mod;
			}
		}
	}
	cout << ans << endl;
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//init();
	solve();

	//cout << "finish" << endl;
	//stop
	return 0;
}

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

#define  fastIO  ios_base::sync_with_stdio(0); cin.tie(0);
#define  int long long int 
#define  endl '\n'

void solveTestCase()
{
	
	int m;
	cin >> m;

	if(m>=400 and m<=599)
		cout << "8\n";
	else if(m>=600 and m<=799)
		cout << "7\n";
	else if(m>=800 and m<=999)
		cout << "6\n";
	else if(m>=1000 and m<=1199)
		cout << "5\n";
	else if(m>=1200 and m<=1399)
		cout << "4\n";
	else if(m>=1400 and m<=1599)
		cout << "3\n";
	else if(m>=1600 and m<=1799)
		cout << "2\n";
	else if(m>=1800 and m<=1999)
		cout << "1\n";

}

int32_t main()
{

	fastIO

	solveTestCase();

	return 0;

}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
    map<int,int>ma;
    int n,m,a;
    cin>>n;
    for(register int i=1;i<=n;++i){
        cin>>a;ma[a]++;
    }
    cin>>m;
    for(register int j=1;j<=m;++j){
        cin>>a;
        if(ma[a]==0){
            cout<<"NO"<<endl;
            return 0;
        }
        ma[a]--;
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 9600
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int query = sc.nextInt();
        
        long[] a = new long[n];
        long[] b = new long[m];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
        }
        for (int i = 0; i < m; i++) {
            b[i] = sc.nextLong();
        }
        
        while (query-- > 0) {
            long now = sc.nextLong();
            int aR = upperBound(a, now);
            int aL = aR - 1;
            int bR = upperBound(b, now);
            int bL = bR - 1;
            
            long min = 1000000000000000000L;
            if (aL != -1 && bL != -1) {
                min = Math.min(min, Math.abs(now - a[aL]) + Math.abs(a[aL] - b[bL]));
                min = Math.min(min, Math.abs(now - b[bL]) + Math.abs(a[aL] - b[bL]));
            }
            if (aL != -1 && bR != b.length) {
                min = Math.min(min, Math.abs(now - a[aL]) + Math.abs(a[aL] - b[bR]));
                min = Math.min(min, Math.abs(now - b[bR]) + Math.abs(a[aL] - b[bR]));
            }
            if (aR != a.length && bL != -1) {
                min = Math.min(min, Math.abs(now - a[aR]) + Math.abs(a[aR] - b[bL]));
                min = Math.min(min, Math.abs(now - b[bL]) + Math.abs(a[aR] - b[bL]));
            }
            if (aR != a.length && bR != b.length) {
                min = Math.min(min, Math.abs(now - a[aR]) + Math.abs(a[aR] - b[bR]));
                min = Math.min(min, Math.abs(now - b[bR]) + Math.abs(a[aR] - b[bR]));
            }
            
            System.out.println(min);
        }
    }
    
    public static int upperBound(long[] array, long target) {
        // 初めてのtarget超過のindexを返す
        // {1, 3, 3, 7} target: 3 -> 3
        
        int left = 0;
        int right = array.length;
        
        while (left < right) {
            int center = (left + right) / 2;
            if (array[center] <= target) {
                left = center + 1;
            } else {
                right = center;
            }
        }
        
        return left;
    }
}


Measured memory_bytes: 101984
#coding:utf-8

import sys
import copy

def main():
    line = sys.stdin.readline()
    #case
    while line.split() != ["0","0"]:
        analy(line)
        line = sys.stdin.readline()
    return

def analy(line):
    #整列
    field = [int(n) for n in line.split()]
    # 横、縦
    num = int(sys.stdin.readline())
    data = []
    for i in range(num):
        a = sys.stdin.readline()
        b = [int(n) for n in a.split()]
        #横、縦
        data.append(b)
    print (compute(field, data))

def compute(field, ng):
    list = []
    for i in range(field[1]):
        for j in range(field[0]):
            #横→縦に移動していく
                if i == 0 :
                    #一番下
                    if [j+1,i+1] in ng:
                        list.append(0)
                    elif j == 0:
                        #左がない
                        list.append(1)
                    else:
                        list.append(list[j-1])
                else:
                    if [j+1,i+1] in ng:
                        list[j] = 0
                    elif j != 0:
                    #no left >> the same.
                        list[j] = list[j-1] + list[j]
    return list[len(list)-1]

if __name__ == "__main__":
    main()

Measured memory_bytes: 4300
module Main where
  
import Control.Monad
import Data.List
import Debug.Trace

main :: IO ()
main = do
  [n, k] <- map read . words <$> getLine :: IO [Int] -- 10^5
  xs <- replicateM n readLn :: IO [Int] -- 10^9
  let ss = sort xs
  let ls = ss
  let hs = drop (k-1) ss
  print $ go ls hs (maxBound::Int)
  where
    go _ [] cost = cost
    go (l:ls) (h:hs) cost =  
      go ls hs (cost `min` (h - l))


Measured memory_bytes: 66044
import bisect

N = int(input())
A = sorted([int(_) for _ in input().split()])
B = sorted([int(_) for _ in input().split()])
C = sorted([int(_) for _ in input().split()])
cnt = 0

for i in range(N):
    j = bisect.bisect_left(A,B[i])
    k = bisect.bisect_right(C,B[i])
    cnt += j*(N-k) 

print(cnt)

Measured memory_bytes: 106724
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
3
1 2 1
---+/
/+---test
2
2 2
---+/
/+---test
9
1 1 1 2 2 1 2 3 2
---+/

void main(string[] args) {
  const N = readln.chomp.to!long;
  auto  B = readln.split.map!(to!long).array;

  long[] op;
  while (B.length > 0) {
    const l = B.length;
    const x = B.enumerate(1).retro.countUntil!(x => x[0] == x[1]);
    if (x < 0) {
      "-1".writeln;
      return;
    }
    B   = B[0..l-x-1] ~ B[l-x..$];
    op ~= l-x;
  }
  op.retro.each!writeln;
}


Measured memory_bytes: 380
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gpu_hash_map<int, int> mp;*/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 62;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 1001;
int board[mxN][mxN];
int dist[mxN][mxN];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int h, w;
bool inside(int x, int y) {
    return x>=0&&x<h&&y>=0&&y<w;
}
int main() {
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    cin>>h>>w;
    string s;
    queue<ttgl> Q;
    memset(dist, INF, sizeof(dist));
    owo(i, 0, h) {
            cin>>s;
        owo(j, 0, w) {
            board[i][j] = s[j]=='#';
            if(s[j]=='#') {
                Q.push({i, j});
                dist[i][j] = 0;
            }
        }
    }
    int ans = 0;
    while(!Q.empty()) {
        auto p = Q.front();
        Q.pop();
        ans = dist[p.first][p.second];
        owo(d, 0, 4) {
            if(inside(p.first+dx[d], p.second+dy[d])) {
                if(dist[p.first+dx[d]][p.second+dy[d]]==INF) {
                    dist[p.first+dx[d]][p.second+dy[d]] = dist[p.first][p.second]+1;
                    Q.push({p.first+dx[d], p.second+dy[d]});
                }
            }
        }
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 19176
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define cpp mp::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
	int to;
	ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	string O, E;
	cin >> O >> E;
	string ans(O.length() + E.length(), 0);
	for (int i = 0; i < ans.length(); i++) {
		if (i % 2 == 0) {
			ans[i] = O[i / 2];
		}
		else {
			ans[i] = E[i / 2];
		}
	}
	cout << ans << endl;
}

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

int main(){
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	for(int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	sort(a.begin(), a.end());
	int q;
	scanf("%d", &q);
	vector<int> b(q);
	for(int i = 0; i < q; i++)
		scanf("%d", &b[i]);
	sort(b.begin(), b.end());
	vector<int> u;
	set_union(a.begin(), a.end(), b.begin(), b.end(), back_inserter(u));
	for(auto x: u)
		printf("%d\n", x);
}



Measured memory_bytes: 6540
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
ll a,b,c,x,y;
cin>>a>>b>>c>>x>>y;

ll kk=min(x,y);

ll k1=min(a+b,2*c);

ll ans=k1*kk;

x-=kk;
y-=kk;

if(x)ans+=x*min(a,2*c);
if(y)ans+=y*min(b,2*c);

ol(ans);

return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
constexpr ll mod=1e9+7;
int main(){
    string s;cin>>s;
    vector<vector<ll>> dp(s.size()+1,vector<ll>(13,0));
    dp[0][0]=1;
    REP(i,s.size()){
        REP(j,13){
            if(s[i]=='?'){
                REP(k,10) (dp[i+1][(10*j+k)%13]+=dp[i][j])%=mod;
            }
            else{
                int k=s[i]-'0';
                (dp[i+1][(10*j+k)%13]+=dp[i][j])%=mod;
            }
        }
    }
    cout<<dp[s.size()][5]<<endl;
}

Measured memory_bytes: 13696
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>

int main() {

    int A, B, K;
    std::cin >> A >> B >> K;

    int divisor = std::min(A, B);

    int cnt = 0;
    for (int i = divisor; i >= 1; --i) {
        if ((A % i == 0) and (B % i == 0)) {
            cnt += 1;
        }
        if (cnt == K) {
            std::cout << i << "\n";
            break;
        }
    }

    return 0;
}


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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

typedef long long ll;
typedef pair<int,int> p;

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

ll f(ll b, ll n) {
    if (n < b) return n;
    return n % b + f(b, n/b);
}

int main(){
    ios::sync_with_stdio(false);
    ll s, n;
    cin >> n >> s;
    ll max_ = sqrt(n) + 1;
    if (s == n) {
        cout << n+1 << endl;
        return 0;
    }
    FOR(i, 2, max_ + 1) {
        if (f(i, n) == s) {
            cout << i << endl;
            return 0;
        }
    }
    ll ans = INF * INF;
    FOR(p, 1, max_ + 1) {
        ll b = (n - s)/p + 1;
        if(b <= 1) continue;
        if (f(b, n) == s) {
            ans = min(ans, b);
        }
    }
    if (ans != INF * INF) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]

cnt = 0
for i in range(n):
    if d[i][0] == d[i][1]:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        print('Yes')
        quit()

print('No')

Measured memory_bytes: 9176
#include<stdio.h>
int main() {
	int a, b;
	while (scanf("%d %d", &a, &b), a + b) {
		for (int i = 0; i < a; i++) {
			for (int j = 0; j < b; j++)
				if (0 != i&&i != a - 1 && j != 0 && j != b - 1)
					putchar('.');
				else
					putchar('#');
			puts("");
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 2552
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int N;
	string S;
	int K;
	cin >>N>> K >> S;
	if (S[K - 1] == 'A')	S[K - 1] = 'a';
	if (S[K - 1] == 'B')	S[K - 1] = 'b';
	if (S[K - 1] == 'C')	S[K - 1] = 'c';

	cout <<S ;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
ll INF = (1LL << 60) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> V(N);
    ll dp[N][N],cost[N+1];
    rep(i,0,N)cin >> V[i];

    rep(i,0,N)rep(j,0,N)dp[i][j] = INF;
    rep(i,0,N)dp[i][i] = 0;
    cost[0] = 0;
    rep(i,0,N)cost[i+1] = cost[i] + V[i];
    rep(i,0,N){
        //差がi
        rep(j,0,N - i){
            //開始がj
            //dp[j][j + i]を最小化
            rep(k,0,i){
                //全探索
                dp[j][j + i] = min(dp[j][j + i], dp[j][j + k] + dp[j + k + 1][j + i] + 
                (cost[j + i + 1] - cost[j]) );
            }
        }
    }
    //dp[i][j] = min(dp[i][j], 
    //dp[i][k] + dp[k][j] + (cost[k+1] - cost[i]) + (cost[j+1] - cost[k]));
    cout << dp[0][N-1] << endl;
}

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

int main() {
    string S, T; cin >> S >> T;
    int ans = 0;
    int n = S.size();
    rep(i, n){
        if(S[i] != T[i]){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3920
fn main() {
    let n: i64 = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let mut a: Vec<(i64, i64)> = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let ret = line.split_whitespace().map(|a| a.parse().unwrap());
        ret.zip(0i64..).collect()
    };
    a.sort();
    println!("{}", a.iter().map(|&(a, i)| (i + 1).to_string()).collect::<Vec<String>>().join(" "))
}


Measured memory_bytes: 12020
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
//#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


void solve()
{
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    if (abs(b - a) % 2) {
        printf("Borys\n");
    }
    else {
        printf("Alice\n");
    }

    

    return;
}


int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}


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

int n,m,ans=0,tmp[200005];
struct Student{
    int l,r;
    bool operator<(const Student &b)const{
        return l!=b.l?l<b.l:r>b.r;
    }
}s[200005];
priority_queue<int,vector<int>,greater<int> > q;

int main(){
//  freopen("data.in","r",stdin);
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&s[i].l,&s[i].r);
    sort(s+1,s+n+1);
    int h=1,t=m;
    for(int i=1;i<=n;i++){
        q.push(s[i].r);
        if(h<=t&&h<=s[i].l)h++;
        else{
            tmp[++tmp[0]]=q.top();
            q.pop();
        }
    }
    sort(tmp+1,tmp+tmp[0]+1);
    for(int i=tmp[0];i>=1;i--){
        if(h<=t&&tmp[i]<=t)t--;
        else ans++;
    }
    printf("%d",ans);
}
// I am exhausted.

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  if(!is_sorted(a.begin(),a.end())){
    prev_permutation(a.begin(),a.end());
    for(Int i=0;i<n;i++){
      if(i) cout<<" ";
      cout<<a[i];
    }
    cout<<endl;
    next_permutation(a.begin(),a.end());
  }
  
  for(Int i=0;i<n;i++){
    if(i) cout<<" ";
    cout<<a[i];
  }
  cout<<endl;
   
  if(next_permutation(a.begin(),a.end())){
    for(Int i=0;i<n;i++){
      if(i) cout<<" ";
      cout<<a[i];
    }
    cout<<endl;
    prev_permutation(a.begin(),a.end());
  }
  return 0;
}



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

int main() {
    int n, ans = 0;
    cin >> n;
    int l[n];
    for(int i = 0; i < n; ++i) cin >> l[i];
    for(int i = 0; i < n; ++i) {
        for(int j = i+1; j < n; ++j) {
            for(int k = j+1; k < n; ++k) {
                if(l[i] + l[j] > l[k]
                && l[i] + l[k] > l[j]
                && l[k] + l[j] > l[i]
                && l[i] != l[j] && l[j] != l[k] && l[i] != l[k]) {
                    ans++;
                }
            }
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3624
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

class Prime {
private:
	void Eratos(lint N) {
		for (lint i = 2; i * i < N; i++) {
			if (Ptb[i]) for (int j = 0; i * (j + 2) < N; j++) Ptb[i *(j + 2)] = 0;
		}
	}
public:
	vector<int> Ptb;
	Prime(lint N) : Ptb(N + 1, 1) { Eratos(N + 1); }

	vector<pair<lint, int>> Pfact(lint num) {
		vector<pair<lint, int>> res;
		for (lint i = 2; i * i <= num; i++) {
			int cnt = 0;
			while (num % i == 0) {
				cnt++;
				num /= i;
			}
			if (cnt) res.emplace_back(i, cnt);
		}
		if (num != 1) res.emplace_back(make_pair(num, 1));
		return res;
	}

	bool isPrime(lint num) {
		if (num < 2) return false;
		else if (num < (int)(Ptb.size())) return (bool)(Ptb[num]);
		else if (num == 2 || num == 3) return true;
		else if (num % 2 == 0 || num % 3 == 0) return false;
		else if (num % 6 != 1 && num % 6 != 5) return false;
		for (lint i = 5; i * i <= num; i += 6) {
			if (num % i == 0) return false;
			if (num % (i + 2) == 0) return false;
		}
		return true;
	}
};

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	Prime p(55555);

	vector<int> ans;
	int ans_sz = 0;
	for (int i = 2; ans_sz < N; i += 5) {
		if (p.isPrime(i)) {
			ans.emplace_back(i);
			ans_sz = static_cast<int>(ans.size());
		}
	}

	for (const auto &e : ans) cout << e << " ";
	cout << "\n";

	return 0;
}

Measured memory_bytes: 512
n = int(input())
ac = []
wa = []
tle = []
re = []
for _ in range(n):
    i = input()
    if i == "WA":
        wa.append(i)
    elif i == "AC":
        ac.append(i)
    elif i == "TLE":
        tle.append(i)
    else:
        re.append(i)

print("AC x", len(ac))
print("WA x", len(wa))
print("TLE x", len(tle))
print("RE x", len(re))

Measured memory_bytes: 16328
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
const Int MAX = 2e18;

void chmin(Int &a,Int b){if(a>b) a=b;}

Int dp[10][10][100][2][4][100];

Int dfs(Int a,Int b,Int t,Int f,Int u,Int k){
  //cout<<t<<":"<<k<<endl;
  Int &res=dp[a][b][t][f][u][k];
  if(~res) return res;
  if(t==k) return res=(u==3);
  res=0;
  res+=dfs(a,b,t,f,u|1,k+1); //use a
  res+=dfs(a,b,t,f,u|2,k+1); //use b
  chmin(res,MAX);
  return res;
}

void restore(Int n){
  //cout<<n<<":::"<<endl;
  Int k=1;
  for(;;k++){
    Int tmp=0;
    for(Int a=0;a<10;a++){
      for(Int b=a+1;b<10;b++){
	if(a!=0) tmp+=dfs(a,b,k,0,1,1); //use a
	tmp+=dfs(a,b,k,1,2,1);          //use b > 0
	chmin(tmp,MAX);
      }
    }
    if(tmp>n) break;
    n-=tmp;
  }
  // cout<<k<<endl;
  Int c,d;
  string ans;
  for(c=1;c<10;c++){
    Int tmp=0;
    for(Int a=0;a<c;a++){
      tmp+=dfs(a,c,k,1,2,1);
      chmin(tmp,MAX);
    }
    for(Int b=c+1;b<10;b++){
      tmp+=dfs(c,b,k,0,1,1);
      chmin(tmp,MAX);
    }
    if(tmp>n){
      ans+=char('0'+c);
      break;
    }
    n-=tmp;
  }
  //cout<<k<<" "<<c<<endl;
  Int l=k-1;
  while(l--){
    Int flg=0;
    for(d=0;d<c;d++){
      Int tmp=dfs(d,c,k,1,3,k-l);
      if(tmp>n){
	ans+=char('0'+d);
	flg=1;
	break;
      }
      n-=tmp;
    }
    if(flg) break;
    Int tmp=0;
    for(Int e=0;e<c;e++){
      tmp+=dfs(e,c,k,1,2,k-l);
      chmin(tmp,MAX);
    }
    for(Int e=c+1;e<10;e++){
      tmp+=dfs(c,e,k,0,1,k-l);
      chmin(tmp,MAX);
    }
    if(tmp>n){
      ans+=char('0'+c);
      continue;
    }
    n-=tmp;
    for(d=c+1;d<10;d++){
      Int tmp=dfs(c,d,k,0,3,k-l);
      if(tmp>n){
	ans+=char('0'+d);
	flg=1;
	break;
      }
      n-=tmp;
    }
    if(flg) break;
  }
  //cout<<c<<":"<<d<<endl;
  while(l--){
    if(c<d){
      Int tmp=dfs(c,d,k,0,3,k-l);
      if(tmp>n){
	ans+=char('0'+c);
      }else{	
	ans+=char('0'+d);
	n-=tmp;
      }
    }else{
      Int tmp=dfs(d,c,k,1,3,k-l);
      if(tmp>n){
	ans+=char('0'+d);
      }else{	
	ans+=char('0'+c);
	n-=tmp;
      }
    }
  }
  cout<<ans<<endl;
}
signed main(){
  memset(dp,-1,sizeof(dp));
  Int n;
  while(cin>>n,n){
    restore(n-1);
  }
  return 0;
}



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

using namespace std;

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

  set<int> s;
  for (int i = 0; i < 3; ++i) {
    int a;
    cin >> a;
    s.insert(a);
  }
  cout << s.size() << "\n";
}


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

public class Main {

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

        int N = nextInt(), capacity = nextInt();

        int[] values = new int[N];
        int[] weights = new int[N];

        for (int i = 0; i < N; i++) {
            weights[i] = nextInt();
            values[i] = nextInt();
        }

        long[][] dp = new long[capacity + 1][values.length + 1];

        for (int j = 0; j < dp[0].length; j++) {
            for (int k = 0; k < dp.length; k++) {
                if (j - 1 < 0) dp[k][j] = 0;
                else if (weights[j - 1] > k) dp[k][j] = dp[k][j - 1];
                else dp[k][j] = Math.max(dp[k][j - 1], values[j - 1] + dp[k - weights[j - 1]][j - 1]);
            }
        }

        System.out.println(dp[capacity][values.length]);
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

}

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

lli r, c, k;
lli f[R][C];
lli dp[R][C][4];

int main(void){
    cin >> r >> c >> k;

    rep(i, r+1){
        rep(j, c+1){
            f[i][j] = 0;
            rep(k, 4) dp[i][j][k] = 0;
        }
    }
    rep(i, k){
        int x, y, v;
        cin >> x >> y >> v;
        f[x][y] = v;
    }
    for(int i = 1; i <= r; i++){
        for(int j = 1; j <= c; j++){
            for(int k = 0; k <= 3; k++){
                dp[i][j][0] = max(dp[i][j][0], dp[i-1][j][k]);
                dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][k]);
            }
            if(f[i][j] != 0){
                for(int k = 0; k <= 3; k++){
                    dp[i][j][1] = max(dp[i][j][1], dp[i-1][j][k]+f[i][j]);
                    if(k < 3) dp[i][j][k+1] = max(dp[i][j][k+1], dp[i][j-1][k]+f[i][j]);
                }
            }
        }
    }
    lli ans = 0;
    rep(k, 4){
        ans = max(ans, dp[r][c][k]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 356352
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int N=0,K=0;
long long dp[100100],Hi[100100];
int main(void){
	cin>>N>>K;
	for(int i=0;i<N;i++){
		cin>>Hi[i];
		dp[i]=1e9;
	}
	dp[N]=1e9;
	dp[0]=0;
	for(int k=1;k<=K;k++)
	{
		for(int j=0;j<k;j++)
		dp[k]=min(dp[k],dp[j]+abs(Hi[j]-Hi[k]));
	}
	for(int i=K+1;i<N;i++){
		for(int k=1;k<=K;k++)
		dp[i]=min(dp[i],dp[i-k]+abs(Hi[i-k]-Hi[i]));
	}
	cout<<dp[N-1]<<endl;
	return 0;
}

Measured memory_bytes: 1792
N = int(input())
P = [int(input()) for _ in range(N)]
index = [-1] * N
for i, p in enumerate(P):
    index[p-1] = i
res = 1
tmp = 1
for i in range(N-1):
    if index[i] < index[i+1]:
        tmp += 1
        res = max(res, tmp)
    else:
        tmp = 1
ans = N-res
print(ans)

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

int main() {
  int N;
  cin >> N;
  
  vector<int> mochies(N);
  
  for (int i = 0; i < N; i++) {
    cin >> mochies.at(i);
  }
  
  sort(mochies.begin(), mochies.end());
  
  int count = 0;
  
  for (int i = 0; i < N; i++) {
    if (i != 0) {
      if (mochies.at(i) != mochies.at(i - 1)) {
        count++;
      }
    } else {
        count++;
    }
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define INFTY 10000000000

void merge(int *,int,int,int);
void mergeSort(int *,int,int);

int count = 0;

int main()
{
  int n,i,left,right;
  scanf("%d",&n);
  int S[n];
  for(i = 0;i < n;i++)
    {
      scanf("%d",&S[i]);
    }
  left = 0;
  right = n;
  mergeSort(S,left,right);
  for(i = 0;i < n;i++)
    {
      printf("%d",S[i]);
      if(i != n -1)
	{
	  printf(" ");
	}
    }
  printf("\n%d\n",count);
  return 0;
}

void merge(int A[],int left,int mid,int right)
{
  int n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;
  int L[n1],R[n2];
  for(i = 0;i < n1;i++)
    {
      L[i] = A[left + i];
    }
  for(i = 0;i < n2;i++)
    {
      R[i] = A[mid + i];
    }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for(k = left;k < right;k++)
    {
      if(L[i] <= R[j])
	{
	  A[k] = L[i];
	  i = i + 1;
	}
      else
	{
	  A[k] = R[j];
	  j = j + 1;
	}
      count++;
    }
}

void mergeSort(int A[],int left,int right)
{
  if(left + 1 < right)
    {
      int mid = 0;
      mid = (left + right)/2;
      mergeSort(A,left,mid);
      mergeSort(A,mid,right);
      merge(A,left,mid,right);
    }
}



Measured memory_bytes: 5760
H, W = map(int, input().split())
original = [list(input()) for i in range(H)]
converted = [[0 for j in range(W)] for i in range(2 * H)]
for i in range(2 * H):
    for j in range(W):
        converted[i][j] = original[i // 2][j]
        
for row in converted:
    print(''.join(row))

Measured memory_bytes: 3316
#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long

int w, n;
int ban[35];
int main()
{
	REP(i, 35) ban[i] = i;
	cin >> w >> n;
	REP(i, n)
	{
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(ban[a], ban[b]);
	}
	FOR(i,1, w+1) cout << ban[i] << endl;
	return 0;
}

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

int main() {
	int N, Q = 0;
	cin >> N;

	int W = N;

	while (W > 0) {
		Q += W % 10;
		W /= 10;
	}

	if (N % Q == 0) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}


Measured memory_bytes: 256
K = int(input())

def gcd(p, q):
  r = p % q
  if r == 0:
    return q
  else:
    p = q
    q = r
    return gcd(p, q)

total = 0
for i in range(1,K+1,1):
  for j in range(1,K+1,1):
    p = gcd(i,j)
    for k in range(1,K+1,1):
      q = gcd(k, p)
      total += q
print(total)
      


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

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

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

    long long int x = 0;
    vector<long long int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        x = gcd(x, a[i]);
    }

    int count = 0;
    while(x % 2 == 0){
        x /= 2;
        count += 1;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
	ll n;
	cin>>n;
	for(ll i=1;i<3500;i++){
		for(ll j=i;j<3500;j++){
			ll k = n*i*j;
			ll b = 4*i*j-n*(i+j);
			if(b>0&&k%b==0){
				cout<<i<<' '<<j<<' '<<k/b<<endl;
				return 0;
			}

		}
	}


	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read()
{
	ll x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
int n;
int main()
{
    n=read();
    printf("%.12lf\n",(double)((int)(n+1)/2)/n);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{
    int N,H,W;
    cin >> N >> H >> W;
    int ans = 0;
    rep(i,N){
        int a,b;
        cin >> a >> b;
        if(a >= H && b >= W) ans++;
    }

    cout << ans << endl;
    
    
    

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;
 
#define Endl endl
 
 
/*--------------------template--------------------*/
 
 
ll gcd(ll a, ll b)
{
	while (b) {
		ll t = (ll)a % (ll)b;
		a = b;
		b = t;
	}
	return a;
}
 
ll lcm(ll a, ll b)
{
	return (a / gcd(a, b)* b);
}
 
 
int main()
{
	cin >> n;
	vi v(n);
	stack<ll> st;
	REP(i, n)
	{
		cin >> v[i];
	}
	REP(i, n) st.push(v[i]);
	while (st.size() != 1) {
		ll a = st.top();
		st.pop();
		ll b = st.top();
		st.pop();
		ll c = lcm(a, b);
		st.push(c);
	}
	cout << st.top() << endl;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
S = [['.']*(W+2)]
for _ in range(H):
  var = ['.'] + list(input()) + ['.']
  S.append(var)
S.append(['.']*(W+2))
#print(S)

dire = [(-1,0),(1,0),(0,-1),(0,1)]

for i in range(1,H+1):
  for j in range(1,W+1):
    if S[i][j] == '#':
      for k in range(4):
        if S[i+dire[k][0]][j+dire[k][1]] == '#':
          break
      else:
        print('No')
        exit()
else:
  print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <numeric>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
typedef pair<int, int> P;

typedef long long ll;
const int MOD = 1000000007;

    class Pairs{
        public : ll a;
        ll b;
        void setpairs(ll _a, ll _b){
            a = _a;
            b = _b;
        }
    };

    bool cmp(const P &A, const P &B){
        return (A.first < B.first);
    }


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

int main(){  
    ll A,B,count,C,D,E;
    cin >> A >> B >> C >> D;
    
    E = C*D/gcd(C, D);
    count = B - A + 1;
    count = count - B/C - B/D + (A-1)/C + (A-1)/D;
    count = count + B/E - (A-1)/E;
    cout << count;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int N;
    int X[100];
    int sum = 0;

    scanf("%d", &N);
    for(int i=0;i<N;i++)
    {
        scanf("%d", &X[i]);
        sum += X[i];
    }

    int avg = sum / N;
    avg = ((sum % N) < N - (sum % N)) ? avg : avg + 1;
    
    sum = 0;
    for (int i = 0; i < N; i++)
    {
        sum += (X[i]-avg)*(X[i]-avg);   
    }

    printf("%d", sum);

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
  char str[101];
  scanf("%s", str);
  int i=0;
  int easy=1;
  while(str[i]){
    if(i%2==0){
      if(str[i]=='L') easy=0;
    }
    else{
      if(str[i]=='R') easy=0;
    }
    i++;
  }
  if(easy){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
/*
　　　　 ∧＿∧　にっぽんちゃちゃちゃ
　／＼（　・∀・）／ヽ
（ ●　と　　　つ　● ）　にっぽんちゃちゃちゃ
　＼/⊂、 ノ　　＼ノ
　　　　　し'
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define MOD 1000000007
#define INF 9223372036854775807

signed main(){
int x=0,y=0,z=0,w=0,a=0,b=0;
std::cin >> x>>y>>z>>w>>a>>b;
if((x+y*5+z*10+w*50+a*100+b*500)>=1000)std::cout << 1<< '\n';
else std::cout << 0 << '\n';
}




Measured memory_bytes: 3116
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int x = scn.nextInt(), y = scn.nextInt();
		if (2 * x <= y && 4 * x >= y && y % 2 == 0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 35816
#include <bits/stdc++.h>
using namespace std;
int main() {
  char s;
  scanf("%c", &s);
  while (s != '\n') {
    if (isalpha(s)) {
      if (islower(s)) {
        s -= 32;
      } else {
        s += 32;
      }
    }
    cout << s;
    scanf("%c", &s);
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,s;
	s=0;
	cin>>n>>k;
	for (int i=0;n>i;i++){
		int x;
		cin>>x;
		if (x<k-x){
			s+=x*2;
		}
		else {
			s+=(k-x)*2;
		}
	}
	cout <<s<<endl;
}

Measured memory_bytes: 256
sx,sy,tx,ty = gets.chomp.split(' ').map{|n| n.to_i}
dx = tx - sx;dy = ty - sy
ans =''
ans << 'U'*dy + 'R'*dx
ans << 'D'*dy + 'L'*dx
ans << 'L' + 'U'*(dy+1) + 'R'*(dx+1) + 'D'
ans << 'R' + 'D'*(dy+1) + 'L'*(dx+1) + 'U'
puts ans

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

using i64 = int64_t;

int main(){
    int n, h, w;
    cin >> n >> h >> w;
    vector<int> v;
    for(int i=0;i<n;++i){
        int x;
        cin >> x;
        v.push_back(x);
    }

    int ans = 0;
    for(int i=0;i<n;i+=2){
        int overlapped = 0;
        if(v[i]+v[i+1] <= w)overlapped = v[i] + v[i+1];
        else overlapped = 2*w - (v[i] + v[i+1]);
        ans += overlapped;
    }
    ans *= h;
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3160
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
static inline char GET(void)
{
  static char buf[1<<15],*ptr=buf,*end=buf;
  if(ptr==end){ptr=buf,end=buf+fread(buf,1,1<<15,stdin);}return *ptr++;
}
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline void OUT(int a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
int N=0;
typedef struct TUPLE tuple;
struct TUPLE{int first,second,id;}*ask;
static inline int Asc(const void *a,const void *b)
{
  if((*(const tuple*)a).second==(*(const tuple*)b).second)return (*(const tuple*)a).first-(*(const tuple*)b).first;
  else return (*(const tuple*)a).second-(*(const tuple*)b).second;
}
static inline void Add(int *fwt,int i,int v){while(i<N){fwt[i]+=v;i|=i+1;}}
static inline int Sum(int *fwt,int i){int v=0;while(i>=0){v+=fwt[i];i=(i&(i+1))-1;}return v;}
static inline int Diff(int *fwt,int x,int y,int sz){if(y==-1){y=sz-1;}return Sum(fwt,y)-Sum(fwt,x-1);}
int main(void)
{
  N=IN();int Q=IN(),*fenwick,k=0,dat[500000],result[500000],temp[500000];
  rep(i,N){dat[i]=IN()-1;}
  ask=(tuple*)malloc((Q)*sizeof(tuple));if(ask==NULL){exit(EXIT_FAILURE);}
  fenwick=(int*)malloc((N)*sizeof(int));if(fenwick==NULL){exit(EXIT_FAILURE);}
  rep(i,Q){ask[i].first=IN()-1,ask[i].second=IN(),ask[i].id=i;}
  qsort(&ask[0],Q,sizeof(tuple),Asc);
  memset(temp,-1,sizeof(temp));
  rep(i,Q)
  {
    while(k<ask[i].second)
    {
      int j=dat[k];
      if(temp[j]!=-1){Add(fenwick,temp[j],-1);}
      temp[j]=k,Add(fenwick,temp[j],1);k++;
    }
    result[ask[i].id]=Diff(fenwick,ask[i].first,ask[i].second-1,N);
  }
  rep(i,Q){OUT(result[i]);}
  free(fenwick);return free(ask),0;
}

Measured memory_bytes: 17260
N = int(input())
S = input()

MOD = int(1e9) + 7

d = {}
for i in range(N):
    if S[i] in d:
        d[S[i]] += 1
    else:
        d[S[i]] = 1

v = d.values()
ans = 1
for i in v:
    ans *= i+1
    ans %= MOD
ans -= 1
ans %= MOD
print(ans)


Measured memory_bytes: 3188