akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
int main()
{
    int n,x,a[4]={0};
    scanf("%d",&n);
    while(n--)
    {
    	scanf("%d",&x);
    	a[x%4]++;
	}
	a[1]+=a[3];
	if(a[0]+1<a[1]) printf("No\n");
	else if((a[0]>=a[1]&&a[2])||a[2]==0) printf("Yes\n");
	else printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

typedef pair<int, int> pii;

const int MAXN = 1e5 + 5;
int N, M;
vector<pii> neigh[MAXN];
bool tk[MAXN];
int val[MAXN];

bool Fill(int v, int col) {
	if (tk[v]) return val[v] == col;
	tk[v] = true;
	val[v] = col;
	for (int i = 0; i < neigh[v].size(); i++) {
		pii u = neigh[v][i];
		if (!Fill(u.first, val[v] + u.second)) return false;
	}
	return true;
}

int main() {
	scanf("%d %d", &N, &M);
	for (int i = 0; i < M; i++) {
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		neigh[a].push_back(pii(b, c));
		neigh[b].push_back(pii(a, -c));
	}
	for (int i = 1; i <= N; i++) {
		if (!tk[i]) {
			if (!Fill(i, 0)) {
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int A,B;
    cin >> A >> B;
    cout << (A-1)*(B-1) << "\n";
}

Measured memory_bytes: 256
use std::io;

fn main() {
    let _ = input_number();
    let numbers = input_number();
    let min = numbers.iter().min().unwrap();
    let max = numbers.iter().max().unwrap();
    let sum: i64 = numbers.iter().sum();

    println!("{} {} {}", min, max, sum);
}

#[allow(dead_code)]
fn input_number() -> Vec<i64> {
    let mut input = String::new();

    io::stdin().read_line(&mut input)
        .expect("Failed to read line");

    let vec: Vec<i64> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap_or(0))
        .collect();
    vec
}



Measured memory_bytes: 5032
#include<bits/stdc++.h>
using namespace std;
struct Node{
	   int father,left,right,child;
};
struct Node T[100001];
int n,k,id,x;
int getdepth(Node u){
	int d=0;
	while (u.father!=-1){
		  u=T[u.father];
		  d++;
	}
	return d;
}
string check(Node u){
	   if (u.father==-1)
	      return "root";
	   if (u.child==0)
	      return "leaf";
	   return "internal node";
}
void print(Node u){
	 int c;
	 c=u.left;
	 cout<<c;
	 while (c!=-1){
	 	   c=T[c].right;
	 	   if (c!=-1)
	 	   	  cout<<", "<<c;
	 }
}
int main(){
    cin>>n;
    for (int i=0; i<n; i++){
    	T[i].father=T[i].left=T[i].right=-1; 
	}
    int l;
	for (int i=0; i<n; i++){
		cin>>id>>k;
		if (k==0) continue;
		T[id].child=k;
	    cin>>T[id].left;
	    l=T[id].left;
	    T[T[id].left].father=id;
	    k--;
		int tt=0;
		while (k--){
			  cin>>x;
			  T[x].father=id;
			  T[l].right=x;
			  l=x;
		}
	}
	int xx;
	for (int i=0; i<n; i++){
		cout<<"node "<<i<<":"<<" parent = "<<T[i].father<<", depth = "<<getdepth(T[i])<<", "<<check(T[i])<<", ";
		if (T[i].child==0)
		   cout<<"[]"<<endl;
		else{
			cout<<"[";
			print(T[i]);
			cout<<"]"<<endl;
		}
		
	}	
	return 0;
}


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

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> grid(h);
  rep(i,h){
    cin >> grid[i];
  }
  int count = 0;
  rep(i,h){
    rep(j,w){
      if(grid[i][j] == '.') count++;
    }
  }
  vector<vector<int>> dist(h, vector<int>(w, INF));
  vector<vector<int>> prev_x(h, vector<int>(w, -1));
  vector<vector<int>> prev_y(h, vector<int>(w, -1));
  queue<P> que;
  dist[0][0] = 0;
  que.push({0, 0});
  while(!que.empty()){
    P p = que.front(); que.pop();
    int y = p.first, x = p.second;
    rep(i,4){
      int ny = y + dy[i], nx = x + dx[i];
      if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
      if(grid[ny][nx] == '#') continue;
      if(dist[ny][nx] != INF) continue;
      dist[ny][nx] = dist[y][x] + 1;
      prev_y[ny][nx] = y;
      prev_x[ny][nx] = x;
      que.push({ny, nx});
    }
  }
  if(dist[h-1][w-1] == INF){
    cout << -1 << endl;
    return 0;
  }
  cout << count - dist[h - 1][w - 1] -1 << endl;
  //経路復元
  //int y = h - 1;
  //int x = w - 1;
  //while(x != -1 && y != -1){
  //  grid[y][x] = 'a';
  //  int px = prev_x[y][x];
  //  int py = prev_y[y][x];
  //  x = px, y = py;
  //}
  //int ans = 0;
  //rep(i,h){
  //  rep(j,w){
  //    if(grid[i][j] == 'a'){
  //      rep(i,4){
  //        int ny = i + dy[i], nx = j + dx[i];
  //        if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
  //        if(grid[ny][nx] == '#' || grid[ny][nx] == 'a') continue;
  //        ans++;
  //        grid[ny][nx] = '#';
  //      }
  //    }
  //  }
  //}
}

Measured memory_bytes: 256
function Main(input){
	input = input.split("\n");
	var arr = input[1].split(" ").map(Number);
	var dp = [0,Math.abs(arr[0]-arr[1])];
	for(var i=2;i<arr.length;i++){
		dp[i] = Math.min(dp[i-2]+Math.abs(arr[i-2]-arr[i]),dp[i-1]+Math.abs(arr[i-1]-arr[i]));
	}
	console.log(dp[dp.length-1]);
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 27696
import math

# A = [list(map(int, input().split())) for _ in range(3)]
# k = int(input())
# B = [int(input()) for _ in range(n)]
# X = list(map(int, input().split()))
h, w = map(int, input().split())
print(1) if min(h, w) == 1 else print(math.ceil((h*w)/2))


Measured memory_bytes: 2940
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        packs: [u64; 3],
    }
    let mut packs = packs;
    packs.sort();
    println!("{}", if packs[0] + packs[1] == packs[2] { "Yes" } else { "No" });
}


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

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int mod = 998244353;
const int MAXN = (int)3e5 + 5;

int fact[MAXN];

int rev[MAXN];

ll a, b, k;

int n, ans;

int binPow(int a, int b, int m = mod) {
    int ret = 1;

    while (b > 0) {
        if (b & 1) {
            ret = (ret * 1ll * a) % m;
        }

        a = (a * 1ll * a) % m;
        b >>= 1;
    }

    return ret;
}

void pre() {
    fact[0] = rev[0] = 1;

    for (int i = 1; i < MAXN; ++i) {
        fact[i] = (fact[i - 1] * 1ll * i) % mod;
        rev[i] = binPow(fact[i], mod - 2);
    }
}

void addMod(int &a, int b, int m = mod) {
    a += b;

    if (m <= a) {
        a -= m;
    }
}

int C(int n, int k) {
    if (k < 0 || k > n) {
        return 0;
    }

    return fact[n] * 1ll * rev[k] % mod * rev[n - k] % mod;
}


int main() {
    pre();

		scanf("%d %lld %lld %lld", &n, &a, &b, &k);

    for (int x = 0; x <= n; ++x) {
        ll left = k - x * a;

        if (left < 0) {
            break;
        }

        if (left % b == 0 && left / b <= n) {
            int y = left / b;
            addMod(ans, C(n, x) * 1ll * C(n, y) % mod);
        }
    }

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



    return 0;
}

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

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}
typedef long long int ll;
typedef long double ld;

