akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

template<typename T> struct fenwick_tree {
    int n;
    T zero;
    std::vector<T> data;
    fenwick_tree(int n, T zero = T()) : n(n), zero(zero), data(n + 1, zero) {}
    void add(int i, T x) { for (i++; i <= n; i += i & -i) { data[i] += x; }}
    T get_sum(int i) const {
        if (i > n) { i = n; }
        T ret = zero;
        for (; i > 0; i -= i & -i) { ret += data[i]; }
        return ret;
    }
    T get_sum(int l, int r) const {
        if (l < r) { return get_sum(r) - get_sum(l); }
        else { return zero; }
    }
};

int N, M, Q;
int L[220000], R[220000], p[220000], q[220000];
vector<pair<pint, int>> ev;
int ans[220000];
signed main() {
    cin >> N >> M >> Q;
    rep(i, M) { cin >> L[i] >> R[i], ev.push_back({{R[i], 0}, i}); }
    rep(i, Q) { cin >> p[i] >> q[i], ev.push_back({{q[i], 1}, i}); }
    sort(all(ev));
    fenwick_tree<int> ft(550);
    rep(i, M + Q) {
        int type = ev[i].first.second;
        int idx = ev[i].second;
        if (type == 0) { ft.add(L[idx], 1); }
        if (type == 1) { ans[idx] = ft.get_sum(p[idx], 550); }
    }
    rep(i, Q) { cout << ans[i] << endl; }
}


Measured memory_bytes: 21356
import re
r=re.compile(r'^keyence$|^.+keyence$|^k.+eyence$|^ke.+yence$|^key.+ence$|^keye.+nce$|^keyen.+ce$|^keyenc.+e$|^keyence.+$')
print('YES') if len(r.findall(input()))>0 else print('NO')

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

map<string, bool> memo;

bool parse(string s) {
  if(memo.find(s) != memo.end()) return memo[s];
  //cout << s << endl;
  if(s == "") return true;
  if(s == "mew") return true;
  int const size = s.size();
  
  bool ok = 0;
  for(int i=1; i<size; i++) {
    if(s[i] == 'e') {
      string temp;
      string t = "m";
      if(i-1>=0) {
	if(parse(temp = s.substr(1, i-1))) t+=temp;
	else continue;
      }
      t += "e";
      if(size-i-2>=0) {
	if(parse(temp = s.substr(i+1, size-i-2))) t+=temp;
	else continue;
      }
      t +="w";
      ok |= s == t;
      //cout << (ok ? "true: " : "false: ") << s  << " " << t<< endl;
    }
  }
  return memo[s] = ok;
}

string checker(string s) {
  return parse(s) ? "Cat" : "Rabbit"; 
}

int main() {
  string s; cin >> s;
  
  cout << checker(s) << endl;
  
  return 0;
}

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

int main()
{
    int n, mx = INT_MIN, mn = INT_MAX, inp;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> inp;
        if(inp - mn > mx)   mx = inp - mn;
        if(inp < mn)    mn = inp;
    }
    cout << mx << endl;


    return 0;
}



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

ll modPow(ll a, ll n) {
  if (n == 0) return 1; // 0乗にも対応する場合
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  ll t = modPow(a, n / 2);
  return (t * t) % MOD;
}


int main(){
  ll N,M,j=0;
  cin >> N >> M;
  vector<ll> A(M),ans(N+1);
  for(ll i=0;i<M;i++) cin >> A.at(i);
  ans.at(0)=1;
  if(M==0){
    ans.at(1)=1;
  }else{
    if(A.at(0)==1){
      ans.at(1)=0;
      j++;
    }else{
      ans.at(1)=1;
    }
  }
  for(ll i=2;i<=N;i++){
    if(j<M){
      if(i==A.at(j)){
        ans.at(i)=0;
        j++;
      }else{
        ans.at(i)=ans.at(i-1)+ans.at(i-2);
        ans.at(i)%=MOD;
      }
    }else{
      ans.at(i)=ans.at(i-1)+ans.at(i-2);
      ans.at(i)%=MOD;
    }
  }
  cout << ans.at(N) << endl;
 
      
}

Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

char change(char c){
  if(c == '1') return '0';
  return '1';
}

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

    string s;
    int n,k;
    cin >> n >> k;
    cin >> s;
    char curStyle = '1';
    vi v;
    v.pb(0);
    F0R(i,n){
      if(curStyle != s[i]) {v.pb(0);curStyle = change(curStyle);}
      v[v.size()-1]++;
    }

    ll segTreeEnd1[100005];
    ll segTreeEnd0[100005];
    int curIndex = 0;
    int curDirNumber = 0;
    segTreeEnd0[0] = 0;
    segTreeEnd1[0] = v[0];
    if(v.size()%2 == 0) v.pb(0);
    while(curIndex < v.size()) {
      if(curIndex %2 == 0)
        segTreeEnd1[curDirNumber] = segTreeEnd0[curDirNumber] + v[curIndex];
      else{
        curDirNumber++;
        segTreeEnd0[curDirNumber] = segTreeEnd1[curDirNumber-1] +v[curIndex];
        // cout << curDirNumber << " - " << segTreeEnd0[curDirNumber] << " : " << segTreeEnd1[curDirNumber - 1] << " " << v[curIndex]<<endl;
      }
      curIndex++;
    }
    ll ans = 0;

    if(curDirNumber < k) k = curDirNumber;
    FOR(i,k,curDirNumber+1){
      int temp = segTreeEnd1[i] - segTreeEnd0[i-k];
      // cout << i << " - " << segTreeEnd1[i] << " : " << segTreeEnd0[i-k]<<endl;
      if(temp > ans) ans = temp;
    }

    // F0R(i,curDirNumber) cout <<i << " - "<< segTreeEnd0[i] << endl;
    cout << ans << endl;


    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 1736
