akhauriyash/Code-Regression huggingface dataset:
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;


int main(void)
{
	//変数の宣言
	int n,k;
	char s[100010];
	int a[100010];
	int b[100010];

	//よく使う変数
	int i,j,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	int dummy;



	//データの読み込み

	scanf("%d %d",&n,&k);
//	scanf_s("%d %d",&n,&k);


	scanf("%s",&s);
//	scanf_s("%s",&s,100010);


/*	for(i=0;i<n;i++){
//		scanf(%d",&h[i]);
		scanf_s("%d",&h[i]);
	}*/

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理
	
	for(i=0;i<100010;i++){
		a[i]=0;
		b[i]=0;
	}

	temp1=0;
	temp2=0;
	flag=1;
	for(i=0;i<n;i++){
		if(flag==1){
			if(s[i]=='1'){
				a[temp1]++;
			}else{
				temp1++;
				flag=0;
				b[temp2]++;
			}
		}else{
			if(s[i]=='0'){
				b[temp2]++;
			}else{
				temp2++;
				flag=1;
				a[temp1]++;
			}
		}
	}

	temp=0;

	for(i=0;i<k;i++){
		temp=temp+a[i];
		temp=temp+b[i];
	}
	temp=temp+a[k];
	ans=temp;

	for(i=0;i+k<temp1;i++){
		temp=temp-a[i]-b[i];
		temp=temp+a[i+k+1]+b[i+k];
		ans=max(ans,temp);
	}

	//	printf("計算部分終了\n");

	//出力
	printf("%d",ans);

	//	printf("結果の出力終了\n");

	return 0;
}



Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N;
  cin >> N;
  int res = 0;
  FOR(i,1,N) res+=i;

  cout <<  res << endl;
}


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

#define REP(i,a,b) for(int i=a;i<(b);i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr int MOD9 = 1e9 + 9;

void FIN(int out) {
  cout << out << endl; exit(0);
}