int main() {
	Boost();

	int n; cin >> n;
	string s; cin >> s;

	vector < int > A(n), B(n);
	for(int i = 0; i < n; ++i) {
		A[i] = s[i] == 'E';
		if(i) A[i] += A[i - 1];
	}
	for(int i = n - 1; i >= 0; --i) {
		B[i] = s[i] == 'W';
		if(i != n - 1) B[i] += B[i + 1];
	}

	int ans = INT_MAX;
	ans = n - 1 - B[1];
	ans = min(ans, n - 1 - A[n - 2]);
	for(int i = 1; i < n - 1; ++i) {
		int have = A[i - 1] + B[i + 1];
		ans = min(ans, n - 1 - have);
	}

	cout << ans;
	return 0;
}

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

using namespace std;

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  cout << a * b << "\n";
  return 0;
}


Measured memory_bytes: 3576
def examA():
    A, B = LI()
    ans = A*B
    print(ans)
    return

def examB():
    N = I()
    A = LI()
    for a in A:
        if a==0:
            print(0)
            return
    ans = 1
    for a in A:
        ans *= a
        if ans>10**18:
            print(-1)
            return
    print(ans)
    return

def examC():
    A, B = list(map(float, input().split()))
    #print(A,B)
    if int(A)==0:
        print(0)
        return
    if int(B)==0:
        print(0)
        return
    ans = A*(B+_ep)
    print(int(ans-_ep))
    return

# from Taka0310
def examC2():
    A, B = list(map(dec, input().split()))
    ans = int(dec(A*B))
    print(ans)
    return

def examD():
    def factorization(n):
        arr = defaultdict(int)
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr[i] = cnt
        if temp != 1:
            arr[temp] = 1
        if arr == []:
            arr[n] = 1
        return arr
    C = [0,1,3,6,10,15,21,28,36,45]
    N = I()
    F = factorization(N)
    ans = 0
    #print(F)
    for f in F.values():
        for i in range(10):
            if C[i]>f:
                ans += i-1
                break
    print(ans)
    return

