akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

string s, t;
int nex[201010][27];

int main() {
  cin >> s >> t;
  int s_sz = s.size();
  int t_sz = t.size();
  s = s + s;
  for (int i = 0; i < 26; i++) nex[2 * s_sz][i] = 2 * s_sz;
  for (int i = 2 * s_sz - 1; 0 <= i; i--) {
    for (int j = 0; j < 26; j++) {
      nex[i][j] = nex[i + 1][j];
    }
    nex[i][s[i] - 'a'] = i + 1;
  }

  long long cur = 0;
  for (int i = 0; i < t.size(); i++) {
    char c = t[i] - 'a';
    int x = cur % s_sz;
    if (nex[x][c] == 2 * s_sz) {
      cout << -1 << endl;
      return 0;
    }
    cur += nex[x][c] - x;
  }

  cout << cur << endl;

  return 0;
}

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

using namespace std;
using ll = long long;

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

    int ans = 0;
    for (int i = 0; i < N - 1; ++i) {
        set<char> left, right, intersection;
        for (int l = 0; l <= i; ++l) left.insert(S[l]);
        for (int r = i + 1; r < N; ++r) right.insert(S[r]);
        set_intersection(left.begin(), left.end(), right.begin(), right.end(), inserter(intersection, intersection.end()));
        int tmp = intersection.size();
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
    s = input()
    if s == "AC":
        ac += 1
    if s == "WA":
        wa += 1
    if s == "TLE":
        tle += 1
    if s == "RE":
        re += 1

print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))


Measured memory_bytes: 9104
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
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 vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXIST2(s,e) (find(ALL(s),(e))!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);


int main(){
	int a,b;
	while(cin>>a>>b){
		int s=a+b;
		int cnt=0;
		while(s){
			s/=10;
cnt++;
		}
cout<<cnt<<endl;
	}
}

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

#define INF 100100100
#define MOD 1000000007

#define FOR(i,n) for(int i=0;i<n;i++)

using namespace std;
using ll = long long;
using ull = unsigned long long ;

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);
   int N,K;
   cin >> N >> K;
   vector<int>D(K);
   FOR(i,K)cin >> D[i];
   int num = N;
   while(true){
      int a = num;
      bool flag = true;
      while(a > 0){
         int d = a % 10;
         for(int i = 0;i<K;i++){
            if(d == D[i])flag = false;
         }
         a /= 10;
      }
      if(flag)break;
      num++;
   }
   cout << num << endl;
   return 0;
}


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

int main()
{
	//std::numeric_limits<int>::max();
	int n,r,i;
	cin>>n>>r;
	if(n>=10)
		i=r;
	else
	{
		i=r+100*(10-n);
	}
	cout<<i<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  ll n;
  cin >> n;
  
  vector<ll> h(n);  
  rep(i, 0, n) cin >> h[i];
  
  ll ans = 0;
  ll cnt = 0;
  rep(i, 0, n-1) {
    if(h[i] >= h[i+1]) {
      cnt++;
      ans = max(ans, cnt);
    }
    else {
      ans = max(ans, cnt);
      cnt = 0;
    }
  }
  cout << ans << "\n";
  
  //cout << (  ?"Yes" :"No") << "\n";
  
  //cout << fixed << setprecision(15) << n << "\n";

}

Measured memory_bytes: 1024
import numpy as np

N, M = map(int, input().split())

P = []
S = []

for _ in range(M):
    p, s = input().split()
    P.append(int(p))
    S.append(s)

AC = np.zeros(N)
WA = np.zeros(N)

for i in range(M):
    if AC[P[i]-1] == 0:
        if S[i] == 'WA':
            WA[P[i]-1] += 1
        else:
            AC[P[i]-1] += 1

WA[AC == 0] = 0

print(int(sum(AC)), int(sum(WA)))

Measured memory_bytes: 39140
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define ALL(x) std::begin(x), std::end(x)
using namespace std;

int solve(int n, const string & s) {
    array<bool, 10> x = {};
    array<bool, 100> y = {};
    array<bool, 1000> z = {};
    for (char c : s) {
        REP (i, 100) if (y[i]) {
            z[i * 10 + c - '0'] = true;
        }
        REP (i, 10) if (x[i]) {
            y[i * 10 + c - '0'] = true;
        }
        x[c - '0'] = true;
    }
    return count(ALL(z), true);
}

int main() {
    int n; cin >> n;
    string s; cin >> s;
    cout << solve(n, s) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] tmpArray = br.readLine().split(" ");
		int n = Integer.parseInt(tmpArray[0]);
		
		Activity[] acts = new Activity[n];
		for(int i = 0; i < n; i++){
			tmpArray = br.readLine().split(" ");
			
			int start = Integer.parseInt(tmpArray[0]);
			int end = Integer.parseInt(tmpArray[1]);
			
			acts[i] = new Activity(start, end);
		}
		
		Arrays.sort(acts);
		
		int count = 1;
		int currentTime = acts[0].end;
		
		for(int i = 1; i < n ; i++){
			if(currentTime < acts[i].start){
				count++;
				currentTime = acts[i].end;
			}
		}
		
		System.out.println(count);
	}

}

