akhauriyash/Code-Regression huggingface dataset:
void main()
{
    long n = rdElem;
    long[] a = rdRow;
    long[] b = rdRow;

    long cnt;
    foreach (x, y; zip(a, b))
    {
        if (x < y) cnt += (y - x) >> 1;
        if (x > y) cnt -= x - y;
    }

    writeln(cnt >= 0 ? "Yes" : "No");
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

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

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

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

bool sorted(vector<int> &a) {
	rep(i, (int)a.size() - 1) {
		if (a[i] > a[i + 1])return false;
	}
	return true;
}
void solve() {
	int n; cin >> n;
	vector<int> p(n);
	rep(i, n)cin >> p[i];
	if (sorted(p)) {
		cout << "YES" << endl; return;
	}
	rep(i, n) {
		Rep(j, i + 1, n) {
			vector<int> cop = p;
			swap(cop[i], cop[j]);
			if (sorted(cop)) {
				cout << "YES" << endl; return;
			}
		}
	}
	cout << "NO" << endl;
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	//cout << pow(1/6000.0, 1.0 / 25) << endl;
	//init();
	solve();
	//cout << "finish" << endl;
	//stop
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int N, D, M, T;

  std::map<int, int> map;

  std::cin >> N;

  for (int i = 0; i < N; i ++) {
    std::cin >> D;

    map[D] ++;
  }

  std::cin >> M;

  for (int i = 0; i < M; i ++) {
    std::cin >> T;

    if (map[T] == 0) {
      std::cout << "NO" << std::endl;

      return 0;
    }

    map[T] --;
  }

  std::cout << "YES" << std::endl;

  return 0;
}


Measured memory_bytes: 9600
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI = 3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//#define rnd(x, y) uniform_int_distribution<ll>(x, y)(rng)

//struct custom_hash {
//    static uint64_t splitmix64(uint64_t x) {
//        // http://xorshift.di.unimi.it/splitmix64.c
//        x += 0x9e3779b97f4a7c15;
//        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
//        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
//        return x ^ (x >> 31);
//    }
//    size_t operator()(uint64_t x) const {
//        static const uint64_t FIXED_RANDOM =
//            chrono::steady_clock::now().time_since_epoch().count();
//        return splitmix64(x + FIXED_RANDOM);
//    }
//};

#define fi first
#define se second

#define MAX 1000006

bool v[MAX];
int len, sp[MAX];

void Sieve() {
	for (ll i = 2; i < MAX; i += 2)	sp[i] = 2;//even numbers have smallest prime factor 2
	for (ll i = 3; i < MAX; i += 2) {
		if (!v[i]) {
			sp[i] = i;
			for (ll j = i; (j * i) < MAX; j += 2) {
				if (!v[j * i])	v[j * i] = true, sp[j * i] = i;
			}
		}
	}
}


int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	Sieve();
	ll n;
	cin >> n;
	ll ans = 0;
	for (ll c = 1; c < n; c++)
	{
		ll diff = n - c;
		map<ll, ll>cry;
		while (diff > 1)
		{
			cry[sp[diff]]++;
			diff /= sp[diff];
		}
		ll naw = 1;
		for (auto &noo : cry)
		{
			naw *= (noo.se + 1);
		}
		ans += naw;
	}
	cout << ans << endl;
	return 0;
}


//252908XL

/*
comments:-

*/


Measured memory_bytes: 8536
#include <stdio.h>
#include <stdbool.h>

