akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <sstream>
#include <numeric>
#include <iomanip>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>

///////////////////////////////////////////////////////////////
// namespace
///////////////////////////////////////////////////////////////
using namespace std;
// namespace mp = boost::multiprecision;

///////////////////////////////////////////////////////////////
// types
///////////////////////////////////////////////////////////////
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
// using mpi = mp::cpp_int;
// using mpf = mp::number<mp::cpp_dec_float<1024>>;

///////////////////////////////////////////////////////////////
// mod https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
///////////////////////////////////////////////////////////////
// ll MOD = 1000000007;
//
//  ll mod(ll val) {
//      ll res = val % MOD;
//      if (res < 0) res += MOD;
//      return res;
//  }
//
// ll modinv(ll a) {
//     ll b = MOD, u = 1, v = 0;
//     while (b) {
//         ll t = a / b;
//         a -= t * b; swap(a, b);
//         u -= t * v; swap(u, v);
//     }
//     u %= MOD;
//     if (u < 0) u += MOD;
//     return u;
// }
//
// const int MAX = -1;
// ll fac[MAX], finv[MAX], inv[MAX];
// void com_init() {  // initialize nCk table with O(N)
//     fac[0] = fac[1] = 1;
//     finv[0] = finv[1] = 1;
//     inv[1] = 1;
//     for (int i = 2; i < MAX; i++){
//         fac[i] = fac[i - 1] * i % MOD;
//         inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
//         finv[i] = finv[i - 1] * inv[i] % MOD;
//     }
// }
// ll com(int n, int k){  // nCk
//     if (n < k) return 0;
//     if (n < 0 || k < 0) return 0;
//     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
// }


int main() {
    string s; cin >> s;
    if (s == "ABC") {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }
    // cout << setprecision(10);
    return 0;
}


Measured memory_bytes: 3596
#include <string>
#include <stack>
#include <iostream>
#include<cstdlib>
using namespace std;

int main() {
  string word;
  stack<int> S;
  int a,b,i=-1;
  char c;
  while (cin >> word)
    {
      if (word == "+") {
	a=S.top();
	S.pop();
	b=S.top();
	S.pop();
	S.push(a+b);
      }
      else if (word == "-") {
	a=S.top();
	S.pop();
	b=S.top();
	S.pop();
	S.push(b-a);
      }
      else if (word == "*") {
	a=S.top();
	S.pop();
	b=S.top();
	S.pop();
	S.push(a*b);
      }
      else {
	S.push(atoi(word.c_str()));
      }
    }
  cout<<S.top()<<endl;
}

Measured memory_bytes: 3216
#[allow(unused_macros)]
macro_rules! input_byline {
    ($($r:tt)* ) => {
        let stdin = std::io::stdin();
        let mut q = std::collections::VecDeque::new();
        let mut next = || {
            if q.is_empty() {
                let mut s = String::new();
                stdin.read_line(&mut s);
                for v in s.split_whitespace() {
                    q.push_back(v.to_string());
                }
            }
            q.pop_front().unwrap()
        };
        input_inner!{next, $($r)*}
    };

}

#[allow(unused_macros)]
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

trait Printable {
    fn p(&self);
}

impl<T: std::fmt::Display> Printable for T {
    fn p(&self) {
        println!("{}", self);
    }
}

impl<T: std::fmt::Display> Printable for [T] {
    fn p(&self) {
        for i in 0..self.len() {
            if i != 0 {
                print!(" ");
            }
            print!("{}", self[i]);
        }
        println!("");
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        n: usize,
    }

