akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        var nx = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nx[0];
        var x = nx[1];
        var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int place = 0;
        int count = 1;
        for (int i = 0; i < l.Length; i++)
        {
            place += l[i];
            if (x < place)
            {
                Console.WriteLine(count);
                return;
            }
            count++;
        }
        Console.WriteLine(count);
    }

    static readonly TextReader In = Console.In;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static int Read()
    {
        int res = 0;
        int next = In.Read();
        while (48 > next || next > 57) next = In.Read();
        while (48 <= next && next <= 57)
        {
            res = res * 10 + next - 48;
            next = In.Read();
        }
        return res;
    }
}


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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

ll a[200001];
ll dp[200001] = {};

int main(void) {
	int n;
	ll count = 0;
	ll point = 0;

	cin >> n;
	FOR(i, 0, n-1) {
		cin >> a[i];
		if (i == 0) {
			dp[i] = a[i];
		}
		else {
			dp[i] += dp[i - 1] + a[i];
		}
		
	}
	sort(dp, dp + n);
	
	FOR(i, 0, n-2) {
		if (dp[i] == 0) {
			count++;
		}
		if (dp[i] == dp[i + 1]) {
			point++;
		}
		else{
			count += (point)*(point + 1) / 2;
			point = 0;
		}
		if (i == n - 2) {
			count += (point)*(point + 1) / 2;
			point = 0;
		}
	}
	if (dp[n - 1] == 0) {
		count++;
	}
	cout << count << endl;

	return 0;
}

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

namespace ABC
{
    class ABC172D
    {
        const string FILE = "/tmp/data.txt";

        static void Main(string[] args)
        {
#if DEBUG
            Console.SetIn(new StreamReader(FILE));
#endif
            long N = RL();

            long[] divisor = new long[N + 1];

            for (int i = 1; i <= N; ++i)
            {
                divisor[i] = 2;
            }

            for (int i = 2; i <= N / 2; ++i)
            {
                int idx = i + i;
                while (idx <= N)
                {
                    divisor[idx] += 1;
                    idx += i;
                }
            }
            long sum = 1;
            for (long i = 2; i <= N; ++i)
            {
                sum += i * divisor[i];
            }
            Console.WriteLine(sum);



#if DEBUG
            Console.WriteLine("*** end ***");
            Console.SetIn(Console.In);
            Console.ReadKey();
#endif
        }

        static long RL()
        {
            return long.Parse(Console.ReadLine());
        }

        static long[] RLa(long n)
        {
            string[] sa = Console.ReadLine().Split(' ');
            long[] la = new long[n];
            for (int i = 0; i < n; ++i)
            {
                la[i] = long.Parse(sa[i]);
            }
            return la;
        }
    }
}


Measured memory_bytes: 105632
// Problem : D - Teleporter
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define min_heap priority_queue<pll,vector<pll>,greater<pll> >
ll dx4[]={-1,1,0,0};
ll dy4[]={0,0,-1,1};
ll dx8[]={-1,-1,-1,0,1,1,1,0};
ll dy8[]={-1,0,1,1,1,0,-1,-1};
bool isvalid(ll x,ll y,ll n,ll m)
{
    return (x>=0 and y>=0 and x<n and y<m);
}
ll isprime[1000];
vector<ll> prime;
void sievetoprime(ll n)
{
    mem(isprime,true);
    for(ll p=2;p*p<=n;p++)
    {
        if(isprime[p]==true)
        {
            for(ll i=p*p;i<=n;i+=p)
                isprime[i]=false;
        }
    }
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
void solve()
{
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n+1);
    a[0]=0;
    rep(i,1,n+1)
    {
    	cin>>a[i];
    }
    ll x=1;
    vector<ll> v;
    v.pb(x);
    vector<ll> vis(n+1,0);
    vis[1]=1;
    rep(i,0,n)
    {
    	x=a[x];
    	if(vis[x])
    	{
    		v.pb(x);
    		break;
    	}
    	vis[x]=1;
    	v.pb(x);
    }
    ll m=v.size();
    x=v[m-1];
    ll start=1;
    ll end=m;
    for(ll i=0;i<m;i++)
    {
    	if(v[i]==x)
    	{
    		start=i+1;
    		break;
    	}
    }
    ll cycle_length=end-start;
    if(k<start)
    {
    	cout<<v[k];
    	return;
    }
    k=k-start+1;
    k=k%cycle_length;
    cout<<v[start+k-1];
    
}
int main()
{
    ll inpoup = 0;
    if(inpoup==1)
    {
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
    }
    IOS
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}

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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define dump(x) cerr << #x " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define endl '\n'

#ifdef _DEBUG27_
    //#define STRESS 1
#endif

typedef long long llong;

const int INF = 2e9 + 999;
const llong LINF = 2e18 + 999;

