akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
    int H, W; cin >> H >> W;
    string s[H];
    for (int i = 0; i < H; i++)
    {
        cin >> s[i];
    }

    vector<bool> r(H, false), l(W, false);
    for (int i = 0; i < H; i++)
    {
        bool a = true;
        for (int j = 0; j < W; j++)
        {
            if(s[i][j] == '#') {
                a = false;
                break;
            }
        }
        r[i] = a;
    }

    for (int i = 0; i < W; i++)
    {
        bool a = true;
        for (int j = 0; j < H; j++)
        {
            if(s[j][i] == '#') {
                a = false;
                break;
            }
        }
        l[i] = a;
    }

    for (int i = 0; i < H; i++)
    {
        if(r[i]) continue;
        for (int j = 0; j < W; j++)
        {
            if(j == W - 1) {
                if(l[j]) cout << endl;
                else {
                    cout << s[i][j] << endl;
                }
            }
            else if(!l[j])cout << s[i][j];
        }
    }

    return 0;
}

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

#define LL long long
#define Dl double
#define Pb push_back
#define Po pop_back
#define Mp make_pair
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)

using namespace std;

typedef vector<LL> Vl;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef vector<Pll> Vpl;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
#define X first
#define Y second

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s;
    cin >> s;

    Vl v;
    LL L = s.size();

    for(LL i = 0; i < L; i++){
        if(s[i] == '0')
            v.Pb(0);
        if(s[i] == '1')
            v.Pb(1);
        if(s[i] == 'B')
            if(v.size() > 0)
                v.Po();
    }

    for(auto i: v)
        cout << i;
    cout << '\n';
    return 0;
}



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