    let mut ans = 11;
    for i in 1..(n as f64).sqrt() as usize + 1 {
        if n % i == 0 {
            let mut a = 0;
            let mut b = 0;
            let mut ii = i;
            let mut jj = n / i;
            while ii > 0 {
                a += 1;
                ii /= 10;
            }
            while jj > 0 {
                b += 1;
                jj /= 10;
            }
            ans = min(max(a, b), ans);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define DQ deque
#define RE rend()
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define SE second
#define DL double
#define G getline
#define IN insert
#define endl "\n"
#define EM empty()
#define EE emplace
#define RB rbegin()
#define MD 1000000007
#define PSB push_back
#define PI acos(-1.00)
#define PPB pop_back()
#define PSF push_front
#define ub upper_bound
#define lb lower_bound
#define PPF pop_front()
#define EB emplace_back
#define LL long long int
#define PQ priority_queue
#define N cout<<"NO"<<endl
#define Y cout<<"YES"<<endl
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define UOSMOY v.C;w.C;ww.C;uu.C;uo.C;vo.C;vu.C;ab.C;bc.C;cc.C;uuu.C;a.C;b.C;c.C;u.C
V<LL>v;
V<LL>w,ab,bc;
set<LL>uo;
map<LL,LL>ww,cc,u;
V<pair<LL,LL> >uu,su;
map<LL,V<LL> >uuu;
map<pair<LL,LL>,LL> vo;
map<pair<LL,LL>,LL> vu;
map<LL,pair<LL,pair<LL,LL > > > vs;
LL dxx[]= {-1,0,1,0};
LL dyy[]= {0,1,0,-1};
LL dx[]= {2,1,-1,-2,-2,-1,1,2};
LL dy[]= {1,2,2,1,-1,-2,-2,-1};
int main()
{
//  BRR;
//  file;
    FAST;
    char ch;
    string a,b,c;
    DL x,y,d,e,f,g,h;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r=0;
//    cin>>tt;
    for(LL mau=1;mau<=tt;mau++)
    {
        UOSMOY;
        cin>>a;
        cout<<a;
        if(a[a.SZ-1]=='s')
        {
            cout<<"es"<<endl;
        }
        else
        {
            cout<<"s"<<endl;
        }


    }
    return 0;
    //IN
    //AL
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

#define ll long long
#define REP(i,n) for(int i=0;i<n;++i)
using namespace std;

int main(){
  int h, a, c;
  cin >> h >> a;
  c = h % a;
  if (c == 0) {
    cout << h / a;
  } else {
    cout << (h / a) + 1;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;

    rep(i, n){
        if (s.substr(i) == t.substr(0,n-i)) {
            // cout << s << t.substr(n-i) << endl;
            cout << s.size() + t.substr(n-i).size() << endl;
            return 0;
        }
    }
    cout << 2 * n << endl;
    return 0;
}


Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<algorithm>
using namespace std;
using ll = long long int;

int n;
vector<ll> a;
pair<ll, ll> ret;

int half(ll x, int h) {
	ll tmp = x / 2;
	int half = 0;
	for (int i = h + 1; i < n; i++) {
		if (a[i] < tmp) {
			if (a[i - 1] - tmp <= tmp - a[i])
				half = i - 1;
			else
				half = i;
			break;
		}
	}
	return half;
}

int main(void) {
	cin >> n;
	for (int i = 0; i < n; i++) {
		ll ai;
		cin >> ai;
		a.push_back(ai);
	}
	sort(a.begin(), a.end(), greater<ll>());
	int h = half(a[0], 0);
	ret = pair<ll, ll>(a[0], a[h]);
	if (n == 2)
		ret = pair<ll, ll>(a[0], a[1]);
	cout << ret.first << " " << ret.second << endl;
	return 0;
}


Measured memory_bytes: 1400
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int K, X;
    cin >> K >> X;
    if (500 * K >= X)
    {
        cout << "Yes" << endl;
    }else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

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

#define fi first
#define se second
#define all(X) X.begin(),X.end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int maxn = 1e5 +5;
const int lg = 20;
const int mod = 1e9 + 7;

template<class T>
void smin(T &_x, const T &_y){
	_x = min(_x, _y);
}
template<class T>
void smax(T &_x, const T &_y){
	_x = max(_x, _y);
}

int n;
int a[maxn], id[maxn];

bool cmp(int x, int y){
	return a[x] < a[y];
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie();
	cin>>n;
	int cnt = 0;
	for(int i = 0; i < n; i++) {
		cin>>a[i];
		id[i] = i;
	}
	sort(id, id + n, cmp);
	for(int i = 0; i < n; i++){
//		cout<<id[i]<<' ';
		if(id[i] % 2 != i % 2)
			cnt++;
	}
//	cout<<endl;
	cout<<cnt / 2<<endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <array>
#include <climits> // INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX, ULLONG_MAX
#include <cmath>
#include <cstdint>
#include <cstring> // memset
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define ALL(x) (x).begin(), (x).end()
#define INF 1e9
#define LOG(x) cout << #x << " = " << (x) << endl
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using namespace std;

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

    vector<pair<int, int>> st[30];

    vector<int> tt;
    
    REP(i, n) {
        int si, ti, ci;
        cin >> si >> ti >> ci;
        auto sti = make_pair(si, ti);
        st[ci - 1].push_back(sti);
        tt.push_back(si);
        tt.push_back(ti - 1);
    }

    sort(ALL(tt));

    REP(i, cn)
        sort(ALL(st[i]));
    
    int maxCount = 0;
    int idx[30] = {0,};
    
    for (auto t : tt) {
        int count = 0;
        REP(j, cn) {
            for (;;) {
                if (idx[j] == st[j].size())
                    break;

                auto k = st[j][idx[j]];
                if (k.first - 1 <= t && t < k.second) {
                    count++;
                    break;
                } else if (k.second <= t) {
                    idx[j]++;
                } else {
                    break;
                }
            }
        }
        maxCount = max(maxCount, count);
    }

    cout << maxCount << endl;
    
    return 0;
}


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

int main(){
    string s;
    cin >> s;
    int cnt = 0;
    int len = s.size();
    int i;
    for(i = 0; i < len/2; i++){
        if(s.at(i) != s.at(len-1-i)){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

int main(){
	string s;
	bool flag = true;
	

	cin >> s;

	for(;;){
		flag = true;
		s.erase(s.begin() + s.length()-1);
		
		if(s.length() % 2 == 0){
			for(int i = 0;i < s.length() / 2;++i){
				if(s[i] != s[i+s.length()/2])
					flag = false;
			}
			if(flag == true)
				break;
		}

	}

	cout << s.length() << endl;
}

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

#define MOD 1000000007

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


template <class T>
ostream &operator<<(ostream &o, const vector<T>&obj) {
    o << "["; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const vector<vector<T>>&obj) {
    o << "[" << endl; for (int i = 0; i < (int)obj.size(); ++i) o << "  " << obj[i] << endl; o << "]"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U>&obj) {
    o << "(" << obj.first << ", " << obj.second << ")"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const set<T>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const multiset<T>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const queue<T>&obj) {
    queue<T> obj_cp = obj;
    bool first = true;
    o << "{";
    while (!obj_cp.empty()) { o << (!first ? ", " : "") << obj_cp.front(); obj_cp.pop(); first = false; }
    o << "}"; return o;
}

void print() {
    cout << "\n";
}
template<class Head, class... Body>
void print(Head head, Body... body) {
    cout << head << " ";
    print(body...);
}


int main(int argc, char const *argv[]) {
    char a;
    cin >> a;
    if (a <= 'Z') {
        cout << "A" << endl;
    } else {
        cout << "a" << endl;
    }
    return 0;
}


Measured memory_bytes: 3592
N=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(N[int(input())-1])


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

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


int main(){
	
	int a,b;cin >> a >> b;
	if(2 * b - 1 <= a)cout << "YES" << endl;
	else cout << "NO" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
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 (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;
ll dp[100][100010];
void solve()
{
	int N, W;
	cin >> N >> W;
	vector<int> w(N), utility(N);
	int umax = 0;
	rep(i, N)
	{
		cin >> w[i] >> utility[i];
		umax += utility[i];
	}
	//cout<<umax<<endl;
	rep(i, N)
	{
		rep(current_utility, umax+1)
		{
			dp[i][current_utility] =(ll) 5e9 + 1;
		}
	}
	rep(i,N){
		dp[i][0]=0;
		dp[i][utility[i]]=w[i];
	}

	rep(i, N)
	{
		rep(current_utility, umax+1)
		{
			if (i)
			{
				
				chmin(dp[i][current_utility], dp[i - 1][current_utility]);
				if (current_utility >= utility[i])
				{

					chmin(dp[i][current_utility], 
					dp[i - 1][current_utility - utility[i]] + w[i]);
				}
				
			}
		}
	}
	int ans=0;
	rep(i,umax+1){
		//cout<<i<<" "<<dp[N-1][i]<<endl;
		if(dp[N-1][i]<=W){
			ans=i;
		}
	}
	cout<<ans<<endl;

}

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


Measured memory_bytes: 78336
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>

#define p(a, b) pair<a, b>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin >> a >> b;
    a %= 2;
    b %= 2;
    if(a*b){
        cout << "Odd";
    } else {
        cout << "Even";
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
	int main(){
		int A,B,C;
		
		scanf ("%d",&A);
		scanf ("%d",&B);
		scanf ("%d",&C);
		
		if (A==B && A==C && B==A && B==C && C==A && C==B){
			printf ("No\n");
		}else if (A==B||A==C||B==A||B==C||C==A||C==B){
			printf("Yes\n");
		}else {
			printf ("No\n");
		}
	}


Measured memory_bytes: 1628
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	cin >> N;
	for (long long int i = -2000; i <= 2000; i++) {
		for (long long int j = -2000; j <= 2000; j++) {
			if (i*i*i*i*i - j * j*j*j*j == N) {
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
}


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

char arr[200][200];
long h, w;
int main(){
    cin >> h >> w;
    for (long i = 0; i < h+2; i++){
		for (long j = 0; j < w+2; j++){
			arr[i][j] = '#';
		}
	}
    for (long i = 0; i < h; i++){
		for (long j = 0; j < w; j++){
			cin >> arr[i+1][j+1];
		}
	}
	for (long i = 0; i < h+2; i++){
		for (long j = 0; j < w+2; j++){
			cout << arr[i][j];
		}
		cout << endl;
	}
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "vector"
#include "string"

using namespace std;

const long long int MOD = 1000000007;

int gcd(int a, int b) {
	while (b) {
		a %= b;
		a ^= b ^= a ^= b;
	}
	return a;
}

long long int extended_gcd(long long int a, long long int b, long long int c, long long int d, long long int m) {
	long long int ret = 0;
	if (c == 1)return d;
	ret = extended_gcd(c, d, a%c, (b + (MOD *MOD / m)*m - (a / c)*d) % m, m);
	return ret;
}

long long int extended_gcd(long long int a, long long int b) {
	int g = gcd(a, b);
	a /= g;
	b /= g;
	long long int box = a % b;
	long long int bag = b - (a % b);
	long long int bbox = 1;
	long long int bbag = b - 1;
	return extended_gcd(box, bbox, bag, bbag, b)*g;
}

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<vector<pair<int, int>>>ans(N);
	for (int i = 0; i < N; i++) {
		cin >> W >> H;
		vector<pair<int, int>>add;
		int g = gcd(W, H);
		bool ch = false;
		if (W > H) {
			swap(H, W);
			ch = true;
		}
		if (H == W) {
			add.push_back({ 0,0 });
			add.push_back({ W , H - 1 });
			add.push_back({ 1,1 });
			add.push_back({ W - 1,H });
		}
		else if (g == 1) {
			long long int x = extended_gcd(H, W);
			long long int y = (x*H + 1) / W;
			add.push_back({ 0,0 });
			add.push_back({ W,H });
			add.push_back({ x,y });
		}
		else {
			long long int box = H * W * 2;
			box -= W * (H - 1);
			box -= H * (W - 1);
			box -= W - W / g;
			box -= H - H / g;
			long long int bag = H * W;
			long long int x = extended_gcd(H / g, W / g);
			long long int y = (x*(H / g) + 1) / (W / g);
			bag -= y * x;
			bag -= (H - y)*x * 2;
			bag -= (H - y)*(W - x);
			if (box <= 50000) {
				add.push_back({ 0,0 });
				add.push_back({ W ,H - 1 });
				add.push_back({ W / g,H / g });
				add.push_back({ W - 1,H });
			}
			else {
				add.push_back({ 0,0 });
				add.push_back({ W,H });
				add.push_back({ x,y });
			}
		}
		if (ch) {
			for (auto &j : add) {
				swap(j.first, j.second);
			}
		}
		ans[i] = add;
	}
	for (auto i : ans) {
		cout << i.size() << endl;
		for (auto j : i) {
			cout << j.first << " " << j.second << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 9932
#include <bits/stdc++.h>
#include <iomanip>
#include<algorithm>
#define ll long long
using namespace std;

int main() {
  ll X, i = 0, money = 100;
  cin >> X;
  bool judge = 0;
  while(money < X) {
    money = (long long)(1.01 * money);
    i += 1;
  }
  cout << i << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define LLI long long int
#define pii pair<int,int>
#define fst first
#define sec second
#define ULTRA 2134567890
#define de(x) if(x!=0 && MODE==x)
#define MODE 1
using namespace std;

unsigned LLI A[100007] = {};

int main()
{
    int i,j;
    int N;

    scanf("%d", &N);
    for( i=1; i<=N; i++)
    {
        scanf("%llu", &A[i]);
        if( A[i] == 0LL)
        {
            printf("0\n");
            return 0;
        }
    }

    unsigned LLI ans = 1;
    for( i=1; i<=N; i++)
    {
        if( ans * A[i] < ans || ans * A[i] > 1000000000000000000LL)
        {
            printf("-1\n");
            return 0;
        }
        ans *= A[i];
    }

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

    return 0;
}

//
//          ___ ___  __________  __________
//         /////\  \/\   ______\/\\\\\\\\\\\  Code by ~Ice Tea~ of
//        //// \ \  \ \  \_____/\ \\\\_____/      New Empire of CHSH ...
//       ////   \ \  \ \  \      \ \\\\\\\\\\\
//      ////__   \ \  \ \  \      \ \\\\_____/
//     ///////\   \ \  \ \  \______\ \\\\_______   ________
//    ////____/    \ \__\ \___   ___\ \\\\\\\\\\\ _\  ___  \_
//   /__/           \/__/\/__/\  \__/\ \\\\_____//\  .\_/\_  \
//                           \ \  \   \ \\\\\\\\\\\\  \_\/_\  \
// ... with the AC Power of   \ \  \   \ \\\\_____/ \   _____  \
//   The Great Tsundere Doggy. \ \  \   \ \\\\     \ \  \  \ \  \
//                              \ \__\   \ \\\\\\\\\\ \__\  \ \__\
//                               \/__/    \/________/\/__/   \/__/
//


Measured memory_bytes: 4496
#include <iostream>
#include <cstring>
#include <sstream>
#include <cstdio>

using namespace std;


int diceset(int num[7])
{
    int i;
    for (i=1; i<7; i++)
    {
        cin >> num[i];
    }
    return num[7];
}

int main()
{
    int num[7];
    diceset(num);
    char direction;
    int j = 0;
    while(scanf("%c", &direction) != EOF)
    {
         if(direction == 'N') 
        {
            int tmp = num[1];
            num[1] = num[2];
            num[2] = num[6];
            num[6] = num[5];
            num[5] = tmp;
        }
        else if(direction == 'W')
        {
            int tmp = num[1];
            num[1] = num[3];
            num[3] = num[6];
            num[6] = num[4];
            num[4] = tmp;
        }
        else if(direction == 'E')
        {
            int tmp = num[1];
            num[1] = num[4];
            num[4] = num[6];
            num[6] = num[3];
            num[3] = tmp;
        }
        else if(direction == 'S')
        {
            int tmp = num[1];
            num[1] = num[5];
            num[5] = num[6];
            num[6] = num[2];
            num[2] = tmp;
        }
    }

    cout << num[1] << endl;

    return 0;
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,L,i,j,zx,xc,wv,bo[309],cnt,tes,t;
pair <int, int> dp[302][302];
vector <pair <int, int> > v[302];
priority_queue <pair <pair <int, int>, int> > s;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a>>b>>L;
    for(i=1; i<=b; i++){
        cin>>c>>d>>e;
        if(e>L) continue;
        v[c].push_back(make_pair(d,e));
        v[d].push_back(make_pair(c,e));
    }
    for(wv=1; wv<=a; wv++){
        cnt++;
        for(i=1; i<=a; i++){
            dp[wv][i].first=a+10;
            dp[wv][i].second=0;
        }
        dp[wv][wv].first=0;
        dp[wv][wv].second=L;
        while(s.size()>0) s.pop();
        s.push(make_pair(make_pair(0,L),wv));
        while(s.size()>0){
            c=s.top().second;
            s.pop();
            if(bo[c]==cnt){
                continue;
            }
            bo[c]=cnt;
            int q=c;
            for(vector <pair <int, int> >::iterator it=v[q].begin(); it!=v[q].end(); it++){
                if(bo[(*it).first]==cnt) continue;
                zx=dp[wv][c].first;
                xc=dp[wv][c].second;
                if((*it).second<=xc){
                    xc-=(*it).second;
                }else{
                    zx++;
                    xc=L-(*it).second;
                }
                if(dp[wv][(*it).first].first>zx){
                    dp[wv][(*it).first].first=zx;
                    dp[wv][(*it).first].second=xc;
                    s.push(make_pair(make_pair(-dp[wv][(*it).first].first,dp[wv][(*it).first].second),(*it).first));
                }else{
                    if(dp[wv][(*it).first].first==zx&&dp[wv][(*it).first].second<xc){
                        dp[wv][(*it).first].second=xc;
                        s.push(make_pair(make_pair(-dp[wv][(*it).first].first,dp[wv][(*it).first].second),(*it).first));
                    }
                }
            }
        }
    }
    cin>>tes;
    for(t=1; t<=tes; t++){
        cin>>c>>d;
        if(dp[c][d].first>a){
            cout<<-1<<endl;
        }else{
            cout<<dp[c][d].first<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2944
using System;
using System.Linq;

namespace ABC085
{
    class C
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long N = int.Parse(input[0]);
            long Y = int.Parse(input[1]);

            long sum = 0;
            for (int i = 0; i <= N; i++)
            {
                for (int j = 0; j <= N - i; j++)
                {
                    sum += 10000 * i + 5000 * j + 1000 * (N - i - j);
                    if (sum == Y)
                    {
                        Console.WriteLine(i + " " + j + " " + (N - i - j));
                        return;
                    }
                    sum = 0;
                }
            }
            Console.WriteLine("-1" + " " + "-1" + " " + "-1");
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cmath>

#define mst(a,b)memset(a, b, sizeof(a))
#define repi(a,b)for(ll i = a; i < b; i++)
#define repj(a,b)for(ll j = a; j < b; j++)
#define pii pair<int,int>

#ifdef LOCAL
#define fre()freopen("in.txt","r",stdin)
#endif
#ifndef LOCAL
#define fre()
#endif

//static int x = []() {
//	std::ios::sync_with_stdio(false);
//	std::cin.tie(NULL);
//	return 0;
//}();

#define FASTIO
#ifdef FASTIO
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
//#define scanf abcabc
//#define printf abcabc
#endif
//#ifndef FASTIO
//#define cin abcabc
//#define cout abcabc
//#endif

typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;

using namespace std;


int a[100010];
int main() {
	int n, m; cin >> n >> m;
	repi(0, m) {
		int l, r; cin >> l >> r;
		a[l]++; a[r + 1]--;
	}
	int ans = 0, c = 0;
	repi(1, n + 1) {
		c += a[i];
		if (c == m)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    bool ans = true;
    int prev_t = 0, prev_x = 0, prev_y = 0;
    
    for(int i = 0; i < N; i++){
        int t, x, y;
        cin >> t >> x >> y;
        if((t-prev_t)%2 != ((abs(y-prev_y)+abs(x-prev_x))%2) || (t-prev_t) < ((abs(y-prev_y)+abs(x-prev_x)))) ans = false;
        prev_t = t;
        prev_x = x;
        prev_y = y;
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define N 3

int P[N][N],T[N][N];
int X[N+1]={0,1,0,-1};
int Y[N+1]={1,0,-1,0};

void empty(int *,int *);
void swap(int *,int *);
int cal();
int dfs(int ,int ,int ,int ,const int );

int main()
{
  int i,j;
  int h,ans,row,col;

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

  empty(&row,&col);

  for(h=0; h<100; h++){
    for(i=0; i<N; i++){
      for(j=0; j<N; j++){
        T[i][j] = P[i][j];
      }
    }
    ans = dfs(row,col,-1,0,h);
    if(ans!=-1){
      printf("%d\n",ans);
      break;
    }
    for(i=0; i<N; i++){
      for(j=0; j<N; j++){
        P[i][j] = T[i][j];
      }
    }
    ans = -1;
    if(h==99)
      printf("%d\n\n",ans);
  }

  return 0;
}

void empty(int *row,int *col)
{
  int i,j;

  for(i=0; i<N; i++){
    for(j=0; j<N; j++){
      if(!P[i][j]){
        *row = j;
        *col = i;
        return;
      }
    }
  }
}

void swap(int *a,int *b)
{
  int tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}

int cal()
{
  int i,e;
  int C=0;

  for(i=0; i<9; i++){
    e = P[i/3][i%3];
    if(e){
      e--;
      C += abs(i/3-e/3) + abs(i%3-e%3);
    }
  }
  return C;
}

int dfs(int x,int y,int p,int deep,const int limt)
{
  int i,len,emc;
  int x2,y2;

  len = cal();

  if(len==0)
    return deep;
  if(deep+len > limt)
    return -1;

  for(i=0; i<N+1; i++){
    x2 = x+X[i];
    y2 = y+Y[i];
    if(~p && i==(p+2)%4)
      continue;
    if(!(0<=x2 && x2<3 && 0<=y2 && y2<3))
      continue;

    swap(&P[y][x],&P[y2][x2]);

    emc = dfs(x2,y2,i,deep+1,limt);

    if(~emc)
      return emc;

    swap(&P[y][x],&P[y2][x2]);
  }

  return -1;
}


Measured memory_bytes: 2112
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int a;

int main(){
	cin >> a;
	cout << a + a*a + a*a*a << endl;


	return 0;
}

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

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

    int cost0 = 0, cost1 = 0;
    int h0 = 0, h1 = 0;
    for (int i = 0; i < n; i++) {
        int h;
        cin >> h;
        if (i == 0) {
            cost1 = 0;
            h1 = h;
        } else if (i == 1) {
            cost0 = cost1;
            h0 = h1;

            h1 = h;
            cost1 = abs(h1 - h0);
        } else {
            int cost = min(abs(h - h0) + cost0, abs(h - h1) + cost1);

            cost0 = cost1;
            h0 = h1;

            h1 = h;
            cost1 = cost;
        }
    }

    cout << cost1 << endl;

    return 0;
}


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

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PDD;

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define dbl(k, x) fixed << setprecision(k) << (x)

template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}

#define _upgrade                \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)

// ********************** CODE ********************** //

int main() {
  int k;
  string s;
  cin >> k >> s;
  if (sz(s) <= k) {
    cout << s << "\n";
  } else {
    cout << s.substr(0, k) + "..."
         << "\n";
  }
  return 0;
}

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

int main() {
	
	int n,d,x;
	cin>>n>>d>>x;
	int a = 0;
	int k = 0;
	while(n--)
	{
		cin>>a;
		k++;
		int i = 1;
		while(i*a+1 <= d)
		{
			k++;
			i++;
		}
	}
	cout<<k+x;
	
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <LL,LL>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair
 
using namespace std;
 
const LL MOD=998244353;

LL n,n2=1,x,y,dat[800010],r[200010],dp[200010];
vector <pii> v;
vector <LL> X;

void upd(LL k,LL val)
{
	dat[k]=max(dat[k],val);
	while(k>0)
	{
		k=(k-1)/2;
		dat[k]=max(dat[k],val);
	}
}

LL query(LL k,LL lb,LL ub,LL tlb,LL tub)
{
	if(ub<tlb||tub<lb) return 0;
	if(tlb<=lb&&ub<=tub) return dat[k];
	return max(query(k*2+1,lb,(lb+ub)/2,tlb,tub),query(k*2+2,(lb+ub)/2+1,ub,tlb,tub));
}

int main()
{
	cin>>n;
	rep(i,n)
	{
		scanf("%lld%lld",&x,&y);
		v.pb(mpr(x,y));
	}
	sort(v.begin(),v.end());
	rep(i,n) X.pb(v[i].fi);
	while(n2<n) n2*=2;
	for(int i=n-1;i>=0;i--)
	{
		LL pos=upper_bound(X.begin(),X.end(),X[i]+v[i].se-1)-X.begin()-1;
		r[i]=max(pos,query(0,0,n2-1,i+1,pos));
		upd(i+n2-1,r[i]);
	}
	dp[0]=1;
	rep(i,n)
	{
		dp[i+1]=(dp[i+1]+dp[i])%MOD;
		dp[r[i]+1]=(dp[r[i]+1]+dp[i])%MOD;
	}
	cout<<dp[n]<<endl;
	return 0;
}

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

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

    int X[50], Y[50];
    for (int i=0;i<N;i++)
    {
        cin >> X[i] >> Y[i];
    }
    
    long long x0, x1, y0, y1;
    long long S = 5 * 1e18;
    for (int i=0;i<N-1;i++)
    {
        for (int j=i+1;j<N;j++)
        {
            for (int k=0;k<N-1;k++)
            {
                for (int l=k+1;l<N;l++)
                {
                    x0 = min(X[i], X[j]);
                    x1 = max(X[i], X[j]);
                    y0 = min(Y[k], Y[l]);
                    y1 = max(Y[k], Y[l]);

                    int cnt = 0;
                    for (int m=0;m<N;m++)
                    {   
                        if (X[m]>=x0 && X[m]<=x1 && Y[m]>=y0 && Y[m]<=y1) cnt++;
                    }
                    if (cnt >= K) S = min(S, (x1-x0)*(y1-y0));
                }
            }
        }
    }
    cout << S << endl;
}

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

int main(void){
	double x,h,s;
while(1){
	scanf("%lf %lf",&x,&h);
		if((x==0)&&(h==0)){
			return 0;
		}
	s=2*hypot((x/2),h)*x+x*x;

	printf("%f\n",s);
}

}

Measured memory_bytes: 652
import java.util.Scanner;


public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String SFT = sc.next();
		if (SFT.equals("7") || SFT.equals("5") || SFT.equals("3")) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

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

main(){
	int n,a[100100],k;
	k = 0;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++){
		k *= -1;
		k += a[i];
	}
	k /= 2;
	for(int i=1;i<=n;i++){
		cout<<2*k<<" ";
		k = a[i]-k;
	}
}

Measured memory_bytes: 1664
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


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


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    A = []
    B = []
    for i in range(3):
        A.append(LI())
        B.append([False] * 3)


    N = I()

    b = []
    for i in range(N):
        b.append(I())

    for t in range(N):
        for i in range(3):
            for j in range(3):
                if b[t] == A[i][j]:
                    B[i][j] = True

    for i in range(3):
        if B[i][0] is True and B[i][1] is True and B[i][2] is True:
            print('Yes')
            return

    for i in range(3):
        if B[0][i] is True and B[1][i] is True and B[2][i] is True:
            print('Yes')
            return

    if B[0][0] is True and B[1][1] is True and B[2][2] is True:
        print('Yes')
        return

    if B[0][2] is True and B[1][1] is True and B[0][2] is True:
        print('Yes')
        return

    print('No')


if __name__ == '__main__':
    main()


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

class Person{
        int boss=0;
        int member=0;
    public:
        void setBoss(int a){this->boss=a;}
        void setMember(int a){this->member=a;}
        int getBoss(){return boss;}
        int getMember(){return member;}
        void addMember(){member++;}
};

int main(){
    int N,a;
    cin >> N;
    Person P[N];
    for(int i=1;i<N;i++){
        cin >> a;
        P[i].setBoss(a);
    }
    for(int i=1;i<N;i++){
//        cout << P[i].getBoss() << endl;
    }
    for(int i=1;i<N;i++){
        P[P[i].getBoss()-1].addMember();
    }
    for(int i=0;i<N;i++){
        cout <<P[i].getMember() << endl;
    }
    return 0;
}


Measured memory_bytes: 5200
#include <iostream>
#include <cstdlib>
#include <cstdio>

using namespace std;

int main(void) {
  int n, a, b;
  cin >> n >> a >> b;

  int res = 0;
  for (int i = 0; i <= n; i++) {
    char s[6] = { 0 };
    sprintf(s, "%04d", i);
    int sum = s[0] + s[1] + s[2] + s[3] - '0' * 4;
    if (sum >= a and sum <= b) {
      res += i;
    }
  }
  cout << res << endl;
  return EXIT_SUCCESS;
}



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

using namespace std;

ifstream fin("../data.txt");

long long n, x, power;
long long v[100005];
bool ok = 1;

long long toPow(long long a, long long b) {
  long long ans = 1;
  while(b) {
    if (b%2) ans = ((1LL * ans * a) % 1000000007);
    a = ((1LL * a * a) % 1000000007);
    b /= 2;
  }
  return ans;
}

int main() {

  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v[x]++;
  }

  if (n%2 && v[0] != 1) {
     ok = 0;
  }

  for (int i = 1; i < n && ok; i++) {
    if (v[i] == 1) {
       ok = 0;
    }
    if (v[i] == 2) power++;
  }

  if (!ok) cout << 0;
  else cout << (long long) toPow(2, power);

  return 0;
}


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

int main()
{
    ll n, ans = 100000;
    cin >> n;
    ll s[n], sum = 0;
    rep(i, n)
    {
        ll w;
        cin >> w;
        sum += w;
        s[i] = sum;
    }
    rep(i, n - 1)
    {
        ans = min(ans, abs(s[n - 1] - 2 * s[i]));
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
<?php
fscanf(STDIN, '%d %d', $n, $k);
fscanf(STDIN, '%s', $s);
 
$ans = '';
for($i = 0; $i < $n; $i++) {
    if ($i === $k - 1) $ans = $ans . strtolower($s[$i]);
    else $ans = $ans . $s[$i];
}
echo $ans . PHP_EOL;

Measured memory_bytes: 4728
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(){
  ll N,D; cin>>N>>D;
  ll cnt=0;
  for( ll i=0; i<N; i++ ){
    ll a,b;
    cin>>a>>b;
    if(a*a+b*b <= D*D) cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3584
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)





int main() {
    ll n;
    string s;
    cin >> n >> s;
    ll cnt[26] = {};
    REP(i, n){
        cnt[s[i] - 'a']++;
    }
    ll ans = 1;
    REP(i, 26){
        ans *= cnt[i] + 1;
        ans %= MOD;
    }
    cout << (ans - 1 + MOD) % MOD << endl;
}

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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[],int n){
    for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
    }
    cout<<endl;
}

int main() {
    int i,n,m,k,sum=0;
    c_p_c();
  	cin>>n;
  	pair<int,int> p[n];
  	for (int i = 0; i < n; ++i)
  	{
  		/* code */
  		cin>>p[i].F>>p[i].S;
  	}


  	for (int i = 0; i < n; ++i)
  	{
  		/* code */
  		sum+=p[i].S-p[i].F+1;
  	}
  	cout<<sum<<endl;
 	return 0;

   }

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	ll asum = 0, bsum = 0;
	vector<ll> a(N),b(N);
	for(int i=0;i<N;i++){
		cin >> a[i];
		asum += a[i];
	}
	for(int i=0;i<N;i++){
		cin >> b[i];
		bsum += b[i];
	}
	ll cnt = 0;
	for(int i=0;i<N;i++){
		if(a[i]>b[i]){
			cnt -= a[i]-b[i];
		}else{
			cnt += (b[i]-a[i])/2;
		}
	}
	if(cnt >= 0)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 384
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    x,y,z=MI()
    print(z,x,y)

main()

Measured memory_bytes: 3064
import java.util.*;
import java.text.*;

class Main {
    public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        for(;;) {
            int h = sc.nextInt();
            int w = sc.nextInt();
            if(h == 0 && w == 0) break;
            String s = "";
            for(int i = 0; i < w; i++) {
                s += "#";
            }
            for(int i = 0; i < h; i++) {
                System.out.println(s);
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 21088