def examE():
    N = I()
    A = [0]*N
    B = [0]*N
    for i in range(N):
        A[i],B[i] = LI()
    A.sort()
    B.sort()
    if N%2==0:
        L = (A[N//2-1] + A[N//2])/2
        R = (B[N//2-1] + B[N//2])/2
        ans = int((R-L)*2) +1
    else:
        L = A[N//2]
        R = B[N//2]
        ans = (R-L)+1

    print(ans)
    return

def examF():
    inv = pow(2,mod2-2,mod2)
    N, S = LI()
    A = LI()
    dp = [[0]*(S+1)for _ in range(N+1)]
    dp[0][0] = pow(2,N,mod2)
    for i in range(N):
        a = A[i]
        for s in range(S+1):
            dp[i+1][s] += dp[i][s]
            dp[i+1][s] %= mod2
            if (s+a<=S):
                dp[i+1][s+a] += dp[i][s]*inv%mod2
                dp[i + 1][s+a] %= mod2
   # print(dp)
    ans = dp[-1][-1]%mod2
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<60
_ep = 10**(-16)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC2()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 78268
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define mp make_pair

int main()
{
	int n,q; cin >> n >> q;
	int arr[n];  forn(i,0,n) cin >> arr[i];
	// int left[q];

	vector<tuple<int,int, int> > v;
	vector<pair<int,int>> v2;
	// cout << "aaa" << endl;
	forn(i,0,q)
	{
		int l,r; cin >> l >> r;
		--l;
		int L = l; --r;
		l = l / (int)sqrt(n);
		v.pb(make_tuple(l,r,i));
		v2.pb(make_pair(L,r));
	}

	// cout << "asfd " << endl;
	sort(v.begin(),v.end());

	// forn(i,0,n)
	// {
	// 	cout << get<0>(v[i]) << " " << get<1>(v[i]) << " " << get<2>(v[i]) << endl;
	// 	cout << v2[get<2>(v[i])].first << " " << v2[get<2>(v[i])].second << endl;
	// }

	int start = v2[get<2> (v[0])].first;
	int end = start;
	int ans[q];
	// int count = 0;

	int hash[6*100005]; forn(i,0,6*100005) hash[i] = 0;
	hash[arr[start]] = 1; int count = 1; 
	// cout << "check " << hash[5] << " " << start << " " << end << endl;

	

	forn(i,0,q)
	{
		int k = get<2>(v[i]);

		int l = v2[k].first; int r = v2[k].second;

		// cout << "l "  << l << " r " << r << endl;
		// if(i == 2 || i == 3 ) cout << start << " " << end << endl;

		// int count = 0;

		while(l < start)
		{
			start--;
			hash[arr[start]]++;
			if(hash[arr[start]] == 1)
				count++;
			// start--;
		}

		while( l > start)
		{
			hash[arr[start]]--;
			// if(i==3)
			// {
			// 	cout << "start " << start << endl;
			// 	cout << "arr " << arr[start] << endl;
			// 	cout << "hash " << hash[arr[start]] << endl;
			// }
			if(hash[arr[start]] == 0)
				count--;
			start++;
		}

		while( r > end )
		{
			end++;
			hash[arr[end]]++;
			if(hash[ arr[end] ] == 1)
				count++;
			// end++;
		}

		while( r < end )
		{
			// end--;
			hash[arr[end]]--;
			if(hash[arr[end]] == 0)
				count--;
			end--;

		}

		// cout << count << endl;
		// if( i== 2 || i == 3 ) cout << "aaa " << hash[2] << " " << hash[5] << " " << hash[6] << " " << hash[7] <<" " << hash[9] << " " << hash[1] <<  endl;
		ans[k] = count;
	}

	// sort(v2.begin(), v2.end());
	// cout << "answer " << endl;
	forn(i,0,q)
		cout << ans[i] << endl;

	return 0;

}

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

#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)

using ll = long long;
#define INF 1e9

int N;
vector<int> s;

int main(){
  int X, A, B;
  cin >>  X >> A >> B;

  if(B - A > X){
    cout << "dangerous" << endl;
  }
  else if(B-A > 0){
    cout << "safe" << endl;
  }
  else{
    cout << "delicious" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


vector<bool> ok;
bool bellmanford(int s, int N, vector<vector<pair<int, int>>>& graph, vector<int>& d){
  d = vector<int>(N, INF);
  d[s] = 0;
  REP(i, N) REP(v, N) REP(k, graph[v].size()){
    if(!ok[v]) continue;
    pair<int, int> e = graph[v][k];
    if(d[v] != INF && d[e.first] > d[v] + e.second){
      d[e.first] = d[v] + e.second;
      if(i == N-1) return true;
    }
  }
  return false;
}

signed main() {
  int N, M, P;
  cin >> N >> M >> P;

  vector<vector<pair<int, int>>> graph(N);
  vector<vector<int>> back(N);
  REP(i, M){
    int u, v, d;
    cin >> u >> v >> d;
    u--; v--;
    graph[u].emplace_back(v, P-d);
    back[v].emplace_back(u);
  }

  ok.resize(N, false);
  ok[N-1] = true;

  queue<int> q;
  q.push(N-1);
  while(!q.empty()){
    int p = q.front(); q.pop();
    for(auto v : back[p]){
      if(ok[v]) continue;
      ok[v] = true;
      q.push(v);
    }
  }
  vector<int> dist(N);

  if(bellmanford(0, N, graph, dist)){
    cout << -1 << "\n";
    return 0;
  }

  cout << max(0ll, -dist[N-1]) << "\n";

  return 0;
}

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

#define gc( ) std::getchar( )
#define pc( i ) std::putchar( i )
#define space ' '
#define enter '\n'
#define RE cout << "Passing [" << __FUNCTION__ << "] on " << __LINE__ << enter
#define DEBUG(...) for( auto &i: __VA_ARGS__ ) cout << i << " "; cout << enter
using std::make_pair;

template < typename T >
inline T read( )
{
 T x = 0;
 char ch = gc( );
 bool f = 0;
 while( !std::isdigit( ch ) )
 {
  f = ( ch == '-' );
  ch = gc( );
 }
 while( std::isdigit( ch ) )
 {
  x = x * 10 + ( ch - '0' );
  ch = gc( );
 }
 return f ? -x : x;
}

template < typename T >
void print( T x )
{
 if( x < 0 )
 {
  x = -x;
  pc( '-' );
 }
 if( x < 10 )
 {
  pc( x + 48 );
  return;
 }
 print < T > ( x / 10 );
 pc( x % 10 + 48 );
 return ;
}

namespace Solution
{
#define IOS std::ios::sync_with_stdio( false ), std::cin.tie( 0 ), std::cout.tie( 0 )
#define Rep( i, j, k ) for( int i = j; i >= k; --i )
#define rdi( ) read < int > ( )
#define rdl( ) read < long long > ( )
#define pti( i ) print < int > ( i ), putchar( space )
#define ptl( i ) print < long long > ( i ), putchar( space )
#define For( i, j, k ) for( int i = j; i <= k; ++i )
 using std::cin;
 using std::cout;
 using std::endl;
 using std::vector;
 using std::map;
 using std::queue;
 using std::deque;
 using std::set;
 using std::pair;
 const int N = 204001, mod = 1e9 + 7;
 int n;
 void Fakemain( )
 {
  n = rdi( );
  vector < int > a( n ), b( n ), c( n + 1, -1 ), d( n + 1, -1 );
  for( auto &i: a )
   i = rdi( );
  for( auto &i: b )
   i = rdi( );
  for( int i = 0; i < n; ++i )
   c[ a[ i ] ] = i;
  for( int i = n - 1; ~i; --i )
   d[ b[ i ] ] = i;
  int D = 0;
  for( int i = 1; i <= n; ++i )
  {
   if( !~c[ i ] || !~d[ i ] )
    continue;
   D = std::max( D, c[ i ] - d[ i ] + 1 );
  }
  std::rotate( b.begin( ), b.begin( ) + n - D, b.end( ) );
  for( int i = 0; i < n; ++i )
  {
   if( a[ i ] == b[ i ] )
   {
    cout << "No";
    return;
   }
  }
  cout << "Yes\n";
  for( int i = 0; i < n; ++i )
   cout << b[ i ] << " ";
  return;
 }

} // namespace Solution

int main( int argc, char* argv[] )
{
 Solution::Fakemain( );
 return 0;
}

Measured memory_bytes: 6376
package main

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

func main() {
	N := ReadInt()
	c := make([]int, 3)
	for i := 0; i < N; i++ {
		a := ReadInt()
		if a%4 == 0 {
			c[2]++
		} else if a%2 == 0 {
			c[1]++
		} else {
			c[0]++
		}
	}
	if c[1] > 0 {
		c[0]++
	}
	if c[2]+1 >= c[0] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }


Measured memory_bytes: 4236
import heapq

n, h = [ int(v) for v in input().split() ]
sword_list = []
for i in range(n):
    a, b = [ int(v) for v in input().split() ]
    sword_list.append((-a,1))
    sword_list.append((-b,0))
heapq.heapify(sword_list)

turn = 0
while h > 0:
    d = heapq.heappop(sword_list)
    if d[1] == 0:
        h += d[0]
        turn += 1
    else:
        attack_turn = (( h - d[0]- 1 ) // (-d[0]))
        h += d[0] * attack_turn
        turn += attack_turn
print(turn)

Measured memory_bytes: 83160
import sys


def input():
    return sys.stdin.readline().strip()


def main():
    N, X, Y = map(int, input().split())
    ans = [0] * N
    for i in range(1, N + 1):
        for j in range(i + 1, N + 1):
            if i <= X and j <= X:
                dist = j - i
            elif i <= X and j <= Y:
                dist = min(j - i, X - i + 1 + Y - j)
            elif i <= X and Y <= j:
                dist = X - i + j - Y + 1
            elif X <= i <= Y and j <= Y:
                dist = min(j - i, i - X + 1 + Y - j)
            elif X <= i <= Y and Y <= j:
                dist = min(j - i, i - X + 1 + j - Y)
            else:
                dist = j - i
            ans[dist] += 1

    for i in range(1, N):
        print(ans[i])


main()


Measured memory_bytes: 3444
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
const long long int m=pow(10,9)+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,d;
    ll l=0,r=0;
    cin>>a>>b>>c>>d;
    l=b/c-(a-1)/c;
    r=b/d-(a-1)/d;
    ll g=__gcd(c,d);
    g=(c*d)/g;
    ll x=b/g-(a-1)/g;
    cout<<(b-a+1)+x-(r+l)<<endl;
    return 0;
}

Measured memory_bytes: 3656
N=int(input())
t =[0]*N
x =[0]*N
y =[0]*N
for i in range(0,N):
    t[i],x[i],y[i] =map(int,input().split())
check=0
d=0
if abs(x[0])+abs(y[0])>t[0] or (abs(x[0])+abs(y[0]))%2!=(t[0])%2:
    check=1
if check==1:
    print('No')
    d=1
for i in range(1,N):
    if d==1:
        break
    check=0
    if abs(x[i]-x[i-1])+abs(y[i]-y[i-1])>t[i]-t[i-1] or (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2!=(t[i]-t[i-1])%2:
        check=1
    if check==1:
        print('No')
        d=1
        break
if d!=1:
    print('Yes')


Measured memory_bytes: 11636
#include <algorithm>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> ns;

    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (i % 2 == 0)
            ns.push_back(a);
        else
            ns.insert(ns.begin(), a);
    }

    if (ns.size() % 2 == 1) reverse(ns.begin(), ns.end());

    for (auto c : ns) {
        cout << c << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int n; cin >> n;
    vector<int> S(n);
    rep(i, n) cin >> S[i];
    int q; cin >> q;
    int ans = 0;
    rep(i, q) {
        int x; cin >> x;
        auto it = lower_bound(all(S), x);
        if (it!=S.end() && *it==x) ans++;
    }
    cout << ans << endl;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<string> S(N);
  vector<string> T = {"AC","WA","TLE","RE"};
  vector<int> C(4);
  
  for (int i = 0; i < N; i++){
    cin >> S.at(i);
    for (int j = 0; j < 4; j++){
      if(S.at(i) == T.at(j)){
      	C.at(j) ++;
      }
    }
  }
  
  for (int j = 0; j < 4; j++){
    cout << T.at(j) << " x " << C.at(j) << endl;
  }
}


Measured memory_bytes: 6316
import std;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto S = sread();
    long N = S.length;
    auto dp = new long[][](2, 2019);
    // dp[0][0] = 1;
    long ans;
    foreach (i; 0 .. N)
    {
        dp[(i + 1) & 1][] = 0;
        dp[(i + 1) & 1][(S[i] - '0')]++;
        foreach (j; 0 .. 2019)
        {
            long x = (j * 10) + (S[i] - '0');
            dp[(i + 1) & 1][x % 2019] += dp[i & 1][j];
        }
        // if (dp[i + 1][0] != 0)
        // {
        //     writeln(" ", i);
        // }
        ans += dp[(i + 1) & 1][0];
    }
    writeln(ans);
}


Measured memory_bytes: 3848
#include <iostream>
#include <algorithm>
using namespace std;
int a[1010];
int sum[1010];

int main()
{
    int k,n;cin >> n >> k;
    
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
    }
    sort(a,a+n);
    int ans =0;
    for(int i = 0;i < k;i++)ans+= a[i];
    cout << ans;

    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long 
#define P pair<int,int>
#define PP pair<P,int>
using namespace std;
int inf = 1ll << 30;

int main(){
    ll a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;

    if(v - w < 0) cout << "NO" << endl;

    else if((v - w)*t >= abs(a - b)) cout << "YES" << endl;
     
    else cout << "NO" << endl;


}


Measured memory_bytes: 3636
def SelectionSort(A, n):
    sw = 0
    for i in xrange(n):
        minj = i
        for j in xrange(i, n):
            if A[j] < A[minj]:
                minj = j
        temp = A[minj]
        A[minj] = A[i]
        A[i] = temp
        if i != minj:
            sw += 1
    return sw

def printArray(A, n):
    for i in xrange(n):
        if i < n-1:
            print A[i],
        else:
            print A[i]

n = input()
arr = map(int, raw_input().split())
cnt = SelectionSort(arr, n)
printArray(arr, n) 
print cnt

Measured memory_bytes: 6472
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

S = input()
T = input()

cnt = 0
for s, t in zip(S, T):
    if s!=t:
        cnt += 1
print(cnt)


Measured memory_bytes: 68816
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
        ll t,n,m,i,a,b;
        cin>>n;
        vector<ll> v(n+1);
        for(i=1;i<=n;i++)
        {
            cin>>v[i];
        }
        a=1;b=0;
        for(i=1;i<=n;i++)
        {
            if(v[i]==a)
            {
                b++;
                a++;
            }
        }
        if(b==0)
            cout<<-1;
        else
            cout<<n-b;
}
    


Measured memory_bytes: 4828
function Main(input) {
  input = input.split('\n');
  var last = input.length - 1;
  var limit;
  var max;
  if (input[last] === "") {
    limit = input[last - 1];
    max = input[last - 2];
  } else {
    limit = input[last];
    max = input[last - 1];
  }
  var min = input[0];
  var maxDistance = max - min;
  if (maxDistance > limit) {
    console.log(':(');
  } else {
    console.log('Yay!');
  }
}

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


Measured memory_bytes: 7372
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }

    let mut ans = 0;
    let mut minus = 0;
    for &a in a.iter() {
        ans += a.abs();
        if a < 0 {
            minus += 1;
        }
    }

    if minus % 2 == 1 {
        ans -= a.iter().map(|a| a.abs()).min().unwrap() * 2;
    }

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


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<pair<int, int> > task_info;
    
    for(int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        task_info.push_back(make_pair(b, a));
    }
    
    sort(task_info.begin(), task_info.end());

    int sum = 0;

    for(int i = 0; i < n; i++) {
        sum += task_info[i].second;
        if(sum <= task_info[i].first) {
            //ok
        }
        else {
            cout << "No" << endl;
            return 0;
        }

    }
    
    cout << "Yes" << endl;

    return 0;

}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;

// DAME:
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;

    int a[81][81], b[81][81];
    rep(i, h)rep(j, w) cin >> a[i][j];
    rep(i, h)rep(j, w) cin >> b[i][j];

    bool dp[81][81][6500];
    dp[0][0][abs(a[0][0] - b[0][0])] = true;

    rep(i, h)rep(j, w)rep(k, 6400){
        if(dp[i][j][k]){
            int kk = abs(a[i+1][j] - b[i+1][j]);
            int kkk = abs(a[i][j+1] - b[i][j+1]);
            dp[i+1][j][k+kk] = true;
            dp[i+1][j][abs(k-kk)] = true;
            dp[i][j+1][k+kkk] = true;
            dp[i][j+1][abs(k-kkk)] = true;
        }
    }
    rep(i, 6500){
        if(dp[h-1][w-1][i]){
            cout << i << endl;
            return 0;
        }
    }
    cout << 11111 << endl;

}

Measured memory_bytes: 41984
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
vector<int>edge[100007];
int depth[100007],temp[100007],fa[100007];
void dfs(int u,int f){
    depth[u]=depth[f]+1;
    temp[u]=depth[f]+1;
    fa[u]=f;
    for(auto it:edge[u])
        if(it!=f){
            dfs(it,u);
            temp[u]=max(temp[u],temp[it]);
        }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int s,t;
    cin>>s>>t;
    for(int i=1;i<n;++i){
        int u,v;
        cin>>u>>v;
        edge[u].push_back(v);
        edge[v].push_back(u);
    }
    dfs(t,0);
    int ans=0;
    int x=s;
    while(1){
        if(depth[s]-depth[x]>=depth[x]-depth[t])
            break;
        ans=max(ans,temp[x]-1);
        x=fa[x];
    }
    cout<<ans-1;
    return 0;
}


Measured memory_bytes: 12032
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)

int gcd(int a,int b)
{
	if(b==0) return a;
	return gcd(b,a%b);
}


int main(){ FastIO;

int a,b,c;cin>>a>>b>>c;
int g=gcd(a,b),ans=g;
for(int i=g;i>0;i--)
{
	if(g%i==0) c--;
	if(c==0) {ans=i;break;}
}
cout<<ans;
return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    if (S == "ABC") {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }

    return 0;
}


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

char maps[102][102];
bool cheak[100][100];
int h,w;
int dy[4]={-1,0,1,0};
int dx[4]={0,-1,0,1};

void dfs(int y,int x,char sym);

int main(){
  int co;
  while(1){
    cin>>h>>w;
    if(!h && !w)break;
    co=0;
    memset(cheak,false,sizeof(cheak));
    for(int i=0;i<h;i++){
      cin>>maps[i];
    }
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(cheak[i][j]==false){
	  co++;
	  dfs(i,j,maps[i][j]);
	}
      }
    }
    cout<<co<<endl;
  }
}

