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

using namespace std;

string a;

int main() {
    int n , sac , swa , stle , sre;
    cin >> n;
    sac = swa = stle = sre = 0;
    while(n -- )
    {
        cin >> a;
        if(a == "AC")
            sac++;
         else if(a == "WA")
            swa++;
         else if(a == "TLE")
            stle++;
        else sre++;
    }
    cout << "AC " << "x " << sac << "\n";
    cout << "WA " << "x " << swa << "\n";
    cout << "TLE " << "x " << stle << "\n";
    cout << "RE " << "x " << sre << "\n";
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<vector>
#include<utility>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<limits>
#include <bitset>      


#define LL long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define INF numeric_limits<int>::max()



using namespace std;


LL dp[102][100005];



int main(){

    int n, w;
    cin >> n >> w;

    int e[n+1], v[n+1];

    memset(dp, INF, sizeof dp);


    for(int i = 1; i <= n; i++){
        cin >> e[i] >> v[i];
      }

    
     for(int i = 0; i<= n; i++){
        for(int j = 0; j <= 100005; j++){
            dp[i][j] = INF;
        }
    }
    

    for(int i = 1; i <= n; i++){
        dp[i][v[i]] = e[i];
        for(int k = 1; k <= 100005; k++){
             dp[i][k] = min(dp[i][k], dp[i-1][k]);
             if(k >= v[i])
                dp[i][k] = min(dp[i][k], dp[i - 1][k - v[i]] + e[i]);
            }
        } 
    


    int ans = 0;

    for(int i = 1; i <= 100005; i++){
          if(dp[n][i] <= w)
                 ans = max(ans, i);
        }
    


    cout << ans;


    return 0;
}




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

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> v(m);
    for (auto &e: v) {
        cin >> e.second >> e.first;
    }
    sort(v.begin(), v.end());
    int ans = 0;
    int curr_bridge = 0;
    for (int i = 0; i < m; i++) {
        int a = v[i].second, b = v[i].first;
        if (curr_bridge < a) {
            ans++;
            curr_bridge = b - 1;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int H, W; cin >> H >> W;
    int N; cin >> N;
    int paint = max(H, W);
    if(N % paint == 0) cout << N/paint << endl;
    else cout << N/paint + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
sumdigits(n, base=10) = sum(digits(n, base=10))

function main()
    n=parseInt(readline())
    a=parseMap(split(readline()))
    cnt=1
    ans=0
    for i in 2:n
        if a[i]==a[i-1]
            cnt+=1
        else
            cnt=1
        end
        if cnt%2==0
            ans+=1
        end
    end
    println(ans)
end
main()

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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    S[3] = '8';
    cout << S << endl;

    return 0;
}


Measured memory_bytes: 256
S = input()

dp = [False] * (len(S) + 1)
dp[0] = True
T = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(1, len(S) + 1):
    tmp = []
    for t in T:
        if i < len(t):
            continue
        tmp.append(dp[i-len(t)] and t == S[i-len(t): i])
    if any(tmp):
        dp[i] = True
print('YES' if dp[len(S)] else 'NO')

Measured memory_bytes: 3956
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,m = map(int, input().split())
ns = [[] for _ in range(n)]
for _ in range(m):
    u,v = map(int, input().split())
    ns[u].append(v)
def scc():
    preorder = {}
    lowlink = {}
    seen = [False]*n
    scc_queue = []
    i = 0  # Preorder counter
    ans = []
    for source in range(n):
        if seen[source]:
            continue
        queue = [source]
        while queue:
            v = queue[-1]
            if v not in preorder:
                i = i + 1
                preorder[v] = i
            done = True
            for w in ns[v]:
                if w not in preorder:
                    queue.append(w)
                    done = False
                    break
            if done:
                lowlink[v] = preorder[v]
                for w in ns[v]:
                    if seen[w]:
                        continue
                    if preorder[w] > preorder[v]:
                        lowlink[v] = min([lowlink[v], lowlink[w]])
                    else:
                        lowlink[v] = min([lowlink[v], preorder[w]])
                queue.pop()
                if lowlink[v] == preorder[v]:
                    scc = {v}
                    seen[v] = True
                    while scc_queue and preorder[scc_queue[-1]] > preorder[v]:
                        k = scc_queue.pop()
                        scc.add(k)
                        seen[k] = True
                    ans.append(scc)
                else:
                    scc_queue.append(v)
    return ans
comp = scc()
print(len(comp))
for item in reversed(comp):
    print(len(item), " ".join(map(str, item)))

Measured memory_bytes: 343036
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using lint = long long;
using P = pair<int, int>;

// int A, F, H, I, J, K, L, M, N, S, T, U;
lint F, H, I, J, K, L, M, N, S, T, U;
//string S;
int ans;

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

	cin >> H >> N;
	lint total = 0;
	rep (i, N) {
		cin >> F;
		total += F;
	}

	if (total >= H)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

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

#define int long long
#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) begin(x),end(x)

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;
		
signed main()
{
    flash
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
		int n;
		cin>>n;
		if(n>=30)
		{
			cout<<"Yes";
		}
		else
		{
			cout<<"No";
		}		
    }
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <vector>
#include <cstdlib> //abs(int)
using namespace std;
int main(void){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(abs(a - b) <= d && abs(b - c) <= d){
    cout << "Yes";
  } else if(abs(a - c) <= d){
    cout << "Yes";
  } else {
    cout << "No";
  }
}

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

/*** Template Begins ***/

typedef long long                   ll;
typedef pair<int,int>               PII;
typedef pair<ll, pair<int, int> >   PIII;
typedef vector<int>                 vi;
typedef vector<pair<int, int> >     vii;

#define endl         '\n'
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
#define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007
#define all(a)       (a).begin(),(a).end()
#define fr(i,a,b)    for(int i=a;i<=b;i++)
#define lp(i,a)      for(int i=0;i< a;i++)

// Debug //

#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;

// Constants //

const int N = 5e1+7;
const int xinc[] = {0, 0, 1, -1};
const int yinc[] = {1, -1, 0, 0};
const long double PI = acos(-1.0);

/*** Template Ends ***/
int n;
PII pt[N];
vii poss;
bool vis[N];

int check(int p, int q) {
	memset(vis, false, sizeof vis);
	map<pair<int, int>, int> m;

	for (int i = 0; i < n; i++)	m[pt[i]] = i;
	
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (vis[i])	continue;

		cnt++;
		vis[i] = true;

		int xi = pt[i].F, yi = pt[i].S;
		while(m.find(mp(xi+p, yi+q)) != m.end())
			vis[m[mp(xi+p, yi+q)]] = true, xi += p, yi += q;

	}
	return cnt;
}

void solve() {
    
    cin >> n;
    lp(i,n) cin >> pt[i].F >> pt[i].S;
    if (n == 1)	{
    	cout << 1 << endl;
    	return;
    }
    sort(pt, pt+n);

    lp(i,n) fr(j,i+1,n) {
    	int dx = pt[j].F-pt[i].F;
    	int dy = pt[j].S-pt[i].S;
    	poss.pb(mp(dx, dy));
    }
    int ans = INT_MAX;
    for (auto i : poss)	ans = min(ans, check(i.F, i.S));
    cout << ans << endl;
}

signed main() {
    
    ios;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int t;
    //cin >> t;
    t = 1;
    while(t--)
        solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cout << #x << " = " << x << endl
#define REP(i , n) for(Long i = 0; i < (Long)n ; i++)
#define pb push_back

using namespace std;

typedef long long Long;

const Long MX = 1e6;
const Long ALPH = 3;

struct Trie{
	Long memo[MX][ALPH];
	Long level[MX];
	Long nodos = 1;
	
	void addWord(string &s){
		Long sz = s.size();
		Long u = 0;
		REP(i , sz){
			Long c = s[i] - '0';
			if(memo[u][c] == 0){
				memo[u][c] = nodos++;
				level[u] = i ;	
			}
			u = memo[u][c];
		}
	}
}trie;


Long f(Long x){
	for(Long i = 0; i < 60; i++){
		if(((x>>i)&1) == 1){
			return i+1;
		}
	}
	return 1;	
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	Long N, L;
	cin >> N >> L;
	REP(i , N){
		string s;
		cin >> s;
		trie.addWord(s);
	}
	Long ans = 0;
	for(Long i = 0; i < trie.nodos; i++){
		if(trie.memo[i][0] != 0 && trie.memo[i][1] == 0){
			ans = ans ^ f(L - trie.level[i]);
			
			
		}
		if(trie.memo[i][0] == 0 && trie.memo[i][1] != 0){
			ans = ans ^ f(L - trie.level[i]);
		}
	}


	if(ans == 0){
		cout << "Bob" << endl;	
	} else {
		cout << "Alice" << endl;	
	}
	return 0;
}


Measured memory_bytes: 6608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		var A = GetInts(N);

		for(int i = 0; i < N; i++)
		{
			if(A[i] % 2 == 1)
				continue;

			if(A[i] % 3 != 0 && A[i] % 5 != 0)
			{
				WriteLine("DENIED");
				return;
			}
		}
		WriteLine("APPROVED");
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 13396
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

  	int a, b, c, d; cin >> a >> b >> c >> d;
    if (abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	int ans = h2*60+m2;
	ans -= h1*60+m1;
	ans -= k;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3620
n,k=map(int,input().split())
l=[0]*(10**5+1)
for _ in range(n):
    a,b=map(int,input().split())
    l[a]+=b
s=0    
for i in range(len(l)):
    s+=l[i]
    if s>=k:
        print(i)
        break

Measured memory_bytes: 44632
N = int(input().strip())
A = list(map(int, input().strip().split(' ')))
B = list(map(int, input().strip().split(' ')))
C = list(map(int, input().strip().split(' ')))

ans = sum(B)
for i in range(0,N-1):
  if A[i]+1 == A[i+1]:
    ans += C[A[i]-1]
print(ans)

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

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

    int H,W,A,B; cin>>H>>W>>A>>B;
    vector<vector<int>> v(H,vector<int>(W,0));
    for(int i=0;i<B;i++){
        for(int j=0;j<A;j++){
            v[i][j]=1;
        }
    }
    for(int i=B;i<H;i++){
        for(int j=A;j<W;j++){
            v[i][j]=1;
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cout<<v[i][j];
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 9088
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    ll sum = 0;
    for(int i = 0; i < s.length(); i++) {
    	sum += s[i] - '0';
    }
    if(sum % 9) {
    	cout << "No\n";
    } else {
    	cout << "Yes\n";
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    long n;

    cin >> n;

    ll a;
    ll m = 0;
    ll k = 0;
    ll j = 0;
    bool is4 = false;
    bool isNo = false;

    long i;

    for (i = 0; i < n; i++) {
        cin >> a;

        if (a % 4 == 0) m++;
        else if (a % 2 == 0) k++;
        else j++;
    }

    for (i = 0; i < n;) {
        if (!is4 && 0 < k) {
            i += k;
            k = 0;
            is4 = true;
        } else if (is4 && 0 < m) {
            m--;
            is4 = false;
            i++;
        } else if (!is4 && 0 < j) {
            i++;
            j--;
            is4 = true;
        } else if (!is4 && 0 < m) {
            i++;
            m--;
            is4 = true;
        } else {
            isNo = true;

            break;
        }
    }

    if (isNo) cout << "No" << endl;
    else cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int h, w;
char map[21][21];
int d, x, y;

void koudou(char);

main(){
  int t, i, j, k, n, f=0, l;
  char temp;
  
  scanf("%d", &t);
  
  for(i=0;i<t;i++){
    if(f==1) printf("\n");
    scanf("%d %d", &h, &w);
    getchar();
    
    for(j=0;j<h;j++){
      for(k=0;k<w;k++){
	scanf("%c", &map[j][k]);
	if(map[j][k]=='^'){
	  y=j;
	  x=k;
	  d=0;
	}
	else if(map[j][k]=='>'){
	  y=j;
	  x=k;
	  d=1;
	}
	else if(map[j][k]=='v'){
	  y=j;
	  x=k;
	  d=2;
	}
	else if(map[j][k]=='<'){
	  y=j;
	  x=k;
	  d=3;
	}
      }
      getchar();
    }
    scanf("%d", &n);
    getchar();
    
    for(j=0;j<n;j++){
      scanf("%c", &temp);
      koudou(temp);
    }

    for(j=0;j<h;j++){
      for(k=0;k<w;k++){
	printf("%c", map[j][k]);
      }
      printf("\n");
    }
    
    f=1;
  }
  return 0;
}


void koudou(char a){
  int i, j, k, ty, tx;
  
  if(a=='U'){
    d=0;
    map[y][x]='.';
    ty=y-1;
    tx=x;
    if(ty>=0 && ty<h && tx>=0 && tx<w){
      if(map[ty][tx]=='.'){
	y=ty;
	x=tx;
      }
    }
    map[y][x]='^';
  }
  
  else if(a=='R'){
    d=1;
    map[y][x]='.';
    ty=y;
    tx=x+1;
    if(ty>=0 && ty<h && tx>=0 && tx<w){
      if(map[ty][tx]=='.'){
	y=ty;
	x=tx;
      }
    }
    map[y][x]='>';
  }
  
  else if(a=='D'){
    d=2;
    map[y][x]='.';
    ty=y+1;
    tx=x;
    if(ty>=0 && ty<h && tx>=0 && tx<w){
      if(map[ty][tx]=='.'){
	y=ty;
	x=tx;
      }
    }
    map[y][x]='v';
  }
  
  else if(a=='L'){
    d=3;
    map[y][x]='.';
    ty=y;
    tx=x-1;
    if(ty>=0 && ty<h && tx>=0 && tx<w){
      if(map[ty][tx]=='.'){
	y=ty;
	x=tx;
      }
    }
    map[y][x]='<';
  }
  
  else if(a=='S'){
    ty=y;
    tx=x;
    while(1){
      if(d==0){
	ty--;
	if(ty<0 || ty>=h || tx<0 || tx>=w) break;
	if(map[ty][tx]=='#') break;
	if(map[ty][tx]=='*'){
	  map[ty][tx]='.';
	  break;
	}
      }
      
      else if(d==1){
	tx++;
	if(ty<0 || ty>=h || tx<0 || tx>=w) break;
	if(map[ty][tx]=='#') break;
	if(map[ty][tx]=='*'){
	  map[ty][tx]='.';
	  break;
	}
      }
      
      else if(d==2){
	ty++;
	if(ty<0 || ty>=h || tx<0 || tx>=w) break;
	if(map[ty][tx]=='#') break;
	if(map[ty][tx]=='*'){
	  map[ty][tx]='.';
	  break;
	}
      }
      
      else if(d==3){
	tx--;
	if(ty<0 || ty>=h || tx<0 || tx>=w) break;
	if(map[ty][tx]=='#') break;
	if(map[ty][tx]=='*'){
	  map[ty][tx]='.';
	  break;
	}
      }
    }
  }
}

Measured memory_bytes: 0
n = gets.to_i

def dsum(n)
  sum = 0
  while true
    n, r = n.divmod(10)
    sum += r
    break if n==0
  end
  sum
end

# p dsum(99999)

min = Float::INFINITY

1.upto(n/2+1) do |i|
  min = [min, dsum(i)+dsum(n-i)].min
end

p min


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

using namespace std;

int main()
{
   string s;
   cin>>s;
   int n;
   long long sum=0;
   for(int i=0; s[i]!='\0'; ++i)
   {
       sum+=s[i]-'0';
   }
   if(sum%9==0)
        cout<<"Yes";
    else
        cout<<"No";
   return 0;
}

Measured memory_bytes: 3684
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }


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

i64 n,k;
cin>>n>>k;
if(2*k-1<=n)
cout<<"YES";
else
cout<<"NO";




    return 0;
  }


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

using namespace std;
string S;
int main(void) {

	cin >> S;

	int ans = 0;

	for (int i = 1; i < (int)S.size(); i++){
		if (S[i - 1] != S[i]) { ans++; }
     }
	cout << ans << endl;
	

	//system("pause");
	return 0;
};

Measured memory_bytes: 512
N,Y = gets.strip.split.map(&:to_i)
i,j,k = -1,-1,-1

(0..N).each do |a|
  (0..N-a).each do |b|
    i,j,k = a,b,N-a-b if a*10000+b*5000+(N-a-b)*1000 == Y
    break if i!=-1
  end
end

puts "#{i} #{j} #{k}"

Measured memory_bytes: 1916
#include<iostream>
using namespace std;
int main(){
	int a, b, c,M = 0;
	cin >> a >> b >> c;
	for (int i = a; i <= b; i++){
		if (c%i == 0){
			M++;
		}
		
	}
	cout << M << endl;
	return 0;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
const ll INF = 1001001001;
const int mod = 1000000007;

int main() {
    int x, a;
    cin >> x >> a;

    if (x < a) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }

}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, p: "List[float]"):
    # prob[i][j]はi枚まで投げてj枚表になる確率
    prob = [[0]*(N+1) for _ in range(N+1)]
    prob[0][0] = 1
    for i in range(N):
        for j in range(N+1):
            prob[i+1][j] = prob[i][j]*(1-p[i])
            if j-1 >= 0:
                prob[i+1][j] += prob[i][j-1]*p[i]
    print(sum(prob[N][N//2+1:]))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    p = [float(next(tokens)) for _ in range(N)]  # type: "List[float]"
    solve(N, p)


if __name__ == '__main__':
    main()


Measured memory_bytes: 259720
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int d, n;
    cin >> d >> n;
    if(n!=100){
        int num = 1;
        rep(i,d) num *= 100;
        int ans = 0;
        rep(i,n) ans += num;
        cout << ans << endl;
    }
    else{
        int num = 1;
        int num2 = 1;
        rep(i,d+1) num *= 100;
        rep(i,d) num2 *= 100;
        cout << num + num2 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h> // Tomasz Nowak
using namespace std;     // XIII LO Szczecin
using LL = long long;    // Poland
#define FOR(i, l, r) for(int i = (l); i <= (r); ++i)
#define REP(i, n) FOR(i, 0, (n) - 1)
template<class T> int size(T &&x) {
	return int(x.size());
}
template<class A, class B> ostream& operator<<(ostream &out, const pair<A, B> &p) {
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto it = x.begin(); it != x.end(); ++it)
		out << *it << (it == prev(x.end()) ? "" : ", ");
	return out << '}';
}
void dump() {}
template<class T, class... Args> void dump(T &&x, Args... args) {
	cerr << x << ";  ";
	dump(args...);
}
#ifdef DEBUG
  struct Nl{~Nl(){cerr << '\n';}};
# define debug(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dump(x), Nl(), cerr << ""
#else
# define debug(...) 0 && cerr
#endif
mt19937_64 rng(0);
int rd(int l, int r) {
	return uniform_int_distribution<int>(l, r)(rng);
}
// end of templates

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

	string s;
	cin >> s;
	int n = size(s);
	if(n % 2 == 1)
		return cout << "No\n", 0;
	REP(i, n)
		if(i % 2 == 0) {
			if(s[i] != 'h')
				return cout << "No\n", 0;
		}
		else {
			if(s[i] != 'i')
				return cout << "No\n", 0;
		}
	cout << "Yes\n";
}


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

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

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

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

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

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

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

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

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

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

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

fn main() {
    input! {
        n: usize,
    }
    println!("{}", 111 * ((n + 110) / 111));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;


struct point
{
    double x, y;
};

point p[50];
int n, M;

double d(point& a, point& b)
{
    return hypot(a.x - b.x, a.y - b.y);
}

point operator+(point a, point b)
{
    return point{a.x + b.x, a.y + b.y};
}

point operator*(double x, point a)
{
    return point{x*a.x,x*a.y};
}

point operator-(point a, point b)
{
    return a + (-1) * b;
}

point rot(point a)
{
    swap(a.x, a.y);
    a.x *= -1;
    return a;
}

point norm(point a)
{
    return (1. / hypot(a.x, a.y)) * a;
}

bool chk(point c, double r)
{
    for (int i = 0; i < n; ++i)
        if (d(c, p[i]) > r + 1e-7)
            return false;
    return true;
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> p[i].x >> p[i].y;

    double lo = 0, hi = 1e6;
    while (hi - lo > 1e-7)
    {
        double r = (lo + hi) / 2;
        bool good = false;
        for (int i = 0; i < n; ++i)
        {
            for (int j = i + 1; j < n; ++j)
            {
                if (d(p[i], p[j]) > 2 * r) continue;
                point c = 0.5 * (p[i] + p[j]);
                point v = norm(rot(p[i] - p[j]));
                double ds = d(p[i], p[j]);
                double al = sqrt(r * r - (ds / 2) * (ds / 2));
                point c1 = c + al * v;
                point c2 = c - al * v;
                if (chk(c1, r) || chk(c2, r))
                {
                    good = true;
                    break;
                }
            }
        }

        if (good)
            hi = r;
        else
            lo = r;
    }
    cout << setprecision(15) << fixed << lo;
}


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

int main(void)
{
	int n;
	int i, j, k;
	int sum = 0;
	int min = 10000;
	int count = 0;
	int w[100] = {0};
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%d", &w[i]);
		sum += w[i];
	}
	
	for(i = 0; i < n; i++) {
		count += w[i];
		if(min >= abs(count - (sum - count) ) ) {
			min = abs(count - (sum - count) );
		}
	}
	
	printf("%d\n", min);
	
	return 0;
}

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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 1e2 + 10;
const int maxK = 1e5 + 10;
const ll mod = 1e9 + 7;

int n, k, a;
ll dp[maxN][maxK];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> k;
    dp[0][0] = 1;
    for1(i, n)
    {
        cin >> a;
        for0(j, k + 1)
        {
            dp[i][j] += dp[i - 1][j];
            if (j + a < k)
            {
                dp[i][j + a + 1] -= dp[i - 1][j];
            }
        }
        for1(j, k)
        {
            dp[i][j] += dp[i][j - 1];
            dp[i][j] %= mod;
        }
    }
    cout << (dp[n][k] + mod) % mod;
    return 0;
}


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

#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;



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

    ll tmp_a = max(a-k, ll(0));
    ll tmp_b = max(b-(k-(a-tmp_a)), ll(0));

    cout << tmp_a << " " <<  tmp_b << endl;
    return 0;
}



Measured memory_bytes: 256
import itertools
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
l=[]
for a in itertools.permutations(range(1,n+1),n):
  l.append(a)
ip=l.index(tuple(p))
iq=l.index(tuple(q))
print(abs(ip-iq))

Measured memory_bytes: 7924
n = input()
A = [int(x) for x in input().split()]
B = [int(y) for y in input().split()]

sum_hit_count = 0
next_knock_down = 0

for i in range(len(A)-1):
    remaining_enemy = A[i] - next_knock_down
    if remaining_enemy >= B[i]:
        sum_hit_count += B[i]
        next_knock_down = 0
        continue
    else:
        sum_hit_count += remaining_enemy
        remaining_capacity = B[i] - remaining_enemy
        if A[i+1] >= remaining_capacity:
            sum_hit_count += remaining_capacity
            next_knock_down = remaining_capacity
        else:
            sum_hit_count += A[i+1]
            next_knock_down = A[i+1]

print(sum_hit_count)

Measured memory_bytes: 18436
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n;cin>>n;
    vector<vector<ll> >G(n+1);
    rep(i,n-1){
        ll a,b;cin>>a>>b;
        G[a].pb(b);
        G[b].pb(a);
    }
    ll ans=0;
    vector<ll> c(n);
    rep(i,n){
        cin>>c[i];
        ans+=c[i];
    }
    sort(all(c));
    reverse(all(c));
    ans-=c[0];
    queue<ll>q;
    q.push(1);
    vector<ll>visited(n+1);
    vector<ll>d(n+1);
    ll now=0;
    while(!q.empty()){
        ll k=q.front();
        visited[k]=1;
        d[k]=c[now];
        q.pop();
        for(auto e:G[k]){
            if(visited[e])continue;
            else q.push(e);
        }
        now++;
    }
    cout<<ans<<endl;
    REP(i,1,n+1){
        cout<<d[i]<<' ';
    }
    cout<<endl;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int w = (c - 1) / b+1;
    int s = (a - 1) / d+1;
    if (s >= w)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3568
N = input()
if len(N) == 1:
  # 1桁の数字
  print(N)
elif all(map(lambda x: x == '9', N[1:])):
  # 下位が全部9の場合
  print(sum(int(n) for n in N))
else:
  # 下位を全部9にする例
    print(9 * (len(N) - 1) + int(N[0]) - 1)
 

Measured memory_bytes: 38384
import itertools
import sys
sys.setrecursionlimit(5000)


class TestInput:
    @classmethod
    def input(self):
        TestInput.current += 1
        return TestInput.data.splitlines()[TestInput.current]
    current = -1
    data = '''\
2 2
0 1
1 0
5 4
1 0 1 0 0
1 0 0 0 0
1 0 1 0 1
1 0 0 1 0
0 0
'''


def read_input():
    # return TestInput.input()
    return input()


class IslandMap:
    moves = list(itertools.product([-1, 0, 1], [-1, 0, 1]))

    def __init__(self, w, h, c):
        self.w = w
        self.h = h
        self.c = c

    def dfs(self, p):
        self.c[p[0]][p[1]] = 0
        for m in IslandMap.moves:
            n = (p[0] + m[0], p[1] + m[1])
            if 0 <= n[0] < self.h and 0 <= n[1] < self.w:
                if self.c[n[0]][n[1]] == 1:
                    self.dfs(n)

    def solve(self):
        region = 0
        lattice = itertools.product(range(self.h), range(self.w))
        for p in lattice:
            if self.c[p[0]][p[1]] == 1:
                self.dfs(p)
                region += 1
        return region


while True:
    w, h = map(int, read_input().split())
    if w == 0 or h == 0:
        break
    c = [list(map(int, read_input().split())) for i in range(h)]
    island = IslandMap(w, h, c)
    print(island.solve())



Measured memory_bytes: 8168
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string str;
    cin >> str;
    map<int,bool> m;
    for(char c : str){
        m[c] = true;
    }

    if((m['W']) == (m['E']) && (m['N']) ==  (m['S'])){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> pair_t;
using Graph = vector<vector<ll>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = 1 << 29;
/****** define constant end ********/
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
	if (n & 1)
	  res = res * a % mod;
	a = a * a % mod;
	n >>= 1;
  }
  return res;
}
/****** define variable start ******/
ll n, k;
/******* define variable end *******/
int solve() {
	cin >> n >> k;
	vl gcd_count(k);
	for(ll i = k - 1; i >= 0; i--){
		ll sum = 0;
		for(ll j = 1; j <= floor((long double)k / (i+1)); j++){
			sum += gcd_count[j * (i+1)-1] % MOD;
		}
		gcd_count[i] = modpow(floor((long double)k / (i+1)), n, MOD) - sum;
	}
	ll ans = 0;
	REP(i, k){
		ans += gcd_count[i] * (i+1) % MOD;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

int main() {
	// clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


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

const int N = 2e6 + 5;
typedef long long LL;

int n, a, b, c, d;
bool f[N], g[N], vis[N];
char ch;

int main() {
	cin>>n>>a>>b>>c>>d;
	for(int i = 1; i <= n; i++) {
		cin>>ch;
		if(ch == '.') vis[i] = 1;
	}
	f[a] = g[b] = 1;
	for(int i = a + 1; i <= c; i++)
		if(vis[i]) f[i] = max(f[i - 1], f[i - 2]);
	for(int i = b + 1; i <= d; i++)
		if(vis[i]) g[i] = max(g[i - 1], g[i - 2]);
	if(c < d) {
		cout<<((f[c] && g[d]) ? "Yes" : "No")<<endl;
		return 0;
	}
	if(!f[c] || !g[d]) {
		cout<<"No"<<endl;
		return 0;
	}
	for(int i = b; i <= d; i++)
		if(g[i] && f[i - 1] && f[i + 1]) {
			cout<<"Yes"<<endl;
			return 0;
		}
	cout<<"No"<<endl;
	return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const ll mod = 1000000007LL;
#define MAX 2010
ll dp[MAX][MAX]; // [L,R]
string s;
int n;

const bool debug = 0;

int rpos[26][MAX], lpos[26][MAX];
int used[30];

void precalc() {
  memset(rpos,-1,sizeof rpos);
  memset(lpos,-1,sizeof lpos);
  rep(i,n) rpos[s[i]-'a'][i] = lpos[s[i]-'a'][i] = i;
  for(int i=n-2;i>=0;--i) rep(j,26) if( rpos[j][i] == -1 ) {
      rpos[j][i] =  rpos[j][i+1];
    }
  REP(i,1,n) rep(j,26) if( lpos[j][i] == -1 ) {
    lpos[j][i] = lpos[j][i-1];
  }
}

int cnt[26];
int getUniqueNum(int l,int r) {
  memset(cnt, 0, sizeof cnt);
  int c = 0;
  rep(i,26) {
    if( ( l <= lpos[i][r] && lpos[i][r] <= r ) && !cnt[i] ) cnt[i] = 1, ++c;
    if( ( l <= rpos[i][l] && rpos[i][l] <= r ) && !cnt[i] ) cnt[i] = 1, ++c;
  }
  return c;
}


void compute() {
  map<char,int> most_left;
  n = s.size();

  precalc();

  ll answer = getUniqueNum(0,n-1);
  
  rep(i,n) if( !used[s[i]-'a'] ) {
    used[s[i]-'a'] = 1;
    int p = lpos[s[i]-'a'][n-1];
    if( p != -1 && p >= i ) {
      ++dp[i][p];
    }
  }

  rep(l,n) {
    REP(r,l+1,n) {
      rep(i,26) {
	int rp = rpos[i][l+1];
	if( rp == -1 || rp >= r ) continue;
	int lp = lpos[i][r-1];
	if( lp == -1 || lp <= l ) continue;
	( dp[rp][lp] += dp[l][r] ) %= mod;
      }
    }
  }

  rep(l,n) REP(r,l+1,n) {
    ( answer += dp[l][r] ) %= mod;
    ll unique = getUniqueNum(l+1,r-1);
    ( answer += ( ( dp[l][r] * unique ) % mod ) ) %= mod;
  }

  cout << answer << endl;
}

int bf() {
  set<string> S;
  n = s.size();
  REP(i,1,(1<<n)) {
    string t = "";
    rep(j,n) if( (i>>j) & 1 ) t = t + s[j];
    string rt = string(t.rbegin(),t.rend());
    if( t == rt ) {
      //if( t.find("k") != string::npos )
      S.insert(t);
    }
  }
  for(auto t : S) {
    cout << "  " << t << endl;
  }
  return S.size();
}

int main() {
  if( 0 ) {
    //rep(i,2000) cout << (char)('a'+rand()%26); puts("");
    rep(i,2000) cout << (char)('a'); puts("");
    return 0;
  }
  cin >> s;
  //cout << bf() << endl;
  compute();
  return 0;
}



Measured memory_bytes: 26168
#include<stdio.h>
int bisearch(int);
int A[10000000],n;
int main(){
  int i,q,judge,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&judge);
    if(bisearch(judge)) count++;
  }
  printf("%d\n",count);
  return 0;
}

int bisearch(int key){
  int l=0,r=n,mid;
  while(l<r){
    mid=(l+r)/2;
    if(key==A[mid]) return 1;
    if(key>A[mid]) l=mid+1;
    else if(key<A[mid]) r=mid;
  }
  return 0;
}





Measured memory_bytes: 2120
def main():
    import os

    INF = 10 ** 9 + 10

    D = int(input())
    *C, = map(int, input().split())
    # C[type]
    # sum(ci*(d-last(d,i) for ci in C)だけ下がる
    S = [[int(x) for x in input().split()] for _ in range(D)]
    # S[day][type]:=happiness

    last = [-1] * 26

    def diff(d, t):
        ret = S[d][t]
        ret -= sum(ci * (d - last[i]) for i, ci in enumerate(C) if i != t)
        if d < D - 1:
            ret -= sum(ci * (d + 1 - last[i]) for i, ci in enumerate(C) if i != t)
        if d < D - 2:
            ret -= sum(ci * (d + 2 - last[i]) for i, ci in enumerate(C) if i != t)
        ret -= C[t]
        return ret

    T = []
    score = 0
    for d in range(D):
        delta = -INF
        take_t = -1
        for t_ in range(26):
            buf = diff(d, t_)
            if delta < buf:
                delta = buf
                take_t = t_
            elif delta == buf and C[t_] > C[take_t]:
                delta = buf
                take_t = t_

        last[take_t] = d
        score += buf
        T.append(take_t + 1)
    print(*T, sep='\n')
    # print(os.path.join(os.path.dirname(__file__), 'output_file.txt'))
    # with open(file=os.path.join(os.path.dirname(__file__), 'output_file.txt'), mode='w', encoding='utf-8') as f:
    #     for t in map(str, T):
    #         f.write(t)
    #         f.write('\n')

    # print(score)


if __name__ == '__main__':
    main()


Measured memory_bytes: 71324
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

string a,b;

int main() {
	// your code goes here
	cin >> a >> b;
	for(int i = 0; i < b.length(); i++) {
	    cout << a[i] << b[i];
	}
	if(a.length() > b.length()) {
	    cout << a[a.length()-1];
	}
	cout << endl;
	return 0;
}


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

namespace _0028
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "";
            int[] num = new int[100];
            while ((str = Console.ReadLine()) != null)
            {
                int input = int.Parse(str);
                num[input - 1]++;
            }
            int max = 0;
            for (int i = 0; i < 100; i++)
            {
                if (num[i] >= max)
                {
                    max = num[i];
                }
            }
            for (int i = 0; i < 100; i++)
            {
                if (num[i] == max)
                {
                    Console.WriteLine(i + 1);
                }
            }
        }
    }
}



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

int main(){
  string a;
  cin >> a;
  
  if( a.at(a.size() - 1) == 's') {
	a += "es";
  }else{
    a += "s";
  }
  
  cout << a << endl;
}


  
  

Measured memory_bytes: 3600
using namespace std;
#include<iostream>
#include<vector>
#include<string>

int main(int argc, char const *argv[]) {
  int a,b,c;
  std::cin >> a >> b >> c;
  if (a==b) {
    if (b==c) {
      std::cout << "1" << std::endl;
    }else{
      std::cout << "2" << std::endl;
    }
  }else if(b==c || a==c){
    std::cout << "2" << std::endl;
  }else{
    std::cout << "3" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int hax = 11;
const int wax = 1011;
int s[hax][wax];
char inp[hax][wax];
int h, w, k;

int ss(int yup, int ydown, int xleft, int xright) {
	return s[ydown][xright] - s[ydown][xleft - 1] - s[yup][xright] + s[yup][xleft - 1];
}

int checkMask(int mask) {
	vi divs;
	divs.pb(0);
	REP(i, h) if (mask & (1 << i)) {
		divs.pb(i + 1);
	}
	divs.pb(h);
	int curr = divs.size() - 2;
	vi roz(divs.size());
	int pop = 0;
	int wsk = 1; // currently adding
	// debug() << imie(divs);
	while (wsk <= w) {
		bool cant = false;
		REP(divider, divs.size() - 1) {
			// rozpatruje  divs[divider]; divs[divider + 1]
			int ska = ss(divs[divider], divs[divider + 1], pop + 1, wsk);
			// printf("sum: [%d;%d] x [%d;%d] : %d\n", divs[divider], divs[divider + 1], pop + 1, wsk, ska);
			if (ska > k) {
				// printf("cant: [%d;%d] x [%d;%d]\n", divs[divider], divs[divider + 1], pop + 1, wsk);
				cant = true;
				break;
			}
		}
		if (cant) {
			// printf(" cant: [%d, %d]\n", pop + 1, wsk);
			if (wsk == pop + 1) {
				return -1;
			}
			// need to make a cut at wsk
			pop = wsk - 1;
			++curr;
		} else {
			// printf(" can: [%d, %d]\n", pop + 1, wsk);
			++wsk;
		}
	}
	return curr;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> h >> w >> k;
	REP(i, h) {
		string x;
		cin >> x;
		FOR(j, 1, w) {
			s[i + 1][j] = (x[j - 1] == '1') + s[i][j] + s[i + 1][j-1] -s[i][j-1];
		}
		// printf("%s\n", inp[i] + 1);
	}
	int res = -1;
	REP(mask, (1 << (h - 1))) {
		int wyn = checkMask(mask);
		// printf("for mask: %d, res: %d\n", mask, wyn);
		if (wyn != -1 && (res == -1 || res > wyn)) {
			res = wyn;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256