void inv(bool e);
template<typename T> T sign(T a);
template<typename T> void die(T &a);
template<typename T> void umax(T &a, T b);
template<typename T> void umin(T &a, T b);

bool brute, alter;
int cnt_tests = 1;

// Improving csa rating

// Code below

int n;
string a, b;

void inp() {
    cin >> n >> a >> b;
}

const llong MOD = 1000000007ll;

void solve() {
    llong ans = 1;
    int last = 0;
    for (int i = 0; i < n; i++) {
        if (last == 0) {
            ans *= (a[i] == b[i] ? 3 : 6);
        } else if (last == 1) {
            ans *= 2;
        } else {
            ans *= (a[i] == b[i] ? 1 : 3);
        }
        if (a[i] != b[i]) {
            last = 2;
            ++i;
        } else {
            last = 1;
        }
        ans %= MOD;
    }
    cout << ans;
}

void stress() {

}

void naive() {

}

void run();
int main() {
    #ifdef _DEBUG27_
        if (1)
            freopen("input.txt", "r", stdin);
    #else
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        if (0) {
            freopen("palindrome.in", "r", stdin);
            freopen("palindrome.out", "w", stdout);
        }
    #endif
    srand(time(0));
    #ifdef STRESS
        brute = true;
    #else
        brute = false;
    #endif

    for (int i = 0; (i < cnt_tests); i++) {
        run();
    }
    cerr << endl << "Time: " << clock() / 1000.0 << " ms";
    return 0;
}

void run() {
    if (!brute) {
        inp();
    }
    else {
        stress();
    }
    solve();
    cout << endl;
}

template<typename T>
void die(T &a) {
    cout << a;
    exit(0);
}

template<typename T>
T sign(T a) {
    if (a == 0)
        return 0;
    if (a < 0)
        return -1;
    return 1;
}

template<typename T>
void umax(T &a, T b) {
    if (b > a)
        a = b;
}

template<typename T>
void umin(T &a, T b) {
    if (b < a)
        a = b;
}

void inv(bool e) {
    if (!e) {
        vector<int> a;
        a[-1] += 1;
    }
}

/** CLEARING BUFFER

    cout << VAL << flush;

    OR

    printf(VAL);
    fflush(stdout);
*/


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

int main(void)
{
	char w[256];
	char buf[256];
	char *ptr;
	char *wp;
	int cnt = 0;
	int ret;
	int wl;
	int pl;

	scanf("%s", w);

	do {
		ret = scanf("%s", buf);
		if (strcmp(buf, "END_OF_TEXT") == 0)
			break;
		ptr = strtok(buf, " ");
		while (ptr != NULL)
		{
			wp = w;
			do {
				pl = *ptr++;
				wl = *wp++;
				pl = tolower(pl);
				wl = tolower(wl);
			} while (pl == wl && pl != '\0');
			if (pl == wl)
				cnt++;
			ptr = strtok(NULL, " ");
		}
	} while (ret != EOF);

	printf("%d\n", cnt);

	return 0;
    
}


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

main() {
    int N,M; cin >> N >> M;
    bool H[N]={false},W[M]={false};
    char c[N][M]; 
    rep(i,N){
        rep(j,M){
            cin >> c[i][j];
            if(c[i][j]=='#'){
                H[i]=true; W[j]=true;
            }
        }
    }
    rep(i,N){
        rep(j,M){
            if(H[i]&&W[j])
            cout << c[i][j];
        }
        cout << endl;
    }



    return 0;
}

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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

pair<ll, ll> D[100000];

int main()
{
	int N, ans = 0;
	ll X, L, C = -(ll)1e15;

	cin >> N;
	rep(i, N) {
		cin >> X >> L;
		D[i].first = X + L;
		D[i].second = X - L;
	}

	sort(D, D + N);

	rep(i, N) {
		if (D[i].second >= C) {
			ans++;
			C = D[i].first;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1792
def func(x):
    x += 1
    res = 0
    for d in range(50):
        loop = 2 ** (d + 1)
        cnt = (x // loop) * (2 ** d)

        if (x % loop) - (2 ** d) > 0:
            cnt += (x % loop) - (2 ** d)

        if cnt % 2 != 0:
            res += 2 ** d
    return res


def main():
    A, B = map(int, input().split())

    print(func(B)^func(A-1))


if __name__ == "__main__":
    main()

Measured memory_bytes: 38256
import std.stdio, std.string, std.conv, std.range, std.algorithm;

void main() {
  auto w = readln.chomp;
  int[char] char_count;
  auto beautiful = true;
  foreach (c; w) {
    char_count[c]++;
  }

  if (char_count.values.all!"a % 2 == 0") {
    "Yes".writeln;
  } else {
    "No".writeln;
  }
}


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

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

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;

const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

int main() {
  ll n;
  cin >> n;
  ll res = 0;

  for(ll i = 1; i*i < n; i++) {
    if (n % i == 0 && n / i != i + 1) {
      ll a = n / i;
      if (a > 2) {
        res += (a - 1);
      }
    }
  }

	cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	N := ReadInt()
	As := ReadInts(N)

	m := make(map[int]int)
	for i := 0; i < N; i++ {
		m[As[i]]++
	}

	ans := 0
	for i := 0; i < N; i++ {
		if m[As[i]] > 1 {
			continue
		}

		divs := Divisors(As[i])
		ok := true
		for _, div := range divs {
			if div == As[i] {
				continue
			}
			if m[div] > 0 {
				ok = false
				break
			}
		}
		if ok {
			ans++
		}
	}
	fmt.Println(ans)
}

func Divisors(n int) []int {
	nums := []int{}
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			nums = append(nums, i)
			if i*i != n {
				nums = append(nums, n/i)
			}
		}
	}
	return nums
}

func ReadInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = ReadInt()
	}
	return ret
}