class Activity implements Comparable<Activity>{
	int start;
	int end;
	
	public Activity(int s, int e){
		this.start = s;
		this.end = e;
	}

	@Override
	public int compareTo(Activity a1) {
		return this.end - a1.end;
	}
	
}


Measured memory_bytes: 66160
#include <stdio.h>

char s[3][101];
int p[3];

int main() {
	int *c;
	char n;
	char a;

	scanf("%s", s[0]);
	scanf("%s", s[1]);
	scanf("%s", s[2]);

	n = s[0][0];
	p[0]++;

	while(n != '\0') {
		a = n;
		c = &p[n - 'a'];
		n = s[n - 'a'][*c];
		(*c)++;
	}

	printf("%c\n", a-32);

	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-

import copy
# スペース区切りの整数の入力
H, W, K = map(int, input().split())
table = []
for i in range(H):
    table.append(list(input()))
# print(table)
ans_cnt = 0
for deh in range(2 ** H):
    htable = copy.deepcopy(table)
    # print("deepcopy", htable)
    for h in range(H):
        if deh & (1 << h):
            for ch in range(W):
                htable[h][ch] = "."
    for dew in range(2 ** W):
        wtable = copy.deepcopy(htable)
        for w in range(W):
            if dew & (1 << w):
                for cw in range(H):
                    wtable[cw][w] = "."
        cnt = 0
        for cnth in range(H):
            for cntw in range(W):
                if wtable[cnth][cntw] == "#":
                    cnt = cnt + 1
        if cnt == K:
            ans_cnt = ans_cnt + 1
        # print(bin(deh), bin(dew))
        # print(cnt, wtable)
print(ans_cnt)


Measured memory_bytes: 9320
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
int main(void){
    int h,n,num,sum=0;
    cin>>h>>n;
    for(int i=0;i<n;i++){
        cin>>num;
        sum+=num;
    }
    if(sum>=h){//与えるダメージの方が大きい
        cout<<"Yes";
    }else{
        cout<<"No";
    }
}


Measured memory_bytes: 256
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	n := readInt()
	k := readInt()
	x := readInt()
	y := readInt()

	println(x*minInt(n, k) + y*maxInt(0, n-k))
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define F first
#define S second
using ll = long long;
const ll mod = 1000000007;
const ll infi = 1000000000000000;
using namespace std;
using vl = vector<ll>;
using pll =  pair<ll,ll>;

int main() {
    ll  n,p,k;
    cin>>n>>k;
    vl h(n),dp(n,infi);
    
    for(int i=0;i<n;i++) cin>>h[i];
    dp[0]=0;
    for(int i=1;i<n;i++){
       for(int j=max(0LL,i-k);j<i;j++){
           dp[i]=min(dp[j]+abs(h[i]-h[j]),dp[i]);
       }
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
    int result[100];
    int a,b;
    int i,j;
    char op;

    for(i=0;;i++){
        scanf("%d %c %d",&a,&op,&b);

        if(op=='?'){
            break;
        }
        else if(op=='+'){
            result[i] = a+b;
        }
        else if(op=='-'){
            result[i] = a-b;
        }
        else if(op=='*'){
            result[i] = a*b;
        }
        else if(op=='/'){
            result[i] = a/b;
        }
    }

    for(j=0;j<i;j++){
        printf("%d\n",result[j]);
    }

    return 0;
}


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

int main() {
    int r;
    cin>>r;
    if (r<1200) cout<<"ABC"<<endl;
    else if(r<2800) cout<<"ARC"<<endl;
    else cout<<"AGC"<<endl;
}   


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

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


int main(){
 
  int P , Q , R;
  
  cin >> P >> Q >> R;
  
  
  int a = max (P ,Q);
  
  int b = max (a , R);
  
  int S = P + Q + R - b;
  
  cout << S << endl;
  
  
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define int long long
using namespace std;
signed main() {
	int N;
	cin >> N;
	vector<int>A(N);
	int ans = 0;

	for (int i = 0; i < N; i++) {
		A.at(i)=i+1;
		if (A.at(i) % 3 != 0 && A.at(i) % 5 != 0) {
			ans += A.at(i);
		}
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 11004
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#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 <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back


const long long MOD = 1e9 + 7;
const long long N = 1e6 + 228;

using namespace std;

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

#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64_t
#endif

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

const int MAXN = 1e5 + 77;

int l[MAXN];
int r[MAXN];

main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = readInt();
    for (int i = 1; i <= n; i++) {
        l[i] = readInt();
        r[i] = readInt();
    }
    n++;
    sort(l + 1, l + 1 + n);
    sort(r + 1, r + 1 + n);
    reverse(l + 1, l + 1 + n);
    int p = 1;
    int ans = 0;
    while(l[p] > r[p]) {
        ans += l[p] - r[p];
        p++;
    }
    cout << 2 * ans;
    return 0;
}





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

#define LL 					long long
#define ULL 				unsigned long long
#define pii 				pair<int,int>
#define fi 					first
#define se 					second
#define mp 					make_pair
#define vi 					vector<int>
#define psb 				push_back
#define ppb 				pop_back
#define all(x)			 	(x).begin(),(x).end()
#define sz(x) 				(int)(x).size()
#define endln 				printf("\n")
#define gc					getchar_unlocked
#define setmin(x)			memset((x), -1, sizeof((x)))
#define setnul(x)			memset((x), 0, sizeof((x)))
#ifndef getchar_unlocked
#define getchar_unlocked 	getchar
#endif
const int inf = 2e9 + 5;
const int mod = 1e9 + 7;

template <typename T>
void gi(T &ret) {
	ret = 0; char inp=gc(); int kl=1;
	while (inp<'0' || inp>'9') {if (inp=='-') kl=-1; inp=gc();}
	while ('0'<=inp && inp<='9') ret=(ret<<3)+(ret<<1)+(inp-'0'), inp=gc();
	if (kl<1) ret=-ret;
}

const int MAXN = 305;
int n, m, ar[MAXN][MAXN], jml[MAXN], piv[MAXN];
vi ad[MAXN];

stack < int > st;

bool ganti (int x) {
	while (piv[x]<=m) {
		int no = ar[x][piv[x]++];
		if (jml[no]<0) continue;
		jml[no]++;
		ad[no].psb(x);
		return 1;
	}
	return 0;
}

bool coba (int x) {
	for (int i=1; i<=m; i++) ad[i].clear();
	setnul(jml);
	for (int i=1; i<=n; i++) {
		piv[i] = 2;
		jml[ar[i][1]]++;
		ad[ar[i][1]].psb(i);
	}
	while (!st.empty()) st.pop();
	while (1) {
		for (int i=1; i<=m; i++)
			if (jml[i]>x) {
				st.push(i);
				jml[i] = -1;
			}
		if (st.empty()) return 1;
		while (!st.empty()) {
			int tp = st.top(); st.pop();
			for (auto xx : ad[tp])
				if (!ganti(xx)) return 0;
		}
	}
	return 1;
}

int solve() {
	int l=1, r=n;
	while (l<r) {
		int mid = (l+r)>>1;
		if (coba(mid)) r = mid;
		else l = mid+1;
	}
	return l;
}

int main() {
	gi(n); gi(m);
	for (int i=1; i<=n; i++)
		for (int j=1; j<=m; j++) 
			gi(ar[i][j]);
	printf ("%d\n", solve());
	return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstdlib>
#include<utility>
using namespace std;

int A[500500];
int L[500500];
int R[500500];
int cnt;

void merge(int l, int m, int r){
	int n1 = m-l;
	int n2 = r-m;
	for(int i=0; i<n1; i++){
		L[i] = A[l+i];
	}
	for(int i=0; i<n2; i++){
		R[i] = A[m+i];
	}
	L[n1] = 1001001001;
	R[n2] = 1001001001;
	int i = 0;
	int j = 0;
	for(int k=l; k<r; k++){
		if(L[i]<R[j]){
			A[k] = L[i];
			i++;
		}else{
			A[k] = R[j];
			j++;
		}
		cnt++;
	}
}

void merge_sort(int l, int r){
	if(l+1<r){
		int m = (l+r)/2;
		merge_sort(l, m);
		merge_sort(m, r);
		merge(l, m, r);
	}
}

int main(){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> A[i];
	}
	cnt = 0;
	merge_sort(0, n);

	for(int i=0; i<n; i++){
		cout << A[i];
		if(i==n-1) cout << endl;
		else cout << " ";
	}
	cout << cnt << endl;
	return 0;
}

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

int main() {
  ll a, b, n;
  cin >> a >> b >> n;

  double low = 0;
  // 右側
  double high = n + 1;

  auto f = [&](ll i) { return a * i / b - a * (i / b); };
  int cnt = 10000;
  while (--cnt) {
    double c1 = (low * 2 + high) / 3;
    double c2 = (low + high * 2) / 3;
    if (f(c1) <= f(c2))
      low = c1;
    else
      high = c2;
  }
  cout << fixed << setprecision(20) << f(low) << endl;
  return 0;
}

Measured memory_bytes: 3632
fun main(args: Array<String>) {
    val (r, c) = readLine()!!.split(" ").map(String::toInt)

    var sheet = MutableList(r) { MutableList(c) {0} }

    (0 until r).forEach { sheet[it] = readLine()!!.split(" ").map(String::toInt).toMutableList() }
    
    (0 until r).forEach { row ->
        sheet[row].forEach { print("$it ") }
        print("${sheet[row].sum()}")
        println()
    }

    (0 until c).forEach { column ->
        print("${sheet.sumBy { it[column] }} ")
    }
    
    println("${sheet.sumBy { it.sumBy { it } }}")
}



Measured memory_bytes: 37988
#include <iostream>
#include <vector>

int main(){
  int N = 0;
  int M = 0;
  std::cin >> N >> M;
  
  std::vector<int> vec(N);
  for(int cnt = 0; cnt < N; cnt++){
    std::cin >> vec.at(cnt);
  }
  
  int border = 0;
  for( int num : vec ){
    border += num;
  }
  if(border%(4*M) == 0){
    border /= 4*M;
  }
  else{
    border /= 4*M;
    border++;
  }
  
  
  int take = 0;
  for(int num :vec){
    if(border <= num){
      take++;
    }
  }
  
  if( M <= take ){
    std::cout << "Yes" << std::endl;
  }
  else{
    std::cout << "No" << std::endl;
  }
  
  
  
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter
from itertools import accumulate, combinations

read = sys.stdin.read
N, K, *A = map(int, read().split())
mod = 10 ** 9 + 7

cnt = 0
for i, j in combinations(range(N), 2):
    if A[i] > A[j]:
        cnt += 1

answer = 0

if K > 1:
    b = Counter(A)
    cnt1 = [j for i, j in sorted(b.items())]
    n = list(accumulate(cnt1))
    n = sum(i * j for i, j in zip(cnt1[1:], n[:-1]))

    answer += n * (K * (K - 1) // 2 % mod)
    answer %= mod

answer += cnt * K
answer %= mod
print(answer)

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

#define ll long long
#define ar array

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> stones(n);
    for (int i = 0; i < n; i++) {
        cin >> stones[i];
    }
    vector<int> dp(n, 1e9 + 5);
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j : {i + 1, i + 2}) {
            if (j < n) {
                dp[j] = min(dp[j], dp[i] + abs(stones[i] - stones[j]));
            }
        }
    }
    cout << dp[n - 1] << "\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n[10];
	for(int i=0; i < 10; i++) {
		cin >> n[i];
	}
	sort(n, &n[10]);
	for(int i=9; i > 6; i--) {
		cout << n[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
mod = 998244353
n = int(input())
a = [int(input()) for i in range(n)]
d = max(a)
go = sum(a)
dp = [[0]*(go+d+1) for j in range(n+1)]
dp[0][0] = 1
dp2 = [[0]*(go+d+1) for j in range(n+1)]
dp2[0][0] = 1
for i in range(n):
    for j in range(go):
            dp[i+1][j+a[i]] += dp[i][j]
            dp[i+1][j] += dp[i][j]*2
            dp[i+1][j+a[i]] %= mod
            dp[i+1][j] %= mod

            dp2[i+1][j+a[i]] += dp2[i][j]
            dp2[i+1][j] += dp2[i][j]
            dp2[i+1][j+a[i]] %= mod
            dp2[i+1][j] %= mod

zen = 3**n
zen %= mod
if go %2 == 1:
    print((zen - sum(dp[n][go//2+1:])*3)%mod)
else:
    print((zen - sum(dp[n][go//2:])*3 + dp2[n][go//2]*3)%mod)

Measured memory_bytes: 458776
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[4];
  int mx=0,cnt=0;
  for(int i=0;i<3;i++){
    cin>>a[i];
    mx=max(mx,a[i]);
  }
  for(int i=0;i<3;i++){
    int temp=mx-a[i];
    cnt+=temp/2;
    a[i]+=temp/2*2;
  }
  sort(a,a+3);
  if(a[0]==a[1]&&a[1]==a[2])cout<<cnt<<endl;
  else if(a[0]==a[1])cout<<cnt+1<<endl;
  else cout<<cnt+2<<endl;
  return(0);
}


Measured memory_bytes: 256
class Main{
  public static void main(String[] args){
    java.util.Scanner sc = new java.util.Scanner(System.in);    
    int n = sc.nextInt();
    
    int count = 0;
    for(int i =0 ;  ; i++){
      int x = decode(i);
      if(x > n || -x > n){
        break;
      }
      if(x > 0){
        count++;
      }
    }
    System.out.println(count);
    
  }
  
  
  static int decode(int i){
    int rev = 0 ;
    int map[] = {0,3,5,7};
    int mapbitflg[] = {8,1,2,4};
    int flg = 0;
    while(i > 0){
      rev *= 10;
      rev += map[i%4];
      flg |= mapbitflg[i%4];
      i /= 4;
    }
    int res = 0;
    while(rev > 0 ){
      res *= 10;
      res += rev%10;
      rev /= 10;
    }
    if(flg == 7){
    	return res;
    }else{
      return -res;
    }
  }
}

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

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a.at(i);
    sort(a.begin(), a.end());
    
    ll l = -INF, r = INF;
    while(l+1 < r){
        ll x = (l+r)/2;
        bool ok_fl = [&] {
            ll tot = 0;
            rep(i,n){
                if(a.at(i) < 0){
                    int l = -1, r = n;
                    while(l+1 < r){
                        int md = (l+r)/2;
                        //cout << x << " " << a.at(i) << " " << a.at(md) << endl;
                        if(a.at(i) * a.at(md) < x) r = md;
                        else l = md;
                    }
                    // cout << x << " " << a[i] << " " << l << " " << r << endl;
                    tot += n-r;
                }
                else {
                    int l = -1, r = n;
                    while(l+1 < r){
                        int md = (l+r)/2;
                        //cout << x << " " << a.at(i) << " " << a.at(md) << endl;
                        if(a.at(i) * a.at(md) < x) l = md;
                        else r = md;
                    }
                    // cout << x << " " << a[i] << " " << l << " " << r << endl;
                    tot += l+1;
                }
                if(a.at(i) * a.at(i) < x) tot--;
            }
            tot /= 2;
            // cout << x << " " << tot << endl;
            return tot < k;
        }();
        // cout << l << " " << r <<  " " << ok_fl << endl;
        if(ok_fl){
            l = x;
        }else {
            r = x;
        }
    }
    cout << l << endl;

    return 0;
} 

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

int64_t N,X;
vector<int64_t> W; // レベルxのときの層の数
vector<int64_t> P; // レベルxのときのパティの数

// レベルxバーガーのy層目まで食べる
int64_t dfs(int64_t x, int64_t y) {
    if ( x == 1 ){
        if ( y <= 1 ) return 0;
        else if ( y == 2 ) return 1;
        else if ( y == 3 ) return 2;
        else if ( y >= 4 ) return 3;
    }
    int64_t w = W[x-1];
    w = w/2;
    int64_t ans;
    if ( y <= w ) {
        ans = dfs(x-1,y-1);
    } else if ( y == w+1 ) {
        //ans = dfs(x-1,w) + 1;
        ans = P[x-2] + 1;
    } else {
        //ans = dfs(x-1,y-w-1) + dfs(x-1,w) + 1;
        ans = dfs(x-1,y-w-1) + P[x-2] + 1;
    }
    return ans;
}

int main() {
    cin >> N >> X;
    W.resize(N);
    P.resize(N);
    W[0] = 5;
    P[0] = 3;
    for ( int64_t i = 1; i < N; ++i){
        W[i] = W[i-1] * 2 + 3;
        P[i] = P[i-1] * 2 + 1;
    }
    
    cout << dfs(N,X) << endl;
    
    return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;

int main() {
  int N, K, C;
  cin >> N >> K >> C;
  string S;

  cin >> S;
  int L[200000], R[200000];
  for (int i = 0; i < N; ++i) {
    L[i] = 0;
    R[i] = 0;
  }
  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    if (S[i] != 'x') {
      L[i] = cnt + 1;
      cnt++;
      i += C;
      if (cnt >= K) {
        break;
      }
    }
  }

  cnt = 0;
  for (int i = N - 1; i >= 0; --i) {
    if (S[i] != 'x') {
      R[i] = K - cnt;
      cnt++;
      i -= C;
      if (cnt >= K) {
        break;
      }
    }
  }

  for (int i = 0; i < N; ++i) {
    if (L[i] != 0 && R[i] != 0 && L[i] == R[i]) {
      cout << i + 1 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3332
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(auto i = (a); i < (b); i++)
#define pb push_back
#define fs first
#define sc second
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const double EPS = 1e-9;

int n;

int memo[1'000'020][2][2];
int md = 1e9+7;
int dp(int at, int zero, int nine) {
    if(at == n) return (zero && nine);
    if(memo[at][zero][nine] != -1) return memo[at][zero][nine];
    int sm = 0;
    rep(i,0,10) {
        if(i == 0) sm += dp(at+1,1,nine);
        else if(i == 9) sm += dp(at+1,zero,1);
        else sm += dp(at+1,zero,nine);
        sm %= md;
    }
    return memo[at][zero][nine] = sm;
}

int main() {
    cin.sync_with_stdio(false);
    memset(memo,-1,sizeof(memo));
    cin >> n;
    cout << dp(0,0,0) << endl;
}


Measured memory_bytes: 81768
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define debug(x) cerr<<#x<<":"<<x<<endl;

signed main() {
  int n,m;cin>>n>>m;
  vector<int> a(n),sm(n+1,0);
  map<int,int> mp;
  for(int i=0;i<n;++i) {
    cin>>a[i];
    a[i]%=m;
    (sm[i+1] += sm[i] + a[i]) %= m;
  }
  for(int i=0;i<n;++i){
    debug(sm[i+1]);
    ++mp[sm[i+1]];
  }

  int ans = 0;
  for(auto &&mi: mp){
    if(mi.first==0){
      ans += max((1+mi.second)*mi.second/2, 0LL);
    }else{
      ans += max((1+mi.second-1)*(mi.second-1)/2, 0LL);
    }
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 5760
while line = gets.chomp
  h,w = line.split(" ").map{|x| x.to_i}
  if h==0 && w==0
    break
  end
  for i in 1..h do
    if i==1 || i==h
      printf("%s\n","#"*w)
    else
      printf("%s\n","#"+"."*(w-2)+"#")
    end
  end
  print "\n"
end


Measured memory_bytes: 7036
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cfloat>
#include <algorithm>
#include <memory>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned uint;
typedef long double l_double;

#define vtr vector
#define PB push_back
#define EB emplace_back
#define gcd __gcd
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define st_ct static_cast // <>
#define TEST uint _ {}; cin >> _; while (_--)
#define PI (3.1415926535897932384626433832795)
#define MOD st_ct<int>(1e9 + 7)
#define EPS 1e-9
#define deb1(x) cerr << #x << " -> " << x << endl;
#define deb2(x,y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ")" << endl;
#define deb3(x,y,z) cerr << "(" << #x << ", " << #y << ", " << #z << ") -> (" << x << ", " << y << ", " << z << ")" << endl;
#define debVV(V) cerr << #V << ":\n" << V << endl; // 2D

// 1D
template<typename T>
istream& operator>>(istream &is, vector<T> &A) {
    for (T &v: A)
        is >> v;
    return is;
}

template <typename T>
ostream& operator<<(ostream &os, const vector<T> &A) {
    for (T const &v: A)
        os << v << " ";
    return os;
}

template<typename T>
void vtrV(const vector<T> &A)
{ for (T const &val: A) cout << val << endl; }

// 2D
template<typename T>
istream& operator>>(istream &is, vector<vector<T>> &A) {
    for (vector<T> &i: A)
        for (T &j: i)
            is >> j;
    return is;
}

template <typename T>
ostream& operator<<(ostream &os, const vector<vector<T>> &A) {
    for (vector<T> const &i: A) {
        for (T const &j: i)
            os << j << " ";
        os << endl;
    }
    return os;
}

template<typename T>
void vvtrNS(const vector<vector<T>> &A) {
    for (vector<T> const &i: A) {
        for (T const &j: i)
            cout << j;
        cout << endl;
    }
}

template<typename T>
T cntDigits(const T &N) { return (floor(log10(N)) + 1); }

template<typename T>
bool isPowOfTwo(const T &N) { return (N && (!(N&(N-1)))); }

template<typename T>
T lcm(T a, T b) { return ((a*b)/gcd(a, b)); }
/* -------------------------------------------------------- */
/* -------------------------------------------------------- */

//

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // cout.setf(std::ios::boolalpha);
    cout<<std::fixed;
    cout<<std::setprecision(6); // default
    /* -------------------------------- */

    int n {};
    cin >> n;
    vtr<string> arr (n);
    cin >> arr;

    sort(all(arr));
    string last {};
    int ans {};
    for (auto const &val: arr) {
        if (val != last) {
            ++ans;
            last = val;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9476
#include<bits/stdc++.h>
const int N=1000111,P=998244353;
int n,a[N],pri[N],mu[N],sum[N];
bool v[N];
int f(int T){
	int k=n/T,sum=0,res=0;
	for(int i=1;i<=k;i++)
        (sum+=1ll*i*a[i*T]%P)%=P;
	for(int i=1;i<=k;i++)
		(sum+=P-1ll*i*a[i*T]%P)%=P,
		(res+=1ll*sum*i%P*a[i*T]%P)%=P;
	return res;
}
int main(){
    int t,x,ans=0;scanf("%d",&t);
    while(t--){
        scanf("%d",&x),++a[x];
        if(x>n)n=x;
    }
    mu[1]=1;
    for(int i=2,tt=0;i<=n;++i){
        if(!v[i])pri[++tt]=i,mu[i]=-1;
        for(int j=1;j<=tt&&i*pri[j]<=n;++j){
            v[i*pri[j]]=1;
            if(i%pri[j]==0)break;
            mu[i*pri[j]]=-mu[i];
        }
    }
    for(int i=1;i<=n;++i)
        mu[i]=(~mu[i])?(mu[i]*i):(mu[i]*i+P);
    for(int x=n;x;--x)
        for(int T=x+x;T<=n;T+=x)
            (mu[T]+=mu[x])%=P;
    for(int T=1;T<=n;++T)
        (ans+=1ll*a[T]*(a[T]-1)/2%P*T%P)%=P;
    for(int T=1;T<=n;++T)
        (ans+=1ll*T*mu[T]%P*f(T)%P)%=P;
    printf("%d\n",ans);
}

Measured memory_bytes: 11648
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int main() 
{
  int n, t[100002],x[100002],y[100002];
  cin >> n;
  t[0] = 0; x[0] = 0; y[0] = 0;
  for(int i = 1; i <= n; i++) 
    cin >> t[i] >> x[i] >> y[i];

  string ans = "Yes";
  for(int i = 1; i <= n; i++)
  {
    int T = t[i] - t[i-1];
    int X = abs(x[i] - x[i-1]);
    int Y = abs(y[i] - y[i-1]);
    if(X+Y == T) continue;
    else if((X+Y-T)%2 == 0 && X+Y < T) continue;
    else ans = "No";
  }
  cout << ans << endl;
}

Measured memory_bytes: 4804
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a,b) memset(a, b, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;
long power(long x,long y){
	long res=1;
	while(y>0){
		if(y&1)
		res=res*x;

		x*=x;
		y>>=1;
	}
	return res;
}
int main(){
        _ios;

	ll x;
	cin>>x;
	for(ll i=1;i<300;i++){
		for(ll j=i-1;j>-300;j--){
			if(pow(i,5)-pow(j,5)==x){
				cout<<i<<" "<<j;
				return 0;
			}
		}
	}

return 0;
}



Measured memory_bytes: 4024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    int64_t ans=B/X-A/X;
    if(A%X==0) ans++;
    cout<<ans<<endl;
}

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

int main(){
  int n;
  cin >> n;
  
  string a,b,c;
  cin >> a >> b >> c;
  
  int ans = 0;
  for(int i=0; i<n; i++){
    if(a[i] == b[i] && b[i] == c[i]) continue;
    else if(a[i] == b[i] || b[i] == c[i] || c[i] == a[i]) ans++;
    else ans += 2;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	A, B := sc.nextInt(), sc.nextInt()
	if A >= 6 && A <= 12 {
		fmt.Println(B / 2)
		return
	}
	if A >= 13 {
		fmt.Println(B)
		return
	}
	if A <= 5 {
		fmt.Println(0)
		return
	}

}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 640
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const [n, m, x] = input[0].split(" ").map((x: string): number => +x);
const a = [];
for (let i = 0; i < n; i++) {
	a.push(input[i + 1].split(" ").map((x: string): number => +x));
}


let min_cost = Infinity;
for (let b = 1; b < 1 << n; b++) {
	let cost = 0;
	const u = new Array(m).fill(0);
	for (let i = 0; i < n; i++) {
		if ((b & (1 << i)) > 0) {
			for (let ii = 0; ii < m; ii++) {
				u[ii] += a[i][ii + 1];
			}
			cost += a[i][0];
		}
	}
	if (u.every(v => v >= x) && cost < min_cost) {
		min_cost = cost;
	}
}

console.log(min_cost === Infinity ? -1 : min_cost);


Measured memory_bytes: 33648
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int a, b;
	cin >> a >> b;
	cout << (a * b) - (a + b - 1) << endl;
} 

Measured memory_bytes: 3644
import sys
import math
sys.setrecursionlimit(int(1e6))

a, b, c = list(map(int, input().split()))
k = int(input())
#print('a, b, c = ', a, b, c)
#print('k = ', k)

while(k>0):
  if (b > a) and (c > b):
    print('Yes')
    break

  if (b > a):
    c = 2 * c
  else:
    b = 2 * b

  k = k - 1
else:
  if (b > a) and (c > b):
    print('Yes')
  else:
    print('No')

#print('a, b, c = ', a, b, c)
#print('k = ', k)


Measured memory_bytes: 9188
# coding: utf-8
sx, sy, tx, ty = map(int, input().split())

ans = ""
dx = tx - sx
dy = ty - sy

for i in range(dx):
    ans += "R"
for i in range(dy):
    ans += "U"
for i in range(dx):
    ans += "L"
for i in range(dy + 1):
    ans += "D"
for i in range(dx + 1):
    ans += "R"
for i in range(dy + 1):
    ans += "U"
ans += "LU"
for i in range(dx + 1):
    ans += "L"
for i in range(dy + 1):
    ans += "D"
ans += "R"

print(ans)
# UURDDLLUUURRDRDDDLLU


Measured memory_bytes: 3064
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
#include<iostream>
#include<bits/stdc++.h>
#include<cstdio>
#include<string.h>
#include<map>
#include<cmath>
#include<stack>
#include<algorithm>
#include<assert.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define mem0(s) memset(s,0,sizeof(s))
#define meminf(s) memset(s,0x3f,sizeof(s))
#define mp_insert(a,b,c) mp.insert(map<pair<int,int>,int>::value_type(make_pair(a,b),c))
double pi=acos(-1);
typedef long long ll;
typedef unsigned long long ull;
inline ll lowbit(ll x){return x&(-x);}
inline ll min(ll a,ll b){return a<b?a:b;}
inline ll max(ll a,ll b){return a>b?a:b;}
const double Rad_to_deg=45.0/atan(1.0);
inline ll floor(const ll&a,const ll&b){return a/b;}
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
const ll INF=4223372036854775807,max_n=400005,mod=1000000007;
inline ll ceil(const ll&a,const ll&b){if(a%b==0)return a/b;return a/b+1;};
inline ll pow(ll a,ll b,ll mod){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int n;
int a[max_n];
ll ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	cout<<endl;
	for(int i=1;i<=n-2;i++)
	{
		for(int j=i+1;j<=n-1;j++)
		{
			int dang=a[i]+a[j];
			int weizhi=lower_bound(a+j+1,a+n+1,dang)-a;
			ans+=weizhi-j-1;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3644
t=list(map(int,input().split()))
l=[1,0,-1]
k=t[3]
s=0
i=0
while(k!=0):
  if(k>t[i]):
    s+=l[i]*t[i]
    k-=t[i]
  else:
    s+=l[i]*k
    k=0
  i+=1
print(s)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	char c;cin >> c;
	if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" << endl;
	else cout << "consonant" << endl;
}


Measured memory_bytes: 256
/*
* @Author: hannibal_lecter
* @Date:   2018-09-23 20:18:51
* @Last Modified by:   hannibal_lecter
* @Last Modified time: 2018-09-23 20:40:20
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) ((x)&(-x))
typedef long long ll;
const int maxn = 1e5+5;
const int mod = 1e9+9;
int Case = 1, n, m;
int x, y;
int a[maxn], b[maxn];
void solve() {
	cin>>n>>m>>x>>y;
    for(int i = 1; i <= n; i++) {cin>>a[i];}
    for(int i = 1; i <= m; i++) {cin>>b[i];}
    sort(a+1, a+1+n);
	sort(b+1, b+1+m);
	for(int i = x+1; i <= y; i++) {
		if(a[n]<i&&b[1]>=i) {
			cout<<"No War\n";
			return;
		}
	}
    cout<<"War\n";
    return;
}

int main() {
    //ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    //freopen("/Users/hannibal_lecter/Desktop/code/in.txt", "r", stdin);
    //freopen("/Users/hannibal_lecter/Desktop/code/out.txt","w",stdout);
#endif
    while(Case--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
int dy[] = {1, 0, 0, -1};
int dx[] = {0, 1, -1, 0};
bool used[110][110];
string s[110];
int h, w;
void dfs(int y, int x, char c){
	rep(i, 4){
		int ny = y + dy[i], nx = x + dx[i];
		if(!(0 <= ny && ny < h && 0 <= nx && nx < w)) continue;
		if(used[ny][nx]) continue;
		if(s[ny][nx] != c) continue;
		used[ny][nx] = true;
		dfs(ny, nx, c);
	}
	return;
}
int main(void){
	while(1){
		cin >> h >> w;
		if(h == 0 && w == 0) return 0;
		rep(i, 110)rep(j, 110) used[i][j] = false;
		int cnt = 0;
		rep(i, h){
			cin >> s[i];
		}
		rep(i, h)rep(j, w){
			if(!used[i][j]){
				cnt++;
				used[i][j] = true;
				dfs(i, j, s[i][j]);
			}
		}
		cout << cnt << endl;
	}
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

ll arr[MX][2],dp[MX];

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    ll N,W; cin >> N >> W;

    F0R(i,N) F0R(j,2) {
        cin >> arr[i][j];
    }

    memset(dp,63,sizeof dp);

    dp[0] = 0;
    F0R(i,N) {
        ROF(v,arr[i][1],MX) {
            dp[v] = min(dp[v],dp[v-arr[i][1]]+arr[i][0]);
        }
    }

    ll res = 0;
    F0R(i,MX) if (dp[i] <= W) {
        res = i;
    }

    cout << res << "\n";
}


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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    int a, b, c, d, n, m, x, y, h, w;
    string s, t;


    auto Yes = [&](bool t){
        cout << (t ? "Yes" : "No") << endl;
    };
    auto YES = [&](bool t){
        cout << (t ? "YES" : "NO") << endl;
    };
    auto tri = [&](bool t, string a, string b){
        cout << (t ? a : b) << endl;
    };

    cin >> h >> w;
    for(int i = 0; i < h; ++i){
        cin >> s;
        cout << s << endl;
        cout << s << endl;
    }

}


Measured memory_bytes: 256
//g++ -std=c++14 test.cpp -o test.out

 
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

string S,T;
LL Q;
LL A[100000],B[100000],C[100000],D[100000];

vector<string> ans;

void solve(){
    //pair<それまで出てきたAの総数,それまで出てきたBの総数>
    vector<pair<LL,LL>> S_accum(S.size()+1,pair<LL,LL>(0,0));
    for(int i=0;i<S.size();i++){
        S_accum[i+1].first = S_accum[i].first + (S[i]=='A');
        S_accum[i+1].second = S_accum[i].second + (S[i]=='B');
    }
    vector<pair<LL,LL>> T_accum(T.size()+1,pair<LL,LL>(0,0));
    for(int i=0;i<T.size();i++){
        T_accum[i+1].first = T_accum[i].first + (T[i]=='A');
        T_accum[i+1].second = T_accum[i].second + (T[i]=='B');
    }

    for(int i=0;i<Q;i++){
        LL S_A = (S_accum[B[i]].first-S_accum[A[i]-1].first)%3LL;
        LL S_B = (S_accum[B[i]].second-S_accum[A[i]-1].second)%3LL;
        LL T_A = (T_accum[D[i]].first-T_accum[C[i]-1].first)%3LL;
        LL T_B = (T_accum[D[i]].second-T_accum[C[i]-1].second)%3LL;
        
        bool ok = false;
        for(int i=0;i<3;i++){
            if(S_A==(T_A+i)%3 && S_B==(T_B+i)%3) ok = true;
        }
        if(ok) ans.push_back("YES");
        else ans.push_back("NO");
    }
}
 
int main(){
	cin >> S >> T >> Q;
    for(int i=0;i<Q;i++) cin >> A[i] >> B[i] >> C[i] >> D[i];
 
    solve();

	for(int i=0;i<Q;i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 12392
#include <stdio.h>
#include <string.h>
 
int main(){
	char w[100];
	int a[26]={};
	int i,j=0;

	scanf("%s",w);

	for(i=0;i<strlen(w);i++){
		a[w[i]-97]++;
	}

	for(i=0;i<26;i++){
		if(a[i]%2!=0){
			j=1; break;
		}
	}

	printf("%s\n",j==0?"Yes":"No");
	return 0;
}

Measured memory_bytes: 128