void dfs(int y,int x,char sym){
  cheak[y][x]=true;
  for(int i=0;i<4;i++){
    int ny=y+dy[i];
    int nx=x+dx[i];
    if(ny>=0 && ny<h && nx>=0 && nx<w && cheak[ny][nx]==false && maps[ny][nx]==sym){
      dfs(ny,nx,sym);
    }
  }
  return;
}

Measured memory_bytes: 1660
#include<cstdio>
#include<algorithm>

int n, m, d[200000], t[200000];
int cnt = 0;

bool solve(int i) 
{
    if (d[i + cnt] == t[i]) {

 


        if (i + 1 != m)
           
            return solve(i + 1); 
        else
            return true;

    } else if (d[i + cnt] < t[i]) {

        
        


        cnt++;
        return solve(i);

    }
    else {


     


        return false;
    }
}



int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &d[i]);
    scanf("%d", &m);
    for (int i = 0; i < m; i++)
        scanf("%d", &t[i]);

    std::sort(&d[0], &d[n]);
    std::sort(&t[0], &t[m]);

    if (solve(0))
        printf("YES");
    else
        printf("NO");
}

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

#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--)

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1001001000;

int main(){
   int a,b,c,d,e,k;
   cin>>a>>b>>c>>d>>e>>k;
   cout << (e-a<=k?"Yay!":":(")<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<(n);i++)