var sc = bufio.NewScanner(os.Stdin)

func init()        { sc.Buffer(make([]byte, 256), 1e9); sc.Split(bufio.ScanWords) }
func Read() string { sc.Scan(); return sc.Text() }

func ReadInt() int {
	v, e := strconv.Atoi(Read())
	if e != nil {
		panic(e.Error())
	}
	return v
}


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

using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb(c) push_back(c)

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<ll>> matrix;

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

	long double a, b, n;
	cin >> a >> b >> n;

	if(n < b) cout << (floor(a*(n/b))-(a*floor(n/b))) << "\n";
	else cout << (floor(a*((b-1)/b))-(a*floor((b-1)/b))) << "\n";

}


Measured memory_bytes: 3868
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  ll n;
  char s[100000];
  scanf("%lld%s", &n, s);
  for (int i = 0; i < strlen(s); i++)
  {
    s[i] = (s[i] - 'A' + n) % 26 + 'A';
  }
  printf("%s\n", s);
}


Measured memory_bytes: 128
package main

import (
	"fmt"
	"os"
)

func main() {
	var (
		a11, a12, a13 int
		a21, a22, a23 int
		a31, a32, a33 int
		N             int
		bs            []int
	)

	fmt.Scan(&a11, &a12, &a13)
	fmt.Scan(&a21, &a22, &a23)
	fmt.Scan(&a31, &a32, &a33)
	fmt.Scan(&N)
	var b int
	for i := 0; i < N; i++ {
		fmt.Scan(&b)
		bs = append(bs, b)
	}

	fmt.Fprintf(os.Stderr, "%v", bs)
	var (
		c11, c12, c13 bool
		c21, c22, c23 bool
		c31, c32, c33 bool
	)

	for _, b := range bs {
		if a11 == b {
			c11 = true
		}
		if a21 == b {
			c21 = true
		}
		if a31 == b {
			c31 = true
		}
		if a12 == b {
			c12 = true
		}
		if a22 == b {
			c22 = true
		}
		if a32 == b {
			c32 = true
		}
		if a13 == b {
			c13 = true
		}
		if a23 == b {
			c23 = true
		}
		if a33 == b {
			c33 = true
		}
	}
	if c11 && c12 && c13 {
		fmt.Println("Yes")
		return
	}
	if c21 && c22 && c23 {
		fmt.Println("Yes")
		return
	}
	if c31 && c32 && c33 {
		fmt.Println("Yes")
		return
	}
	if c11 && c21 && c31 {
		fmt.Println("Yes")
		return
	}
	if c12 && c22 && c32 {
		fmt.Println("Yes")
		return
	}
	if c13 && c23 && c33 {
		fmt.Println("Yes")
		return
	}
	if c11 && c22 && c33 {
		fmt.Println("Yes")
		return
	}
	if c13 && c22 && c31 {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
	return
}


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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

using mint = modint998244353;

//const mint inv9 = mint(1) / mint(9);

struct S {
    mint x, w;
    S(mint x=0, mint w=1) : x(x), w(w) {}
};

S op(S a, S b) { return S(a.x*b.w+b.x, a.w*b.w); }

S e() { return S(0, 1); }

S mapping(int f, S s) {
    if (f == 0) return s;
    else return S((s.w-1)/9*f, s.w);
}

int composition(int g, int f) {
    if (g == 0) return f;
    else return g;
}

int id() { return 0; }

int main(){
    int n, q;
    cin >> n >> q;
    lazy_segtree<S, op, e, int, mapping, composition, id> seg(n);
    rep(i, n) seg.set(i, S(1, 10));
    rep(i, q) {
        int l, r, d;
        cin >> l >> r >> d;
        --l;
        seg.apply(l, r, d);
        cout << seg.all_prod().x.val() << endl;
        //printf("%u\n", seg.all_prod().x.val());
    }
    return 0;
}


Measured memory_bytes: 9840
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=1000000007;

int main() {
 int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  ll ans=0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      ans=ans+a.at(i)*a.at(j);
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define ft              first
#define sd              second
#define ll          long long
#define pb              push_back
#define mkp           make_pair
#define pll             pair<ll,ll>
#define vll             vector<int>
#define mll             map<ll,ll>
#define pqg             priority_queue<ll>
#define pqs             priority_queue<ll,vll,greater<ll>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod          1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define MAXN   10000001
void online_judge()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
}

void ISO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
int main() {

    ISO();
    online_judge();
    int t;
    t = 1;
    while (t--)
    {

        int n;
        cin >> n;
        int k;
        cin >> k;
        int h[n + 1];
        for (int i = 1; i <= n; ++i)
        {
            cin >> h[i];
        }
        int cost[n + 1] = {0};
        for(int i=0;i<=n;++i)
        {
            cost[i] = INT_MAX;
        }
        //cost[2] = abs(h[2] - h[1]);
        cost[1] = 0;
        for (int i = 2; i <= n; ++i)
        {
            for (int l = 1; l <= k && (i - l) > 0; ++l)
            {
                cost[i] = min(cost[i], (cost[i - l] + abs(h[i] - h[i - l])));
            }
            
        }
        cout << cost[n] << "\n";

    }

    cerr << "Time elapsed: " << clock() / 1000 << " ms" << endl;
    return 0;
}

Measured memory_bytes: 4420
#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;

int N, K;
int A[101010], B[101010];

int solve(int lim)
{
    int ret = 0;
    REP(i,N) {
        if ((lim & A[i]) == A[i]) {
            ret += B[i];
        }
    }
    return ret;
}

signed main()
{
    cin >> N >> K;
    REP(i,N) cin >> A[i] >> B[i];

    int ret = solve(K);
    REP(i,30) {
        if (K & (1 << i)) {
            int K2 = (K - (1 << i)) | ((1 << i) - 1);
            ret = max(ret, solve(K2));
        }
    }
    
    cout << ret << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include <cctype>
#define ll          long long int
#define PB          push_back
#define GO          ll t; cin>>t; while(t--)
#define G(t)        cin>>t; while(t--)
#define ALLR(x)     x.rbegin(), x.rend()
#define PII         pair<ll ,ll >
#define VI          vector<ll >
#define ALL(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define PI          3.141592653589793238
#define SZ(x)       (ll )x.size()
#define hell2        998244353
#define hell        1000000007
#define FO(i,a,b)    for(i=a;i<b;i++)
#define FOREV(i,a,b)    for(i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define BS          binary_search
#define MP          make_pair
#define LIM         100005
#define ARR(n,i,a)    ll n,i;cin>>n;ll a[n];FO(i,0,n)cin>>a[i];
#define ARRK(k,n,i,a) int n,k,i;scanf("%d%d",&n,&k);ll a[n];FO(i,0,n)scanf("%lld",&a[i]);
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
/*ll powM(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll POW(ll x, ll y)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x);
        y = y >> 1;
        x = (x * x);
    }
    return res;
}
int LIS(std::vector<int>& v)
{
    if (v.size() == 0)
        return 0;
    std::vector<int> tail(v.size(), 0);
    int length = 1;
    tail[0] = v[0];
    for (int i = 1; i < v.size(); i++)
    {
        auto b = tail.begin(), e = tail.begin() + length;
        auto it = lower_bound(b, e, v[i]);
        if (it == tail.begin() + length)
            tail[length++] = v[i];
        else
            *it = v[i];
    }
    return length;
}
ll modInverse(ll n, ll p)
{
    return powM(n, p - 2, p);
}
ll fac[500000] = {0};
ll done = 1;
ncrModP(ll n, ll r, ll p)
{
    if (r == 0)
        return 1;
 
    fac[0] = 1;
    if (n > done)
    {    for (ll i = done ; i <= n; i++)
            fac[i] = (fac[i - 1] * i) % p;
    }
    done = max(done, n);
 
    return (fac[n] * modInverse(fac[r], p) % p *
            modInverse(fac[n - r], p) % p) % p;
 
}
ll ncrM(ll n, ll r)
{
    if (r > n - r)
        r = n - r;
    ll C[r + 1];
    memset(C, 0, sizeof(C));
    C[0] = 1;
    for (ll i = 1; i <= n; i++) {
        for (ll j = min(i, r); j > 0; j--)
            C[j] = (C[j] + C[j - 1]);
    }
    return C[r];
}
map<ll, ll>f;
ll fib(ll k)
{
    ll i; f[0] = 1; f[1] = 1; f[2] = 2;
    if (k <= done)return f[k];
    for (i = done; i <= k; i++)f[i] = (f[i - 1] % hell + f[i - 2] % hell) % hell;
    done = k;
    return f[k] % hell;
}void sieve(int n)
{
     bool prime[5*LIM];
     memset(prime, true, sizeof(prime));
      int rootn = (int)sqrt(n);
     for (int p = 2; p <= rootn; p++)
          if (prime[p] == true)
               for (int i = p*p; i <= n; i += p)
                    prime[i] = false;
     prime[1] = 0;
 
}*/

int t;
int main()
{
fio
int x,y;
cin>>x>>y;
if(y<=4*x&&y>=2*x&&y%2==0)
cout<<"Yes";
else
cout<<"No";
    return 0;
    }



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

int main() {
    string S;
    cin >> S;
    if(S.at(0)==S.at(1) && S.at(2)==S.at(3) && S.at(0)!=S.at(2)) {
        cout<<"Yes"<<endl;
    }else if(S.at(0)==S.at(2) && S.at(1)==S.at(3)&& S.at(0)!=S.at(1)) {
        cout<<"Yes"<<endl;
    }else if(S.at(0)==S.at(3) && S.at(1)==S.at(2)&& S.at(0)!=S.at(1)) {
        cout<<"Yes"<<endl;
    }else
    {
        /* code */
        cout<<"No"<<endl;
    }
    return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define itn int
#define make_unique(x) sort((x).begin(), (x).end()); (x).erase(unique((x).begin(), (x).end()), (x).end())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

int main() {
	cout << 360 / gcd(nxt(), 360) << "\n";

	return 0;
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}

int ans;
int n;
vector<P> v;

void f(int p,int q){
  int res=0;
  bool b[100]={};

  rep(i,n){
    if(b[i]) continue;
    res++;
    int x=v[i].F,y=v[i].S;
    while(true){
      auto it = find(all(v),P(x+p,y+q));
      if(it==v.end()) break;
      b[it-v.begin()]=true;
      x+=p;
      y+=q;
    }
  }

  ans=min(ans,res);
}



signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  
  cin>>n;
  v.resize(n);
  ans=n;
  rep(i,n){
    cin>>v[i].F>>v[i].S;
  }
  sort(all(v));
  map<P,int> mp;
  rep(i,n){
    FOR(j,i+1,n){
      f(v[j].F-v[i].F,v[j].S-v[i].S);
    }
  }

  
  cout<<ans<<endl;


}

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

#define show(x) cerr << #x << " = " << x << endl ;
#define input_from_file freopen("input.txt","r",stdin)
#define output_to_file freopen("output.txt" , "w",stdout)
#define fastio ios_base::sync_with_stdio(0)
#define endl '\n'

map < int , int >mp;

int main()
{
	 #ifdef LOCAL
        input_from_file;
        output_to_file;
    #endif
	fastio;cin.tie(0);cout.tie(0);
	int n  , k , x ; cin >> n;
	mp.clear();
	for(int i = 1 ; i <= n ; ++i)
	{
		cin >> x;
		mp[x] = i;
	}
	for(auto it = mp.begin() ; it != mp.end() ; ++it)
	{
		cout << it -> second << " ";
	}

	return 0;
}

Measured memory_bytes: 5504
class UnionFind:
  def __init__(self,n):
    *self.table,=range(n)
    self.rank=[1]*n
  def root(self,x):
    if self.table[x]==x:
      return x
    else:
      self.table[x]=self.root(self.table[x])
      return self.table[x]
  def unite(self,x,y):
    x=self.root(x)
    y=self.root(y)
    if x!=y:
      if self.rank[x]<self.rank[y]:
        x,y=y,x
      self.rank[x]+=self.rank[y]
      self.table[y]=x
  def same(self,x,y):
    return self.root(x)==self.root(y)
  def size(self,x):
    return self.rank[self.root(x)]
(n,m),_,*e=[map(int,t.split())for t in open(0).readlines()]
u=UnionFind(n)
a=[n*~-n//2]
for x,y in e[::-1]:
  x,y=x-1,y-1
  t=a[-1]
  if not u.same(x,y):
    t-=u.size(x)*u.size(y)
  a.append(t)
  u.unite(x,y)
print(*a[::-1],sep='\n')

Measured memory_bytes: 131292
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll x;
    cin >> x;
    ll res = 0;
    if(400<=x && x<=599) res = 8;
    if(600<=x && x<=799) res = 7;
    if(800<=x && x<=999) res = 6;
    if(1000<=x && x<=1199) res = 5;
    if(1200<=x && x<=1399) res = 4;
    if(1400<=x && x<=1599) res = 3;
    if(1600<=x && x<=1799) res = 2;
    if(1800<=x && x<=1999) res = 1;
    cout << res << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  string S;
  cin >> S;

  ll ans = 0;

  rep(i, 4){
    if(S[i] == '+') ans++;
    else ans--;
  }

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


Measured memory_bytes: 384
def numinput():
    a = input().split()
    return a
   
def main():
    n = int(input())
    a = numinput()
    a.reverse()
    answer = a[0]
    for i in range(1, len(a)):
        answer += " " + a[i]
    print(answer)
   
if __name__ == "__main__":
    main()


Measured memory_bytes: 5600
#include<stdio.h>

int main(){
    int ans,i,n,price;
    double tmp=0.0;

    scanf("%d",&n);
    i = n;
    while(i--){
        scanf("%d",&price);
        tmp += (double)price / n;
    }
    ans = tmp;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,arr1[200040],arr2[200040],ans;
int v1[200040],v2[200040];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++) scanf("%d",arr1+i);
	for(int i=0;i<n;i++) scanf("%d",arr2+i);
	for(int i=0;i<=28;i++)
	{
	    int now=0,s1=0,s2=0;
	    for(int j=0;j<n;j++) if(arr1[j]&(1<<i)) s1^=1;
	    for(int j=0;j<n;j++) if(arr2[j]&(1<<i)) s2^=1;
	    if((s1^s2)&n&1) now^=1;
		for(int j=0;j<n;j++) v1[j]=(arr1[j]&((1<<i)-1));
		for(int j=0;j<n;j++) v2[j]=(arr2[j]&((1<<i)-1));
		//sort(v1,v1+n);
		sort(v2,v2+n);
		ll cnt=0;
		for(int j=0;j<n;j++)
            cnt+=v2+n-lower_bound(v2,v2+n,(1<<i)-v1[j]);
		cnt%=2;
		if(cnt) now^=1;
		ans|=(now<<i);
	} printf("%d",ans);
}


Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using namespace std;

using lli = long long int;
using ulli = unsigned long long int;

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int N;
char IN;
deque<char> in, ou;
int Lcnt = 0, Rcnt = 0;

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

	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> IN;
		in.push_back(IN);
	}
	ou = in;
	for(char i : in){

		if(i == '('){
			/*
			if(Rcnt > 0){
				if(Lcnt > 1){
					if( (Lcnt - Rcnt) > 0){
						Lcnt -= Rcnt;
						Rcnt = 0;
						for(; Lcnt > 1; Lcnt--){
							ou.push_back(')');
						}
					}else{
						Rcnt -= Lcnt ;
						Lcnt = 0;
						for(; Rcnt > 0; Rcnt--){
							ou.push_front('(');
						}
					}
				}else{
					for(; Rcnt > 0; Rcnt--){
						ou.push_front('(');
					}
				}
			}
			*/
			Lcnt++;
		}else if(i == ')'){
			if(Lcnt == 0){
				Rcnt++;
			}else{
				Lcnt--;
			}

		}


		dbug(Rcnt);
		dbug(Lcnt);
		/*
		for(char i : ou){
			dbugf(i);
		}
		*/
		dbugln;

	}
	/*
	while(Lcnt > 0 && Rcnt > 0){
		Lcnt--; Rcnt--;
	}
	*/
	dbug(Rcnt);
	dbug(Lcnt);
	dbugln;
	for(; Rcnt > 0; Rcnt--){
		ou.push_front('(');
	}
	for(; Lcnt > 0; Lcnt--){
		ou.push_back(')');
	}

	for(char i : ou){
		cout << i;
	}
  return 0;
}


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