#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 <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;
const double pi=3.14159265358979323846;

double a,b,h,m;

int main()
{
	cin>>a>>b>>h>>m;
	double n=abs(h*30+30.0*m/60.0-m*6);
	if(n>180) n=360-n;
	printf("%.15lf\n",sqrt(a*a+b*b-2*a*b*cos(n*pi/180.0)));
	return 0;
}

Measured memory_bytes: 4288
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<int,P> State;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

int dp[18][301];

int main(){
    dp[0][0] = 1;

    FOR(i, 1, 18){
        REP(j, 301){
            dp[i][j] = dp[i-1][j];
            if(j-i*i >= 0){
                dp[i][j] += dp[i][j-i*i];
            }
        }
    }

    int n;
    while(std::cin >> n, n){
        std::cout << dp[17][n] << std::endl;
    }
}

Measured memory_bytes: 1180
// luogu-judger-enable-o2
#include <iostream>
using namespace std;
int main(){
	int n,i,a,b;
	int sum=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a>>b;
		sum+=b-a+1;
	}
	cout<<sum<<endl;
}

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define print_var(x) cerr << #x << " = " << x << endl
#define print_array(arr, len) {cerr << #arr << " = "; for (int i = 0; i < len; i++) cerr << arr[i] << " "; cerr << endl;}
#define print_iterable(it) {cerr << #it << " = "; for (const auto &e : it) cerr << e << " "; cerr << endl;}
#else
#define eprintf(...) (void)0
#define print_var(x) (void)0
#define print_array(arr, len) (void)0
#define print_iterable(it) (void)0
#endif

typedef long long ll;
const int N = 55;

ll cnk[N][N];
int n, p;
int cnt0, cnt1;