int main()
{
    int N;
    int X = 0;
    cin >> N;
    int M = N;
    while(M != 0){
        X += M % 10;
        M /= 10;
    }
    if(N % X == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
#include <array>
#include <chrono>
#include <random>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { std::cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { std::cin >> first; Scan(rest...); }
#define OUT(d) std::cout<<d;
#define FOUT(n, d) std::cout<<std::fixed<<std::setprecision(n)<<d;
#define SOUT(n, c, d) std::cout<<std::setw(n)<<std::setfill(c)<<d;
#define SP std::cout<<" ";
#define TAB std::cout<<"\t";
#define BR std::cout<<"\n";
#define FLUSH std::cout<<std::flush;
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
#define PAIR std::pair<int, int>
#define IN(a, x, b) (a<=x && x<b)
#define SHOW(d) {std::cerr << #d << "\t:" << d << "\n";}
#define SHOWVECTOR(v) {std::cout << #v << "\t:";for(const auto& i : v){std::cout << i << " ";}std::cout << "\n";}
#define SHOWVECTOR2(v) {std::cout << #v << "\t:\n";for(const auto& i : v){for(const auto& j : i){std::cout << j << " ";}std::cout << "\n";}}
#define SHOWPAIRVECTOR2(v) {std::cout << #v << "\t:\n";for(const auto& i : v){for(const auto& j : i){std::cout<<'('<<j.first<<", "<<j.second<<") ";}std::cout << "\n";}}
#define SHOWPAIRVECTOR(v) {for(const auto& i:v){std::cout<<'('<<i.first<<", "<<i.second<<") ";}std::cout<<"\n";}
#define CHECKTIME(state) {auto start=std::chrono::system_clock::now();state();auto end=std::chrono::system_clock::now();auto res=std::chrono::duration_cast<std::chrono::nanoseconds>(end-start).count();std::cerr<<"[Time:"<<res<<"ns  ("<<res/(1.0e9)<<"s)]\n";}
#define SHOWQUEUE(a) {std::queue<decltype(a.front())> tmp(a);std::cout << #a << "\t:";for(int i=0; i<static_cast<int>(a.size()); ++i){std::cout << tmp.front() << "\n";tmp.pop();}std::cout << "\n";}

//#define int ll
using ll = long long;
using ull = unsigned long long;
constexpr int INFINT = 1 << 30;
constexpr ll INFLL = 1LL << 60;
constexpr double EPS = 0.0000000001;
constexpr int MOD = 1000000007;

signed main() {
	INIT;
	VAR(int, n, k, x, y);
	int ans = 0;
	REP(i, n) {
		if (i < k) {
			ans += x;
		}
		else {
			ans += y;
		}
	}
	OUT(ans)BR;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 998244353

#define INF 1000000000000LL

int main(){
  ll n;
  cin>>n;
  vector<pair<ll,ll> > vp;
  rep(i,0,n){
    ll a,b;
    cin>>a>>b;
    vp.pb(mp(a,a+b));
  }
  sort(all(vp));
  reverse(all(vp));
  set< pair<ll, pair<ll,ll> > > se;
  se.insert(mp(-INF, mp(-INF, -1)));
  se.insert(mp(INF, mp(INF, -1)));

  rep(i,0,vp.sz){
    ll l = vp[i].fi;
    ll r = vp[i].se;
    se.insert(mp(l,mp(r,1)));
    set< pair<ll, pair<ll,ll> > >::iterator itr = se.lower_bound(mp(l, mp(-1,-1)));
    // connect right
    ll a = 1;
    while(r > itr->first){
      pair<ll,ll> p = itr->second;
      r = max(r, p.first);
      a *= p.second;
      a %= MOD;
      se.erase(itr++);
    }
    se.insert(mp(l,mp(r,(1+a)%MOD)));
  }
  vector<pair<ll, pair<ll,ll> > > v1(all(se));
  ll ans = 1;
  rep(i,1,v1.sz-1){
    ans *= v1[i].se.se;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 17260
import math

a, b, x = map(int, input().split())
if (a * a * b / 2) >= x:
    ans = 90 - math.degrees(math.atan(2 * x / (a * b) / b))
else:
    x = a * a * b - x
    ans = math.degrees(math.atan(2 * x / (a * a) / a))

print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main() {
    ios::sync_with_stdio(0);

    string str;
    getline(cin, str);

    int ans = 0;
    char state = 'J';
    int accj = 0, acco = 0, acci = 0;
    for(string::iterator it = str.begin(); it != str.end(); ++it) {
        //cout << state << endl;
        switch(state) {
            case 'J':
                switch(*it) {
                    case 'J':
                        ++accj;
                        break;
                    case 'O':
                        acco = 1;
                        state = 'O';
                        if(acco > accj) {
                            accj = 0;
                            state = 'J';
                        }
                        break;
                    case 'I':
                        accj = 0;
                        break;
                }
                break;
            case 'O':
                switch(*it) {
                    case 'J':
                        accj = 1;
                        state = 'J';
                        break;
                    case 'O':
                        if(++acco > accj) {
                            accj = 0;
                            state = 'J';
                        }
                        break;
                    case 'I':
                        acci = 1;
                        state = 'I';
                        if(acci == acco) {
                            ans = max(ans, acci);
                        }
                        break;
                }
                break;
            case 'I':
                switch(*it) {
                    case 'J':
                        accj = 1;
                        state = 'J';
                        break;
                    case 'O':
                        accj = 0;
                        state = 'J';
                    case 'I':
                        if(++acci == acco) {
                            ans = max(ans, acci);
                        }
                        break;
                }
                break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(){
    int x,y,amari;
    cin>>x>>y;
    while(1){
        amari=x%y;
        if(amari==0){
            break;
        }else{
            x=y;
            y=amari;
        }
    }cout<<y<<endl;
}


Measured memory_bytes: 3104
import java.math.BigDecimal;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        BigDecimal bg = new BigDecimal(l);
        bg.setScale(7);
        BigDecimal bg2 = bg.divide(new BigDecimal(3), 7, BigDecimal.ROUND_DOWN);

        System.out.println(bg2.multiply(bg2).multiply(bg2));
        sc.close();

    }

}


Measured memory_bytes: 21844
#[allow(dead_code)]
fn getline() -> String {
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

#[allow(unused_macros)]
macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            s.trim().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let mut iter = s.trim().split(' ');
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
}

#[allow(unused_macros)]
macro_rules! readlvec {
    ($t: ty) => {{
        let s = getline();
        let iter = s.trim().split(' ');
        iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
    }};
}

#[allow(unused_macros)]
// macro_rules! debug {
//     ($x: expr) => {
//         println!("{}: {:?}", stringify!($x), $x)
//     };
// }
macro_rules! debug { ($x: expr) => () }

#[allow(dead_code)]
fn show<T>(iter: T) -> String
where
    T: Iterator,
    T::Item: std::fmt::Display,
{
    let mut res = iter.fold(String::new(), |sum, e| sum + &format!("{} ", e));
    res.pop();
    res
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BinaryHeap, HashMap, HashSet};
#[allow(unused_imports)]
use std::collections::btree_map::Entry::{Occupied, Vacant};

fn main() {
    use std::io::Write;
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    macro_rules! printf { ($($arg:tt)*) => (write!(out, $($arg)*).unwrap()); }
    macro_rules! printfln { () => (writeln!(out).unwrap()); ($($arg:tt)*) => (writeln!(out, $($arg)*).unwrap()); }

    let n = readl!(usize);
    let a = readlvec!(i64);
    let mut dp: Vec<_> = a.iter().cloned().zip(0..n).collect();
    for i in 0..n {
        dp[i] = max(
            dp[i],
            (0..i)
                .filter(|&j| j % 2 == i % 2)
                .map(|j| (dp[j].0+a[i], j))
                .max()
                .unwrap_or(dp[i]),
        );
    }
    debug!(dp);

    let ans = dp.iter().cloned().map(|x| x.0).zip(0..).max().unwrap();
    let mut sta = Vec::new();
    {
        let mut p = ans.1;
        sta.push(p);
        while p != dp[p].1 {
            p = dp[p].1;
            sta.push(p);
        }
    }
    let mut log = Vec::new();
    debug!(sta);
    for i in (ans.1+1..n).rev() {
        log.push(i+1);
    }
    let ll = if let Some(&t) = sta.last() {
        for _ in 0..t {
            log.push(1);
        }
        t
    } else {
        0
    };
    
    for i in 0..(sta.len() as i32-1) {
        let r = sta[i as usize];
        let l = sta[(i+1) as usize];
        for k in (1..(r-l)/2+1).rev() {
            log.push(l+k+1-ll);
        }
    }
    printfln!("{}", ans.0);
    printfln!("{}", log.len());
    for &e in &log {
        printfln!("{}", e);
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < 3; i++) {
			sb.append(Character.toString((char)(sc.next().charAt(0)-'a' + 'A')));
		}
		System.out.println(sb);
	}

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    ll ans = 0;
    vector<ll> A(N);
    REP(i, N) {
        cin >> A[i];
        ans += A[i];
    }
    ll Q;
    cin >> Q;
    vector<ll> B(Q);
    vector<ll> C(Q);
    REP(i, Q) {
        cin >> B[i] >> C[i];
    }

    map<ll, ll> m;
    REP(i, N) {
        m[A[i]]++;
    }

    REP(i, Q) {
        ans -= B[i] * m[B[i]];
        ans += C[i] * m[B[i]];
        m[C[i]] += m[B[i]];
        m[B[i]] = 0;
        cout << ans << endl;
    }
}


Measured memory_bytes: 11416
# AOJ 0512: Caesar Cipher
# Python3 2018.6.29 bal4u

t = {}
for i in range(26-3): t[chr(i+3+ord('A'))] = chr(i+ord('A'))
t['A'], t['B'], t['C'] = 'X', 'Y', 'Z'
a = input()
ans = ''
for c in a: ans += t[c]
print(ans)


Measured memory_bytes: 5560
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

// Thursday 3/19/20

//  158 C Tax Increase

int main() {
	int A, B;
	cin >> A >> B;
	bool notFound = true;
	int value = -1;
	for (int i = A; i < 2000 && notFound; ++i) {
		if (int(i * .08) == A && int(i * .1) == B) {
			notFound = false;
			value = i;
		}
	}
	cout << value;
	return 0;
}

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

using namespace std;

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

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

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

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

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

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

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

    ll n;
    string s;
    cin>>s;
    string ans;
    ll x = s[0]-'a';
    x ++;
    ans = x+'a';
    cout<<ans<<endl;
    return  0;
}


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

int main(){
    int N;
    string item;
    std::map<string, int> mp;
    scanf("%d", &N);
//   printf("%d", N);

    for(int i = 0; i < N; i++){
        std::cin >> item;
        mp[item] = 1;
    }

    printf("%d", (int)mp.size());

}

Measured memory_bytes: 19396
#include <iostream>
#include <algorithm>
#include <ostream>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <cstring>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

template <typename T, typename U>
std::ostream& operator << (std::ostream& out, std::pair<T, U> p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}

template <typename T>
std::ostream& operator << (std::ostream& out, std::vector<T> v) {
  out << "[";
  for (int i = 0; i < v.size(); ++i) {
    out << v[i] << (i == (v.size() - 1) ? "" : ", ");
  }
  out << "]";
  return out;
}

int main() {
  int x;
  cin >> x;
  if (x == 3 or x == 5 or x == 7) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 764
import java.io.InputStreamReader;
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		try(Scanner scan = new Scanner(new InputStreamReader(System.in))){
			StringBuilder S = new StringBuilder(scan.nextLine());
			
			S.insert(4, " ");

			System.out.println(S.toString());
		}
	}
}


Measured memory_bytes: 9044
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    static int N;
    static int[] A;
    static int[] B;

    static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        A = sc.nextIntArray(N);
        B = sc.nextIntArray(N);
        System.out.println( solve() );
    }

    static long solve() {
        Arrays.sort(A);
        Arrays.sort(B);

        long ans = 1;
        int ai = 0;
        int bi = 0;
        int ab = 0;
        while(ai < N || bi < N) {
            if( bi == N || (ai != N) && A[ai] < B[bi] ) {
                if( ab < 0 ) {
                    ans = ans * -ab % MOD;
                }
                ai++;
                ab++;

            } else {
                if( ab > 0 ) {
                    ans = ans * ab % MOD;
                }
                bi++;
                ab--;
            }
        }

        return ans;
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;
        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }
        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}

Measured memory_bytes: 43812
q = int(input())
A = []

for i in range(q):
    Q, *x = (int(x) for x in input().split())
    x = x[0] if x else None
    if Q == 0:
        A.append(x)
    elif Q == 1:
        print(A[x])
    else:
        del A[-1]




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

using namespace std;

long long inf=1000000007;

int main(){
	long long n;
	cin>>n;
	long long ans=0;//(m+1)x=N
	set<long long> yakusu;

	for(long long i=1;i*i<=n;i++){
		if(n%i==0){
			yakusu.insert(i);
			yakusu.insert(n/i);
		}
	}

	for(auto at=yakusu.begin();at!=yakusu.end();at++){
		long long m=*at-1;

		if(m>0 && n/m==n%m) ans+=m;
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3812
a,b,c,d=map(int,input().split());m=998244353;x=range(3010);D=[[0]*3011for _ in[0]*3011];D[a][b]=1
for i in x:
 for j in x:D[i+1][j+1]+=(D[i+1][j]*(i+1)+D[i][j+1]*(j+1)-D[i][j]*i*j)%m
print(D[c][d])

Measured memory_bytes: 136784
////////////////////////////////////////////
///                                      ///
///        Template ver. 1.2. rapel      ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define endl '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

void hora(int tc) {
	int a, b;
	cin>>a>>b;
	if(a + b == 3) cout<<3<<endl;
	else if(a + b == 4) cout<<2<<endl;
	else cout<<1<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define en "\n"
using namespace std;
const int M=1e5+100;

char s[M],s1[M],s2[M];

int main()
{
    cin>>s;
    int len=strlen(s);

    if(len==1)
    {
        cout<<0<<en;
        return 0;
    }

    s1[0]='1';
    s2[0]='0';
    for(int i=1;i<len;i++)
    {
        if(s1[i-1]=='0')s1[i]='1';
        else s1[i]='0';

        if(s2[i-1]=='0')s2[i]='1';
        else s2[i]='0';
    }
    int an1=0,an2=0;
    for(int i=0;i<len;i++)
        if(s1[i]!=s[i])an1++;

    for(int i=0;i<len;i++)
        if(s2[i]!=s[i])an2++;

    cout<<min(an1,an2)<<en;
    return 0;
}


Measured memory_bytes: 512
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
vector<T> divisor(const T n) {
	vector<T> res;
	for (T i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			res.emplace_back(i);
			if (i * i != n) res.emplace_back(n / i);
		}
	}
	sort(res.begin(), res.end());
	return res;
}

int main() {

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

	int X;
	cin >> X;

	auto div = divisor(X);

	for (const auto &e : div) {
		
		for (lint i = -5000000; i < 5000000; i++) {

			lint p = i + e;
			lint q = i - e;

			if (i*i*i*i*i - p * p*p*p*p == X) {
				cout << i << " " << p << "\n";
				return 0;
			}
			if (i*i*i*i*i - q * q*q*q*q == X) {
				cout << i << " " << q << "\n";
				return 0;
			}

		}

	}

	assert(false);
	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(b/a>c)
    {
    	printf("%d",c);
	}
	else
	{
		printf("%d",b/a);
	}
	return 0; 
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define print(x) cout << (x) << endl;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, count = 0, sum = 0;
    cin >> N;
    vector<int> W(N);
    for (int i = 0; i < N; i++) {
        cin >> W.at(i);
        sum += W.at(i);
    }
    if (sum % 2 == 0) {
        A = sum / 2;
        }
        else {
            A = sum / 2 + 1;
        }
    for(int i = 0; i < N; i++) {
        count += W.at(i);
        if (count >= A) {
            if (count - (sum - count) > -((count - W.at(i)) - (sum - count + W.at(i)))) {
                cout << -((count - W.at(i)) - (sum - count + W.at(i))) << endl;
            }
            else {
                cout << count - (sum - count) << endl;
            }
            break;
        }
    }
}

Measured memory_bytes: 256
import sys
from itertools import combinations_with_replacement

read = sys.stdin.read
readline = sys.stdin.readline

N, M, Q, *abcd = map(int, read().split())

answer = 0
abcd = tuple(zip(*[iter(abcd)] * 4))
for seq in combinations_with_replacement(range(1, M + 1), N):
    t = 0
    for a, b, c, d in abcd:
        if seq[b - 1] - seq[a - 1] == c:
            t += d
    answer = max(answer, t)

print(answer)


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

using namespace std;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	int h, w, k;
	cin >> h >> w >> k;
	char cs[h][w];
	for (int r = 0; r < h; r++) {
		for (int c = 0; c < w; c++) {
			cin >> cs[r][c];
		}
	}
	int ans = 0;
	for (int r = 0; r < (1 << h); r++) {
		for (int c = 0; c < (1 << w); c++) {
			int cnt = 0;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (((r >> i) & 1) == 0 && ((c >> j) & 1) == 0 && cs[i][j] == '#') {
						cnt++;
					}
				}
			}
			if (cnt == k) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3692
function Main(input){
    input = input.split("\n");
    var n = parseInt(input[0],10);

    for(var i = 0;i < n;i++){
        input[i + 1] = input[i + 1].split(' ');
        var a = parseInt(input[i + 1][0],10);
        var b = parseInt(input[i + 1][1],10);
        var c = parseInt(input[i + 1][2],10);

        if(a > b){
            var ex = a;
            a = b;
            b = ex;
        }
        if(b > c){
            var ex = b;
            b = c;
            c = ex;
        }
        if(a * a + b * b === c * c)
            console.log("YES");
        else
            console.log("NO");
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 17480
#include<iostream>
#include<bitset>
#include<vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    bool ans = true;
    
    if(n % 2) ans = false;
    else {
        for(int i = 0; i < n / 2; i++){
            if(s[i] != s[i + (n / 2)]){
                ans = false;
                break;
            }
        }
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int H, W;
int K;
string s[1003];
int imos[3][1003][1003];
int get(int i, int y, int x) {
    if (y < 0 || x < 0) return 0;
    // cout << i << ", " << y << ", " << x << ": " << imos[i][y][x] << endl;
    return imos[i][y][x];
}
int get(int i, int y1, int x1, int y2, int x2) {
    return get(i, y2, x2) - get(i, y2, x1 - 1) - get(i, y1 - 1, x2) +
           get(i, y1 - 1, x1 - 1);
}
int main() {
    cin >> H >> W >> K;
    rep(i, H) cin >> s[i];
    rep(y, H) rep(x, W) {
        int t = 0;
        if (s[y][x] == 'O') t = 1;
        if (s[y][x] == 'I') t = 2;
        imos[t][y][x]++;
    }
    rep(i, 3) rep(y, 1003) rep(x, 1003) if (x) {
        imos[i][y][x] += imos[i][y][x - 1];
    }
    rep(i, 3) rep(y, 1003) rep(x, 1003) if (y) {
        imos[i][y][x] += imos[i][y - 1][x];
    }

    rep(_, K) {
        int y1, x1;
        int y2, x2;
        cin >> y1 >> x1 >> y2 >> x2;
        y1--, x1--;
        y2--, x2--;
        rep(i, 3) {
            cout << get(i, y1, x1, y2, x2);
            if(i==2) cout<<endl;
            else cout << " ";
        }
    }

    return 0;
}

Measured memory_bytes: 15836
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int parent[110];
int root(int x) { return parent[x] < 0 ? x : parent[x] = root(parent[x]); }
bool unionSet(int x, int y) {
  x = root(x); y = root(y);
  if (x == y) { return false; }
  if (parent[x] > parent[y]) { swap(x, y); }
  parent[x] += parent[y];
  parent[y] = x;
  return true;
}

struct Edge {
  int from;
  int to;
  int cost;
  Edge() {;}
  Edge(int f, int t, int c) : from(f), to(t), cost(c) {;}
  bool operator<(const Edge &rhs) const { return cost < rhs.cost; }
};

Edge edges[100000];

int main() {
  int n, m;
  while (scanf("%d %d", &n, &m), n|m) {
    REP(i, m) {
      int f, t, c;
      scanf("%d %d %d", &f, &t, &c);
      edges[i] = Edge(f, t, c);
    }
    sort(edges, edges + m);
    int ans = 1 << 30;
    REP(i, m) {
      MEMSET(parent, -1);
      if (i != 0 && edges[i].cost == edges[i - 1].cost) { continue; }
      int sum = 0;
      FOR(j, i, m) {
        if (unionSet(edges[j].from, edges[j].to)) {
          sum++;
          if (sum == n - 1) {
            ans = min(ans, edges[j].cost - edges[i].cost);
            break;
          }
        }
      }
    }
    if (ans == (1 << 30)) { ans = -1; }
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 936
#include <stdio.h>

int main(void)
{
    int a, b, sum = 0;
    scanf("%d %d", &a, &b);

    for (int i = 0; i < 2; i++){
        if (a > b)
            sum += a--;
        else
            sum += b--;
    }

    printf("%d\n", sum);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
string str;
char t[3][3];

int main(){
  while(cin>>str){
    for(int i=0;i<3;i++)for(int j=0;j<3;j++)t[i][j]=str[i*3+j];

         if(t[0][0]=='o'&&t[0][1]=='o'&&t[0][2]=='o')cout<<'o'<<endl;
    else if(t[1][0]=='o'&&t[1][1]=='o'&&t[1][2]=='o')cout<<'o'<<endl;
    else if(t[2][0]=='o'&&t[2][1]=='o'&&t[2][2]=='o')cout<<'o'<<endl;

    else if(t[0][0]=='o'&&t[1][0]=='o'&&t[2][0]=='o')cout<<'o'<<endl;
    else if(t[0][1]=='o'&&t[1][1]=='o'&&t[2][1]=='o')cout<<'o'<<endl;
    else if(t[0][2]=='o'&&t[1][2]=='o'&&t[2][2]=='o')cout<<'o'<<endl;

    else if(t[0][0]=='o'&&t[1][1]=='o'&&t[2][2]=='o')cout<<'o'<<endl;
    else if(t[0][2]=='o'&&t[1][1]=='o'&&t[2][0]=='o')cout<<'o'<<endl;

    else if(t[0][0]=='x'&&t[0][1]=='x'&&t[0][2]=='x')cout<<'x'<<endl;
    else if(t[1][0]=='x'&&t[1][1]=='x'&&t[1][2]=='x')cout<<'x'<<endl;
    else if(t[2][0]=='x'&&t[2][1]=='x'&&t[2][2]=='x')cout<<'x'<<endl;

    else if(t[0][0]=='x'&&t[1][0]=='x'&&t[2][0]=='x')cout<<'x'<<endl;
    else if(t[0][1]=='x'&&t[1][1]=='x'&&t[2][1]=='x')cout<<'x'<<endl;
    else if(t[0][2]=='x'&&t[1][2]=='x'&&t[2][2]=='x')cout<<'x'<<endl;

    else if(t[0][0]=='x'&&t[1][1]=='x'&&t[2][2]=='x')cout<<'x'<<endl;
    else if(t[0][2]=='x'&&t[1][1]=='x'&&t[2][0]=='x')cout<<'x'<<endl; 
	 
    else cout<<'d'<<endl;


  }
  return 0;
}

Measured memory_bytes: 1176
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];
        for(int i = 0; i < N; i++) A[i] = sc.nextInt();

        int[] B = new int[N];
        for(int i = 0; i < N; i++) {
            if(i==0){
                B[i] = K - A[N-1] + A[i];
            } else {
                B[i] = A[i] - A[i-1];
            }
        }
        Arrays.sort(B);
        int res = 0;
        for(int i = 0; i < N-1; i++) res += B[i];
        System.out.println(res);
    }
}


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

int main() {
  int TT, TK, AT, AK;
  cin >> TT >> TK >> AT >> AK;

bool check = 0;
  
  while (check==0){
  AT -= TK;
  if (AT <= 0) {
    cout << "Yes" << endl;
    check=1; break;
  }
  TT -= AK;
  if (TT <= 0) {
    cout << "No" << endl;
    check =1;break;
  }
  }
  
}


Measured memory_bytes: 3624
import java.util.*;

public class Main {

    private static final int MOD = 1_000_000_007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        System.out.println( solve(N, A) );
    }

    private static int solve(int N, int[] A) {
        Arrays.sort(A);
        int ans;
        int i = 0;
        int abs;
        if( N % 2 == 1 ) {
            if( A[i] != 0 ) {
                return 0;
            } else {
                i++;
                abs = 2;
                ans = 1;
            }

        } else {
            abs = 1;
            ans = 1;
        }

        while(i < N) {
            if( A[i] == abs && A[i+1] == abs ) {
                ans = (ans * 2) % MOD;
                i += 2;
                abs += 2;
            } else {
                return 0;
            }
        }

        return ans;
    }
}


Measured memory_bytes: 50896
#include "stdio.h"
#include "math.h"

int N;
int a[50];

 
int main(void){
	int i;
	int max = 0xFFFFFFFF;
	int min = 0x7FFFFFFF;
	int max_ind = 0;
	int min_ind = 0;
	int to_plus = 0;

	scanf("%d", &N);

	for(i=0;i<N;i++){
		scanf("%d", &a[i]);
		if(a[i]<min) min = a[i], min_ind = i;
		if(a[i]>max) max = a[i], max_ind = i;
	}

	if(abs(min)<abs(max)){
		to_plus = 1;
	}

printf("%d\n", N + N -1);

	if(to_plus){
		for(i=0;i<N;i++){
printf("%d %d\n", max_ind+1, i+1);
//			a[i]+=max;
		}
	}
	else //to minus
	{
		for(i=N-1;i>=0;i--){
printf("%d %d\n", min_ind+1, i+1);
//			a[i]+=min;
		}
	}


	if(to_plus){
		for(i=1;i<N;i++){
printf("%d %d\n", i, i+1);
//			a[i]+=a[i-1];
		}
	}
	else //to minus
	{
		for(i=N-1;i>0;i--){
printf("%d %d\n", i+1, i);
//			a[i]+=a[i+1];
		}
	}


//	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int n;

int main() {
    while(1) {
        cin >> n;
        if(n == 0) break;
        vector<int> a(n, 0);
        int sum = 0;
        for(int i = 0; i < n; ++i) {
            cin >> a[i];
            sum += a[i];
        }
        int ch = sum/n;
        sort(a.begin(), a.end());
        int no = upper_bound(a.begin(), a.end(), ch) - a.begin();
        cout << no << endl;
    }
}


Measured memory_bytes: 3152
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

llong pow(int x, int n) {
    llong ans = x;
    if (n == 0) return 1;

    for(int i = 0; i < n - 1; i++) {
        ans *= x;
    }

    return ans;
}

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b >= c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll>vi;
vector<ll> :: iterator vt;
ll arr[200009];
int main()
{
    ll n,t,x,y,z,j,i,k,m,flag =0,maxi=LONG_LONG_MIN ,mini=LONG_LONG_MAX,sum=0,c=0;
    map<string,ll>mp;
    map<string,ll> :: iterator mt;
    string s, ss;
    cin>>n;
    for(i = 0 ;i<n ;i++)
    {
        cin>>s;
        mp[s]++;
    }
    cin>>m;
    for(i  = 0;i<m ;i++)
    {
        cin>>s;
        mp[s]--;
    }
    for(mt = mp.begin() ;mt!= mp.end() ;mt++)
    {
        maxi = max(mt->second,maxi);
    }
    if(maxi<0)
        maxi = 0;
    cout<<maxi<<endl;
}


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

int main(){

    string s;
    cin>>s;
    for(int i=0;i<3;i++){
        if(s.at(i)=='1') s.at(i)='9';
        else if(s.at(i)=='9') s.at(i)='1';
    }
    cout<<s<<endl;








    return 0;
}

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

int f(int x)
{
    if (x < 0)
        return -x;
    else   
        return x;
}

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if ((f(a-c) <= d) || ((f(b-a) <= d)&&(f(c-b) <= d)))
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>    
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m, s[2019], t[2019];
ll MOD = 1e9+7;

int main(){
	cin >> n >> m;
	ll dp[2019][2019];
	dp[0][0] = 1;
	for(ll i = 1; i <= n; i++){cin >> s[i]; dp[i][0] = 1;}
	for(ll j = 1; j <= m; j++){cin >> t[j]; dp[0][j] = 1;}
	
	for(ll i = 1; i <= n; i++){
		for(ll j = 1; j <= m; j++){
			dp[i][j] = dp[i-1][j] + dp[i][j-1] +(MOD - dp[i-1][j-1]);
			dp[i][j] %= MOD;
			if(s[i] == t[j]){
				dp[i][j] += dp[i-1][j-1];
				dp[i][j] %= MOD;
			}
		}
	}
	
	cout << dp[n][m] << endl;
	return 0;
}

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

using namespace std;

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

    set<int> a;
    int i_tmp;
    int j_tmp;

    for (int i = 0; i < k; i++) {
        cin >> i_tmp;
        for (int j = 0; j < i_tmp; j++) {
            cin >> j_tmp;
            a.insert(j_tmp);
        }
    }

    cout << n - a.size() << endl;

    return 0;
}


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

#define pb push_back
#define fst first
#define snd second
#define ALL(s) s.begin(),s.end()
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define SZ(x) ((int)(x).size())
#define PI 3.1415926535897932384626433832795
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef long long ll;
using namespace std;

int main() {FIN;
    ll a,b; cin>>a>>b;
    if(a%2==0){
        if(b%2){
            int cnt = ((b+1)-a)/2;
            if(cnt%2==0)cout<<0<<"\n";
            else cout<<1<<"\n";
        }else{
            int cnt = ((b)-a)/2;
            if(cnt%2==0)cout<<b<<"\n";
            else cout<<(1^b)<<"\n";
        }
    }else{
        if(b%2){
            int cnt = ((b+1)-a)/2;
            if(cnt%2==0)cout<<a<<"\n";
            else cout<<(1^a)<<"\n";
        }else{
            int cnt = ((b)-a)/2;
            if(cnt%2==0)cout<<(b^a)<<"\n";
            else cout<<(1^b^a)<<"\n";
        }
    }
    return 0;
}



Measured memory_bytes: 256
import heapq

*T, K = [int(i) for i in input().split()]
A, B, C = [sorted([int(i) for i in input().split()], reverse=True)
           for _ in range(3)]

def get_next(t):
    x, y, z = t
    return [(x + 1, y, z), (x, y + 1, z), (x, y, z + 1)]

def evaluate(t):
    x, y, z = t
    return (-(A[x] + B[y] + C[z]), t)


q = []
heapq.heappush(q, evaluate((0, 0, 0)))
memo = set()

for _ in range(K):
    v, t = heapq.heappop(q)
    print(-v)

    for i, nt in enumerate(get_next(t)):
        if nt[i] < T[i] and nt not in memo:
            heapq.heappush(q, evaluate(nt))
            memo.add(nt)


Measured memory_bytes: 4840
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, k = map(int, input().split())
a = [int(x) for x in input().split()]

left = 0
right = 10**9 + 1

while right - left > 1:
    mid = (right + left) // 2
    cnt = 0
    for b in a:
        cnt += b // mid + int(b % mid != 0) - 1
    if cnt <= k:
        right = mid
    else:
        left = mid
print(right)

Measured memory_bytes: 94092
//We are still young.
// D.cpp
// Created on 2019-02-16 19:54
#include <bits/stdc++.h>
#define LL long long
#define db double
using namespace std;

#define MAXN 100100
#define MAXE 400400

typedef pair<int, int> pii;
#define X first
#define Y second
const int INF = 0x7FFFFFFF;
#define Debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> inline void read(T &x) {
    int ch = getchar();
    bool fg = false;
    for (x = 0; !isdigit(ch); ch = getchar()) {
        if (ch == '-') {
            fg = true;
        }
    }
    for (; isdigit(ch); ch = getchar()) {
        x = x * 10 + ch - '0';
    }
    if (fg) {
        x = -x;
    }
}

int a[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6}, n, m, b[MAXN];
pii A[20];
string f[MAXN];

bool chk(string c, string d) {
	if(c.length() > d.length()) return 0;
	if(c.length() < d.length()) return 1;
	int len = c.length();
	for(int i = 0; i < len; i++) {
		if(c[i] > d[i]) return 0;
		else if(c[i] < d[i]) return 1;
	}
	return 1;
}

int main() {
#ifdef LOCAL
	freopen("in.txt", "r", stdin);
#endif
	read(n), read(m);
	for(int i = 1; i <= m; i++) read(b[i]);
	for(int i = 0; i <= n; i++) {
		if(f[i].length() == 0 && i != 0) continue;
		for(int j = 1; j <= m; j++) {
			if(chk(f[i + a[b[j]]], f[i] + (char) ('0' + b[j]))) 
				f[i + a[b[j]]] = f[i] + (char) ('0' + b[j]);
		}
	}
	cout << f[n] << endl;
#ifdef LOCAL
	Debug("My Time: %.3lfms", (double)clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}
/*
20 4
3 7 8 4
*/


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

int main() {
  vector<int> v(3);
  for(int i=0; i<3; i++) {
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  cout << v[2]*10+v[0]+v[1] << endl;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
N,A,B,C,D=map(int,input().split());

x=N//A
x1=N%A
if x1>0:
    yen1=(x+1)*B
else:
    yen1=x*B

y=N//C
y1=N%C
if y1>0:
    yen2=(y+1)*D
else:
    yen2=y*D

if yen1>yen2:
    print(yen2)
else:
    print(yen1)




Measured memory_bytes: 5600
#include <bits/stdc++.h>
#define left_son (node<<1)
#define right_son ((node<<1)|1)
#define mid ((st+dr)/2)
#define X first.first
#define Y first.second
#define lim1 second.first
#define lim2 second.second

using namespace std;

typedef long long ll;
typedef pair< pair<int,int> , pair<int,int> > inform;
const int Nmax = 2e5 + 5;

priority_queue< inform, vector<inform>, greater<inform> > heap;
inform el;

int n, qr, Left, Right, i, val[Nmax], pos[Nmax], type;


class SegmentTree
{
    int a[2][Nmax<<2];

    public:
    void build(int node, int st, int dr)
    {
        if(st == dr)
        {
            if(st&1) a[1][node] = val[st], a[0][node] = n+1;
                else a[0][node] = val[st], a[1][node] = n+1;
            return;
        }

        build(left_son, st, mid); build(right_son, mid+1, dr);
        a[0][node] = min(a[0][left_son], a[0][right_son]);
        a[1][node] = min(a[1][left_son], a[1][right_son]);
    }

    int query(int node, int st, int dr)
    {
        if(Left <= st && dr <= Right) return a[qr][node];

        int ans1 = n+1, ans2 = n+1;
        if(Left <= mid) ans1 = query(left_son, st, mid);
        if(mid < Right) ans2 = query(right_son, mid+1, dr);
        return min(ans1, ans2);
    }
} aint;

void add(int x, int y, int type)
{
    if(x > y) return;

    int v1, v2;

    Left = x, Right = y-1, qr = type;
    v1 = aint.query(1, 1, n);

    Left = pos[v1] + 1, Right = y, qr = type ^ 1;
    v2 = aint.query(1, 1, n);

    if(type == 1) x = -x;
    heap.push({ {v1, v2} , {x, y} });
}

int main()
{
  //  freopen("input", "r", stdin);
  //  freopen("output", "w", stdout);
    cin.sync_with_stdio(false);

    cin >> n;
    for(i=1; i<=n; ++i) cin >> val[i], pos[val[i]] = i;
    aint.build(1, 1, n);

    add(1, n, 1);

    while(heap.size())
    {
        el = heap.top();
        heap.pop();

        cout << el.X << ' ' << el.Y << ' ';

        if(el.lim1 < 0) el.lim1 = -el.lim1, type = 1;
            else type = 0;

        add(el.lim1, pos[el.X]-1, type);
        add(pos[el.X]+1, pos[el.Y]-1, type^1);
        add(pos[el.Y]+1, el.lim2, type);
    }

    return 0;
}


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

int main()
{
    long long int n;
    cin >> n;
    int ans = 0;
    for(int i = 2; i <= (int)floor(sqrt(n)); ++i)
    {
        if(n%i!=0)
        {
            continue;
        }
        for(long long int j = i; j <= n; j *= i)
        {
            if(n%j==0)
            {
                ++ans;
                n /= j;
            }
        }
        while(n%i==0)
        {
            n /= i;
        }
    }
    if(n != 1)
    {
        ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640