int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int> a(m);
    rep(i,m) cin>>a[i];
    
    int i=0;
    int cnt=0;
    while(x>a[i]){
        cnt++;
        i++;
    }
    
    if(cnt>m-cnt) cout<<m-cnt<<endl;
    else cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3500
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007

    using namespace std;
     //int g[105][105];
    //vector < int > wt(100004);
   // vector < int > a;
    //vector < int > v(30500);
    //int cst[102][100005];
    //int ansr[100005];
 //ll int sum,x=0,c=0,n,m,flag=0,a1,a2,flag1=0,flag2=0;
    //vector < vector < int > > adj(5000, vector < int > (5000));
 //int  dp[1000006];
   // int level[500];




    void solve()
    {
        int i,j=0,r=200,p,q,k=0,ans=0,d,h,flag=0,n,m=0,a,b,id,c,h1,h2,a1,b1;
         cin>>n;
         vector < int > v(n),dp(n,hell);
         rep(i,0,n)
         {
             cin>>v[i];
         }
         dp[0]=0; dp[1]=abs(v[1]-v[0]);
         rep(i,2,n)
            {
                dp[i]=min(dp[i],min(dp[i-1]+abs(v[i-1]-v[i]),dp[i-2]+abs(v[i-2]-v[i])));
            }
            cout<<dp[n-1];



    }



    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t=1;
        //cin>>t;
        while(t--)
        solve();
    }

       /*

  void bfs( int i , int j)
       {
           vis[i][j]= true;
         queue < int > que;
         que.push(k);
         while(!que.empty())
         {
            int x= que.front();
            que.pop();
             for ( int i=1;i<=n;i++)
             {
                 if((!g[1][n] and g[x][i] ) or (g[1][n] and ! g[x][i]))
                 {
                   if(!vis[i])
                   {
                       que.push(i);
                       level[i]=level[x]+1;
                       vis[i]= true;
                   }
                 }
             }
         }
       }

      ll int por(ll int a,ll int b)
         {
            ll int k=1;
            while(b>0)
            {
                if(b%2) k=k*a,k%=hell;
                b/=2;
                a*=a; a%=hell;
            }
            return k;
         } */


