akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
//#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    VI a(4); cin >> a;
    SORT(a);
    cout << abs(a[0] - a[1] - a[2] + a[3]) << "\n";
}


Measured memory_bytes: 3220
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;

class Main {
  public static void main(String[] args) throws Exception {
    
    //System.out.println("Hello Codiva");
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) ;
    ArrayList<Integer> arr  = new ArrayList<>();
    for(int i=0;i<5 ;i++){
      arr.add(Integer.parseInt(br.readLine()));
    }
    
	Collections.sort(arr,new Comparator<Integer>(){
      public int compare(Integer e1, Integer e2) {
        if((e1 % 10 != 0) && (e2 % 10 == 0)){
            return 1;
        }else if((e1 % 10 == 0) && (e2 % 10 != 0)){
          return -1 ;
        }
        else{
			return -1 ;
        }
    }
    });
    //System.out.println(arr);
    
  Collections.sort(arr, new Comparator<Integer>() {
    public int compare(Integer e1, Integer e2) {
        if (e1 % 10 == 0 && e2 % 10 != 0 || (e2 % 10 == 0 && e1 % 10 != 0) || e1 % 10 == 0 || e2 % 10 == 0) {
            return 0;
        } else {
            if (e1 % 10 < e2 % 10) {
                return 1;
            } else {
                return -1;
            }
        }
    }
});

    //System.out.println();
	int sum = 0;
    //System.out.println(arr);
    for(int i= 0; arr.isEmpty()!=true ;){
     	sum+=arr.remove(i);
      	if(arr.isEmpty()){
          break;
        }else if(sum%10 != 0){
      		sum+= (10-(sum%10));
    	}
    }
    System.out.println(sum);
    
  }
}


Measured memory_bytes: 20692
from functools import reduce

def gcd(a,b):
  while b:
    c = a%b
    a = b
    b = c    
  return a

n,k = map(int,input().split())
A = list(map(int,input().split()))

ans = 'IMPOSSIBLE'  

if max(A) < k:
  pass
else:  
  m = reduce(gcd,A)
  for i in range(n):
    if (k-A[i])%m == 0:
      ans = 'POSSIBLE'
      break
  
print(ans)    

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

#define fi(a,b) for(int i=a;i<b;++i)
typedef long long ll;
///////////////////

int const N = 1e6 + 41;
int const MOD = 1e9 + 7;

int n, m, k;
int f[N], invf[N];
int th[N];
int ans;

void add(int &a, int b){
	a += b;
	while(a >= MOD) a -= MOD;
	while(a < 0) a += MOD;
}

int mul(int a, int b){
	return (ll) a * b % MOD;
}

int bp(int x, int d){
	int res = 1;
	while(d){
		if(d&1) res = mul(res, x);
		d >>= 1;
		x = mul(x, x);
	}
	return res;
}

int inv(int x){
	return bp(x, MOD-2);
}

int dg[N];

int getc(int n, int k){
	if(k > n) return 0;
	int res = f[n];
	res = mul(res, invf[k]);
	res = mul(res, invf[n-k]);
	return res;
}

void init(){
	f[0] = 1;
	fi(1, N) f[i] = mul(f[i-1], i);
	fi(0, N) invf[i] = inv(f[i]);
	th[0] = 1;
	fi(1, N) th[i] = mul(th[i-1], 3);
	dg[0] = 1;
	int all = 1;
	int bad = 0;
	fi(1, m+k+1){
		all = mul(all, 2);
		bad = mul(bad, 2);
		int b0 = getc(i-1, k);
		add(bad, b0);
		int b1 = getc(i-1, m);
		add(bad, b1);
		dg[i] = all;
		add(dg[i], -bad);
	}
}

void solve(){
	int x = n + m + k;
	fi(n, x+1){
		int f = getc(i-1, n-1);
		int g = dg[i-n];
		int t = th[x-i];
		add(ans, mul(f, mul(g, t)));
	}
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%d %d %d",&n,&m,&k);

	init();

	solve();

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

	return 0;
}

Measured memory_bytes: 15872
from copy import deepcopy

def warshall_floyd(n,a):
    d = deepcopy(a)
    is_via = [[False] * n for _ in range(n)]
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if i == j:
                    continue
                # 経由する場合
                if (d[i][k] != 0 and d[k][j] != 0) and (d[i][j] == d[i][k] + d[k][j]):
                    is_via[i][j] = True
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    flag = a == d
    return flag, is_via

N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]

flag, is_via = warshall_floyd(N,A)

if not flag:
    print(-1)
    exit()

ans = 0
for i in range(N):
    for j in range(i,N):
        if is_via[i][j]:
            continue
        ans += A[i][j]

print(ans)

