akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<pii> vpii;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-7
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(n) ((n) * (n))
#define INF 300000005
#define MAXN 1000000

int main()
{
	int n;
	scanf("%d", &n);
	int ans;
	if (n == 1)
	{
		printf("1");
		return 0;
	}
	ll max_col = 0;
	REPD(i, n + 1)
	{
		int tmp = i;
		ll col = 0;
		while (tmp % 2 == 0 && tmp > 0)
		{
			col++;
			tmp /= 2;
		}
		if (col > max_col)
		{
			ans = i;
			max_col = col;
		}
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int a[10];
int i, j;
int max,num;

int main(void){
  for(i= 0; i<10; i++){
    scanf("%d", &a[i]);
  }

  for(i = 0; i < 3; i++){
    max = a[0];
    num = 0;
    for(j=1; j<10; j++){
      if(max < a[j]){
	max = a[j];
	num = j;
      }
    }
    printf("%d\n", max);
    a[num] = 0;
  }
  return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<stack>

#define int long long
#define all(x) x.begin(), x.end()
#define forn(i, x) for(int i = i; i < x; ++i)

using namespace std;

int INF = 1e16 + 7;

int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

void solve() {
    int n;
    cin >> n;
    map<int, int> d;
    bool ch = 1;
    int g = 0;
    while (n--) {
        int x;
        cin >> x;
        if (!g) g = x;
        if(g != 1) g = gcd(g, x);
        if (ch) {
            for (int i = 2; i * i < x; ++i) {
                if (x % i == 0) {
                    if (d[i]++) ch = 0;
                    while (x % i == 0) x /= i;
                }
            }
            if (x != 1) if (d[x]++) ch = 0;
        }
    }
    if (ch) cout << "pairwise coprime";
    else if (g == 1) cout << "setwise coprime";
    else cout << "not coprime";
}

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

    cout << setprecision(10) << fixed;

    solve();

    return 0;
}

Measured memory_bytes: 7904
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<queue>
#define LL long long
using namespace std;
inline int read( )
{
  int sum=0;char c=getchar( );bool f=0;
  while(c<'0'||c>'9') {if(c=='-') f=1;c=getchar( );}
  while(c>='0'&&c<='9') {sum=sum*10+c-'0';c=getchar( );}
  if(f) return -sum;
  return sum;
}
const int N=1000005;
int n,m,R[N],f[N];
char S[N],T[N];
int main( )
{
  int i,j,ans=0;char x;
  n=read( );
  scanf("%s",S+1);
  scanf("%s",T+1);
  for(i=1;i<=n;i++) 
    T[i]==T[i-1]?++R[m]:R[++m]=i;
  for(j=n,i=m;i>=1;i--)
    {
      j=min(j,R[i-1]+1);x=T[R[i]];
      while(j&&S[j]!=x) j--;
      while(j<n&&S[j+1]==x) j++; /*tips*/
      if(!j) {puts("-1");return 0;}
      f[i]=j;
    }
  f[m+1]=N;
  for(i=1,j=0;i<=m;i++)
    {
      for(;j<m&&f[j+1]-(j+1-i)<R[i];j++);
      ans=max(ans,j-i+1);
    }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 9984
#include<iostream>
#include<string>
using namespace std;
#define rep(a,b) for(int a=0;a<(b);a++)
int main(){
	int N;
	string S;
	cin >> N;
	cin >> S;
	int r=0,g=0,b=0,exception=0;
	rep(i,N){
		if(S[i]=='R'){
			r++;
		}else if(S[i]=='G'){
			g++;
		}else if(S[i]=='B'){
			b++;
		}
	}
	for(int i=0;i<N-1;i++){
		for(int j=i+1;j<N;j++){
			if(S[i]!=S[j]){
				int cursor=j+j-i;
				if(cursor<N&&S[cursor]!=S[i]&&S[cursor]!=S[j]){
					exception++;
				}
			}
		}
	}
	cout <<(long long)r*g*b-exception << endl;
	return 0;
}


Measured memory_bytes: 3196
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<cmath>
using namespace std;
using Graph = vector<vector<int>>;
typedef unsigned long long ll;
ll mod = (10e+8)+ 7;

#define For(N,i) for(int i = 0; i < N; i++)
	
int main(){
	int N;
	cin>>N;
	ll ans = 0;
	for(int i = 0; i < N; i++){
		ans += i;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
using namespace std;
#define int long long
typedef pair<int, int> pii;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

int N;

signed main(){
    int mn = INFL;
    cin >> N;
    int ans = -INFL;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        ans = max(ans, a - mn);
        mn = min(mn, a);
    }
    cout << ans << endl;


    return 0;
}

/*

*/


Measured memory_bytes: 3108
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;$n:expr) => {
        (0..$n).map(|_| scan!()).collect::<Vec<_>>()
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (a, b, c, d) = scan!(i64, i64, i64, i64);
    let mut ans = 0;
    for t in 0..101 {
        if a <= t && t < b && c <= t && t < d {
            ans += 1
        }
    }
    println!("{}", ans);
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long n, a, b, c, d;
    string s;
    cin >> n >> a >> b >> c >> d >> s;
    bool ok = true;
    for(int i = a-1; i < c-1; i++){
        if(s[i] == '#' && s[i+1] == '#') ok = false;
    }
    for(int i = b-1; i < d-1; i++){
        if(s[i] == '#' && s[i+1] == '#') ok = false;
    }
    if(c > d){
        bool space = false;
        for(int i = a-1; i < c-2; i++){
            if(s[i] == '.' && s[i+1] == '.' && s[i+2] == '.'){
                if(b-1 <= i+1 && i+1 <= d-1) space = true;
            }
        }
        if(!space) ok = false;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 592
import sys
def 解():
    iN,iM = [int(_) for _ in input().split()]
    aAB = [[int(_) for _ in sLine.split() ] for sLine in sys.stdin.readlines()]
    d1 = set()
    dN = set()
    for a,b in aAB:
        if a == 1 :
            d1.add(b)
        if b == iN:
            dN.add(a)
    if d1 & dN == set():
        print("IMPOSSIBLE")
    else:
        print("POSSIBLE")
解()


Measured memory_bytes: 53548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	ll sum1=0,k;
	cin>>k;
	string t=s;
	for(ll i=0;i<t.size()-1;i++){
		if(t[i]==t[i+1]){
			sum1++;
			t[i+1]='A';
		}
	}
	ll sum2=0;
	t=t[t.size()-1]+s;
	for(ll i=0;i<t.size()-1;i++){
		if(t[i]==t[i+1]){
			sum2++;
			t[i+1]='A';
		}
	}
	bool ch=false;
	if(t[t.size()-1]==t[0]){
		ch=true;
	}
	//cout << sum1<< " "<<sum2<<endl;
	ll ans=0;
	if(ch){
		ans=k/2*(2*sum2);
		if(k%2==0){
			ans+=sum1-sum2;
		}
	}
	else{
	ans=k/2*(sum1+sum2);
	}
	if(k%2!=0){
		ans+=min(sum1,sum2);
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

ll r[5000], g[5000], b[5000];

signed main(){
    int N; string S;
    cin >> N >> S;
    REP(i, N){
        r[i + 1] += r[i]; g[i + 1] += g[i]; b[i + 1] += b[i];
        if(S[i] == 'R') r[i + 1]++;
        else if(S[i] == 'G') g[i + 1]++;
        else b[i + 1]++;
    }
    ll ans = 0;
    REP(i, N){
        if(S[i] == 'R'){
            ans += (g[N] - g[i + 1]) * (b[N] - b[i + 1]);
            FOR(j, 1, N){
                if(i + 2 * j >= N) break;
                if(S[i + j] == 'G' && S[i + 2 * j] == 'B') ans--;
                if(S[i + j] == 'B' && S[i + 2 * j] == 'G') ans--;
            }
        }else if(S[i] == 'G'){
            ans += (r[N] - r[i + 1]) * (b[N] - b[i + 1]);
            FOR(j, 1, N){
                if(i + 2 * j >= N) break;
                if(S[i + j] == 'R' && S[i + 2 * j] == 'B') ans--;
                if(S[i + j] == 'B' && S[i + 2 * j] == 'R') ans--;
            }
        }else{
            ans += (g[N] - g[i + 1]) * (r[N] - r[i + 1]);
            FOR(j, 1, N){
                if(i + 2 * j >= N) break;
                if(S[i + j] == 'G' && S[i + 2 * j] == 'R') ans--;
                if(S[i + j] == 'R' && S[i + 2 * j] == 'G') ans--;
            }
        }
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 3736
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n=int(input())
a = [int(i) for i in readline().split()]

s = sum(a)

s0 = sum(a[1:1+2*((n-1)//2):2])
ans = [0]*n

ans[0] = (s-2*s0)
for i in range(n-1):
    ans[i+1] = 2*a[i]-ans[i]


print(*ans)

Measured memory_bytes: 14108
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,i,sum=0,a;
  cin>>m>>n;
  for(i=1; i<=n; i++)
  {
      cin>>a;
      sum=sum+a;
  }
  if(sum<=m)
  {
      cout<<m-sum;
  }
  else
    cout<<"-1";
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define mp 	    make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define mod        1000000007
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
ll power(ll a , ll b,ll modi)
{
    ll res = 1 ;
    while(b)
    {
        if(b%2) {
            res = (res * a) % modi ;
        }
        b/=2 ;
        a = (a*a) % modi ;
    }
    return res ;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t=1;
	//cin>>t;
	while(t--)
	{
	ll n,m;
	cin>>n>>m;
	ll ans=(m*(m-1))/2+(n*(n-1))/2;
	cout<<ans;
	}
return 0;
}

Measured memory_bytes: 256
from collections import Counter
def main():
   s = input()
   k = int(input())
   li = [1]
   for i in range(len(s)-1):
       if s[i] != s[i+1]:
           li.append(1)
       else:
           li[-1] += 1
   temp = 0
   ans = 0
   if len(li) == 1:
       ans += len(s) * k // 2
   else:
       for i in li:
           temp += i//2
       if s[0] != s[-1]:
           ans = temp * k
       else:
           li[0] += li[-1]
           for i in li[:-1]:
               ans += i//2
           ans = ans * (k-1) + temp
   print(ans)
main()

Measured memory_bytes: 3316
/*
[jsc2019-qual] C - Cell Inversion
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

const int MAX_N = 1e5;
const int MOD = 1e9 + 7;

class gf {
public:
    int n;
    gf() : n(0) {}
    gf(int n) : n(n % MOD) {}
    gf operator+(gf x) { return gf((n + x.n) % MOD); }
    gf operator-(gf x) { return gf((n - x.n + MOD) % MOD); }
    gf operator*(gf x) { return gf((1LL * n * x.n) % MOD); }
    gf& operator+=(gf x) { return *this = (*this + x); }
    gf& operator-=(gf x) { return *this = (*this - x); }
    gf& operator*=(gf x) { return *this = (*this * x); }
};

int N;
string S;
int cnt[2 * MAX_N];

ll solve() {
    if (S[0] == 'W' || S[2 * N - 1] == 'W') {
        return 0;
    }

    cnt[0] = 1;
    for (int i = 1; i < 2 * N; i++) {
        cnt[i] = (S[i - 1] == S[i]) ? (1 - cnt[i - 1]) : cnt[i - 1];
    }
    for (int i = 1; i < 2 * N; i++) {
        cnt[i] += cnt[i - 1];
    }
    if (cnt[2 * N - 1] != N) {
        return 0;
    }

    gf ans = 1;
    for (int i = 1; i < 2 * N; i++) {
        if (cnt[i - 1] == cnt[i]) {
            // R
            int p = 2 * cnt[i - 1] - i;
            if (p <= 0) {
                return 0;
            }
            ans *= p;
        }
    }
    for (int i = 1; i <= N; i++) {
        ans *= i;
    }

    return ans.n;
}

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

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 1412
#include "bits/stdc++.h"

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? " " : "");
  outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? "\n" : "");
  outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
  return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
  return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

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

  var(int, N, x);

  i64 res = 0;
  vector<i64> a(N);
  rep(i, N) {
    input(a[i]);
    if (i) {
      if (a[i] + a[i-1] > x) {
        i64 need = a[i] + a[i-1] - x;
        res += need;
        a[i] = max<i64>(0, a[i] - need);
      }
    }
  }

  outl(res);

  return 0;
}


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

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int f(int n)
{
    if(n % 2 == 0) {
        return n / 2;
    } else {
        return 3 * n + 1;
    }
}

int main()
{
    int s, v;
    set<int> st;

    cin >> s;
    st.insert(s);
    v = s;

    for(int m = 2; m <= 1000000; m++) {
        v = f(v);
        if(st.find(f(v)) != st.end()) {
            cout << m + 1 << endl;
            return 0;
        } else {
            st.insert(v);
        }
    }

    return 0;
}


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

typedef long long int   ll;
#define int             ll
#define PI              3.1415926535897932384626433832795

#define pb              push_back
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]

#define hell            freopen("input.txt","r", stdin);freopen("output.txt", "w", stdout);freopen("error.txt", "w",stderr);
#define fastasF_boi()   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
//#define cerr            if(false)cerr

int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}
int mulmod(int a,int b){return ((a%mod)*(b%mod))%mod;}
int addmod(int a,int b){return (((a%mod)+(b%mod))+mod)%mod;}

void solve();

signed main(){
//    hell;

    fastasF_boi();
    int t=1;
//    cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
}

void solve(){
    int n;cin>>n;
    int ar[n];
    inputar0(ar);
    int sum=1000;
    for(int i=0;i<n-1;i++){
        if(ar[i]>sum) continue;
        if(ar[i]<ar[i+1]){
            int rem=sum%ar[i];
            int st=sum/ar[i];
            sum=rem+ar[i+1]*st;
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3660
#include<iostream>
#include<string>
using namespace std;
int main(){
	int r,g,b,sum;
	cin>>r>>g>>b;
	sum=r*100+g*10+b;
	if(sum%4==0){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
}

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

const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int SUMN = 1e5 + 2;
const int N = 1e2 + 2;

int n, w, sum;
int weight[N], value[N];
ll dp[2][SUMN];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	
	cin >> n >> w;

	for (int i = 1; i <= n; ++i) {
		cin >> weight[i] >> value[i];
		sum += value[i];
	}

	int m = 1;
	for (int i = 1; i <= sum; ++i)
		dp[0][i] = INFLL;

	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= sum; ++j) {
			dp[m][j] = dp[m^1][j];
			if (value[i] <= j) 
				dp[m][j] = min(dp[m][j], dp[m^1][j-value[i]] + weight[i]);
		}
		m^=1;
	}

	int ans = 0;
	for (int i = 0; i <= sum; ++i) {
		if (dp[m^1][i] <= w) {
			ans = max(ans, i);
		}
	}

	cout << ans << "\n";
	
	return 0;
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


int main() {
    int n,y; cin >> n >> y;
    rep(i, n+1) FOR(j,i, n+1) {
        int a = i;
        int b = j-i;
        int c = n-a-b;
        if(a*10000 + b*5000 + c*1000 == y) {
            cout << a << endl;
            cout << b << endl;
            cout << c << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    cout << -1 << endl;
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>

using namespace std ; 

typedef long long ll ; 

ll A[111111] ; 

int main()
{
    int N ; 
    scanf("%d", &N) ; 
    for(int i = 0 ; i != N ; i++){
        scanf("%lld", A+i) ; 
    }
    ll ans = 0 ; 
    for(int i = 0 ; i != N-1 ; i++) {
        if(A[i]%2) {
            if(A[i+1]) {
                A[i]-- ; 
                A[i+1]-- ; 
                ans++ ; 
            }
        }
    }
    for(int i = 0 ; i != N ; i++){
        ans += A[i]/2 ; 
    }
    printf("%lld\n", ans) ; 
    return 0 ; 
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define scs(s) scanf("%s", s)
#define pri(x) printf("%d\n", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define imprime(v) for(int X=0;X<v.size();X++) cout<<v[X]<<" "; cout<<endl;
#define grid(v) for(int X=0;X<v.size();X++){for(int Y=0;Y<v[X].size();Y++) cout<<v[X][Y]<<" ";cout<<endl;}
#define endl "\n"
const int INF= 0x3f3f3f3f;
const long double pi= acos(-1);
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector< vector< int > > vvi;
typedef vector< vector< ii > > vvii;
const int MOD=1e9+7;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
ll dp[100005];
ll v[100005];
ll v2[100005];
int main()
{
    BUFF;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        v2[i]=v[i];
    }
    dp[0]=v[0]/2LL;
    ll resp=v[0]/2LL;
    v[0]-=(dp[0])*2LL;
    for(int i=1;i<n;i++)
    {
        resp+=v[i]/2LL;
        v[i]-=(v[i]/2LL)*2LL;
        if(v[i] and v[i-1])
        {
            resp++;
            v[i]--;
            v[i-1]--;
        }
        else if(v[i-1] and !v[i] and v2[i]>0)
        {
            v[i]=1;
            v[i-1]=0;
        }
    }
    cout<<resp<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
  int t,n,i,j,k,l,l1;
  cin>>n;
  string s1,s2;
  cin>>s1>>s2;
  for(i=0;i<n;i++)
  {
    cout<<s1[i]<<s2[i];
  }
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s =scan.next();
		scan.close();
		int check=1;
		for(int i=1;i<s.length();i++) {
			char c=s.charAt(i-1);
			if(s.charAt(i)==c) {
				check=0;
				break;
			}
		}
		if(check==1)System.out.println("Good");
		else System.out.println("Bad");
	}
}

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

#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>
#include <bits/stdc++.h>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//typedef vector<ll> vec;
//typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll MAX_N=100010;

ll a,b;

int main(){
  cin>>a>>b;
  ll h=0,ct=10000;
  a--;b--;
  cout<<100<<' '<<100<<endl;
  while(true){
    if(ct>5000){
      if(a>0){
        if(h%2==0){
          if(ct%2==0){
            cout<<'.';
            a--;
          }
          else{
            cout<<'#';
          }
        }
        else{
            cout<<'#';
        }
      }
      else{
        cout<<'#';
      }
    }
    else{
      if(b>0){
        if(h%2==1){
          if(ct%2==0){
            cout<<'#';
            b--;
          }
          else{
            cout<<'.';
          }
        }
        else{
            cout<<'.';
        }
      }
      else{
          cout<<'.';
      }
    }
    ct--;
    if(ct%100==0){
      cout<<endl;
      h++;
    }
    if(ct==0){
      cout<<endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i=0; i<(n); i++)
#define SORT(x) sort((x).begin(),(x).end())
typedef vector<int> VI;

int main() {
	int n; cin >> n;
	VI a(n); REP(i, n)cin >> a[i];

	SORT(a);
	
	int i = 0, ans = 0;
	while (i < n) {
		int x = a[i], cnt = 0;
		while (i < n && a[i] == x) { cnt++; i++; }
		if (cnt % 2 == 1)ans++;
	}
	cout << ans << endl;
}

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

typedef long long ll;
int a[10000005];

void findDivisors(int n)
{
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j * i <= n; j++)
            a[i * j]++;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    findDivisors(n);
    ll ans = 0;
    for (int i = 1; i <= n; i++)
    {
        ans += ll(i) * ll(a[i]);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 42728
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
l=list(map(int,input().split()))
dp=[0]*n
for i in range(1,min(k,n)):
	dp[i]=abs(l[i]-l[0])
#print(dp)
for i in range(k,n):
  dp[i]=dp[i-1]+abs(l[i-1]-l[i])
  for j in range(k+1):
  	dp[i]=min(dp[i],dp[i-j]+abs(l[i-j]-l[i]))
#print(dp)
print(dp[n-1])
               

Measured memory_bytes: 52444
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String S = br.readLine();
	char array[] = S.toCharArray();
	if (array[0] != array[1] && array[1] != array[2] && array[2] != array[3])
	    System.out.println("Good");
	else
	    System.out.println("Bad");
    }
}


Measured memory_bytes: 22868
//abc131_a.cpp
//Sun Sep  1 20:41:33 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	for (int i=1;i<4;i++){
		if (s[i]==s[i-1]){
			cout << "Bad" << endl;
			return 0;
		}
	}

	cout << "Good" << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    ll r, d, x; cin >> r >> d >> x;
    rep(i, 10){
        x = r*x-d;
        cout << x << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<double,double> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

using P=pair<double,int>;
int main(){
   vector<pint> p;
   vector<double> r;
   rep(i,2){
       double x,y;
       cin>>x>>y;
       p.push_back({x,y});
       r.push_back(0);
   }
   int n;cin>>n;
   rep(i,n){
       double x,y,rr;
       cin>>x>>y>>rr;
       p.push_back({x,y});
       r.push_back(rr);
   }
   vector<vector<double>> v(n+2,vector<double>(n+2));
   rep(i,n+2)REP(j,i+1,n+2){
       double ret=sqrt((p[i].first-p[j].first)*(p[i].first-p[j].first)+(p[i].second-p[j].second)*(p[i].second-p[j].second));
       v[i][j]=v[j][i]=max(ret-r[i]-r[j],0.0);
   }
   priority_queue<P,vector<P>,greater<P>> q;
   vector<double> dist(n+2,longinf);
   dist[0]=0;
   q.push({0.0,0});
   while(q.size()){
       int idx=q.top().second;
       double d=q.top().first;
       q.pop();
       if(dist[idx]+1e-6<d)continue;
       rep(i,n+2){
           if(idx==i)continue;
           if(dist[i]>d+v[idx][i]+1e-9){
               dist[i]=d+v[idx][i];
               q.push({dist[i],i});
           }
       }
   }
   cout<<setprecision(12)<<dist[1]<<endl;
   return 0;
}


Measured memory_bytes: 14324
// AOJ 2963 Is Greedy Optimal
// 2019.8.10 bal4u

#include <stdio.h>

typedef long long ll;

int main()
{
	int A, B, c;
	scanf("%d%d", &A, &B);
	c = (B-1)/A;
	if (B-A >= (ll)c*(A-1)) puts("-1");
	else printf("%lld\n", (ll)(A+B-1)/A*A);
	return 0;
}


Measured memory_bytes: 2148
// Problem : A - Circle Pond
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
ll nCr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
void solve()
{
	int n;
	cin >> n;
	n=2*n;
	printf("%.6f",n*((double)22/7));
	//cout << ((long double)n)*((long double)22)/((long double)7) << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}


Measured memory_bytes: 3784
#include <stdio.h>
#include <algorithm>
int k, t;
int a[100];
int main() {
	scanf("%d%d", &k, &t);
	for (int i = 0; i < t; i++) {
		scanf("%d", a + i);
	}
	std::sort(a, a + t);
	k = k - a[t - 1];
	k = a[t - 1] - k - 1;
	if (k < 0)k = 0;
	printf("%d\n", k);
}

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


int main(){
	int N;
	cin >> N;
	int i,j;
	int P[N];
	for(i=0;i<N;i++){
		cin >> P[i];
	}
//	for(i=0;i<N;i++){
//		cout << P[i];
//	}

	int maxval=INFINITY;
	int maxpos=0;
	int out = 0;
	bool OK;
	for(i=0;i<N;i++){
		if(maxval>=P[i]){
			maxval=P[i];
			maxpos=i;
			out++;
		}
	}
	cout << out;
}





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

int main(){
  int N;
  
  cin >> N;
  vector<tuple<string,int,int>> p(N);  
  for(int i = 0;i<N;++i){
    cin >>get<0>(p.at(i)) >> get<1>(p.at(i));
    get<2>(p.at(i)) = i+1;
  }

  sort(p.begin(),p.end());
  for(int i=0;i<N-1;++i){
    for(int j=i+1;j<N;++j){
      if(get<0>(p.at(i)) == get<0>(p.at(j)) && get<1>(p.at(i)) < get<1>(p.at(j))){
        swap(p.at(i),p.at(j));
      }
    }
  }
  for(int i =0;i<N;++i){
    cout <<get<2>(p.at(i)) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cstring>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector < int >
#define vll vector < long long >
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int solve(){
    int a, b, c;
    cin >> a >> b >> c;
    int cnt = inf;
    for(int ac = 0; ac <= 50; ++ac){
        for(int ab = 0; ab <= 50; ++ab){
            for(int bc = 0; bc <= 50; ++bc){
                for(int x = 0; x <= 50; ++x){
                    int tot = a + ac + ab + 2 * x;
                    int twoy = tot - b - bc - ab;
                    int twoz = tot - c - ac - bc;
                    if(twoy < 0 || twoz < 0 || twoy % 2 != 0 || twoz % 2 != 0) continue;
                    cnt = min(cnt, ac + ab + bc + x + twoy / 2 + twoz / 2);
                }
            }
        }
    }
    return cnt;
}

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

    cout << solve() << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  
  int n4 = 0;
  int n2 = 0;
  auto f = [&](int x) {
    if (x%4 == 0) n4++;
    else if (x%2 == 0) n2++;
  };

  rep(i,n) f(a[i]);
  if (n4 >= n/2) puts("Yes");
  else if (n-2*n4 == n2) puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;


int main(){
  int r,g,b;
  cin >> r >> g >> b ;
  int num=r*100+g*10+b;
  
  if(num%4==0){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
  
  
  return 0;
}

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

int main() {
  int N,A;
  cin >> N >> A;
   
  int amari;
  amari = N % 500;
  
  if ( amari <= A) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}




Measured memory_bytes: 256
n = input()
l = list()
cnt = 0
def decide(digit,cur):
  if digit==0:
    l.append(cur)
    return
  decide(digit-1,cur+"3")
  decide(digit-1,cur+"5")
  decide(digit-1,cur+"7")
  return
for i in range(1,len(n)+1):
  decide(i,"")
n = int(n)
for x in l:
  if "3" not in x or "5" not in x or "7" not in x:
    continue
  if int(x)<=n:
    cnt += 1
print(cnt)

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

unsigned long Factorial(unsigned long n){
    if(n!=1){
        return n*Factorial(n-1);
    }else{
        return 1;
    }
}

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

    cout << Factorial(n) << endl;
return 0;
}

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

using lint = long long;

#define REP(i,n)    for(int i=0, i##_len=(n); i<i##_len; ++i)
#define RREP(i,n)   for(int i=((int)(n)-1);   i>=0; --i)
#define FOR(i,a,n)  for(int i=(a), i##_len=(n); i<i##_len; ++i)

#define EPS 1e-6;

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; }

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

    int N;
    cin >> N;
    vector<int> a(N);
    double ave = 0;
    REP(i, N) {
        cin >> a[i];
        ave += a[i];
    }

    ave /= N;

    double min_dist = ave;
    int idx = 0;

    REP(i, N) {
        double dist = abs(a[i] - ave);
        if (dist < min_dist) {
            min_dist = dist;
            idx = i;
        }
    }

    cout << idx << endl;

    return 0;
}


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

#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Fout freopen("output.txt","w",stdout)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define EPS 0.00000001
#define INF INT_MAX
#define PI 2*acos(0.0)
#define P1(XX) cout<<"db1: "<<XX<<endl
#define P2(XX,YY) cout<<"db2: "<<XX<<" "<<YY<<endl
#define P3(XX,YY,ZZ) cout<<"db3: "<<XX<<" "<<YY<<" "<<ZZ<<endl
#define set(XX,POS) XX|=(1<<POS)
#define reset(XX,POS) XX&=(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>


using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree< pair<int,int> , null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;

#define MOD 1000000007LL
#define MX 4000005


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

ll m, n;
string s;
ll a[MX];
map<ll,ll>mp;
int main()
{
    int test, tc=0;
    ll b,bl, i, j;
    //scanf("%d", &test);
    test=1;
    while(test--)
    {
        b=0;
        string s,t;
        cin>>s>>t;
        n=s.size();
        for(i=0;i<n;i++)
        {
            if(s[i]!=t[i])b++;
        }
       cout<<b<<endl;
    }
    return 0;
}


Measured memory_bytes: 3924
//### In The Name Of GOD ###

//%% Remember; (((He))) is The (((Accepter))) %%

// GOD IS GREATER ...

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;
typedef long double ld ;

//#define int ll
#define pb push_back
#define bp pop_back
#define pf push_front
#define fp pop_front
#define X first
#define Y second
#define sz(a) (int)(a.size())
#define sg(a, b) (a + b - 1) / b

const int MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1000ll * 1000 * 1000 * 1000 * 1000 * 1000 ;
const int MAXN = 200 * 1000 + 100;
const int MLOG = 17;
const int NMAX = 20;

int main() {
	int n;
	cin >> n;
	pair <int, int> a[MAXN];
	for(int i = 0; i < n; i++) cin >> a[i].Y;
	ll diff = 0;
	int x;
	for(int i = 0; i < n; i++) {
		cin >> x;
		a[i].X = a[i].Y - x;
		diff += a[i].X;
	}
	if(diff < 0){
		cout << -1;
		return 0;
	}
	sort(a, a + n);
	int ans = 0;
	for(int i = 0; i < n; i++){
		//cout << diff << ' ' << a[i].X << endl;
		if(diff >= a[i].X && a[i].X >= 0) diff -= a[i].X, ans++;
	}
	cout << n - ans;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long a,b,c,d,n,ans,res;
double va,vb,vc,vd,mn;
int main()
{
	scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&n);
	va=(double)a/1;
	vb=(double)b/2;
	vc=(double)c/4;
	vd=(double)d/8;
	n*=4;
	mn=min(va,min(vb,min(vc,vd)));
	if (mn==va)
	  ans+=(n/1)*a;
    else
    if (mn==vb)
    {
      ans+=(n/2)*b;
      res=n%2;
      ans+=res*a;
	}
	else
	if (mn==vc)
    {
    	ans+=(n/4)*c;
    	res=n%4;
    	if (va>vb)  ans+=(res/2)*b;
    	else  ans+=res*a;
	}
	else
	{
		ans+=(n/8)*d;
		res=n%8;
		mn=min(va,min(vb,vc));
		if (mn==va)
		  ans+=res*a;
		else
		if (mn==vb)
		  ans+=(res/2)*b;
		else
		  ans+=(res/4)*c;
	}
	printf("%lld",ans);
}

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

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義
//#define int long long
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int n;cin>>n;
  string s;cin >> s;
  if(n%2==1){
    cout << "No" << endl;
    return 0;
  }
  bool p = true;
  rep(i,n/2){
    p&=s[i]==s[i+n/2];
  }
  if(p){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;

}


Measured memory_bytes: 256
n,m = map(int,input().split())
x = []
y = []
for i in range(m):
    a,b = map(int,input().split())
    x.append(a-1)
    y.append(b-1)

num = [1]*n
r = [False]*n
r[0] = True

for i in range(m):
    if r[x[i]] == True:
        r[y[i]] = True
    num[x[i]] -= 1
    num[y[i]] += 1
    
    if num[x[i]] == 0:
        r[x[i]] = False

print(r.count(True))
        
        



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

int main() {
  int x,n; cin >> x >> n;
  if (n==0) {
    cout << x << endl;
    return 0;
  }
  vector<int> p(n);
  rep(i,n) cin >> p[i];

  sort(p.begin(), p.end());
  auto it = lower_bound(p.begin(), p.end(), x);
  if (*it != x ) {
    cout << x << endl;
    return 0;
  }

  int i=0;
  int ans_mi = p[0]-1;
  while (true) {
    if (x-i > *(it-i)) {
      ans_mi = x-i;
      break;
    }
    if (it-i == p.begin()) break;
    i++;
  }
  i=0;
  int ans_ma = p[n-1]+1;
  while (true) {
    if (x+i < *(it+i)) {
      ans_ma = x+i;
      break;
    }
    i++;
    if (it+i == p.end()) break;
  }
  if (abs(x-ans_mi) > abs(x-ans_ma)) {
    cout << ans_ma << endl;
  } else {
    cout << ans_mi << endl;
  }
}

Measured memory_bytes: 3636
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var S string
	fmt.Scan(&S)
	nump := len(S) - 1
	ans := 0
	for p := 0; p < (1 << uint(nump)); p++ {
		prev := 0
		for j := 0; j < nump; j++ {
			if p&(1<<uint(j)) != 0 {
				sub, _ := strconv.Atoi(S[prev : j+1])
				prev = j + 1
				// fmt.Println("p", p, "j", j, "sub", sub)
				ans += sub
			}
		}
		rest, _ := strconv.Atoi(S[prev:])
		ans += rest
		// fmt.Println("p", p, "rest", rest)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
ll read()
{
    ll tmp=0; char c=getchar(),f=1;
    while(c<'0'||'9'<c){if(c=='-')f=-1; c=getchar();}
    while('0'<=c&&c<='9'){tmp=tmp*10+c-'0'; c=getchar();}
    return tmp*f;
}
using namespace std;
ll f[90];
int main()
{
	int n=read(),i;
	f[0]=2; f[1]=1;
	for(i=2;i<=n;i++)f[i]=f[i-1]+f[i-2];
	printf("%lld",f[n]);
	return 0;
}

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

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define ABS(x, y) ((x) > (y) ? ((x) - (y)) : ((y) - (x)))

#define MOD(x, y) ((x) % (y))
#define DIVCEIL(x, y) (((x) + ((y) - 1)) / (y))
#define DIVFLOOR(x, y) (((x) + ((y) / 2)) / (y))
#define DIVROUND(x, y) ((x) - MOD(x, y) >= MOD(x, y) ? DIVCEIL(x, y) : DIVFLOOR(x, y))

constexpr int MAX_N = 100;

int main() {
  int N;
  char A[MAX_N+1], B[MAX_N+1], C[MAX_N+1];
  scanf("%d", &N);
  scanf("%s", A);
  scanf("%s", B);
  scanf("%s", C);

  int result{};
  for (int i{}; i < N; ++i) {
    int equal{};
    if (A[i] == B[i]) ++equal;
    if (B[i] == C[i]) ++equal;
    if (C[i] == A[i]) ++equal;
    if (equal == 1 || equal == 2) result += 1;
    else if (equal == 0) result += 2;
  }

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


Measured memory_bytes: 760
import java.util.*;

public class Main {
  public static void main(String[] srgs) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int[] edge = new int[n];
    for(int i = 0; i < n; i++) edge[i] = Integer.parseInt(sc.next());
    Arrays.sort(edge);
    long area = 0;
    long temp = 0;
    boolean flag = false;
    for(int i = n - 1; i > 0; i--) {
      if(!flag && edge[i] == edge[i - 1]) {
        temp = edge[i];
        edge[i - 1] = -1;
        flag =true;
      } else if(flag && edge[i] == edge[i - 1]) {
        area = temp * edge[i];
        break;
      }
    }
    System.out.println(area);
  }
}


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

int main() {
int q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;
	int m = (n/2)*2;
	long long ans = min(min(1ll*4*q*m, 1ll*2*h*m), min(1ll*s*m, 1ll*d*m/2));
	if(n % 2) ans += min(min(1ll*4*q, 1ll*2*h), 1ll*s);
	cout << ans;
}


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


#define int long long
int a[200010];
signed main(){
    int n;cin>>n;
    int ans=0;
    map<int,int>mt;
    for(int i=1;i<=n;++i){
        cin>>a[i];
        int t2=i+a[i];
        if(t2<=n&&t2>0){
            ++mt[t2];
        }
    }
    for(int i=1;i<=n;++i){
        int t1=i-a[i];
        if(t1>0){
            ans+=mt[t1];
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 15936