const int MOD = 1e9 + 7 ;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=1e5+3;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
 
      int m,k;
      cin>>k>>m;
      if(m==0)
      {
            for(int i=0;i<(1<<k);i++) cout<<i<<" "<<i<<" ";
            return 0;
      }
      if(m>=(1<<k))
      {
            cout<<"-1";
      }
      else{
            vector<int> ans;
            int o=0;
            for(int i=0;i<(1<<k);i++)
            {
                  if(i!=m)
                  {
                        ans.pb(i);
                        o^=i;
                  }
            }
            if(o!=m)
            {
                  cout<<"-1\n";
                  return 0;
            }
            for(auto x:ans) cout<<x<<" ";
            cout<<m<<" ";
            reverse(all(ans));
            for(auto x:ans) cout<<x<<" ";
            cout<<m<<" ";
      }
}     



Measured memory_bytes: 2932
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod    1000000007
#define PI 2*acos(0.0)

const int N = 200005;
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};

int32_t main()
{
    io;
    int n, m, k, sx, sy, tx, ty;
    cin>>n>>m>>k>>sx>>sy>>tx>>ty;
    sx--;
    sy--;
    tx--;
    ty--;
    string inp[n];
    for(int i= 0; i< n; i++)
        cin>>inp[i];

    int dist[n][m];
    for(int i= 0; i< n; i++)
        for(int j = 0; j < m; j++)
            dist[i][j] = INT_MAX;

    dist[sx][sy] = 0;
    bool vis[n][m];
    memset(vis, 0, sizeof(vis));
    queue< pair<int, pii > > q;
    q.push({0, {sx, sy}});
    while(!q.empty())
    {
        int cost = q.front().first, ax = q.front().second.first, ay = q.front().second.second;
        q.pop();
        /*if(vis[ax][ay])
            continue;
        vis[ax][ay] = 1;*/
        for(int i = 0; i < 4; i++)
        {
            for(int d = 1; d<= k; d++)
            {
                int nx = ax + dirx[i]*d, ny = ay + diry[i]*d;
                if(nx >= n || ny >= m || nx < 0 || ny < 0 || inp[nx][ny] == '@')
                    break;
                if(dist[nx][ny] > cost+1)
                {
                    dist[nx][ny] = cost + 1;
                    q.push({cost + 1, {nx, ny}});
                }
                else if(dist[nx][ny] == cost+1)
                    continue;
                else
                    break;
            }
        }
    }
    if(dist[tx][ty] == INT_MAX)
        cout<<-1;
    else
        cout<<dist[tx][ty];
    return 0;
}


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