void solve()
{
    for (int i = 0; i < N; i++)
    {
        cnk[i][0] = cnk[i][i] = 1;
        for (int j = 1; j < i; j++)
            cnk[i][j] = cnk[i - 1][j] + cnk[i - 1][j - 1];
    }

    scanf("%d%d", &n, &p);
    for (int i = 0; i < n; i++)
    {
        int x;
        scanf("%d", &x);
        if (x % 2 == 0)
            cnt0++;
        else
            cnt1++;
    }

    ll ans = 0;
    for (int i = p; i <= cnt1; i += 2)
        ans += cnk[cnt1][i];
    ans *= 1LL << cnt0;

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

int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    solve();

    eprintf("\n\ntime = %.3lf\n", (double)clock() / CLOCKS_PER_SEC);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 1e5+5;
ll dp[N];
void solve(){
	string s; 
	cin>>s;
	int n=  s.size();
	dp[n] = 1;
	for(int i=n-5;i>=0;i--){
		if(i+4<n){
			string t = s.substr(i,5);
			if(t=="dream" or t=="erase"){
				dp[i]=max(dp[i], dp[i+5]);
			}
		}
		if(i+5<n){
			string t = s.substr(i,6);
			if(t=="eraser"){
				dp[i]=max(dp[i], dp[i+6]);

			}
		}

		if(i+6<n){
			string t = s.substr(i,7);;
			if(t=="dreamer"){
				dp[i]=max(dp[i], dp[i+7]);

			}
		}
	}
	if(dp[0])cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 4496
import java.util.Scanner;

public class Main {
	private static Scanner sc;

	public static void main(String[] args) throws Exception {
		sc = new Scanner(System.in);
		double[] ary = new double[5];
		for (int i = 0; i < 5; i++) {
			ary[i] = sc.nextInt();

		}

		for (int i = 0; i < ary.length - 1; i++) {
			if (ary[i] % 10 == 0) {
				continue;
			}
			if (ary[ary.length - 1] % 10 == 0 || ary[ary.length - 1] % 10 > ary[i] % 10) {
				double tmp = ary[ary.length - 1];
				ary[ary.length - 1] = ary[i];
				ary[i] = tmp;
			}

		}

		double a = 0;

		for (int i = 0; i < ary.length; i++) {
			if (i == ary.length - 1) {
				a += ary[i];
			} else {

				a += Math.ceil(ary[i] / 10) * 10;
			}

		}

		System.out.println(String.format("%.0f", a));

	}

}

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

#include <math.h>
#include <stdlib.h>


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

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    ll ans1 = 0;
    ll sum1 = 0;
    for(int i = 0; i < n; i++){
        sum1 += a[i];
        if(i%2 == 0){
            if(sum1 <= 0){
                ans1 += (1 - sum1);
                sum1 = 1;
            } 
        } else {
            if(sum1 >= 0){
                ans1 += sum1+1;
                sum1 = -1;
            } 
        }
    }

    ll ans2 = 0;
    ll sum2 = 0;
    for(int i = 0; i < n; i++){
        sum2 += a[i];
        if(i%2 != 0){
            if(sum2 <= 0){
                ans2 += (1 - sum2);
                sum2 = 1;
            } 
        } else {
            if(sum2 >= 0){
                ans2 += sum2+1;
                sum2 = -1;
            } 
        }
    }
    
    cout << min(ans1, ans2) << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int min(int x, int y){return x<y?x:y;}
int main(void){
	char s[100000];
	scanf("%s",s);
	int a=0,b=0,i;
	for(i=0;i<strlen(s);i++){
		if(s[i] == '0')a++;
		else b++;
	}
	printf("%d",min(a,b)*2);
	return 0;
}

Measured memory_bytes: 256
use std::collections::HashMap;

fn main() {
    let n = read();
    let mut blue_s = Vec::new();
    for _ in 0..n {
        blue_s.push(read_line_str());
    }

    let m = read();
    let mut red_t = Vec::new();
    for _ in 0..m {
        red_t.push(read_line_str());
    }

    let mut hmap = HashMap::new();
    for e in &blue_s {
        if hmap.contains_key(e) {
            if let Some(x) = hmap.get_mut(e) {
                *x = *x + 1;
            }
        } else {
            hmap.insert(e, 1);
        }
    }

    for e in &red_t {
        if hmap.contains_key(e) {
            if let Some(x) = hmap.get_mut(e) {
                *x = *x - 1;
            }
        } else {
            hmap.insert(e, -1);
        }
    }

    let mut price = 0;
    for (key, val) in hmap {
        if price < val {
            price = val;
        }
        // println!("{} {}", key, val);
    }

    println!("{}", price);
}

fn read() -> i32 {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_line_str() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.replace("\n", "");
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <math.h>
int minimum(int a, int b) { return a < b ? a : b; }
int maximum(int a, int b) { return a > b ? a : b; }
const long long mod = 1000000007;
//const long long mod = 998244353;

using std::vector;
using std::map;
using std::pair;

class carr {
	int** c;
	int level;
public:
	carr(int n, int t = 0) {
		for (int i = 0; i < 30; i++) {
			if (1 << i >= n) {
				level = i + 1;
				break;
			}
		}
		c = new int* [level];
		for (int i = 0; i < level; i++) {
			c[i] = new int[1 << (level - 1 - i)];
			for (int j = 0; j < 1 << (level - 1 - i); j++) {
				if (i == 0) {
					c[0][j] = j < n ? t : 0;
				}
				else {
					c[i][j] = c[i - 1][j << 1] + c[i - 1][(j << 1) + 1];
				}
			}
		}
	}
	carr(int n, int* t) {
		for (int i = 0; i < 30; i++) {
			if (1 << i >= n) {
				level = i + 1;
				break;
			}
		}
		c = new int* [level];
		for (int i = 0; i < level; i++) {
			c[i] = new int[1 << (level - 1 - i)];
			for (int j = 0; j < 1 << (level - 1 - i); j++) {
				if (i == 0) {
					c[0][j] = j < n ? t[j] : 0;
				}
				else {
					c[i][j] = c[i - 1][j << 1] + c[i - 1][(j << 1) + 1];
				}
			}
		}
	}
	void cadd(int n, int a = 1) {
		for (int i = 0; i < level; i++) {
			c[i][n >> i] += a;
		}
	}
	void csub(int n, int a = 1) {
		for (int i = 0; i < level; i++) {
			c[i][n >> i] -= a;
		}
	}
	int prev(int n) {
		for (int i = 0; i < level; i++) {
			if (n & (1 << i) && c[i][(n >> i) - 1]) {
				int r = (n >> i) - 1;
				for (int j = i - 1; j >= 0; j--) {
					r <<= 1;
					if (c[j][r | 1])r |= 1;
				}
				return r;
			}
		}
		return -1;
	}
	int next(int n) {
		for (int i = 0; i < level; i++) {
			if ((n & (1 << i)) == 0 && c[i][(n >> i) + 1]) {
				int r = (n >> i) + 1;
				for (int j = i - 1; j >= 0; j--) {
					r <<= 1;
					if (c[j][r] == 0)r |= 1;
				}
				return r;
			}
		}
		return -1;
	}
	int count_before(int n) {
		int res = 0;
		for (int i = 0; i < level; i++) {
			if (n & (1 << i)) {
				res += c[i][(n >> i) - 1];
			}
		}
		return res;
	}
	int count_after(int n) {
		return c[level - 1][0] - count_before(n) - c[0][n];
	}
	int nth(int n) {
		if (n > c[level - 1][0])return -1;
		int r = 0;
		for (int i = level - 1; i >= 0; i--) {
			r <<= 1;
			if (c[i][r] > n) {
				r |= 1;
			}
		}
		return r;
	}
};

int main() {
	int N;
	scanf("%d", &N);
	char* S = new char[N + 1];
	scanf("%s", S);
	int Q;
	scanf("%d", &Q);
	vector<int> res;
	carr* ca[26];
	for (int i = 0; i < 26; i++)ca[i] = new carr(N);
	for (int i = 0; i < N; i++)ca[S[i] - 'a']->cadd(i);
	for (int z = 0; z < Q; z++) {
		int t;
		scanf("%d", &t);
		if (t == 1) {
			int i; char c;
			scanf("%d %c", &i, &c);
			i--;
			ca[S[i] - 'a']->csub(i);
			ca[c - 'a']->cadd(i);
			S[i] = c;
		}
		else {
			int l, r;
			scanf("%d %d", &l, &r);
			l--; r--;
			int cnt = 0;
			for (int d = 0; d < 26; d++) {
				if (ca[d]->count_before(r + 1) - ca[d]->count_before(l) != 0) {
					cnt++;
				}
			}
			res.push_back(cnt);
		}
	}
	for (int i = 0; i < res.size(); i++) {
		printf("%d\n", res[i]);
	}
	return 0;
}

Measured memory_bytes: 108032
//Volume0-0055
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		//declare
		final double EVEN = 0;
		      double a,sum;

        //input
        Scanner sc = new Scanner(System.in);
        while((sc.hasNext())){
        	a = sc.nextDouble();

        	//calculate
        	sum = a;
        	for(int i=2;i<=10;i++){
        		if   (i%2 == EVEN){a *= 2;}
        		else              {a /= 3;}
        		sum += a;
        	}

        	//output
        	System.out.println(sum);
        }
	}
}

Measured memory_bytes: 19288
fun main(args: Array<String>) = yorukatsu17e()

fun yorukatsu17e() {
    val (n, c) = readLine()!!.split(' ').map { it.toInt() }
    val changeCosts = (1..c).map { readLine()!!.split(' ').map { it.toLong() } }
    val grid = Array(n) { readLine()!!.split(' ').map { it.toInt() - 1 }.toIntArray() }

    data class YXValue(val group: Int, val value: Int)

    val groupingBy = grid.mapIndexed { y, row ->
        row.mapIndexed { x, i -> YXValue((y + x) % 3, i) }
    }.flatten().groupBy { it.group }.mapValues { it.value.map { it.value } }
    val one = groupingBy[0].orEmpty()
    val two = groupingBy[1].orEmpty()
    val three = groupingBy[2].orEmpty()
    var answer = Long.MAX_VALUE

    val costOne = LongArray(c + 1)
    val costTwo = LongArray(c + 1)
    val costThree = LongArray(c + 1)
    for (i in 0 until c) {
        costOne[i] = one.map { changeCosts[it][i] }.sum()
        costTwo[i] = two.map { changeCosts[it][i] }.sum()
        costThree[i] = three.map { changeCosts[it][i] }.sum()
    }

    for (c1 in 0 until c) {
        for (c2 in 0 until c) {
            if (c2 == c1) continue
            for (c3 in 0 until c) {
                if (c3 == c1 || c3 == c2) continue
                val sum = costOne[c1] + costTwo[c2] + costThree[c3]
                answer = Math.min(answer, sum)
            }
        }
    }

    println(answer)
}


Measured memory_bytes: 124576
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n;
	scanf("%d",&n);
	
	int x = 800 * n;	// 食べた数 × 800
	int y = 200 * (n / 15);	// クーポン数 × 200
	
	printf("%d\n", x - y);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;

    long long ans = N;
    long long max_A = 0;
    long long min_B = 1000000001;

    for (int i = 0; i < N; i++){
        int A, B;
        cin >> A >> B;
        if (A > max_A){
            max_A = A;
            min_B = B;
        }
    }

    cout << max_A + min_B << endl;
}