Measured memory_bytes: 1024
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    L = []
    e = ""
    for i in range(N):
        S = sys.stdin.readline().rstrip()
        if S in L:
            print("No")
            exit()
        L.append(S)
        if i > 0:
            if e != S[0]:
                print("No")
                exit()
        e = S[::-1][0]

    print("Yes")

Measured memory_bytes: 5200
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<string> ss(h); cin >> ss;
    struct Elem {
        int l, r, t, b;
        int sum(){
            return l + r + t + b - 3;
        }
    };
    vector<vector<Elem>> es(h, vector<Elem>(w));
    for(int i = 0; i < h; i++){
        int cnt = 0;
        for(int j = 0; j < w; j++){
            if(ss[i][j] == '#'){ cnt = 0; }else{ cnt++; es[i][j].l = cnt; }
        }
        cnt = 0;
        for(int j = w - 1; j >= 0; j--){
            if(ss[i][j] == '#'){ cnt = 0; }else{ cnt++; es[i][j].r = cnt; }
        }
    }
    for(int j = 0; j < w; j++){
        int cnt = 0;
        for(int i = 0; i < h; i++){
            if(ss[i][j] == '#'){ cnt = 0; }else{ cnt++; es[i][j].t = cnt; }
        }
        cnt = 0;
        for(int i = h - 1; i >= 0; i--){
            if(ss[i][j] == '#'){ cnt = 0; }else{ cnt++; es[i][j].b = cnt; }
        }
    }
    int ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            ans = max(ans, es[i][j].sum());
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 68992
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,d=0,e=0;
	cin>>a>>b;
	int c[b+1];
	for(int i=1;i<=b;i++)
	cin>>c[i];
	for(int i=0;i<=b;i++)
	{
		d=0;
		e=0;
		for(int k=1;k<=b;k++)
		{
			if(a+i==c[k])
			{
				d++;
 			}
			if(a-i==c[k])
			{
				e++;
			}
		}
		if(e==0)
		{ 
			cout<<a-i<<endl;
			return 0; 
		} 
		if(d==0)
		{
			cout<<a+i<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        char c;
        cin >> c;
        if(c >= 'a' and c <= 'z'){
            cout << "a\n";
        }else{
            cout << "A\n";
        }
    }
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pi> vpi;
typedef vector<bool> vbool;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define forall(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define F0(i,n) for(ll i = 0; i < n; i++)
#define F1(i,n) for(ll i = 1; i <= n; i++)
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define per(i,a,b) for(int i = b-1; i >= a; i--)
#define FIN ios::sync_with_stdio(false);cin.tie(0);
#define db(x) cout<<#x<<" = "<<x<<"\n"
#define all(v) v.begin(),v.end()
#define modulo(a,b) ((a%b)+b)%b
#define F first
#define S second
#define INF 1000000010
#define eps 0.000000000001
#define mod 1000000007
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

//=======================//
int n;
vi h;
vi dp;
int main () {
	//FIN
	cin >> n;
	h = dp = vi(n);
	F0(i,n) cin >> h[i];
	dp[0] =  0;
	dp[1] = abs(h[1]-h[0]);
	rep(i,2,n-1) {
		dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i]-h[i-1]));
	}
	cout << dp[n-1] << "\n";

	return 0;
}