int main(){
    int h,w;
    scanf("%d %d",&h,&w);
    char a[h][w];
    bool b[h][w];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            scanf("\n%c",&a[i][j]);
            b[i][j] = true;
        }
    }

    int count_a_r;
    int count_b_r;
    for(int j = 0; j < h; j++){
        count_a_r = 0;
        count_b_r = 0;
        for(int k = 0; k < w; k++){
            if(b[j][k] == true){
                count_b_r++;
                if(a[j][k] == '.'){
                    count_a_r++;
                    continue;
                }else if(a[j][k] == '#'){
                    break;
                }
            }
        }
        if(count_a_r == count_b_r){
            for(int l = 0; l < w; l++){
                b[j][l] = false;
            }
        }
    }

    int W = w;
    int count_a_c;
    int count_b_c;
    for(int j = 0; j < w; j++){
        count_a_c = 0;
        count_b_c = 0;
        for(int k = 0; k < h; k++){
            if(b[k][j] == true){
                count_b_c++;
                if(a[k][j] == '.'){
                    count_a_c++;
                    continue;
                }else if(a[k][j] == '#'){
                    break;
                }
            }
        }
        if(count_a_c == count_b_c){
            for(int l = 0; l < h; l++){
                b[l][j] = false;
            }
            W--;
        }
    }

    int count_w = 0;
    for(int i = 0; i < h; i++){
        count_w = 0;
        for(int j = 0; j < w; j++){
            if(b[i][j]){
                printf("%c",a[i][j]);
                count_w++;
            }
            if(count_w == W){
                printf("\n");
                break;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	int ans=0;
	for(int i=0;i<s.length()/2;i++){
		if(s[i]!=s[s.length()-i-1])
		ans++; 
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/*************************************/

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  string s; cin >> s;
  char l = 'A';
  int ans = 0;
  for (char c : s) {
    if (c != l) ans++;
    l = c;
  }
  kek(ans);
  
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 60, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  ;
  cin >> N;
  va.resize(N);
  rep(i, 0, N - 1) { cin >> va[i]; }
}
void solve() {
  sort(all(va));
  // にぶたん？

  // debugv(va);
  int ans = 0;
  rep(i, 0, N - 1) {
    rep(j, i + 1, N - 1) {
      //
      int tp = va[i] + va[j];
      // jouken?
      // tp > va[k] && va[i]+va[k] > va[j].
      auto md = lower_bound(all(va), tp);
      md--;
      // auto md2 = upper_bound(all(va), va[j] - va[i]);
      // int ind1 = md - va.begin();
      // int ind2 = md2 - va.begin();
      // if (ind1 > ind2){
      // ans += ind1 - ind2 - 1;
      // }
      int ind = md - va.begin();
      if (ind <= j) continue;
      ans += ind - j;
    }
  }
  cout << ans << endl;

  // rep(i, 2, N - 1) {
  //   int plus = 0;
  //   rep(j, 0, i - 1) {
  //     rep(k, j + 1, i - 1) {
  //       if (j == k) continue;
  //       if ((va[j] + va[k] > va[i]) && (va[i] + va[j] > va[k]) &&
  //           (va[k] + va[i] > va[j])) {
  //         // debug(i);
  //         // debug(j), debug(k);
  //         plus++;
  //       }
  //     }
  //   }
  //   dp[i] = dp[i - 1] + plus;
  // }

  // cout << dp[N - 1] << endl;
  // ;
  // ;
}
signed main() {
  input();
  solve();
  return 0;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

ll ans , a , b , c , d , x , y;

ll max(ll a , ll b){
    if(a > b)   return a;
    return b;
}

int main()
{
    _FastIO;

    cin >> a >> b >> c >> d;

    ans = max(max(a * c , a * d) , max(b * c , b * d));

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


Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC085A
{
    class Program
    {
        static void Main(string[] args)
        {
            String s; 

            s = Console.ReadLine(); 

            char[] cs = s.ToCharArray(); 

            cs[3] = '8';

            Console.WriteLine(cs);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
      if (Math.abs(B-A)<=D && Math.abs(C-B)<=D)
       System.out.println("Yes");
      else
       if(Math.abs(A-C)<=D){
       System.out.println("Yes");
       }else{
       System.out.println("No");
       }
       
    }
}

Measured memory_bytes: 23892
// Template by [thunder_blade]
// IIIT ALLAHABAD
// includes :)

#include <bits/stdc++.h>
using namespace std;
#define TEST  int test_case; cin>>test_case; while(test_case--)
#define all(v) (v).begin(),(v).end()
#define fi  first
#define se  second
#define pb push_back
#define mp make_pair
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);  cin.tie(0);  cout.tie(0);
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define pf(x) printf("%f\n",x)
#define ps(x) printf("%s\n",x)
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sf(x) scanf("%f",&x)
#define ss(x) scanf("%s",x)
#define pis(x) cout<<x<<" "//printf("%d ",x)
#define pls(x) printf("%lld ",x)
#define pfs(x) printf("%f ",x)
#define pss(x) printf("%s ",x)
#define FOR(i,a,b) for(i=a;i<b;i++)
#define mod 998244353
#define tr(container, it)  for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
ll power(ll a, ll n) {
	ll p = 1;
	while (n > 0) {
		if(n&1) {
			p = ((p%mod) * (a%mod))%mod;
		}
		n >>= 1;
		a = ((a%mod)*(a%mod))%mod;
	}
	return p%mod;
}
ll inf  = 1000;
const long long B = 100000007;
const long long C = 10010107;
const int N = 500005;
const int LN = 25;

ll fr[N], bk[N];

ll ncr(ll n, ll r)
{
    ll tmp = (fr[n]*bk[r])%mod;
    tmp *= bk[n-r];
    tmp %= mod;
    return tmp;
}

int main()
{
    fr[0] = fr[1] = 1;
    bk[0] = bk[1] = 1;

    for(ll i=2;i<=300000;i++){
        fr[i] = (fr[i-1]*i)%mod;
        bk[i] = power(fr[i], mod-2*1LL);
    }
	ll n,a ,b, k;
	sl(n), sl(a), sl(b), sl(k);

	ll ans = 0;
	for(ll i = 0 ; i <= n; i++){
        ll x = k - (a*i);
        if(x<0 || (x%b))continue;

        x/= b;
        if(x > n)continue;
        ll var = (ncr(n, i) * ncr(n, x))%mod;
        ans += var;
        ans %= mod;
	}
    pl(ans);
}











Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    ll L[210];
    cin >> N;
    rep(i,0,2*N) cin >> L[i];
    sort(L, L+2*N);
    ll ans = 0;
    rep(i,0,N){
        ans += min(L[2*i], L[2*i+1]);
    }
    print(ans);

    

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mod = 1e9+7;
void add_self(int& a, int b){
    a = a+b;
    if(a>=mod)
        a-=mod;
}
void sub_self(int& a,int b){
    a-=b;
    if(a<=0){
        a+=mod;
    }
}

const int NAX = 405;
const ll INF = 1e18+5;
ll dp[NAX][NAX];
// dp[l][r] is minimum score in combining subtree from l to r
int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int &x:a){
        cin>>x;
    }
    auto sum = [&](int L,int R){
        ll s = 0; 
        for(int i=L;i<=R;i++){
            s+=a[i];
        }
        return s;
    };
    for(int L= n-1;L>=0;L--){
        for(int R=L;R<n;R++){
            if(L==R)
                dp[L][R] = 0;
            else{
                dp[L][R] = INF;
                ll sumval = sum(L,R);
                for(int i=L;i<=R-1;i++){
                    dp[L][R] = min(dp[L][R],dp[L][i]+dp[i+1][R]+sumval);
                }
            }
        }
    }
    cout<<dp[0][n-1];
}


Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
char mem[214514];
char t[214514];
char c[214514];
string s[214514];
int l[214514],r[214514];
int a[214514];
int sa[214514];
pair<int,int> b[214514];
signed main(){
	ic(n)
	rep(0,i,n)cin>>a[i];
	sort(a,a+n);
	rep(0,i,n){
		if(a[i]==a[i+1]){
			c("NO")
			return 0;
		}
	}	
	c("YES")
}	

Measured memory_bytes: 8448
a,b,c=map(int,input().split())
ans=7
w=7*a+b
if c<=6*a:
    if c%a==0:
        ans=c//a
    else:
        ans=c//a+1
else:
    if c>w:
        ans+=(c//w-1)*7
        c-=c//w*w
        if c%a==0 and c<=6*a:
            ans+=c//a
        else:
            if 6*a<c<=7*a+b:
                ans+=7
            else:
                ans+=c//a+1
print(ans)




Measured memory_bytes: 5596
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			// nがあり、nの数だけの整数の入力
			long n = sc.nextLong();
			List<Long> an = new ArrayList<>();
			for (long i = 0; i < n; i++) {
				an.add(sc.nextLong());
			}
			long retain = 0;
			long target = 1;
			for (int i = 0; i < an.size(); i++) {
				if (an.get(i) == target) {
					retain++;
					target++;
				}
			}
			if (target == 1) {
				System.out.println(-1);
			} else {
				System.out.println(an.size() - retain);
			}
		}
	}
}


Measured memory_bytes: 93480
#include<stdio.h>
long long n,srx[101];
int i;
long long lgx(long long n)
{
    if(srx[n])
    return srx[n];
    if(n>0)
    srx[n]=lgx(n-1)*2+2;
}
int main()
{
    scanf("%d",&n);
    srx[0]=2;
    lgx(n);
    printf("%lld\n",srx[n]);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

signed main()
{
  int N, M, R;
  cin >> N >> M >> R;
  vector<int> r(R);
  for (int i = 0; i < R; i++)
  {
    cin >> r.at(i);
  }
  
  vector<vector<int>> d(222, vector<int>(222, INF));
  for (int i = 0; i < d.size(); i++)
  {
    d.at(i).at(i) = 0;
  }
  
  for (int i = 0; i < M; i++)
  {
    int a, b, c;
    cin >> a >> b >> c;
    d.at(a).at(b) = c;
    d.at(b).at(a) = c;
  }
  for (int i = 1; i <= N; i++)
  {
    for (int j = 1; j <= N; j++)
    {
      for (int k = 1; k <= N; k++)
      {
        chmin(d.at(j).at(k), d.at(j).at(i) + d.at(i).at(k));
      }
    }
  }
  
  sort(r.begin(), r.end());

  int ans = INF;
  do
  {
    int a0 = 0;
    for (int i = 1; i < R; i++)
    {
      a0 += d.at(r.at(i)).at(r.at(i - 1));
    }
    chmin(ans, a0);
  } while (next_permutation(r.begin(), r.end()));
  
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<stdio.h>
using namespace std;
int main(){
	char a[2]={'H','D'};
	char b[2]={'H','D'};
	scanf("%c %c",&a,&b);
	if((a[0]=='H')&&(b[0]=='H'))
	printf("H");
	else if((a[0]=='H')&&(b[1]=='D'))
	printf("D");
	else if((a[1]=='D')&&(b[0]=='H'))
	printf("D");
	else if((a[1]=='D')&&(b[1]=='D'))
	printf("H");
	return 0;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


const ll MOD = 1e9+7;
signed main(){
    ll n,t;
    cin >> n >> t;
    ll a[n] = {};
    ll memo[n] = {};
    priority_queue<ll> pq;
    rep(i,0,n){
        cin >> a[i];
    }

    memo[n-1] = a[n-1];
    rep(i,1,n){
        ll index = n-i-1;
        memo[index] = max(a[index],memo[index+1]);
        pq.push(memo[index] - a[index]);
    }

    ll ans = 1;
    ll v = pq.top();
    pq.pop();
    while(!pq.empty()){
        if(v == pq.top()){
            ans++;
            pq.pop();
        }
        else{
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5788
'use strict'

let Main = (input) => {
  let lines = input.split('\n')
  let v = lines[1].split(' ')
  let finish = true
  let count = 0
  while(finish){
    for(let i=0; i <= v.length-1; i++){
      if(v[i] % 2 == 1){
        finish = false
        break
      }
    }
    if(!finish) break

    v = v.map(value => {
      return value / 2
    })
    
    count++
  }
  //result
  console.log(count)
}

Main(require("fs").readFileSync("/dev/stdin","utf8"))

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

using namespace std;

int main(){
  string s, t;
  cin >> s >> t;
  bool a = true;
  for (int i = 0; i < s.size(); i++){
    if (t.at(i) != s.at(i)){
      a = false;
    }
  }
  if (a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  
}


Measured memory_bytes: 3584
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <vector>
#include <algorithm>
#include <complex>
#include <cmath>
#include <utility>
#include <tuple>

using value_type = long double;
using point = std::complex<value_type>;

point f(point A, point B, point C) {
  auto X = A;
  B -= A;
  C -= A;
  A -= A;

  value_type aa = std::norm(B-C);
  value_type bb = std::norm(C-A);
  value_type cc = std::norm(A-B);

  value_type S = std::abs(C.real()*B.imag() - B.real()*C.imag()) / 2.0;
  if (S < 1e-7) return {};

  A += X;
  B += X;
  C += X;

  return (aa*(bb+cc-aa)*A + bb*(cc+aa-bb)*B + cc*(aa+bb-cc)*C) / (16*S*S);
}

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<point> z(n);
  for (size_t i = 0; i < n; ++i) {
    double x, y;
    scanf("%lf %lf", &x, &y);
    z[i] = point(x, y);
  }

  std::vector<point> cand = z;

  for (size_t i = 0; i < n; ++i) {
    for (size_t j = 0; j < i; ++j) {
      cand.push_back((z[i]+z[j]) / 2.0L);
      for (size_t k = 0; k < j; ++k) {
        cand.push_back(f(z[i], z[j], z[k]));
      }
    }
  }

  value_type res = 1e18;
  for (auto const& zi: cand) {
    value_type cur = 0.0;
    for (size_t i = 0; i < n; ++i)
      cur = std::max(cur, std::abs(zi-z[i]));

    res = std::min(res, cur);
  }
  printf("%.12Lf\n", res);
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
using namespace std;

const int N=500005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x=(x+y)%mod;}
template<class T> inline void read(T &x){
	x=0;char ch=getchar();
	while(ch>'9'||ch<'0') ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
}
template<class T> inline void print(T x){
	if(!x){puts("0");return;}
	int a[20],m=0;
	while(x) a[m++]=x%10,x/=10;
	while(m--) putchar(a[m]+'0');puts("");
}
inline int exp(int x,int y){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

struct node{ll x;int num;}p[N];
int n,k,a[N],c[N];
ll s;
int get(int x){
	int ans=0;
	while(x){
		ans+=c[x];x-=x&-x;
	}
	return ans;
}
void change(int x,int y){
	while(x<=n+1){
		c[x]+=y;x+=x&-x;
	}
}
bool cmp(node a,node b){
	if(a.x!=b.x) return a.x<b.x;
	return a.num<b.num;
}

int main(){
#ifdef rqgao2014
	freopen("input.txt","r",stdin);
	srand(time(0));
#endif
	ios::sync_with_stdio(0);
	read(n);read(k);
	for(int i=1;i<=n;i++) read(a[i]),a[i]-=k;
	p[0]=(node){0,0};
	for(int i=1;i<=n;i++){
		s+=a[i];
		p[i]=(node){s,i};
	}
	sort(p,p+n+1,cmp);
	ll ans=0;
	for(int i=0;i<=n;i++){
		ans+=get(p[i].num+1);
		change(p[i].num+1,1);
	}
	print(ans);
#ifdef rqgao2014
	time_tester(1);
#endif
	return 0;
}




Measured memory_bytes: 7296
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N, M = map(int, input().split())
print(max([x for x in make_divisors(M) if x <= M // N]))


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <array>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int CO = 0;
bool F = 0;
int n;
int field[10][10][10];//zyx
int m1, m2;
int a[100], b[100];
string s;

int search(int z, int y, int x){
	int co = 0;

	for (int i = -1; i <= 1; i++){
		for (int j = -1; j <= 1; j++){
			for (int k = -1; k <= 1; k++){
				if (i == 0 && j == 0 && k == 0)continue;
				int nz = z + k, ny = y + j, nx = x + i;
				if (nz >= 0 && nz < 5 && ny >= 0 && ny < 5 && nx >= 0 && nx < 5){
					if (field[nz][ny][nx])co++;
				}
			}
		}
	}

	//cout << field[z][y][x] << "!" << co << endl;
	/*REP(i, m1){
		if (co == a[i])return 1;
	}
	REP(i, m2){
		if (co == b[i])return 0;
		if (i == m2 - 1)return -1;
	}

	return 0;*/
	return co;
}

bool check(int m, int ar[], int co){
	REP(i, m){
		if (ar[i] == co)return true;
	}
	return false;
}

int main(){
	while (cin >> n&&n){
		CO++;
		REP(i, 5){
			REP(j, 5){
				cin >> s;
				REP(k, 5){
					field[i][j][k] = s[k] - '0';
				}
			}
		}

		cin >> m1;
		REP(i, m1)cin >> a[i];
		cin >> m2;
		REP(i, m2)cin >> b[i];

		REP(l, n){
			//cout << l << endl;
			int newfield[10][10][10];
			REP(i, 5){
				REP(j, 5){
					REP(k, 5){
						int num = search(i, j, k);
						if (field[i][j][k] == 0){
							if (check(m1, a, num))newfield[i][j][k] = 1;
							else newfield[i][j][k] = 0;
						}
						else{
							if (!check(m2, b, num))newfield[i][j][k] = 0;
							else newfield[i][j][k] = 1;
						}
					}
				}
			}
			REP(i, 5){
				REP(j, 5){
					REP(k, 5){
						field[i][j][k] = newfield[i][j][k];
						//cout << field[i][j][k];
					}
					//cout << endl;
				}
				//cout << endl;
			}
		}

		if (F)cout << endl;
		cout << "Case " << CO << ":" << endl;
		REP(i, 5){
			REP(j, 5){
				REP(k, 5){
					cout << field[i][j][k];
				}
				cout << endl;
			}
			if (i != 4)cout << endl;
		}
		F = 1;
	}
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S, T;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;
ll V;
vec a(0);

bool ok(ll c){
    if(c == K - 1) return true;
    ll b = a[c] + M, rest = M * (V - K);
    if(rest <= 0) return b >= a[K-1];
    reps(i,K - 1,N){
        if(i == c) continue;
        rest -= min(M, b - a[i]);
    }
    return rest <= 0 && b >= a[K-1];
}
int main(){
    cin>>N>>M>>V>>K;
    rep(i,N) {
        cin>>A;
        a.push_back(A);
    }
    sort(ALL(a));
    reverse(ALL(a));//降順
    ll lb = K - 1, ub = N;
    while(ub - lb > 1){//境界をにぶたん
        ll cen = (ub + lb) /2;
        (ok(cen) ? lb : ub) = cen;
    }
    ll border = a[lb], ans = 0;
    rep(i,N){
        ans += (a[i] >= border);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4304
import sys
nums = []
patterns = []
for i in range(3):
    line = sys.stdin.readline().strip()
    a, b, c = map(int, line.split())
    nums.append([a,b,c])
    patterns.append([a,b,c])

# vertical
for i in range(3):
    patterns.append([nums[0][i], nums[1][i], nums[2][i]])
patterns.append([nums[0][0], nums[1][1], nums[2][2]])
patterns.append([nums[0][2], nums[1][1], nums[2][0]])

line = sys.stdin.readline().strip()
n = int(line)
tests = []
for i in range(n):
    line = sys.stdin.readline().strip()
    tests.append(int(line))

for p in patterns:
    if p[0] in tests and p[1] in tests and p[2] in tests:
        print('Yes')
        sys.exit(0)
print('No')

Measured memory_bytes: 3064
n = int(input())
b = [int(i) for i in input().split()]
if n == 2:
	ans = 2 * b[0]
else:
	ans = b[0] + b[n-2]
	for i in range(1, n-1):
		ans += min(b[i], b[i-1])
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdint.h>
#include <ctype.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

static int32_t isPrime(int32_t n) {
    int i;
    double sq = sqrt(n);

    for ( i = 2; i <= (int)sq; i += 1 ) {
        if ( (n % i) == 0 ) {
            return 0;
        }
    }

    return 1;
}

static void printArray(const uint32_t A[], uint32_t n) {
    uint32_t i;

    for ( i = 0; i < n; i++ ) {
        printf("%u%s", A[i], i == n -1 ? "" : " ");
    }
    printf("\n");

    return;
}

static int insersionSort(uint32_t A[], uint32_t n, uint32_t g) {
    int i, j;
    uint32_t v;
    int c = 0;

    for (i = g; i < n; i++) {
        v = A[i];
        j = i - g;
        while ( (j >= 0) && A[j] > v ) {
            A[j + g] = A[j];
            j = j - g;
            c++;
        }
        A[j+g] = v;
    }
    
    return c;
}

#if 0
static uint32_t* makeGbyPrime(uint32_t n, uint32_t* m) {
    int i, j;
    uint32_t* G;
    uint32_t t;
    
    t = sqrt(n);
    G = malloc(sizeof(uint32_t) * t);
    assert( G != NULL );
    for ( j = 0, i = sqrt(n); i > 0; i--) {
        if ( isPrime(i) ) {
            G[j++] = i;
        }
    }
    *m = j;

    return G;
}
#endif

static uint32_t* makeGby3nPlusOne(uint32_t n, uint32_t* m) {
    int i;
    uint32_t* G;
    uint32_t t;
    
    G = malloc(sizeof(uint32_t) * 100);
    assert( G != NULL );

    G[0] = 1;
    for ( i = 1; i < 100; i++ ) {
        G[i] = G[i-1] * 3 + 1;
        if ( G[i] > n ) {
            break;
        }
    }
    *m = i;
    
      /* change order */
    for ( i = 0; i < *m / 2; i++ ) {
        t = G[i];
        G[i] = G[*m - i - 1];
        G[*m - i - 1] = t;
    }
    
    return G;
}

static inline uint32_t* makeG(uint32_t n, uint32_t* m) {
    return makeGby3nPlusOne(n, m);
}

int main(int argc, char* argv[]) {
    int ret;
    int i;
    int count = 0;
    uint32_t n, d;
    uint32_t* A;
    uint32_t m;
    uint32_t* G;

    ret = fscanf(stdin, "%u\n", &n);
    assert( ret == 1 );
    assert( (1 <= n) && n <= 1000000 );

      /* read line number */
    A = malloc(sizeof(uint32_t) * n);
    assert( A != NULL );

      /* read input data */
    memset(A, 0x00, sizeof(uint32_t) * n);
    i = 0;
    while ( (ret = fscanf(stdin, "%u\n", &d)) == 1 ) {
        A[i++] = d;
    }
    assert( i == n);

    G = makeG(n, &m);

    printf("%d\n", m);          /* line: 1 */
    printArray(G, m);           /* line: 2 */

    for ( i = 0; i < m; i++ ) {
        count += insersionSort(A, n, G[i]);
    }

    printf("%d\n", count);      /* line: 3 */

    assert( (double)count < pow(n, 1.5) );
    
    for ( i = 0; i < n; i++ ) {
        printf("%d\n", A[i]);
    }

    free(A);
    free(G);
    
    return 0;
}



Measured memory_bytes: 5484
import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            double x1 = sc.nextDouble();
            double y1 = sc.nextDouble();
            double x2 = sc.nextDouble();
            double y2 = sc.nextDouble();
            double x3 = sc.nextDouble();
            double y3 = sc.nextDouble();
            double xp = sc.nextDouble();
            double yp = sc.nextDouble();
            
            double c1 = (x2-x1) * (yp-y2) - (y2-y1) * (xp-x2);
            double c2 = (x3-x2) * (yp-y3) - (y3-y2) * (xp-x3);
            double c3 = (x1-x3) * (yp-y1) - (y1-y3) * (xp-x1);
    
            if ((c1>0&&c2>0&&c3>0)||(c1<0&&c2<0&&c3<0)){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }
    }
}

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

int main() {
  int N,Z=0;
  string p,a="0123456789";
  cin>>N>>p;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      for(int k=0;k<10;k++){
        int x=0;
        for(int l=0;l<N;l++){
          if(x==0&&p.at(l)==a.at(i)){
            x++;
          }
          else if(x==1&&p.at(l)==a.at(j)){
            x++;
          }
          else if(x==2&&p.at(l)==a.at(k)){
            x++;
            Z++;
          }
        }
      }
    }
  }
  cout<<Z<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=1e5+5;
int n;
long long a[maxn];
int main(){
	cin>>n;
	//long long x,sum=1;
	//bool f=1;
	for(int i=0;i<n;i++)cin>>a[i];
	int x=0,y=0,z=0;
	for(int i=0;i<n;i++){
		if(a[i]%4==0)x++;
		else if(a[i]%2==0)y++,z++;
		else z++;
	}
	//cout<<x<<' '<<y<<' '<<z<<endl;
	if(z==y)cout<<"Yes"<<endl;
	else{
		if(y%2==0)z-=y;
		else z=z-y+1;
		if(x>=z-1)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	//else if(x>=z-y/2-1)cout<<"Yes"<<endl;
	//else cout<<"No"<<endl;
	/*for(int i=n-1;i>=0;i--){
		sum*=x;
		if(sum%4){
			cout<<"No"<<endl;
			f=0;
			break;
		}
		sum%=4;
	}
	if(f)cout<<"Yes"<<endl;*/
	return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Deque;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String str[] = br.readLine().split(" ");
		int a[] = new int[n + 1];

		for (int i = 0; i < n; i++) {
			a[i + 1] = Integer.parseInt(str[i]);
		}

		int dp[] = new int[n + 10];

		ArrayList<Integer> list = new ArrayList<>();
		for (int i = n; i >= 1; i--) {
			int sum = 0;
			for (int j = i; j <= n; j += i) {
				sum += dp[j];
			}
			if (sum % 2 != a[i]) {
				dp[i]++;
				list.add(i);
			}
		}

		Collections.sort(list);

		System.out.println(list.size());
		if (list.size() != 0) {
			System.out.print(list.get(0));
			for (int i = 1; i < list.size(); i++) {
				System.out.print(" " + list.get(i));
			}
			System.out.println();
		}
	}

	public static final ArrayList<Integer> divisor(final int n) {
		final ArrayList<Integer> list = new ArrayList<>();

		for (int i = 1; i * i <= n; i++) { // √n
			if (n % i == 0) {
				list.add(i); // a x b
				if (i != n / i) {
					list.add(n / i); // b x a (逆向き)
				}
			}
		}
		return list;
	}
}

Measured memory_bytes: 64392
#include<iostream>
using namespace std;
int main(){
	int ans=0;
	char S[4];
	for (int i = 0; i < 4; i++){
		cin >> S[i];
		if (S[i] == '+'){
			ans += 1;
		}
		else if (S[i] == '-'){
			ans -= 1;
		}

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

Measured memory_bytes: 256
/***************************************************
 * Problem Name : D.cpp
 * Problem Link : https://atcoder.jp/contests/abc121/tasks/abc121_d
 * OJ           : atCoder
 * Verdict      : Trying
 * Date         : 2020-06-14
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

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

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.rbegin(), v.rend())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define F first
#define S second
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm ( ll a, ll b ) {
    return ( a / __gcd ( a, b ) ) * b;
}
/************************************ Code Start Here ******************************************************/
ll find_xor (ll n) {
    int x = n & 3; // n%4

    if (x == 0) return n;
    else if (x == 1) return 1;
    else if (x == 2) return n + 1LL;
    else return 0;
}

int main () {
    //~ __FastIO;
    //~ cout << setprecision (10) << fixed;
    ll a, b;
    cin >> a >> b;
    cout << (find_xor (b) ^ find_xor (a - 1) ) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  vector<int>cnt(M,0);
  for(int i=0;i<N;i++){
    int K;
    cin>>K;
    for(int j=0;j<K;j++){
      int A;
      cin>>A;
      A--;
      ++cnt[A];
    }
  }
  int ans=0;
  for(int i=0;i<M;i++){
    if(cnt[i]==N){
      ++ans;
    }
  }
cout<<ans;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int n,tmp;
  cin >> n;
  int a[110];
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  for(int i = n-1; i >= 0;i--){
    cout << a[i];
    if(i != 0){
      cout << " ";
    }
  }
  /*ソートじゃなかった！
  for(int i = 0;i < n-1; i++){
    for(int j = n-1;j > i;j--){
      if(a[j-1] < a[j]){
        tmp = a[j-1];
        a[j-1] = a[j];
        a[j] = tmp;
      }
    }
  }
  for(int i = 0;i < n; i++){
    cout << a[i];
    if(i != n-1){
      cout << " ";
    }
  }
  */
  cout << endl;
  return 0;
}



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int H,W,A,B;
int V[1010][1010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W>>A>>B;
	
	FOR(y,H) {
		FOR(x,W) cout<<((y<B)^(x<A));
		cout<<endl;
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int main(){
  int A,B,X;
  cin>>A>>B>>X;
  if(A>X){
    cout<<"NO"<<endl;
  }else{
    if(X<A+B){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }
/*操作する→全部チェック→TLE
どうするっぺ
 */
int main(){
    int n;cin>>n;
    vector<int> a(n);
    set<int> s;
    rep(i,n){
        cin>>a[i];
        s.insert(a[i]);
    }    
    int ans=s.size();
    if(ans%2==0) ans--;
    cout<<ans<<endl;
    return 0;   
}

Measured memory_bytes: 5376
n = int(input())
list_score = list(map(int, input().split()))

ans = []
m = max(list_score)

for i in range(1, m+1):
    c = []
    #print(i)
    for j in range(n):
        a = list_score[j] - i
        b = a**2
        c.append(b)
    #print(len(c))
    #print(c)
    ans.append(sum(c))

#print(ans)
ans.sort()

print(ans[0])

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

int main(){
  	ll L,R,ans,i,j;
  	cin >> L >> R;
	if(R-L >= 2019){
      	cout << 0 << endl;
      	return 0;
    }
  	//cout << L << R << endl;
  	ans = 2019;
  	//cout << "ans is" << ans << endl;
  	//cout << L << R << endl;
  	for(i = L; i <= R; i++){
    	for(j = i+1; j <= R; j++){
        	//ans = min(ans, i*j%2019);
          	if(ans > (i*j)%2019){
            	//cout << "i:"<< i << "j:" << j << "i*j:"<< i*j << endl;
              	ans = i*j%2019;
            }
        }
      	//cout << ans << endl;
    }
  	cout << ans << endl;
	return 0;
}

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

char a;

int main(){
  cin >> a;
  if (isupper(a)) cout << "A" << endl;
  else cout << "a" << endl;
}


Measured memory_bytes: 3524
#include <stdio.h>

int main(void){
    int slot[100001] = {0};
    int flag = 0;
    int n, m, a, b;
    scanf("%d %d", &n, &m);
    for(int i = 0;i < m;i++){
        scanf("%d %d", &a, &b);
        slot[a] = !slot[a];
        slot[b] = !slot[b];
    }
    for(int i = 0;i < n;i++){
        if(slot[i] == 1) flag = 1;
    }
    if(flag == 1) printf("NO\n");
    else printf("YES\n");
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var edge = new List<int[]>[N + 1].Select(l => new List<int[]>()).ToArray();
            for (int i = 0; i < N - 1; i++)
            {
                var input = ReadArrayInt();
                var u = input[0];
                var v = input[1];
                var w = input[2];
                edge[u].Add(new int[] { v, w });
                edge[v].Add(new int[] { u, w });
            }
            var dis = new long[N + 1].Select(l => long.MaxValue).ToArray();
            dis[1] = 0;
            var que = new Queue<int>();
            que.Enqueue(1);
            while (que.Any())
            {
                var num = que.Dequeue();
                for (int i = 0; i < edge[num].Count(); i++)
                {
                    if (edge[num][i][1] + dis[num] < dis[edge[num][i][0]])
                    {
                        dis[edge[num][i][0]] = edge[num][i][1] + dis[num];
                        que.Enqueue(edge[num][i][0]);
                    }
                }
            }
            for (int i = 1; i <= N; i++)
            {
                if (dis[i] % 2 == 0) Console.WriteLine(0);
                else Console.WriteLine(1);
            }

            Console.WriteLine();
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 41404