Measured memory_bytes: 256
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string t="hello";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define srch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
    while(cin>>n)
    {
        map<int,int> mp;
        s=1;
        x=n;
        while(1)
        {
            if(mp.count(x)==1)
            {
                break;
            }
            if(x%2==0)
            {
                mp[x]++;
                x=x/2;
            }
            else
            {
                mp[x]++;
                x=3*x+1;
            }
        }
        cout<<mp.sz+1<<en;
    }
}



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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  ll N,L;
  cin>>N>>L;
  vector<ll>a(N);
  for(int i=0;i<N;i++)cin>>a[i];
  vector<int>ans;
  bool ok=false;
  for(int i=0;i<N-1;i++){
    if(a[i]+a[i+1]>=L){
      ok=true;
      for(int j=1;j<i+1;j++)ans.push_back(j);
      for(int j=N-1;j>=i+1;j--)ans.push_back(j);
      break;
    }
  }
  if(ok){
    cout<<"Possible"<<endl;
    for(auto it:ans)cout<<it<<endl;
  }
  else cout<<"Impossible"<<endl;
  return 0;
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vb vector<bool>
#define vd vector<double>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vs vector<string>
#define pull pair<ull, ull>
#define F first
#define S second
#define m_p make_pair
#define debug(x) cout << #x << " " << x << endl
#define printArr(a, start, end)for(int i=start ; i<end ; ++i)cout << a[i] << " ";cout << '\n';
#define readArr(a, start, end)for(int i=start ; i<end ; ++i)cin >> a[i];
#define read2D(mat, n, m)for(int i=0 ; i<n ; ++i)for(int j=0 ; j<m ; ++j)cin >> mat[i][j];