Measured memory_bytes: 3992
X, Y = map(int, input().split())
r = 0
if(X == 1):
  r += 300000
elif(X == 2):
  r += 200000
elif(X == 3):
  r += 100000
else:
  pass

if(Y == 1):
  r += 300000
elif(Y == 2):
  r += 200000
elif(Y == 3):
  r += 100000
else:
  pass

if(X == Y == 1):
  r += 400000

print(r)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ii = pair<int, int>;

int main(){
	ios::sync_with_stdio(0);
	int a, b;
	cin >> a >> b;
	int r1 = a+b;
	r1 = max(r1, a-b);
	r1 = max(r1, a*b);
	cout << r1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <cstdio>

using namespace std;

int main(){
    int n; cin >> n;
    vector<bool> ans;
    while(n){
        int r=n%(-2);
        if(r<0) r=1;
        ans.push_back(r);
        n-=r;
        n/=(-2);
    }
    if(ans.empty()) cout << 0 << endl;
    else{
        for(int i=ans.size()-1; i>=0; --i){
            cout << ans[i];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
using namespace std;
int main()
{
   #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   #endif
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int a[5];
   for(int i=0;i<5;i++) cin>>a[i];
   for(int i=0;i<5;i++)
   {
      if(a[i]==0)
      {
         cout<<i+1;
         break;
      }
   }   
   return 0;
}

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

using namespace std;

#define FOE(i, s, t) for (int i = s; i <= t; i++)
#define FOR(i, s, t) for (int i = s; i < t; i++)
#define FOD(i, s, t) for (int i = s; i >= t; i--)

#define LL long long
#define mp make_pair
#define pb push_back

#define M 998244353

#define K 3001

int a, b, c, d;

LL dp[K][K];
LL acc[K][K];

LL solve(int x, int y) {
	if (x < a || y < b) return 0;
	if (x == a && y == b) return 1;
	
	if (dp[x][y] == -1) {
		dp[x][y] = solve(x, y - 1) * x % M;
	//	printf("dp[%d][%d] = solve(%d, %d) * %d [%lld * %d]\n", x, y, x, y - 1, x, solve(x, y - 1), x);
		
		LL base = 1;
		
		if (y != b) {
			solve(x - 1, y);
			acc[x][y] = (acc[x][y] + (acc[x - 1][y] * y % M + solve(x - 1, y - 1) * (x - 1) % M) % M) % M; 
			dp[x][y] = (dp[x][y] + acc[x][y]) % M;
		} else {
			dp[x][y] = (dp[x][y] + solve(x - 1, y) * y) % M;
		}
	}
	
	return dp[x][y];
}

int main() {
	cin >> a >> b >> c >> d;
	
	FOE(i, 1, c) FOE(j, 1, d) {
		dp[i][j] = -1;
	}
	
	cout << solve(c, d) << endl;
}

Measured memory_bytes: 144660
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <set>

using namespace std;

int main()
{
    string s;

    cin >> s;

    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 0) {
            if (s[i] == 'L') {
                cout << "No" << endl;
                return (0);
            }
        }
        else {
            if (s[i] == 'R') {
                cout << "No" << endl;
                return (0);
            }
        }
    }

    cout << "Yes" << endl;
}


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

int main() {

    int H, W;
    cin >> H >> W;

    vector<string> S(H);
    for (int i = 0; i< H; i++) {
        cin >> S.at(i);
    }

    int cnt = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cnt = 0;
            if (S.at(i).at(j) != '.') {
                cout << S.at(i).at(j);
                continue;
            }

            for (int k = max(i - 1, 0); k < min(H, i + 2); k++) {
                for (int l = max(j -1, 0); l < min(W, j +2); l++) {
                    if (S.at(k).at(l) == '#') {
                        cnt++;
                    }
                }
            }

            cout << cnt;
        }

        cout << "" << endl;
    }

    return 0;
}

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