int main() {
  int N; cin >> N;
  map<int, int> mp;
  rep(i, N) {
    int a; cin >> a;
    mp[a]++;
  }

  int64_t ans = 1;

  if (N % 2) {
    if (mp[0] != 1) { FIN(0); }
    for (int i = 1; i < N; i += 2) {
      if (mp[N - i] != 2) {
        FIN(0);
      }
      (ans *= 2) %= MOD;
    }
  } else {
    for (int i = 1; i < N; i += 2) {
      if (mp[i] != 2) {
        FIN(0);
      }
      (ans *= 2) %= MOD;
    }
  }

  cout << ans << endl;
}


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

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	int total = 0;
	for(int i=0;i<N;i++){
		cin >> A[i];
		total += A[i];
	}
	int n = 0;
	for(int i=0;i<N;i++){
		if(A[i]*4*M >= total){
			n++;
		}
	}
	if(n >= M){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
L = [0] * 200001
for i in range(N):
  L[A[i]] += 1
L.sort(reverse = True)
ans = 0
for i in range(K):
  ans += L[i]
print(N-ans)

Measured memory_bytes: 25432
#include <bits/stdc++.h>
#define i64 long long
#define mod (i64)(1e9+7)
using namespace std;
int main() {
	// your code goes here
	i64 n, res = 1LL; 
	cin>>n;
	for(int i=2;i<=n;i++) res = (res*i)%mod;
	printf("%d\n",res);
	return 0;
}

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

int main() {
    ll N, M;
    cin >> N >> M;
    vector<int> a(M);
    rep(i, M) cin >> a[i];
    ll sum = 0;
    rep(i, M) sum += a[i];
    if (sum > N) {
        cout << "-1" << endl;
        return 0;
    } else {
        cout << N - sum << endl;
        return 0;
    }
}

Measured memory_bytes: 3672
import sys
import numpy as np
N, W = map(int, input().split())
it = iter(map(int, sys.stdin.read().split()))
dp = np.zeros(W + 1, dtype=int)
for w, v in zip(it, it):
    np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print(dp[-1])

Measured memory_bytes: 19352
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			char[] c = String.valueOf(i).toCharArray();
			
			int num = 0;
			for (char d : c) {
				num += d - '0';
			}
			if (a <= num && num <= b) {
				ans += i;
			}
			
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1e-8

map<char, int> hand;

int main(){
	hand['q']=1;
	hand['w']=1;
	hand['e']=1;
	hand['r']=1;
	hand['t']=1;
	hand['a']=1;
	hand['s']=1;
	hand['d']=1;
	hand['f']=1;
	hand['g']=1;
	hand['z']=1;
	hand['x']=1;
	hand['c']=1;
	hand['v']=1;
	hand['b']=1;
	while(1){
		string str;
		cin >> str;
		if(str=="#")return 0;
		int n=str.length();
		int now = -1;
		int ret = -1;
		REP(i,n){
			if(hand[str[i]]!=now)ret++;
			now = hand[str[i]];
		}
		cout << ret << endl;
	}
}

Measured memory_bytes: 1192
N = int(input())
A = list(map(int, input().split()))
A_dic = { x: 0 for x in set(A)}
for a in A:
    A_dic[a] += 1
res_norm = sum([x*(x-1)//2 for x in A_dic.values()])
for a in A:
    print(res_norm - A_dic[a] + 1)

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define pb push_back
#define nl cout<<"\n"
#define F first
#define S second
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const ll MOD = 1000000007;
ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

template<class T1, class T2> void add( T1 &x, T2 y, ll m = MOD )
{
    x += y;
    if( x >= m )
        x -= m;
}

template<class T1, class T2> void sub( T1 &x, T2 y, ll m = MOD )
{
    x -= y;
    if( x < 0 )
        x += m;
}

int main() 
{
    fastio();

    int n;
    cin>>n;
    vector<ll>a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];

    ll ans = 0, mx = 0;
    for(int i=0;i<n;i++)
    {
        if( mx > a[i] )
            ans += mx - a[i];
        mx = max( mx, a[i] );
    }   
    cout<<ans,nl; 

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 4760
n = int(input())
arr = sorted(list(map(int, input().split())))+[0]

ans = 0
num = arr[0]
cnt = 0

for i in arr:
        if i == num: cnt += 1
        else:
                if cnt<num : dif = 1000000001
                else: dif = cnt-num
                ans += min(cnt, dif)
                cnt = 1
                num = i
print(ans)

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

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

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong W;
	cin >> W;

	cout << W*32 << endl;

	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep_ll(i,n) for(ll i = 0; i < (ll)(n); i++)

using namespace std;
 
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;

const long double PI = (acos(-1));
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int gcd(int a, int b){
    if(b == 0) return a;
 
    return gcd(b, a%b);
}
 
int main(){

   int n;
   cin >> n;

   if(n%10==3) cout << "bon";
   else if((n%10==0)||(n%10==1)||(n%10==6)||(n%10==8)) cout << "pon";
   else cout << "hon";
   
   return 0;
}

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

using namespace std;
using lli = long long int;
const lli maxn=1e6+5;
lli n,k;
lli a[maxn];
lli maxi=-1;
bool check(lli m)
{
    lli sl=0;
    for(lli i=0;i<n;i++)
	{
        sl+=a[i]/m;
        if(a[i]%m==0)
		{
			sl-=1;
		}
	}
	return (sl<=k);
}
int findmin()
{
    lli dau=1;
    lli cuoi=maxi;
    lli giua;
    lli m;
    while(dau<=cuoi)
	{
        giua=(dau+cuoi)/2;
        if(check(giua)==true)
		{
			m=giua;
			cuoi=giua-1;
		}
		else
		{
            dau=giua+1;
		}
	}
	return m;
}
void nhap()
{
    //freopen("test.inp","r",stdin);
    cin>>n>>k;
    for(lli i=0;i<n;i++)
	{
        cin>>a[i];
        maxi=max(maxi,a[i]);
	}
	cout<<findmin();
}
int main()
{
    nhap();
}


Measured memory_bytes: 5088
package main

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

var in = newIo(bufio.NewScanner(os.Stdin))

func main() {
	in.setSplit(bufio.ScanLines)
	var fline = strings.Split(in.next(), " ")
	var _, _, x, y = perseInt(fline[0]), perseInt(fline[1]), perseInt(fline[2]), perseInt(fline[3])
	var xx = in.nextIntSlice(1, " ")[0]
	var yy = in.nextIntSlice(1, " ")[0]
	print(solve(x, y, xx, yy))
}

func print(result bool) {
	var r = "No War"
	if result {
		r = "War"
	}
	fmt.Println(r)
}

func solve(x int, y int, xx []int, yy []int) bool {
	xx = append(xx, x)
	yy = append(yy, y)
	sort.Sort(sort.Reverse(sort.IntSlice(xx)))
	sort.Sort(sort.IntSlice(yy))
	x1 := xx[0]
	y1 := yy[0]
	return x1 >= y1
}

type io struct {
	sc *bufio.Scanner
}

func newIo(sc *bufio.Scanner) *io {
	i := new(io)
	i.sc = sc
	i.sc.Split(bufio.ScanWords)
	return i
}

func (i *io) setSplit(f bufio.SplitFunc) {
	i.sc.Split(f)
}

func (i *io) nextIntSlice(y int, delim string) [][]int {
	result := make([][]int, y)
	for j := 0; j < y; j++ {
		line := i.next()
		result[j] = perseIntSlice(strings.Split(line, delim))
	}
	return result
}

func (i *io) next() string {
	i.sc.Scan()
	return i.sc.Text()
}

func (i *io) nextInt() int {
	return perseInt(i.next())
}

func (i *io) nextLong() int64 {
	return perseLong(i.next())
}

func perseInt(s string) int {
	in, _ := strconv.Atoi(s)
	return in
}

func perseLong(s string) int64 {
	in, _ := strconv.ParseInt(s, 10, 64)
	return in
}

func perseIntSlice(s []string) []int {
	var r = make([]int, len(s))
	for i := 0; i < len(s); i++ {
		r[i] = perseInt(s[i])
	}
	return r
}


Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define random_shuffle asdasdd

const int MAXN = 2 * 105000;

int n;
int a[MAXN], b[MAXN];
int an[MAXN], bn[MAXN];
int sLen;
int s[4 * MAXN];
int p[4 * MAXN];

int main() { 

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

  for (int i = 0; i < n; i++) {
    an[i] = a[i] ^ a[(i + 1) % n];
  }

  for (int i = 0; i < n; i++) {
    bn[i] = b[i] ^ b[(i + 1) % n];
  }

  sLen = 3 * n + 1;
  for (int i = 0; i < n; i++) {
    s[i] = bn[i];
  }
  s[n] = -1;
  for (int i = 0; i < n; i++) {
    s[n + 1 + i] = an[i];
  }
  for (int i = 0; i < n; i++) {
    s[2 * n + 1 + i] = an[i];
  }

  for (int i = 2; i <= sLen; i++) {
    int prev = p[i - 1];
    while (prev > 0 && s[prev] != s[i - 1])
      prev = p[prev];
    if (s[prev] == s[i - 1])
      prev++;
    p[i] = prev;
  }

  for (int i = n + 1; i < sLen; i++) {
    if (p[i] == n) {
      cout << i - (2 * n + 1) << " " << (a[i - (2 * n + 1)] ^ b[0]) << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 13184
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class Main {
    private static Scanner sc;
    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            String s = sc.next();
            int count = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'o') {
                    count ++;
                }
            }
            if (count + 15 - s.length() > 7) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 21076
n, x = map(int, input().split())
A = tuple(map(int, input().split()))
pre = max(0, A[0] - x)
ans = pre

for i in range(n - 1):
    a = A[i]
    b = A[i + 1]
    a -= pre
    tmp = 0
    if b > x:
        tmp += b - x
        b = x

    if a + b > x:
        tmp += a + b - x
    ans += tmp
    pre = tmp
print(ans)


Measured memory_bytes: 20012
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 10000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
	ll factorial[1000000];
	factorial[0] = 1;
	REP(i, 1000000 - 1){
		factorial[i+1] = (factorial[i] * (i+1)) % MOD;
	}
	int n, m;
	cin >> n >> m;
	if(abs(n-m) > 1) cout << 0 << endl;
	else if(n == m) cout << (2 * (factorial[n] * factorial[n]) % MOD) % MOD << endl;
	else cout << (factorial[n] * factorial[m]) % MOD << endl;
	return 0;
}


Measured memory_bytes: 8064
from collections import Counter
n=int(input())
V=list(map(int,input().split()))
v1=Counter(V[::2]).most_common()
v2=Counter(V[1::2]).most_common()
if len(v1) ==1:
  v1.append([0,0])
if len(v2) == 1:
  v2.append([0,0])
if v1[0][0]==v2[0][0]:
  if v1[1][1]>v2[1][1]:
    print(n-v1[1][1]-v2[0][1])
  else:
    print(n-v1[0][1]-v2[1][1])
else:
  print(n-v1[0][1]-v2[0][1])

Measured memory_bytes: 20820
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int B=N;
		int a=0;
		while(B>0) {
			a=a+B%10;
			B=(int)B/10;
		}
		if(N%a==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T> inline T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll a,b,k,x;cin>>a>>b>>k;
  x=a;
  a=max(0ll,a-k);
  k-=x;
  if(k>0)b=max(0ll,b-k);
  cout<<a<<" "<<b<<ENDL;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
   int w,h,x,y,r;
   scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
   if(w-r>=x&&r<=x&&h-r>=y&&r<=y){
   	printf("Yes\n");
   }else{
   	printf("No\n");
    }
}

Measured memory_bytes: 2692
#include<iostream>
using namespace std;
int main(void) {
	int a, b;
	cin >> a >> b;
	if (a > b) {
		cout << "a > b" << endl;
	}
	else if (a < b) {
		cout << "a < b" << endl;
	}
	else {
		cout << "a == b" << endl;
	}
	return 0;
}


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

int selectionSort(int A[], int N) {
	int minj, sw=0;
	for (int i = 0; i <= N-1; i++) {
		minj = i;
		for (int j = i; j <= N - 1; j++) {
			if (A[j] < A[minj]) minj = j;
		}
		if (i != minj) {
			swap(A[i], A[minj]);
			sw++;
		}
	}
	return sw;
}

int main(void) {
	int N, A[100], sw;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	sw = selectionSort(A, N);

	for (int i = 0; i < N; i++) {
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;

	cout << sw << endl;

	return 0;
}

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#define  N  20
#define  M  1100
#define  ALL  71000
using  namespace  std;
int  n,m,f[ALL],b[M],c[M],lim;
inline  int  mymin(int  x,int  y){return  x<y?x:y;}
int  main()
{
	scanf("%d%d",&n,&m);
	for(int  i=1;i<=n;i++)lim=(lim<<1)^1;
	for(int  i=1;i<=lim;i++)f[i]=999999999;
	for(int  i=1;i<=m;i++)
	{
		int  k;scanf("%d%d",&b[i],&k);
		for(int  j=1;j<=k;j++)
		{
			int  y;scanf("%d",&y);
			c[i]^=(1<<(y-1));
		}
	}
	f[0]=0;
	for(int  i=0;i<lim;i++)
	{
		for(int  j=1;j<=m;j++)f[i|c[j]]=mymin(f[i|c[j]],f[i]+b[j]);
	}
	if(f[lim]==999999999)f[lim]=-1;
	printf("%d\n",f[lim]);
	return  0;
}

Measured memory_bytes: 128
/*
[abc168] E - ∙ (Bullet)
*/

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

const int MAX_N = 2e5;
const int MOD = 1000000007;
const double INF = 2e18;
const double EPS = 1e-10;

class gf {
public:
    int n;
    static gf mod_inv(int a, int m) {
        int u = 0, v = 1;
        while (a != 0) {
            int t = m / a;
            m -= t * a;
            u -= t * v;
            swap(a, m);
            swap(u, v);
        }
        return gf(u);
    }
    gf() : n(0) {}
    gf(int n) : n(n < 0 ? n % MOD + MOD : n % MOD) {}
    gf operator+(gf x) { return gf((n + x.n) % MOD); }
    gf operator-(gf x) { return gf((n - x.n + MOD) % MOD); }
    gf operator*(gf x) { return gf((1LL * n * x.n) % MOD); }
    gf operator/(gf x) { return *this * x.inv(); }
    gf& operator+=(gf x) { return *this = (*this + x); }
    gf& operator-=(gf x) { return *this = (*this - x); }
    gf& operator*=(gf x) { return *this = (*this * x); }
    gf& operator/=(gf x) { return *this = (*this / x); }
    gf inv() { return mod_inv(n, MOD); }
};

int N;
ll A[MAX_N], B[MAX_N];

ll gcd(ll a, ll b) {
    a = abs(a), b = abs(b);
    while (b != 0) {
        swap(b, a %= b);
    }
    return a;
}

ll solve() {
    gf p2[MAX_N + 1];
    p2[0] = 1;
    for (int i = 0; i < N; i++) {
        p2[i + 1] = p2[i] * 2;
    }

    int z = 0;
    map<pii, int> m;
    for (int i = 0; i < N; i++) {
        if (A[i] == 0 && B[i] == 0) {
            z++;
            continue;
        }
        ll g = gcd(A[i], B[i]);
        pii p = B[i] >= 0 ? pii(A[i] / g, B[i] / g) : pii(-A[i] / g, -B[i] / g);
        m[p]++;
    }

    gf ans = 1;
    while (!m.empty()) {
        auto p = *m.begin();
        pii k = p.first;
        int x = p.second;
        int y = m[pii(-k.second, k.first)] + m[pii(k.second, -k.first)];
        ans *= p2[x] + p2[y] - 1;
        m.erase(k);
        m.erase(pii(-k.second, k.first));
        m.erase(pii(k.second, -k.first));
    }
    ans += z - 1;

    return ans.n;
}

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 19964
// failed to generate code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

int main(){	
	ll N, K;
	cin >> N >> K;
	vector<ll> A(N), sum(N+1);
	rep(i, N) {
		cin >> A[i];
		if (i != 0) sum[i+1] = sum[i]+A[i]; else sum[i+1] = A[i];
	}
	map<ll, ll> m;
	m[sum[0]]++;

	ll res = 0;
	repn(i, N) {
		if (i-K >= 0) m[(sum[i-K]-(i-K))%K]--;
		res += m[(sum[i]-i)%K];
		m[(sum[i]-i)%K]++;
	}

	cout << res << endl;
}


Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n; cin>>n;
	vector<int> a(n + 1), b(n + 1), c(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 - 1; i++)
		cin>>c[i];
	int ans = 0;
	for(int i =1; i<=n; i++){
		ans += b[a[i]];
		if(i!=1){
			if(a[i] - a[i-1] == 1){
				ans += c[a[i-1]];
			}			
		}
	}	
	cout<<ans;
  return 0;
}


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

#pragma GCC optimize("O3")

using namespace std;

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

typedef long long ll;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

int main() {
    double l;
	cin >> l;
	l = l + .0;
	cout << pow((l/3), 3);
    
    return 0;
}


Measured memory_bytes: 4156
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
long long l,ans;
using namespace std;
int main()
{
	string a;
	cin>>a;
	l=a.size();
	for(int i=0;i<l-1;i++)
	{
		if(a[i]!=a[i+1])
		ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll N, T;
  cin >> N >> T;
  ll time = 0;
  ll ans = 0;
  REP(i, N){
    ll t;
    cin >> t;
    if(t < time){
      ll d = time - t;
      ans += T - d;
    }
    else ans += T;
    time = t + T;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n, X = map(int, input().split())

x = list(map(int, input().split()))

def gcd(a, b):
    """Calculate the Greatest Common Divisor of a and b.

    Unless b==0, the result will have the same sign as b (so that when
    b is divided by it, the result comes out positive).
    """
    while b:
        a, b = b, a%b
    return a

def solve():
    x.append(X)

    sorted_x = sorted(x)
    sorted_aaa = []

    aaa = []

    for (i, item) in enumerate(sorted_x):
        if i == 0:
            continue
        aaa.append(int(sorted_x[i] - sorted_x[i - 1]))

    sorted_aaa = sorted(aaa)
    res = 100000000
    # from math import gcd
    for (k, elm) in enumerate(sorted_aaa):
        if len(sorted_aaa) == 1:
            res = sorted_aaa[k]
            break
        if k == 0:
            continue
        g = gcd(sorted_aaa[k - 1], sorted_aaa[k])
        if g < res:
            res = g
    print(res)


if __name__ == '__main__':
    solve()



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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll K; cin >> K;
  ll result = 0;
  rep(i,K) rep(j,K) rep(k,K) result += gcd(gcd(i+1,j+1),k+1);
  cout << result << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  string s,p;cin>>s>>p;
  s+=s;
  rep(i,0,s.size()-1){
    bool e=true;ll c=0;
    rep(j,i,p.size()+i){
      if(s[j]!=p[c])e=false;
      else c++;
    }
    if(e){
      out("Yes");
      return 0;
    }
  }
  out("No");


  return 0;
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  set<int> s;
  int a;
  for(int i = 0; i < n; i++){
    cin >> a;
    s.insert(a);
  }
  
  if(s.size() == n) cout << "YES\n";
  else cout << "NO\n";
}

Measured memory_bytes: 9600
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>

using namespace std;
using ll = long long;
using ull = unsigned long long;
#define out(S) cout<<(S)<<endl;
#define REP(i,b) for(size_t i=0;i<(b);i++)
#define rREP(i,b) for(int i=(b)-1;i>=0;i--)
#define FOR(i,a,b) for(size_t i=(a);i<(b);i++)
#define rFOR(i,a,b) for(int i=(b)-1;i>=0;i--)
#define Foreach(item,collection) for(auto item:collection)
#define mod(i) ((i) % (ll)(1e9 + 7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a * modpow((ll)b,(ll)(1e9 + 5))))
#define Yes out("Yes")
#define No out("No")
#define NO out("NO")
#define YES out("YES")
#define INF 1e10;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define IfOut(condition,text) if((condition)){out(text);return 0;}
#define IfeOut(condition,itext,etext) if(condition){out(itext);return 0;}else{out(etext);return 0;}
#define Select(collection,condition,result) Foreach(i,collection){result+=condition;}
#define GetAuto(_N,vect) {cin>>N;vect.resize(N);REP(i,_N){cin>>vect[i];}}
void removeAt(string& s, int index) { s.erase(index, 1); }
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
ll manhattanDistance(ll x1, ll y1, ll x2, ll y2) { return (abs(x2 - x1) + abs(y2 - y1)); }


int main() {
	ll a, b;
	vector<int> ans;
	while (cin>>a>>b)
	{
		ll c = a + b;
		int cnt = 0;
		while (c)
		{
			c /= 10;
			cnt++;
		}
		ans.push_back(cnt);
	}
	Foreach(i, ans) out(i);
	return 0;
}

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

int main() {
  queue<ll> Q;
  int k;
  cin >> k;
  for(int i=1;i<=9;i++) Q.push(i);
  k--;

  while(k>0){
      k--;
      ll p = Q.front();
      Q.pop();
      if(p%10==0){
          Q.push(p*10);
          Q.push(p*10 + 1);
      }
      else if(p%10==9){
          Q.push(p*10+8);
          Q.push(p*10+9);
      }
      else{
          Q.push(p*10+(p%10)-1);
          Q.push(p*10+(p%10));
          Q.push(p*10+(p%10)+1);
      }
  }

  ll ans = Q.front();

  cout << ans<< endl;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
const ll INF = 2e18;
const int inf = 1e9+10;
const int maxN = 10010;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 1000000007;

char s[maxN];
char t[maxN];
ll a[1000];
int main()
{	
	ll k;
	for(int i=1;i<=3;i++)
	{
		scanf("%lld",&a[i]);
	}
	scanf("%lld",&k);
	ll ans = 0;
	vector<int> b(4);
	b[1] = 1;
	b[2] = 0;
	b[3] = -1;
	for(int i=1;i<=3;i++)
	{
		if(k<=a[i])
		{
			ans += k*b[i];
			break;
		}
		else
		{
			ans += a[i] * b[i];
			k -= a[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include<vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define rng(a) a.begin(),a.end()
using ll = long long;

using namespace std;



int main() {
    int n;
    cin>>n;
    vector<int>a(n+1+1);
    rrep(i,n+1) cin>>a[i];
    vector<int>b(n+1+1);
    rrep(i,n) cin>>b[i];
    ll ans = 0;
    rrep(i,n+1) {
        if(a[i]>=b[i-1]) {
            ans += b[i-1];
            a[i] -= b[i-1];
        } else {
            ans += a[i];
            a[i] = 0;
        }
        if(a[i]>=b[i]) {
            ans += b[i];
            b[i] = 0;
        } else {
            ans += a[i];
            b[i] -= a[i];
            a[i] = 0;
        }
    }
    cout<<ans<<endl;

    return 0;
}


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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;
long long INF = 1000000000000000;

int main(){
  cout << setprecision(10);
  int N,M;
  cin >> N >> M;
  vector<pii> e(M);

  map<int,ll> dist;
  map<pii,ll> length;
  for(int i = 0; i < N; i++){
    dist[i] = INF;
  }
  dist[0] = 0;

  for(int i = 0; i < M; i++){
    int a,b;
    ll c;
    cin >> a >> b >> c;
    a--;
    b--;
    e.at(i) = make_pair(a,b);
    length[make_pair(a,b)] = -c;
  }

  // 最短路
  for(int i = 0; i < N; i++){
    for(int j = 0; j < M; j++){
      pii now = e.at(j);
      int src = now.first;
      int dst = now.second;
      
      if(dist[src] == INF) continue;

      if(dist[dst] > dist[src] + length[now]){
        dist[dst] = dist[src] + length[now];
      }
    }
  }

  ll ans = dist[N-1];

  vector<bool> negative(N, false);

  for(int i  = 0; i < N; i++){
    for(int j = 0; j < M; j++){
      pii now = e.at(j);
      int src = now.first;
      int dst = now.second;
      
      if(dist[src] == INF) continue;

      if(negative[src]){
        negative[dst] = true;
      }
      if(dist[dst] > dist[src] + length[now]){
        dist[dst] = dist[src] + length[now];
        negative[dst] = true;
      }
    }
  }

  if(negative[N-1]){
    cout << "inf" << endl;
  } else {
    cout << -ans << endl;
  }




}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	string s,t;cin>>s>>t;
	rep(i,s.size()){
		string k;
		rep(j,s.size()){
			k+=s[(j+i)%s.size()];
		}
		if(k==t){
			puts("Yes");return 0;
		}
	}
	puts("No");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a != 2 && b != 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pint pair<int,int>
#define mk(x,y) make_pair(x,y)
#define fir first
#define sec second
#define Rep(x,y,z) for(int x=y;x<=z;++x)
#define Red(x,y,z) for(int x=y;x>=z;--x)
using namespace std;
const int MAXN=605,Mod=1e9+7;
char buf[1<<12],*p1=buf,*p2=buf,nc;int ny;
inline char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;if(nc<0)return nc;
	x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48);return x*ny;
}int n,k,to[MAXN],cnt[MAXN][MAXN],F[MAXN][MAXN],g[MAXN],ans;
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	n=read()*2,k=read();
	Rep(i,1,k){int a=read(),b=read();to[a]=b,to[b]=a;}
	Rep(i,1,n)Rep(j,i,n)cnt[i][j]=cnt[i][j-1]+(!to[j]);
	g[0]=1;for(int i=2;i<=n;i+=2)g[i]=1ll*g[i-2]*(i-1)%Mod;
	Rep(i,1,n)Rep(j,i,n){
		int flg=0;
		Rep(k,i,j)if(to[k]&&(to[k]>j||to[k]<i))flg=1;
		if(flg)continue;F[i][j]=g[cnt[i][j]];
		Rep(k,i+1,j-1)F[i][j]=(F[i][j]-1ll*F[i][k]*g[cnt[k+1][j]]%Mod+Mod)%Mod;
	}Rep(i,1,n)Rep(j,i+1,n)ans=(ans+1ll*F[i][j]*g[n-2*k-cnt[i][j]])%Mod;
	cout<<ans<<"\n";
	return 0;
}



Measured memory_bytes: 6444
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define ll long long
#define P pair<int, int>
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------
int n, k;

void solve(){
}
int main(){
    double pi = 3.14;
    int r;
    cin >> r;
    cout << fixed << setprecision(10);
    cout << 2 * r * pi << endl;
    solve();
    return 0;
}



Measured memory_bytes: 3724
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;

int main(void)
{
    int N;
    cin >> N;
    for(int i=0;i<N;++i)
    {
        cout <<"ACL";
    }
    cout <<endl;
}

Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

int main(void) {
	int i, j, h, w, ok = true;
	string s;
	vector<int> d(26, 0), k(3, 0);
	cin >> h >> w;
	for (i = 0; i < h; i++) {
		cin >> s;
		for (j = 0; j < w; j++)
			d[s[j] - 'a']++;
	}
	if ((h & 1) & (w & 1)) {
		k[0] = 1;
		k[1] = (h >> 1) + (w >> 1);
	}
	else if (h & 1)
		k[1] = w >> 1;
	else if (w & 1)
		k[1] = h >> 1;
	k[2] = (h >> 1) * (w >> 1);
	for (i = 0; i < 26; i++) {
		while (k[2] > 0 && d[i] >= 4) {
			k[2]--;
			d[i] -= 4;
		}
		while (k[1] > 0 && d[i] >= 2) {
			k[1]--;
			d[i] -= 4;
		}
		while (k[0] > 0 && d[i] >= 1) {
			k[0]--;
			d[i] -= 4;
		}
		if (d[i] > 0) {
			ok = false;
			break;
		}
	}
	if (ok)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int min = 1000000000;
  int max = 1;
  int a;
  for(int i = 0;i < n;i++) {
    cin >> a;
    if(a < min) {
      min = a;
    }
    if(a > max) {
      max = a;
    }
  }
  cout << max - min << endl;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



string s;
int Q;
list<char> l;
void solve(){
	cin >> s >> Q;
	bool ok = 0;
	for(int i = 0; i < s.size(); i++) l.push_back(s[i]);
	for(int i = 0; i < Q; i++){
		int a,b;
		char c;
		cin >> a;
		if(a == 1){
			ok = !ok;
		}
		else{
			cin >> b >> c;
			if((b == 1) ^ ok) l.push_front(c);
			else l.push_back(c);
		}
	}
	if(ok){
		int b = 0;
		for(auto i = l.end();; i--){
			if(!b){
				b = 1;
				continue;
			}
			cout << *i;
			if(i == l.begin()) break;
		}
		cout << endl;
	}
	else{
		for(auto i = l.begin(); i != l.end(); i++){
			cout << *i;
		}
		cout << endl;
	}
}

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


Measured memory_bytes: 10064
import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())
ans = []

if S > K:
  for i in range(K+1):
    s_z = S - i
    if s_z < 0:
      pass
    elif K < s_z:
      if (K + 1) > (s_z - K):
        ans.append(K*2 - s_z + 1)
    else:
      ans.append(s_z + 1)

else:
  for i in range(S+1):
    s_z = S - i
    if s_z < 0:
      pass
    elif K < s_z:
      if (K + 1) > (s_z - K):
        ans.append(K*2 - s_z + 1)
    else:
      ans.append(s_z + 1)
 
print(sum(ans))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}


int main(){
    int n, m, x, cnt1=0, cnt2=0;
    R n >> m >> x;
    rep(i, m){
        int a=0;
        R a;
        if (a < x)cnt1 += 1;
        else cnt2 += 1;
    }
    co(min(cnt1, cnt2));
}


Measured memory_bytes: 256
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

cnt = 0

chkflg=False
while cnt * 4 <= n:
    
    if n % 4 == 0 or n % 7 == 0:
        
        chkflg=True
        break
        
    elif (n-cnt * 4) % 7 == 0:
        
        chkflg=True
        break
       
    else:
        
        cnt+=1
           
print("Yes" if chkflg else "No")
    
    
    

Measured memory_bytes: 3064
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  int N;
  cin >> N;
  
  vector<pair<int, int>> A(N);
  int a;
  REP(i, N){
    cin >> a;
    A[i] = make_pair(i+1, a);
  };
  
  sort(ALL(A), [](const pair<int, int>& x, const pair<int, int>& y){return x.second < y.second;});
  
  REP(i, N){
    if(i!=0) cout << ' ';
    cout << A[i].first;
  };
  cout << endl;
  return 0;
};


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

char s[101000];
int l,n,T,a[101000],x,y,fa[101000];

int GF(int x){
	return fa[x]==x? x: fa[x]=GF(fa[x]);
}

int main(){
	scanf("%s",s+1); l=strlen(s+1); n=l>>1;
	for (int i=1;i<=n;++i) a[i]=s[i]-s[l-i+1];
	for (int i=n+1;fa[i]=i;--i) a[i]-=a[i-1];
	for (cin>>T;T--;){
		scanf("%d%d",&x,&y);
		if (x>n){
			x=l+1-x;
			y=l+1-y;
			swap(x,y);
		}else if (y>n){
			y=l+1-y;
			if (x>y) swap(x,y);
			--y;
		}
		if (x>n||x>y) continue;
		x=GF(x), y=GF(min(y,n)+1);
		if (x-y){
			a[x]+=a[y];
			fa[y]=x;
		}
	}
	for (int i=1;i<=n+1;++i) if (fa[i]==i&&a[i]%26)
		return !puts("NO");
	puts("YES");
}

Measured memory_bytes: 768
#include <stdio.h>

int main(void) {
	int a[3000], b[3000];
	int i, j;
	int wk;

	for (i = 0; i < 3000; i++) {
		scanf("%d %d", &a[i], &b[i]);
		if (a[i] == 0 && b[i] == 0)break;
	}
	for (j = 0; j < i; j++) {
		if (a[j] > b[j]) {
			wk = a[j];
			a[j] = b[j];
			b[j] = wk;
		}
		printf("%d %d\n", a[j], b[j]);
	}
	return 0;
}



Measured memory_bytes: 1916
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

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

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTS(s) printf("%s\n",(s))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

typedef long long ll;

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int a, int b) {
	return (a)>(b) ? (a) : (b);
}

int main() {
	int x, a, b;
	scanf("%d %d %d", &x, &a, &b);
	PRINTD((x - a) % b);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int M = 1e9 + 7;

pi norm(int a, int b) {
	int g = __gcd(a, b);
	a /= g, b /= g;
	if(a == 0) b = 1;
	if(b == 0) a = 1;
	if(a < 0) a = -a, b = -b;
	return {a, b};
}

pi inv(pi p) {
	return norm(-p.S, p.F);
}

int pw[200010];

map<pi, int> cnt, vis;

signed main()
{
	IO_OP;
	
	pw[0] = 1;
	for(int i = 1; i < 2e5 + 7; i++)
		pw[i] = pw[i - 1] * 2 % M;

	int n, ans = 0;
	cin >> n;
	for(int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if(a == 0 && b == 0) ans++;
		else {
			pi p = norm(a, b);
			cnt[p]++;
		}
	}
	ll tt = 1;
	for(auto pp:cnt) {
		pi p = pp.F, q = inv(p);
		if(vis[p]) continue;
		tt = tt * (pw[cnt[p]] + pw[cnt[q]] - 1) % M;
		vis[p] = vis[q] = 1;
	}
	ans += tt;
	ans += M - 1;
	ans %= M;
	cout << ans << endl;
	
}





Measured memory_bytes: 55136