const long double PI = 3.141592653589793238462643383279502884197169399;

// Find Set LSB = (x&(-x)), isPowerOfTwo = (x & (x-1))

void solve(){
	int n;
	cin >> n;
	
	vi a(n);
	for(int& x : a)cin >> x;
	
	vi dp(n, 0);
	dp[1] = abs(a[0] - a[1]);
	for(int i=2 ; i<n ; ++i){
		dp[i] = min(dp[i-2] + abs(a[i] - a[i-2]), dp[i-1] + abs(a[i] - a[i-1]));
	}
	
	cout << dp[n-1];
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int tt=1;
	//cin >> tt;
	
	while(tt--){
		solve();
	}
}


Measured memory_bytes: 3976
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char c[4];
	int c1=0,a=0,b=0;
	for(int i=0;i<3;i++)
	{
		scanf("%c",&c[i]);
	}
	if(c[0]=='a')
	{
		c1++;
	}
	if(c[0]=='b')
	{
		a++;
	}
	if(c[0]=='c')
	{
		b++;
	}
	if(c[1]=='a')
	{
		c1++;
	}
	if(c[1]=='b')
	{
		a++;
	}
	if(c[1]=='c')
	{
		b++;
	}
	if(c[2]=='a')
	{
		c1++;
	}
	if(c[2]=='b')
	{
		a++;
	}
	if(c[2]=='c')
	{
		b++;
	}
	if(c1==1&&b==1&&a==1)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			(3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
template<class T> void chmax(T &a, const T &b){if(a<b)a=b;}
template<class T> void chmin(T &a, const T &b){if(a>b)a=b;}
void YN(bool b){cout<<(b?"YES":"NO")<<endl;}
void Yn(bool b){cout<<(b?"Yes":"No")<<endl;}
void yn(bool b){cout<<(b?"yes":"no")<<endl;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	range(i,1,10){
		range(j,1,10){
			cout<<i<<"x"<<j<<"="<<i*j<<endl;
		}
	}
}




Measured memory_bytes: 3120
N, H, W = map(int, input().split())


ab = []
for _ in range(N):
    a, b = map(int, input().split())
    ab.append([a, b])

ans = 0
for a, b in ab:
    board = 1
    while True:
        if H * board <= a and W * board <= b:
            board += 1
            ans += 1
        else:
            break

print(ans)

Measured memory_bytes: 3188
import java.util.*;
 
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    for(int i = 1;i <= N;i++){
      String S = sc.next();
      if( S.equals("AC")){
        ac++;
      }else if( S.equals("WA")){
        wa++;
      }else if( S.equals("TLE")){
        tle++;
      }else if( S.equals("RE")){
        re++;
      }
    }
  System.out.println("AC x "+ac);
  System.out.println("WA x "+wa);
  System.out.println("TLE x "+tle);
  System.out.println("RE x "+re);
  }
}

Measured memory_bytes: 59104
import bisect

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
sa = set(A)
sb = set(B)
MOD = 10**9+7

if len(sa) != N or len(sb) != M:
    print(0)
    exit()

ans = 1
for n in range(N*M,0,-1):
    if n in sa and n in sb: continue
    if n in sa:
        j = M - bisect.bisect_left(B,n)
        vacant = j
    elif n in sb:
        i = N - bisect.bisect_left(A,n)
        vacant = i
    else:
        i = N - bisect.bisect_left(A,n)
        j = M - bisect.bisect_left(B,n)
        vacant = i*j - (N*M-n)
    if vacant <= 0:
        print(0)
        exit()
    ans *= vacant
    ans %= MOD
print(ans)

Measured memory_bytes: 43756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9 + 7;
const int INF = (int)100100100;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int K,X;
    cin >> K >> X;
    for(int i=0;i<2*K-1;i++){
        cout << X-K+i+1 << ' ';
    }
    


}

/*



 */



Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define INF 2140000000
#define MOD 1000000007