using namespace std;

int main(){
  long long n, a[100009];
  cin >> n;
  for(int i=1;i<=n;i++)cin >> a[i];
  long long ans=0;
  for(int i=1;i<=n;i++){
    ans += a[i]/2;
    if(i<n&&(a[i]%2==1)&&a[i+1]>0){
      a[i+1]--;
      ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 4376
def main():
    coin_a = int(input())
    coin_b = int(input())
    coin_c = int(input())
    total_money = int(input())
    result_count = 0

    for i in range(coin_a+1):
        for j in range(coin_b+1):
            for k in range(coin_c+1):
                if i * 500 + j * 100 + k * 50 == total_money:
                    result_count += 1

    print(result_count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#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>;

int main() {
  int n;
  cin >> n;
  double ans = 0;
  rep(i, n) {
    int a;
    cin >> a;
    ans += 1.0 / a;
  }
  ans = 1.0 / ans;
  printf("%.10lf\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



int main(){
	int n;
	ll a[200005] = {};
    ll x = 0,y = 0;
	cin >> n  ;

    cin >> a[0];
    x = a[0];
	rep(i,1,n){
	    cin >> a[i];
        y += a[i];
    }

    ll ans = abs(x - y);
    
    rep(i,1,n-1){
        x += a[i];
        y -= a[i];
        ans = min(ans,abs(x - y));
    }
    P(ans);
	return  0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;


signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	int A[N];
	rep(i,N) cin >> A[i];
	if(A[0] != 0){
		cout << -1 << endl;
		return 0;
	}
	else{
		int ans = 0;
		map<int, int> mp;
		for(int i=1;i<N;i++){
			if(A[i-1]+1 < A[i]){
				cout << -1 << endl;
				return 0;
			}
			else{
				mp[A[i]-i] = A[i];
			}
		}
		for(auto e : mp){
			ans += e.second;
		}
		cout << ans << endl;
	}

}

Measured memory_bytes: 14336