int main(){
    int n,m;
    cin>>n>>m;
    
    set<pair<int,int>> s;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        s.emplace(a,b);
    }
    
    for(int i=2;i<n;i++){
        if(s.count(make_pair(1,i)) && s.count(make_pair(i,n))){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

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

#define int long long

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = 0;
    for(int i=1;i<n;i++)ans+=(n-1)/i;
    cout << ans << endl;
}



Measured memory_bytes: 3620
// Ivan Carvalho
// Problem K - Educational Dynamic Programming Contest - AtCoder
// Link : https://atcoder.jp/contests/dp
#include <bits/stdc++.h>
using namespace std;

const int MAXK = 1e5 + 10;
const int MAXN = 1e3 + 10;

int A[MAXN],dp[MAXK],N,K;

int solve(int k){

	if(dp[k] != -1) return dp[k];

	if(k == 0) return dp[k] = 0;

	int ans = 0;
	for(int i = 1;i<=N;i++){
		if(A[i] > k) continue;
		if(solve(k - A[i]) == 0){
			ans = 1;
			break;
		}
	}

	return dp[k] = ans;

}

int main(){

	memset(dp,-1,sizeof(dp));
	cin >> N >> K;
	for(int i = 1;i<=N;i++){
		cin >> A[i];
	}

	if(solve(K)) printf("First\n");
	else printf("Second\n");

	return 0;

}

Measured memory_bytes: 7112
#include <iostream>
#include <algorithm>
#include <string>
#include <map>

std::map<int, int> mp;
int a[100000 + 1];
 
int main() {

	int n, m;
	int l; std::string s;
	int ansa, answ;
	ansa = answ = 0;

	std::cin >> n >> m;

	for (int i = 0; i < m; ++i) {

		std::cin >> l >> s;
		if (s == "WA" && mp[l] == 0) a[l]++;
		else if (s == "AC" && mp[l] == 0) { ansa++; mp[l] = 1; }

	}
	for (int i = 1; i <= n; i++)	if (mp[i] == 1)answ += a[i];
	
	std::cout << ansa << " " << answ << std::endl;

	return 0;
}

Measured memory_bytes: 5248
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = 1e18;
    if (a % 2 == 0) ans = 0;
    else            ans = min(ans, b * c);

    if (b % 2 == 0) ans = 0;
    else            ans = min(ans, c * a);

    if (c % 2 == 0) ans = 0;
    else            ans = min(ans, a * b);

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


Measured memory_bytes: 3640
L, R = 'L', 'R'
S = gets.chomp.split('')
size = S.length

ans = Array.new(S.length, 0)
i = 0
l, r, e = 0

while i + 1 < size do
  r = i
  while S[i] == R do
    i += 1
  end
  l = i

  while S[i] == L do
    i += 1
  end

  e = i
  rt = l - r
  lt = e - l

  ans[l - 1] = rt - rt / 2 + lt / 2
  ans[l] = rt / 2 + lt - lt / 2
end

puts ans.join(' ')


Measured memory_bytes: 22692
#include <iostream>
using namespace std ;
int s[15], h[15], c[15], d[15] ;
int main () {
  char op ;
  int a ;
  int n ;
  cin >> n ;
  for ( int i = 0 ; i < n ; i++ ) {
    cin >> op >> a ;
    if ( op == 'S') {
       s[a] = 1 ;
    } else if ( op == 'H') {
       h[a] = 1 ;
    } else if ( op == 'C') {
       c[a] = 1 ;
    } else if ( op == 'D') {
       d[a] = 1 ;
    }
  }
  for ( int i = 1 ; i < 14 ; i++) {
    if ( s[i] == 0 ) {
      cout << 'S' << ' ' << i << endl ;
      }
  }
  for ( int i = 1 ; i < 14 ; i++) {
    if ( h[i] == 0 ) {
      cout << 'H' << ' ' << i << endl ;
      }
  }
    for ( int i = 1 ; i < 14 ; i++) {
    if ( c[i] == 0 ) {
      cout << 'C' << ' ' << i << endl ;
      }
    }  
    for ( int i = 1 ; i < 14 ; i++) {
    if ( d[i] == 0 ) {
      cout << 'D' << ' ' << i << endl ;
      }
    }
} 


Measured memory_bytes: 3080
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define p_f(a) printf("%d ",a)
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;

int main()
{
    char c;
	cin>>c;
	c=c+1;
	cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
a_list = list(map(int, input().split()))
a_list.sort(reverse=True)

Alice = 0
Bob = 0

for i in range(len(a_list)):
    if i % 2 == 0:
        Alice += a_list[i]
    else:
        Bob += a_list[i]

print(Alice-Bob)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    if( s.at(0)!=s.at(1) && s.at(1)!=s.at(2) && s.at(2)!=s.at(0)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}




Measured memory_bytes: 256
#include <stdio.h>

int main(void){

    int A = 0;
    int B = 0;
    int C = 0;
    int D = 0;

    scanf("%d %d %d %d", &A, &B, &C, &D);

    while (A > 0 && C > 0){
        A -= D;
        C -= B;
    }

    if (C<= 0){
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    
    return 0;
}

Measured memory_bytes: 1648
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
int a[100010],b[100010],c[100010];
long long po1[100010],po2[100010];
long long sum1[100010],sum2[100010];
long long ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)   cin>>a[i];
	for(int i=1;i<=n;i++)   cin>>b[i];
	for(int i=1;i<=n;i++)   cin>>c[i];
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	int pos1=1,pos2=1;
	for(int i=1;i<=n;i++)
	{
		po1[i]=lower_bound(b+pos1,b+n+1,a[i])-b;
		if(b[po1[i]]==a[i])
		{
			po1[i]++;
			while(b[po1[i]]==a[i])
			{
				po1[i]++;
			}
		}
		pos1=po1[i];
		po2[i]=lower_bound(c+pos2,c+n+1,b[i])-c;
		if(c[po2[i]]==b[i])
		{
			po2[i]++;
			while(c[po2[i]]==b[i])
			{
				po2[i]++;
			}
		}
		pos2=po2[i];
	}
	for(int j=1;j<=n;j++)   po2[j]+=po2[j-1];
	for(int i=1;i<=n;i++)
	{
/*		for(int j=po1[i];j<=n;j++)
		{
			ans+=(n-po2[j]+1);
		}*/
		ans+=(n-po1[i]+1)*(n+1)-(po2[n]-po2[po1[i]-1]);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 2944
#include<cstdio>
#define MAX 10000
#define NIL -1

struct Node{int p,l,r;};
struct Node T[MAX];
int n;

void preParse(int u){
  if(u == NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u == NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postParse(int u){
  if(u == NIL) return ;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(){
  int i,v,l,r,root;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p = NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }

  for(i=0;i<n;i++){
    if(T[i].p == NIL) root = i;
  }

  printf("Preorder\n");
  preParse(root);
  printf("\nInorder\n");
  inParse(root);
  printf("\nPostorder\n");
  postParse(root);
  printf("\n");

  return 0;
}



Measured memory_bytes: 2764