int main() {
	long long a, b, c, n;

	cin >> a >> b >> c >> n;

	long long cnt = 0;

	for (int i = 0; i < 3001; ++i) {
		for (int j = 0; j < 3001; ++j) {
			long long temp = i * a + j * b;
			if (temp <= n && (n - temp) % c  == 0) {
				cnt++;
			}
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000

struct unionfind{
	vector<int> data;
	vector<int> size;
	unionfind(int n){
		for(int i=0;i<n;i++){
			data.push_back(i);
			size.push_back(1);
		}
	}
	
	int find(int x){
		if(data[x]==x)return x;
		return data[x]=find(data[x]);
	}
	
	bool unite(int x,int y){
		x=find(x);y=find(y);
		if(x==y)return false;
		data[x]=y;
		size[y]+=size[x];
		return true;
	}
	
	bool check(int x,int y){
		return (find(x)==find(y));
	}
	
	int get_size(int x){
		int X = find(x);
		return size[X];
	}
};


void dfs(vector<vector<long long>> &ans,vector<vector<pair<int,long long>>> &E,int now,int parent,int first,long long maxi){
	
	ans[first][now] = maxi;
	
	for(int i=0;i<E[now].size();i++){
		int to = E[now][i].first;
		long long c = E[now][i].second;
		if(to==parent)continue;
		dfs(ans,E,to,now,first,max(maxi,c));
	}
	
}


int main(){
	int N,M;
	cin>>N>>M;
	
	vector<pair<long long,pair<int,int>>> V;
	
	for(int i=0;i<M;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		long long c;
		cin>>c;
		
		V.emplace_back(c,make_pair(a,b));
	}
	
	vector<vector<pair<int,long long>>> E(N,vector<pair<int,long long>>());
	unionfind uf(N);
	
	sort(V.begin(),V.end());
	long long sum = 0;
	for(int i=0;i<M;i++){
		int a=V[i].second.first,b=V[i].second.second;
		long long cost = V[i].first;
		
		if(uf.unite(a,b)){
			sum+=cost;
			E[a].emplace_back(b,cost);
			E[b].emplace_back(a,cost);
		}
	}
	
	vector<vector<long long>> ans(N,vector<long long>(N,0));
	
	for(int i=0;i<N;i++){
		dfs(ans,E,i,-1,i,0);
	}
	
	int Q;
	cin>>Q;
	
	for(int i=0;i<Q;i++){
		int s,t;
		cin>>s>>t;
		s--;t--;
		
		cout<<sum - ans[s][t]<<endl;
	}
	
		
	
	return 0;
}


Measured memory_bytes: 134632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
long long X;
cin>>X;
long long tmp=1;
long long a,b,num;
bool judge=true;
while(tmp*tmp<=X){
    if(X%tmp==0){
        a=tmp/2;
        b=a-tmp;
        while(num<X/tmp || b<0){
        num=a*a*a*a+a*a*a*b+a*a*b*b+a*b*b*b+b*b*b*b;
        if(tmp*num==X){
            cout<<a<<" "<<b<<"\n";
            judge=false;
            break;
        }
        a+=1;
        b+=1;
        }
    }
    if(!judge){
        break;
    }
    tmp+=1;
}
return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
 
int main( void ) 
{
    int a[101][101];
    int b[101][101];
    long c;
    int n, m, l;
    int i, j, k;
     
    scanf( "%d%d%d", &n, &m, &l );
    for( i=0; i<n; i++ ) {
        for( j=0; j<m; j++ ) {
            scanf( "%d", &a[i][j] );
        }
    }
    for( i=0; i<m; i++ ) {
        for( j=0; j<l; j++ ) {
            scanf( "%d", &b[i][j] );
        }
    }
 
    for( i=0; i<n; i++ ) {
        for( j=0; j<l; j++ ) {
        	c = 0;
	        for( k=0; k<m; k++ ) {
                c += ( a[i][k] * b[k][j] );
            }
            if( j < l-1 ) {
            	printf( "%ld ", c );
            } else {
            	printf( "%ld\n", c );
        	}
        }
    }
 
    return 0;
}

Measured memory_bytes: 680
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define v vector<ll>
#define mp make_pair
#define fir first
#define sec second
#define _fast_ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define hell 1000000007
using namespace std;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}

ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
char mat[1002][1002];
ll ans[1002][1002];
int main()
{
    _fast_
    ll t = 1;
  //  cin>>t;
    while(t--){
    ll h,w;
    cin>>h>>w;
    rep(i,1,h+1){
        rep(j,1,w+1)
        {
            cin>>mat[i][j];
        }
    }
    ll idx1,idx2;
    memset(ans,0,sizeof(ans));
    for(ll i = 1;i<=w;i++)
    {
        if(mat[1][i] != '#')
        {
            ans[1][i] = 1;
        }
        else
        {
            idx1 = i;
            break;
        }
        
    }
    for(ll i = 1;i<=h;i++)
    {
        if(mat[i][1] != '#'){
            ans[i][1] = 1;
        }
        else
        {
            idx2 = i;
            break;
        }
    }
    for(ll i = 2;i<=h;i++)
    {
        for(ll j = 2;j<=w;j++)
        {
            if(mat[i-1][j] == '.' && mat[i][j-1] == '.')
            {
                ans[i][j] += ans[i-1][j]%hell + ans[i][j-1]%hell;
            }
            else if(mat[i-1][j] == '.')
            {
                ans[i][j] += ans[i-1][j]%hell;
            }
            else if(mat[i][j-1] == '.')
            {
                ans[i][j] += ans[i][j-1]%hell;
            }
            ans[i][j]%= hell;
        }
    }
    cout<<ans[h][w]<<"\n";
    }
    return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using ll = long long;
using namespace std;        
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define ar array


void solve(){
		int n;
		cin>>n;
		vector<int> a(n);
		for(auto &x:a){
			cin>>x;
		}
		int x=a[0];
		for(int i=1;i<n;i++){
			x=(int)x^a[i];
		}
		for(int i=0;i<n;i++){
			cout<<int(x^a[i])<<" ";
		}
		cout<<endl;
	
			

}

int main(){
	ios_base::sync_with_stdio(false);
   	cin.tie(NULL);
//	freopen("input.txt",r,"stdin");
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}





Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <limits>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <sstream>
#include <deque>
#include <cmath>

using namespace std;
using ll = long long;

int main() {

    ll N, K;
    cin >> N >> K;

    vector<int> A;
    A.push_back(0); // 1-based

    for (int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        A.push_back(a);
    }

    ll currTown = 1;
    ll step = 0;
    map<ll, ll> lastVisit;
    lastVisit[currTown] = step;
    while (K > 0) {
        step++;
        int nextTown = A[currTown];
        if (lastVisit.count(nextTown) > 0) {
            K--;
            ll cycleLength = step - lastVisit[nextTown];
            ll mod = K % cycleLength;
            K = mod;

        } else {
            K--;
        }
        currTown = A[currTown];
        lastVisit[currTown] = step;
//        K--;
    }

    cout << currTown << "\n";

    return 0;
}


Measured memory_bytes: 14008
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n; cin>>n;
    vi v(n);rep(i,n)cin>>v[i];
    int cost=INF,__index=0;
    for(int i= -100; i<=100;i++){
        int temp=0;
        for(int j=0; j<n;j++){
            temp+=abs(i-v[j])*abs(i-v[j]);
        }
        cmin(cost,temp);
    }
    cout<<cost<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#define N 1234
#define int long long
template<typename T> inline void read(T &x) {
	x = 0; char c = getchar(); bool flag = false;
	while (!isdigit(c)) { if (c == '-') flag = true; c = getchar(); }
	while (isdigit(c)) { x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); }
	if (flag)	x = -x;
}
using namespace std;
inline int F(int x) {
	return x < 0 ? -x : x;
}
int n;
int X[N], Y[N];
int d[43], dtot;
inline void work(int x, int y) {
	int nx = 0, ny = 0;
	for (int i = 1; i <= dtot; ++i) {
		int t = d[i];
		if (F(x - nx) > F(y - ny)) {
			if (x < nx)	putchar('L'), nx -= t;
			else	putchar('R'), nx += t;
		} else {
			if (y < ny)	putchar('D'), ny -= t;
			else putchar('U'), ny += t;
		}
	}
	putchar('\n');
}
signed main() {
	read(n);
	int type = -1;
	for (int i = 1; i <= n; ++i) {
		read(X[i]), read(Y[i]);
		int t = (X[i] + Y[i]) % 2;
		if (t < 0)	t += 2;
		if (type == -1)	type = t;
		else if (type != t) { puts("-1"); exit(0); }
	}
	if (type)	puts("31");
	else	puts("32");
	for (int i = 30; ~i; --i)	printf("%d ", 1 << i);
	if (type == 0)	puts("1");
	else	puts("");
	int nw = 30;
	if (type == 0) {
		for (int i = 0; i <= 30; ++i)	d[++dtot] = 1 << nw, --nw;
		d[++dtot] = 1;
	} else {
		for (int i = 0; i <= 30; ++i)	d[++dtot] = 1 << nw, --nw;
	}
	for (int i = 1; i <= n; ++i)	work(X[i], Y[i]);
	return 0;
}


Measured memory_bytes: 3236
#include "bits/stdc++.h"
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

#include<unordered_map>


int main() {
	vector<int>v(5);
	for (int i = 0; i < 5; ++i) {
		cin >> v[i];
	}
	sort(v.begin(), v.end(), greater<int>());
	for (int i = 0; i < 5; ++i) {
		cout<<v[i];
		if(i==4)cout<<endl;
		else cout<<" ";
	}
	return 0;
}


Measured memory_bytes: 3160
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (C >= A && C <= B) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

const int mod = 1e9 + 7;

#define N 200005

int expmod(int a, int b, int mod) {
    int res = 1;
    for ( ; b; b >>= 1) {
        if (b&1) res = 1ll * res * a % mod;
        a = 1ll * a * a % mod;
    }
    return res;
}

int n, A, B, C;

int inv[N] = {0, 1}, fac[N] = {1, 1}, rfac[N] = {1, 1};

int CC(int n, int m) {
	if (m<0||m>n) return 0;
	return 1ll * fac[n] * rfac[n-m] % mod * rfac[m] % mod;
}

void init() {
	for (int i = 2; i < N; i ++) {
		fac[i] = 1ll * fac[i-1] * i % mod;
		inv[i] = 1ll * (mod / i) * (mod - inv[mod % i]) % mod;
		rfac[i] = 1ll * rfac[i-1] * inv[i] % mod;
	}
    return;
}

int main() {
	init();
    scanf("%d %d %d %d", &n, &A, &B, &C);
	int inv = expmod(100, mod-2, mod);
    A = 1ll * A * inv % mod;
    B = 1ll * B * inv % mod;
    C = 1ll * C * inv % mod;
    int D = 1 - C;
    if (D < 0) D += mod;
    D = expmod(D, mod-2, mod);
    int ans = 0, res = 0;
    int cb = 1ll * D * B % mod, cc = 1;
    for (int k = 0; k < n; k ++) {
        ans = (ans + 1ll * cc * CC(n+k, k)) % mod;
        cc = 1ll * cc * cb % mod;
    }
    res = (res + 1ll * ans * n % mod * expmod(D, n+1, mod) % mod * expmod(A, n, mod)) % mod;
    ans = 0;
    cb = 1ll * D * A % mod, cc = 1;
    for (int k = 0; k < n; k ++) {
        ans = (ans + 1ll * cc * CC(n+k, k)) % mod;
        cc = 1ll * cc * cb % mod;
    }
    res = (res + 1ll * ans * n % mod * expmod(D, n+1, mod) % mod * expmod(B, n, mod)) % mod;
    printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e11;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    int x,y;
    cin >> x >> y;
    PRINT(x+y/2);
}

Measured memory_bytes: 256
import sys

def main():
    a = int(sys.stdin.readline().rstrip())
    b = int(sys.stdin.readline().rstrip())

    if a > b:
        print("GREATER")
    elif a == b:
        print("EQUAL")
    else:
        print("LESS")

    return 0

if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n, odd, two, four;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	FOR(i, n) {
		int a;
		cin >> a;
		if (a % 2 == 1) odd++;
		else if (a % 4 == 0) four++;
		else two++;
	}
	if (odd <= four) cout << "Yes" << endl;
	else if (two == 0 && odd == four+1) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
using namespace std;
#define mod 1000000007;

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

Measured memory_bytes: 256
n = int(input())
mod = 1000000007
a = [int(i) for i in input().split()]
s = 0
for i in range(n):
    s += a[i]%mod
    s %= mod
ans = 0
for i in range(n-1):
    s -= a[i]
    s %= mod
    ans += a[i]*s%mod
    ans %= mod    
print(ans)

Measured memory_bytes: 31412
#B
i = input()
a = int(i.split()[0])
b = int(i.split()[1])
c = int(i.split()[2])
k = int(i.split()[3])

count = 0

if k < a:
    count += a-(a-k)
elif k <= a+b:
    count += a
elif a+b < k:
    count += (a)-(k-(a+b))
print(count)

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if (max(A,max(B,C)) == C || min(A,min(B,C)) == C) cout << "No" << endl;
  else cout << "Yes" << endl;
}




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

int main() {
	int a[4],b[4];
	int hit,blow;
	
	while ( cin >> a[0] ){
		for ( int i = 1; i < 4; i++ ) 
			cin >> a[i];
		for ( int i = 0; i < 4; i++ )
			cin >> b[i];
		
		hit = 0; blow = 0;
		for ( int i = 0; i < 4; i++ ) {
			for ( int j = 0; j < 4; j++ ) {
				if ( a[i] == b[j] ) {
					if ( i == j ) {
						hit++;
					}else{
						blow++;
					}
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int main(void) {
	int n;
	cin >> n;
	double sum = 0 , a;
	for (int i = 0; i < n; i++) {
		cin >> a;
		sum += 1 / a;
	}
	cout << 1 / sum << endl;
return 0;
}

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

int main() {
  int sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  rep(i,0,tx-sx) cout<<'R';
  rep(i,0,ty-sy) cout<<'U';
  rep(i,0,tx-sx) cout<<'L';
  rep(i,0,ty-sy) cout<<'D';
  cout<<'D';
  rep(i,0,tx-sx+1) cout<<'R';
  rep(i,0,ty-sy+1) cout<<'U';
  cout<<'L';
  cout<<'U';
  rep(i,0,tx-sx+1) cout<<'L';
  rep(i,0,ty-sy+1) cout<<'D';
  cout<<'R';
  cout<<endl;
}


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

typedef long long llt;

const int MaxSqr = 2000000 + 5;

llt N, P;
llt Prime[MaxSqr], num[MaxSqr]; int cntp;

inline llt Fast_pow(llt low, llt high) {
    llt res = 1;
    while (high) {
        if (high & 1) res *= low;
        high >>= 1;
        low *= low;
    }
    return res;
}

void solve() {
    if (P == 1) {
        cout << 1 << endl;
        return;
    }

    llt p = P;
    for (llt i = 2; i * i <= P; ++i) {
        if (p % i == 0) {
            Prime[++cntp] = i;
            while (p % i == 0) {
                num[cntp]++;
                p /= i;
            }
        }
    }
    if (p != 1) {
        Prime[++cntp] = p;
        num[cntp] = 1;
    }

    llt res = 1;
    for (int i = 1; i <= cntp; ++i)
            res *= Fast_pow(Prime[i], (num[i] / N));
    cout << res << endl;
}

int main() {
    cin >> N >> P;
    solve();
    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF (int)1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<long long> vl;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,k,res;
  cin >> n >> k;
  res = n%k;
  res = min(res,k-res);
  cout << res << endl;
}



Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
#コストを保管しておくリストが必要となる
#要素０のN×１行列を生成
dp = [0]*N
#最初の足場、その隣の足場には行き方は一つしかないので定義しておく
dp[0] = 0
dp[1] = abs(H[0]-H[1])

#2つめの場所からは全ての場所において、2通りの生き方があり、コストの低い場合を選択する。
#この場合においては、DP法が有効である
for i in range(2,N):
    #一つとなりから飛んでくる場合
    a = dp[i-1] + abs(H[i-1]-H[i])
    #2つとなりから飛んでくる場合
    b=  dp[i-2] + abs(H[i-2]-H[i])
    dp[i] = min(a,b)
print(dp[N-1])

Measured memory_bytes: 13928