Measured memory_bytes: 56796
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e15;
using namespace std;
typedef long long ll;
int main() {
  ll n;
  cin >> n;
  vector<ll> p(n);
  map<ll, ll> mp;
  REP(i, n) {
    cin >> p[i];
    p[i]--;
    mp[p[i]] = i;
  }
  set<ll> st;
  ll ans = 0;
  REPR(x, n - 1) {
    ll i = mp[x];
    ll c = 0;

    st.insert(i);
    vector<ll> l(2, -1);
    vector<ll> r(2, n);

    {
      auto it = st.find(i);
      REP(j, 2) {
        if (it == st.begin()) break;
        --it;
        l[j] = *it;
      }
    }

    {
      auto it = st.find(i);
      REP(j, 2) {
        ++it;
        if (it == st.end()) break;
        r[j] = *it;
      }
    }

    vector<ll> ls(2), rs(2);
    ls[0] = i - l[0];
    ls[1] = l[0] - l[1];
    rs[0] = r[0] - i;
    rs[1] = r[1] - r[0];
    c = ls[0] * rs[1] + ls[1] * rs[0];

    ans += c * (x + 1);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 12032
import java.util.*;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        ArrayList<String> word_list = new ArrayList(Arrays.asList("dream", "dreamer", "erase", "eraser"));
        char[] S_char_list = new StringBuilder(S).reverse().toString().toCharArray();

        int idx = 0;
        int tmp_idx = 0;

        boolean next_flg = true;
        while (idx < S_char_list.length) {
            for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            }
            if (!next_flg)
                break;
        }

        System.out.println(idx >= S_char_list.length ? "YES" : "NO");
    }
}

Measured memory_bytes: 27860
n=int(input())
a=list(map(int,input().split()))
dic={}
mx=[0,0]
for x in a:
    if x in dic:
        dic[x]+=1
    else:
        dic[x]=1
    if dic[x]==2:
        dic[x]=0
        for i in range(2):
            mx.sort()
            if mx[i]<x:
                mx[i]=x
                break
print(mx[0]*mx[1])

Measured memory_bytes: 18060
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
  
signed main(){
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout.precision(20);
  
  int n;
  cin >> n;
  vec a(n);
  vector<vector<P>> xy(n);
  REP(i, n){
    cin >> a[i];
    REP(j, a[i]){
      P p;
      cin >> p.first >> p.second;
      p.first--;
      xy[i].push_back(p);
    }
  }

  int ans = 0;
  REP(i, 1 << n){
    bool breakFlag = false;
    int t = 0;
    REP(j, n){
      if(i >> j & 1){
        REP(k, a[j]){
          if( (i >> xy[j][k].first & 1) != xy[j][k].second){
            breakFlag = true;
          }
        }
        if(!breakFlag) t++;
      }
      if(breakFlag) break;
    }
    if(!breakFlag){
      ans = max(ans, t);
    }
  }

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

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char* argv[])
{
    vector<int> candy(3); cin >> candy[0] >> candy[1] >> candy[2];
    sort(candy.begin(), candy.end());

    cout << (candy[0]+candy[1] == candy[2] ? "Yes" : "No") << endl;
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vll h(n);
    rep(i,n) cin>>h[i];
    set<ll> s;
    rep(i,n){
        if (s.lower_bound(h[i]+2)!=s.end()){
            cout<<"No\n";
            return 0;
        }
        s.ins(h[i]);
    }
    cout<<"Yes\n";
    return 0;
}


Measured memory_bytes: 5760
a[],x;main(i,j){for(;~j;++i)i<6?x|=1<<(gets(a+i),j=a[i]-=49):i>10?x=i=0:printf("%d\n",x^x&-x&&x-7?j=a[i-5],x&2?j+x%2:j?1:2:3);}

Measured memory_bytes: 520
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (a); i < (b); ++i)
#define repr(i, a, b) for (ll i = (a); i > (b); --i)
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
vector<ll> fact(1e5 + 10);
vector<ll> invs(1e5 + 10);

ll mod_pow(ll x, ll m, ll mod)
{
    // x ** m % mod
    if (m == 0)
    {
        return 1;
    }
    else if (m % 2 == 0)
    {
        ll half = mod_pow(x, m / 2, mod);
        return half * half % mod;
    }
    else
    {
        return x * mod_pow(x, m - 1, mod) % mod;
    }
}

ll perm(ll n, ll r)
{
    if (n < r)
        return 0;
    return fact[n] * invs[n - r] % mod;
}

ll k;
vector<vector<ll>> es(1e5 + 10, vector<ll>());
ll ans;
void dfs(ll v, ll p = -1)
{
    // 親かどうかで挙動が変わる
    for (ll u : es[v])
    {
        if (u == p)
            continue; // 親には遷移しない
        dfs(u, v);
    }
    ll nk = (p == -1) ? k : k - 2;
    ll c = (p == -1) ? es[v].size() + 1 : es[v].size() - 1;
    ans *= perm(nk, c);
    ans %= mod;
}

int main()
{
    ll n;
    cin >> n >> k;
    rep(i, 0, n - 1)
    {
        ll a, b;
        cin >> a >> b;
        --a;
        --b;
        es[a].push_back(b);
        es[b].push_back(a);
    }

    fact[0] = 1;
    rep(i, 1, k + 1) fact[i] = fact[i - 1] * i % mod;
    invs[k] = mod_pow(fact[k], mod - 2, mod);
    repr(i, k - 1, -1) invs[i] = invs[i + 1] * (i + 1) % mod;

    ans = 1;
    dfs(0);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 10100;
int a[N];
int b[N];

int main () {
	//std::ios::sync_with_stdio(false);
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
	int n;
	cin >> n;
	ll suma = 0, sumb = 0;
	forn(i, n) {
		cin >> a[i];
		suma += a[i];
	}
	forn(i, n) {
		cin >> b[i];
		sumb += b[i];
	}
	ll col2 = 0;
	forn(i, n) {
		col2 += max(0, (b[i] - a[i] + 1) / 2);
	}
	if (suma > sumb) {
	 	puts("No");
	 	return 0;
	}
	if (col2 <= sumb - suma) {
		puts("Yes");
		return 0;		
	} else {
		puts("No");
		return 0;
	}

	

	return 0;
}

Measured memory_bytes: 384
import io
import os
from collections import defaultdict

DEBUG = False
if not DEBUG:

    input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

    R, C, K = [int(x) for x in input().split()]
    grid = [[0 for c in range(C)] for r in range(R)]
    for r, c, v in ((int(x) for x in input().split()) for i in range(K)):
        grid[r - 1][c - 1] = v
else:
    import random

    random.seed(0)
    R, C = 3000, 3000
    # 2 * 10**5 / 90 * 10**5 full
    grid = [
        [int(random.randint(1, 90) <= 2) * random.randint(0, 10 ** 9) for c in range(C)]
        for r in range(R)
    ]
    print(sum(bool(grid[r][c]) for r in range(R) for c in range(C)))
    print("done gen")

    from timeit import default_timer as timer

    startTime = timer()


currRow = [[0 for i in range(3 + 1)] for c in range(C + 1)]
prevRow = [0 for c in range(C + 1)]
nextPrevRow = [0 for c in range(C + 1)]

inf = float("inf")
for r in range(R):
    for c in range(C):
        for numTakenThisRow in range(3 + 1):
            best = max(
                currRow[c - 1][numTakenThisRow],  # came from left
                prevRow[c],  # came from top, didn't take curr
                currRow[c - 1][numTakenThisRow - 1] + grid[r][c]
                if numTakenThisRow
                else 0,  # came from left, took curr
                prevRow[c] + grid[r][c]
                if numTakenThisRow == 1
                else 0,  # came from top, took curr
            )
            currRow[c][numTakenThisRow] = best
        nextPrevRow[c] = max(currRow[c][i] for i in range(3 + 1))
    prevRow, nextPrevRow = nextPrevRow, prevRow
print(prevRow[C - 1])

if DEBUG:
    print(timer() - startTime)


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

using namespace std;

int main()
{
        int a[5][5]={0};

        for(int i=0;i<3;i++)
        {
                int t1,t2;
                cin>>t1>>t2;
                a[t1][t2]=1;
                a[t2][t1]=1;
        }

        for(int i=2;i<=4;i++)
        {
                for(int j=2;j<=4;j++)
                {
                        for(int k=2;k<=4;k++)
                        {
                                if(i==j || j==k || i==k)
                                        continue;
                                
                                if(a[1][i]==1 && a[i][j]==1 && a[j][k]==1)
                                {
                                        cout<<"YES"<<endl;
                                        return 0;
                                }
                        }
                }
        }

        cout<<"NO"<<endl;

        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repX(i, n ,x) for (int i = x; i < (int)(n); i++)
#define repBack(i, n) for (int i = n; i >= 0; i--)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
	int N,X,T;
	cin >> N >> X >> T;
	cout << dup(N,X)*T << endl;

	return 0;
}


Measured memory_bytes: 3600
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
#define debug printf("%s %d\n", __FUNCTION__, __LINE__)
const int inf = 2147483647;

const int maxn = 2000000 + 10;

int n, m;
bool Forward[maxn], back[maxn];

int main(int argc, char **argv) {
    scanf("%d%d", &n, &m); 
    for (int i = 1; i <= m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        if (u == 1) Forward[v] = true;
        if (v == n) back[u] = true;
    }
    for (int i = 1; i <= n; i++) 
        if (Forward[i] && back[i]) {
            printf("POSSIBLE");
            return 0;
        }
    printf("IMPOSSIBLE");
    return 0;
}



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

int main(void){
    int n, d;
    cin >> n >> d;
    int ans = n/(2*d+1);
    
    if(n % (2*d+1) != 0){
        ans++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
S_list = list(map(int,input().split()))
A,B,C,D = S_list
takahashi ,aoki = A, C
while takahashi > 0 or aoki > 0:
    aoki = aoki - B
    if aoki <=0 :
        break
    takahashi = takahashi - D
    if takahashi <=0:
        break
        """
    print("あおき:"+str(aoki))
    print("たかはし:"+str(takahashi))
		"""
if takahashi > aoki:
    result = "Yes"
else:
    result = "No"
print(result)

Measured memory_bytes: 9008
using System;
using System.Collections.Generic;
using System.Linq;
using static Scanner;

class Program
{
    static void Main() => new Program().Solve();

    public void Solve()
    {
        _ = Read();
        string s = Read();
        int ans = 0;
        for (int i = 0; i < 1000; i++)
        {
            int a = s.IndexOf($"{i:000}"[0]);
            if (a == -1) continue;
            int b = s[(a + 1)..].IndexOf($"{i:000}"[1]);
            if (b == -1) continue;
            int c = s[(a + b + 2)..].IndexOf($"{i:000}"[2]);
            if (c == -1) continue;
            ans++;
        }
        Console.WriteLine(ans);
    }
}

static class Scanner
{
    static Queue<string> que = new Queue<string>();
    public static string Read() { if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s); return que.Dequeue(); }
    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());
    public static decimal ReadDecimal() => decimal.Parse(Read());
    public static IEnumerable<string> Read(long n) { for (long i = 0; i < n; i++) yield return Read(); }
    public static IEnumerable<int> ReadInt(long n) => Read(n).Select(int.Parse);
    public static IEnumerable<long> ReadLong(long n) => Read(n).Select(long.Parse);
    public static IEnumerable<double> ReadDouble(long n) => Read(n).Select(double.Parse);
    public static IEnumerable<decimal> ReadDecimal(long n) => Read(n).Select(decimal.Parse);
}


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

#define sfor(i,a,n) for(int i=a;i<n;i++)
#define efor(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define t int tc; cin>>tc; while(tc--)
#define ll long long
const ll mod=1000000007;

int solve(){
    return 0;
}
int32_t main(){
    static const int _ = []() {
        ios::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        return 0;
    }();
    int n;
    vector<int> vec;
    //idhar dekho idhar
    string s;
    cin>>s;
    n= s.length();
    cout<< string( n, 'x')<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define endl "\n"
int dp[100005];
int getAns(int a[],int i,int n){
    if(i == n-1)return 0;
    if(dp[i] != -1)return dp[i];
    //jump to i+1
    int x = INT_MAX;
    if(i < n-1)x = abs(a[i+1] - a[i]) + getAns(a,i+1,n);

    //jump to i+2
    int y = INT_MAX;
    if(i < n-2)y = abs(a[i+2] - a[i]) + getAns(a,i+2,n);
    return dp[i] = min(x,y);
}
int main(){
    FASTIO
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    memset(dp,-1,sizeof(dp));
    cout<<getAns(a,0,n)<<endl;
}


Measured memory_bytes: 7296
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<char> v(n);
  for(int i = 0; i < n; i++){
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  if(v[n - 1] == 'Y'){
    cout << "Four" << endl;
  }
  else{
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 384
import sys
fin = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush


def initialize(adj, s):
    MAX_NUM = float('inf')
    parent = {s: None}
    d = {vertex: MAX_NUM for vertex in adj.keys()}
    d[s] = 0
    return d, parent


def initialize_int(adj, s):
    """
    assume that all vertex in {0, 1, 2, ..., N - 1}
    """
    N = len(adj)
    MAX_NUM = float('inf')
    d = [MAX_NUM] * N
    d[s] = 0
    parent = [None] * N
    return d, parent


# Dijkstra can work using a minheap which does not have decrease_key.
# and also we do not have to implement Vertex class.
# Instead, we can use (distance, vertex).
# in this case, the time it takes is O(ElgE).
# E is at most O(V^2), thus O(ElgE) = O(ElgV).
def dijkstra_simple(adj, w, s):
    d, parent = initialize_int(adj, s)
    priority_queue = []
    heappush(priority_queue, (d[s], s))
    while priority_queue:
        distance, source = heappop(priority_queue) 
        for neighbor in adj[source]:
            new_distance = distance + w[(source, neighbor)]
            if new_distance < d[neighbor]:
                d[neighbor] = new_distance
                parent[neighbor] = source
                heappush(priority_queue, (new_distance, neighbor))
    return d


n, m, s, t = [int(elem) for elem in fin().split()]
s -= 1
t -= 1
adj = [[] for _ in range(n)]
yen_weights = dict()
snuuk_weights = dict()
for _ in range(m):
    u, v, a, b = [int(elem) for elem in fin().split()]
    u -= 1
    v -= 1
    for v1, v2 in [(u, v), (v, u)]:
        adj[v1].append(v2)
        yen_weights[(v1, v2)] = a
        snuuk_weights[(v1, v2)] = b

d_yen = dijkstra_simple(adj, yen_weights, s)
d_snuuk = dijkstra_simple(adj, snuuk_weights, t)
min_cost = float('inf')
min_cost_after_each_year_reversed = []
for vertex in reversed(range(n)):
    min_cost = min(min_cost, d_yen[vertex] + d_snuuk[vertex])
    min_cost_after_each_year_reversed.append(min_cost)

initial_money = 10**15
for cost in reversed(min_cost_after_each_year_reversed):
    print(initial_money - cost)


Measured memory_bytes: 93724
#include <iostream>
using namespace std;
int ans;
int N, A, B;
int sumDigit(int n) {
	int ret = 0;
	while (0 < n) {
		ret += n % 10;
		n /= 10;
	}
	return ret;
}
int main(void) {
	cin >> N >> A >> B;
	for (int i = 1; i <= N; ++i) {
		int sum = sumDigit(i);
		if (A <= sum && sum <= B) ans += i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
g = [[0]*(n+1) for _ in range(n+1)]
for i in range(n):
    u, k, *v, = map(int, input().split())
    for vi in v:
        g[u][vi] = 1

d = [0]*(n+1)
f = [0]*(n+1)
t = 0


def dfs(u):
    global t
    if d[u] != 0:
        return
    t += 1
    d[u] = t
    for i, v in enumerate(g[u]):
        if v == 1:
            dfs(i)
    t += 1
    f[u] = t


for i in range(1, n+1):
    if d[i] == 0:
        dfs(i)
for i in range(1, n+1):
    print(f"{i} {d[i]} {f[i]}")



Measured memory_bytes: 5728
def runlen(a):
    n = len(a)
    result = []
    count = 1
    for i in range(n):
        if i == n - 1 or a[i] != a[i + 1]:
            result.append((count, a[i]))
            count = 1
        else:
            count += 1
    return result

N, K = map(int, input().split())
S = input()
rl = runlen(S)
if rl[0][1] == '0':
    rl.insert(0, (0, '1'))
if rl[-1][1] == '0':
    rl.append((0, '1'))
rl, _ = zip(*rl)
l = len(rl)
first = 0
last = 2 * K + 1
stands = sum(rl[first: last])
result = stands
while last + 2 <= l:
    stands += -sum(rl[first: first + 2]) + sum(rl[last: last + 2])
    result = max(result, stands)
    first += 2
    last += 2
print(result)

Measured memory_bytes: 19068
import sys
from itertools import accumulate

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def prime_numbers(n):
    if n < 2:
        return []

    m = (n + 1) // 2
    p = [1] * m
    for i in range(1, int((n ** 0.5 - 1) / 2) + 1):
        if p[i]:
            p[2 * i * (i + 1) :: 2 * i + 1] = [0] * (((m - 1) - 2 * i * (i + 1)) // (2 * i + 1) + 1)

    return {2} | {2 * i + 1 for i in range(1, m) if p[i]}


def main():
    primes = prime_numbers(10 ** 5)
    A = [1 if n in primes and (n + 1) // 2 in primes else 0 for n in range(10 ** 5 + 1)]
    A = tuple(accumulate(A))

    Q, *LR = map(int, open(0).read().split())
    ans = []
    for l, r in zip(*[iter(LR)] * 2):
        ans.append(A[r] - A[l - 1])

    print(*ans, sep='\n')
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 29000
#include <stdio.h>
#define MAX_V 10000

int prime[MAX_V + 1];

int main() {
	int data[10000];
	int i, k, cnt = 0, n, p1, q1;
	for(i = 2; i <= MAX_V; i++) {
		prime[i] = 1;
	}
	for(i = 2; i * i <= MAX_V; i++) {
		if(prime[i]) {
			for(k = 2 * i; k <= MAX_V; k += i) {
				prime[k] = 0;
			}
		}
	}
	while(1) {
		scanf("%d", &n);
		if(n == 0) break;
		data[cnt] = n;
		cnt++;
	}
	for(i = 0; i < cnt; i++) {
		for(k = 5; k <= data[i]; k++) {
			if(prime[k] && prime[k-2]) {
				p1 = k - 2;
				q1 = k;
			}
		}
		printf("%d %d\n", p1, q1);
	}
	return 0;
}

Measured memory_bytes: 1856
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

#define MAX 256

int main(void){
	int n;

	scanf("%d", &n);

	int A[4][3][10] = { 0 };
	int b, f, r, v;

	for (int i = 0; i < n; i++){
		scanf("%d%d%d%d", &b, &f, &r, &v);
		A[b - 1][f - 1][r - 1] += v;
	}

	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 3; j++){
			for (int k = 0; k < 10; k++){
				printf(" %d", A[i][j][k]);
			}
			printf("\n");
		}
		if (i != 3){
			for (int l = 0; l < 20; l++){
				printf("#");
			}
			printf("\n");
		}
	}

	return 0;
}

Measured memory_bytes: 3224
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>

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

ll mod=1000000007;
ll fac[3000]={};
ll ifac[3000]={};
ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mod;
        x = x*x % mod;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0|| b<0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % mod;
    return tmp * fac[a] % mod;
}

int main(){
    fac[0]=1;
    ifac[0]=1;
    REP(i,2999){
        fac[i+1]=fac[i]*(i+1)%mod;
        ifac[i+1]=ifac[i]*mpow(i+1,mod-2)%mod;
    }
    //ll a=comb(5,3)%mod;
    int n,k;
    scanf("%d%d",&n,&k);
    int l=n-k;
    REP(i,k){
        if(i>((n+1)/2)){
            printf("0\n");
            continue;
        }
        //printf("%lld %lld %lld %lld\n",comb(k-1,i),comb(l-1,i+1),comb(l-1,i),comb(l-1,i-1));
        ll red;
        if(l!=0)red=comb(l-1,i+1)+comb(l-1,i)*2+comb(l-1,i-1);
        else if(i==0)red=1;
        else red=0;
        ll ans=comb(k-1,i)*red%mod;
        printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//B
int main(){
  
  int A, B, C, D; cin >> A >> B >> C >> D;
  while(A>0){
    C -= B;
    if(C>0) A -= D;
    else{
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  
}

Measured memory_bytes: 3588
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,m,a,x[100005]={},ans=0;
  cin >> n >> m;
  for(int i=1; i<=n; i++) {
    x[i]=inf;
  }
  for(int i=0; i<m; i++) {
    cin >> a;
    x[a]=0;
  }
  for(int i=2; i<=n; i++) {
    if(x[i-1]!=inf) {
      x[i]=min(x[i-1]+1,x[i]);
    }
  }
  for(int i=n-1; i>=1; i--) {
    if(x[i+1]!=inf) {
      x[i]=min(x[i+1]+1,x[i]);
    }
  }
  for(int i=1; i<=n; i++) {
    ans=max(ans,x[i]);
  }
  cout << ans << endl;
}


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

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

int H,W,X;
string S[303];
int dp[303][303];
string A,B;
int dif[303][303][303];


int dpdp(int a,int b) {
	if(a==0 || b==0) return 0;
	if(dp[a][b]>=0) return dp[a][b];
	
	return dp[a][b]=min(dpdp(a-1,b),dpdp(a,b-1))+dif[X][a][b];
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	cin>>H>>W;
	FOR(y,H) cin>>S[y];
	
	FOR(x,W-1) {
		for(int d=-(H-1);d<=H-1;d++) {
			r=0;
			FOR(y,H) {
				if(y-d>=0 && y-d<H) r += (S[y][x]==S[y-d][x+1]);
				if(y+1-d<=H && y+1-d>=0) dif[x][y+1][y+1-d]=r;
			}
		}
	}
	
	int ret=0;
	FOR(x,W-1) {
		MINUS(dp);
		X=x;
		ret+=dpdp(H,H);
	}
	cout<<ret<<endl;
	
	
}


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


Measured memory_bytes: 108032
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int INF = 1e9;
ll dp[100001][3];
int main() {
	int n;
	cin >> n;
	vector<ll>a(n), b(n), c(n);
	rep(i, n) {
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	rep(i, n) {
		if (i - 1 >= 0) {
			dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
			dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
			dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
		}
		
	}
	ll ans = max(dp[n - 1][0], max(dp[n - 1][2], dp[n - 1][1]));
	//rep(i, 3)cout << dp[n - 1][i] << endl;
	cout << ans;
	return 0;
}

Measured memory_bytes: 7992
N = int(input())
A = list(map(int, input().split()))

xo = A[0]
l = 0
r = 1
ans = 0

while l < N:
    if r == N:
        ans += r - l
        l += 1
        continue
    if xo ^ A[r] == xo + A[r]:
        xo += A[r]
        r += 1
    else:
        ans += r - l
        xo ^= A[l]
        l += 1
print(ans)


Measured memory_bytes: 32032
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
ll dp[2][100001][100];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    string K;
    int D;
    dp[0][0][0] = 1;
    dp[1][0][0] = 1;
    cin >> K >> D;
    for(int i = 0; i < K.size(); i++){
        int m = K[K.size()-i-1]-'0';
        for(int j = 0; j < D; j++){
            for(int k = 0; k < 10; k++){
                if(k < m){
                    dp[0][i+1][(j+k)%D] += dp[1][i][j];
                }else if(k == m){
                    dp[0][i+1][(j+k)%D] += dp[0][i][j];
                }
                dp[1][i+1][(j+k)%D] += dp[1][i][j];
                dp[0][i+1][(j+k)%D] %= MOD;
                dp[1][i+1][(j+k)%D] %= MOD;
            }
        }
    }
    dp[0][K.size()][0]--;
    dp[0][K.size()][0] += MOD;
    dp[0][K.size()][0] %= MOD;
    cout << dp[0][K.size()][0] << endl;
}

Measured memory_bytes: 16768
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <unordered_map>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <deque>
#include <map>
using namespace std;

typedef long long ll;

int main(void)
{
	int a, b, c;
	cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);
	cout << a << " " << b << " " << c << endl;
	return 0;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a) {if(a){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
void YESNO(int a) {if(a){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}}
void AorB(int a,string b,string c) {if(a){cout<<b<<endl;}else{cout<<c<<endl;}}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int n;
    string s;
    cin>>n>>s;
    Vi w(n),e(n);
    REP(i,0,n){
        if(i==0){
            if(s[0]=='W') w[0]=1;
            else e[0]=1;
            continue;
        }
        if(s[i]=='W'){
            w[i]=w[i-1]+1;
            e[i]=e[i-1];
        }else{
            w[i]=w[i-1];
            e[i]=e[i-1]+1;
        }
    }
    int ans=e[n-1]-e[0];
    REP(i,1,n){
        chmin(ans,w[i-1]+(e[n-1]-e[i]));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5396
#include<bits/stdc++.h>
using namespace std;
int memoLongestPath(map<int, vector<int>>& ma, int s, vector<int>& dp){
    if(dp[s] != -1)
        return dp[s];

    if(ma[s].size() == 0){
        dp[s] = 0;
        return dp[s];
    }
    int mxm = 0;
    for(auto x:ma[s]){
        int cur = 1 + memoLongestPath(ma, x, dp);
        mxm = max(mxm, cur);
    }

    return dp[s] = mxm;

}

int main(){
    map<int, vector<int>> ma;
    int n,m;
    cin>>n>>m;
    int x,y;
    for(int i=0; i<m; i++){
        cin>>x>>y;
        ma[x].push_back(y);
    }
    vector<int> dp(n+1, -1);
    int mxm = 0;
    for(int i=1; i<=n; i++){
        mxm = max(mxm, memoLongestPath(ma, i, dp));
    }
    cout<<mxm<<endl;
    return 0;
}


Measured memory_bytes: 18648
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()
int main(){
    int a,b;char op;cin>>a>>op>>b;
    if(op=='+')cout<<a+b<<endl;
    else cout<<a-b<<endl;
}


Measured memory_bytes: 3560
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int D = sc.nextInt();
        int count = 0;
        for (int i = 0; i < N; i++) {
            double X = sc.nextDouble();
            double Y = sc.nextDouble();
            double distance = Math.sqrt(Math.pow(X, 2) + Math.pow(Y, 2));
            if (distance <= D)
                count++;
        }
        sc.close();

        System.out.println(count);
    }
}


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

namespace Atc_0042
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();

            int result = 700;

            if (S.Substring(0, 1) == "o")
            {
                result += 100;
            }

            if (S.Substring(1, 1) == "o")
            {
                result += 100;
            }

            if (S.Substring(2, 1) == "o")
            {
                result += 100;
            }

            Console.WriteLine(result);
        }
    }
}


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

int N;
int A[20];
int x[20][20];
int y[20][20];

int counter(int x) {
	if(x == 0) return 0;
	return counter(x >> 1) + (x & 1);
}

void solve() {
	cin >> N;
	for(int i = 1; i <= N; i++) {
		cin >> A[i];
		for(int j = 1; j <= A[i]; j++) {
			cin >> x[i][j] >> y[i][j];
		}
	}
	int ans = 0;
	for(int bits = 1; bits < (1 << N); bits++) {
		bool ok = true;
		for(int i = 1; i <= N; i++) {
			if(!(bits & (1 << (i-1)))) continue;
			for(int j = 1; j <= A[i]; j++) {
				if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
			}
		}
		if(ok) ans = max(ans, counter(bits));
	}
	cout << ans << endl;
	return;
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
	int num, i, j, a, m = 0;
	cin >> num;
	vector<int> d(num + 1), ans(num + 1, false);
	for (i = 1; i <= num >> 1; i++)
		scanf("%d", &d[i]);
	for (; i <= num; i++) {
		scanf("%d", &d[i]);
		ans[i] = d[i];
		if (ans[i])
			m++;
	}
	for (i = num >> 1; i > 0; i--) {
		for (a = 0, j = i << 1; j <= num; j += i) {
			a ^= ans[j];
		}
		if (a != d[i]) {
			ans[i] = true;
			m++;
		}
	}
	printf("%d\n", m);
	for (i = 1; i <= num; i++) {
		if (ans[i])
			printf("%d ", i);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
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;}
// head
int main() {
	string s,t;
	cin>>s>>t;
	
	
    int lenS=s.length();
    int lenT=t.length();
    
	int maxx=0,cnt=0;
	for(int i=0;i+lenT<=lenS;i++){
		cnt=0;
		rep(j,0,t.size() ){
			if(s[i+j]==t[j]){
				cnt++;
			}
		}
		maxx=max(cnt,maxx);
	}
	printf("%d",t.size()-maxx);
} 

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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define FOR(i,c,num) for(ll (i)=(c);(i)<(num);++(i))
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return x;}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

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

	auto N=in(),W=in();
	vll w(N),v(N);
	REP(i,N){
		w[i]=in();
		v[i]=in();
	}
	ll V = *max_element(ALL(v))*N;

	vvll dp(N+1,vll(V+1,1ll<<60));
	dp[0][0]=0;
	REP(i,N){
		REP(j,V+1){
			chmin(dp[i+1][j],dp[i][j]);
			if(j+v[i]<=V) chmin(dp[i+1][j+v[i]],dp[i][j]+w[i]);
		}
	}
	ll X=0;
	REP(i,V+1){
		if(dp[N][i]<=W) X=i;
	}
	out(X);
	return 0;
}


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

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

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <int,int> mp;
vector<int> V;
#define debug(x) cerr << #x << ": " << x << "\n";
#define INF (1<<29) //53687091
#define INFLL (1ll<<58)
#define EPS (1e-10)
static const int MAX=(int) 1e5;
static const int MOD=(int) 1e9+7;
static const int NMAX=50;
static const int MMAX=50;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
int N;
ll a,min_a=INFLL,max_a=-INFLL;
void solve(){
    
}

int main(){
    cin.tie(0);  ios::sync_with_stdio(false);
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> a;
        min_a=min(min_a,a);
        max_a=max(max_a,a);
    }
    cout<<max_a-min_a<<"\n";
    
    return 0;
}


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

int N;
vector<int> X, Y;

double dist(int i, int j)
{
  return sqrt(pow(X.at(i) - X.at(j), 2) + pow(Y.at(i) - Y.at(j), 2));
}

int main()
{
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    int x, y;
    cin >> x >> y;
    X.push_back(x);
    Y.push_back(y);
  }
  vector<int> order(N);
  for (int i = 0; i < N; i++)
  {
    order.at(i) = i;
  }
  double bunshi = 0;
  // O(N(N!))のアルゴリズム
  do
  {
    for (int i = 0; i < N - 1; i++)
    {
      bunshi += dist(order.at(i), order.at(i + 1));
    }
  } while (next_permutation(order.begin(), order.end()));
  double bunbo = 1;
  for (int i = 1; i <= N; i++)
  {
    bunbo *= i;
  }
  printf("%.10f\n", bunshi / bunbo);
}

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

 int main() {
   int N;
   int count = 0;
   cin >> N;
   int p[60];
   string res = "NO";
   for (size_t i = 0; i < N; i++) {
     cin >> p[i];
     if (p[i] != i + 1) {
       count++;
     }
   }
   if (count == 0 || count == 2) {
     res = "YES";
   }
   cout << res << '\n';
 }


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

using namespace std;
using LL = long long;

constexpr int N = 2e5 + 5;

int n;
int a[N];
vector< int> E[N];

int before[N];
int ans[N];

set< int> st;

void dfs(int x, int p = -1) {
	auto it = st.lower_bound(a[x]);
	if (it == st.end()) {
		before[x] = -1;
	}
	else {
		before[x] = *it;
		st.erase(it);
	}

	st.insert(a[x]);
	ans[x] = st.size();

	for (int &to : E[x]) {
		if (to == p) continue;
		dfs(to, x);
	}

	st.erase(a[x]);
	if (before[x] != -1) st.insert(before[x]);
}

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

	for (int i = 0; i < n - 1; i++) {
		int a, b;
		cin >> a >> b;
		E[a].push_back(b);
		E[b].push_back(a);
	}

	dfs(1);

	for (int i = 1; i <= n; i++) cout << ans[i] << "\n";
}

Measured memory_bytes: 31228
N = int(input())
A = list(map(int,input().split()))
box = [0] * (N+1)
res = []

for i in range(1, N+1)[::-1]:
  s = 0
  for j in range(1, N // i):
    s += box[(j+1)*i]
  if s % 2 != A[i-1]:
    box[i] = 1
    res.append(i)

print(len(res))
print(*res)

Measured memory_bytes: 13996
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;
using ll = long long;
constexpr long long MOD = 1000000007;
int main(){
mp::cpp_int x;
cin >> x;
mp::cpp_int motode = 100;
ll ans = 0;
while(true){
    motode *= 101;
    motode /= 100;
    ans++;
    if (motode >= x) break;
    if (ans == 3760) break;
}
cout << ans << endl;
}


Measured memory_bytes: 3660