akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define lli long long int
#define ulli unsigned long long int
#pragma GCC target ("sse4.2")
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define time cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#define plli pair<lli,lli>
#define pslli pair<string,lli>
#define pclli pair<char,lli>
const lli N=4e5+5;


int main()
{


    fast;
    lli h;
    cin>>h;
    lli x=1;
    lli t=0;
    while(h)
    {
        h/=2;
        t+=x;
        x*=2;

    }
    cout<<t;

    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
#include<ctype.h>
using namespace std;


int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a+b>=c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << 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
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    if (b - a == c - b) { cout << "YES" << endl; }
    else { cout << "NO" << endl; }
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<map>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<bitset>
#include<stack>
#include<algorithm>
#include<climits>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long int
#define vii vector<ll>
#define mii map<ll, ll>
#define debug(x) cerr << #x << " is " << x << "\n";
#define debug1(x, y) cerr << #x << " is " << x << "\n" << #y << " is " << y << "\n";
#define w(x) ll x; cin >> x; while(x--)
#define endl "\n"
#define f first 
#define s second 
#define fo(n) for(ll i = 0LL; i < n; ++i) 
#define setbits(n) __builtin_popcount(n)
#define all(x) x.begin(), x.end()
#define sortAll(x) sort(x.begin(), x.end())
#define pb push_back
#define mk make_pair
#define PERMUTE next_permutation
#define RESET(a, b) memset(a, b, sizeof(a))
#define MOD 1000000007
using namespace std;
 
int main(){
    fast
    ll n;
    cin >> n;
    vector<ll> a(n, 0);
    fo(n) cin >> a[i];
    vector<ll> dp(n, 0);
    dp[1] = abs(a[0] - a[1]);
    for(int i = 2; i < n; i++)
        dp[i] = min(abs(a[i - 1] - a[i]) + dp[i - 1], abs(a[i - 2] - a[i]) + dp[i - 2]);
    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 4768
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1000000000;

int main() {
  //
  ll h, w;
  cin >> h >> w;
  vvl c(10, vl(10));
  rep(i, 10) {
    rep(j, 10) { cin >> c[i][j]; }
  }
  rep(k, 10) {
    rep(i, 10) {
      rep(j, 10) { c[i][j] = min(c[i][j], c[i][k] + c[k][j]); }
    }
  }
  ll ans = 0;
  rep(i, h) {
    rep(j, w) {
      ll a;
      cin >> a;
      if (a >= 0) {
        ans += c[a][1];
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 888
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        Strategy strategy = new MyStrategy();
        strategy.solve(out, sc);
        out.flush();
    }
}

class MyStrategy implements Strategy {
    @Override
    public void solve(PrintWriter out, FastScanner sc) {
        String S = sc.next();
        String T = sc.next();
        int num = 0;
        for (int i=0; i<3; i++) {
            if (S.charAt(i) == T.charAt(i)) {
                num += 1;
            }
        }
        out.println(num);
    }
}

interface Strategy {
    void solve(PrintWriter out, FastScanner sc);
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 21460
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <vector>
template <class T>
inline bool rd(T &ret) {
	char c; int sgn;
	if(c=getchar(),c==EOF) return 0;
	while(c!='-'&&(c<'0'||c>'9')) c=getchar();
	sgn=(c=='-')?-1:1;
	ret=(c=='-')?0:(c-'0');
	while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
	ret*=sgn;
	return 1;
}
template <class T>
inline void pt(T x) {
    if (x <0) {
        putchar('-');
        x = -x;
    }
    if(x>9) pt(x/10);
    putchar(x%10+'0');
}
using namespace std;
const int inf = (int)1e8;
const int N = 55;
typedef pair<int, int> pii;

int n, m, c;

deque<int> Q, q[15];
deque<int>::iterator it;
vector<int>G[105];
int id[105];
void input(){
	while(!Q.empty())Q.pop_front();
	for(int i = 1, num, j; i <= n; i++){
		G[i].clear();
		rd(num); while(num--){rd(j); G[i].push_back(j);	}
		reverse(G[i].begin(), G[i].end());
		if(G[i].size())Q.push_back(i);
	}
	for(int i = 1; i <= m; i++) while(!q[i].empty())q[i].pop_front();
	for(int i = 1; i <= 100; i++)id[i] = m+1;
}
int putbook(int book, int from){
	for(int i = from; i <= m; i++){
		if(q[i].size()<c){
			q[i].push_back(book);
			id[book] = i;
			return i;
		}
	}
	id[book] = m+1;
	return m+1;
}
int takebook(int book){
	if(id[book] == m+1)return m+1;
	for(it = q[id[book]].begin(); it != q[id[book]].end(); it++)
		if(*it == book){
			q[id[book]].erase(it); break;
		}
	return id[book];
}
int main() {
	while(~scanf("%d %d %d", &m, &c, &n), n + c+m){
		input();
		int ans = 0;
		while(!Q.empty()){
			int stu = Q.front();	Q.pop_front();
			int book = G[stu][G[stu].size()-1];
			G[stu].erase(G[stu].end()-1, G[stu].end());
			if(G[stu].size()) Q.push_back(stu);
			ans += takebook(book);
			ans += putbook(book, 1);
			if(id[book]!=1){
				int pre = q[1].front();
				q[1].pop_front();
				ans++;
				ans += putbook(pre, 2);
				ans += takebook(book);
				ans += putbook(book, 1);
			}
		}
		pt(ans); puts("");
	}
    return 0;
}

/*

9 9
*#**#**#*
*#**#**#*
*#**#**#*
*#**.**#*
*#*#.#*#*
*$##*##$*
*#*****#*
*.#.#.#.*
*********
3 3
*$*
*#*
*$*


*/

Measured memory_bytes: 1244
p=lambda x:print(x,end=' ')
n=input()
p(n+':')
n=int(n);s=n**.5
while n%2==0 and n>3:
    p(2)
    n//=2
d=3
while s>d and n>d:
    if n%d==0:
        p(d)
        n//=d
    else:d+=2
print(n)


Measured memory_bytes: 5632
from itertools import accumulate
n=int(input())
w=list(map(int,input().split()))
tmp=0
l=list(accumulate(w))
ans=float("inf")
for i in range(n):
    tmp=abs(l[i]-(l[n-1]-l[i]))
    if tmp<ans:
        ans=tmp
print(ans)

Measured memory_bytes: 9124
from itertools import product
N = int(input())
D, X = map(int, input().split())

A = []
for _ in range(N):
    A.append(int(input()))

cnt = 0
for d, a in product(range(1, D + 1), A):
    if (d - 1) % a == 0:
        cnt += 1

print(X + cnt)


Measured memory_bytes: 3060
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  ll N, M;
  while (cin >> N >> M) {
    ll M2 = M / 2;
    ll t = min(N, M2);
    ll res = t + (M2 - t) / 2;
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<math.h>
 
void koch(int n, double d, double x, double y, int w)
{
    double r;
    double x1, y1;
    if(n == 0){
        r = w*M_PI/180.0;
        x1 = x + d * cos(r);
        y1 = y + d * sin(r);
        printf("%.8lf %.8lf\n", x1, y1);
        return;
    }
 
    d /= 3;
    koch(n - 1, d, x, y, w);
 
    r = w*M_PI/180.0;
    x = x + d * cos(r);
    y = y + d * sin(r);
 
    w += 60;
    koch(n - 1, d, x, y, w);
 
    r = w*M_PI/180.0;
    x = x + d * cos(r);
    y = y + d * sin(r);
 
    w += -120;
    koch(n - 1, d, x, y, w);
 
    r = w*M_PI/180.0;
    x = x + d * cos(r);
    y = y + d * sin(r);
 
    w += 60;
    koch(n - 1, d, x, y, w);
 
    return;
}
 
int main()
{
    int n;
    double x, y;
 
    scanf("%d", &n);
    x = y = 0;
    printf("%.8lf %.8lf\n", x, y);
    koch(n, 100, x, y, 0);
 
    return(0);
}

Measured memory_bytes: 644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Arrays;
import java.lang.Math;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String s = fs.next();

        char a = s.charAt(0);

        if (Character.isUpperCase(a)) {
            System.out.println("A");
        } else {
            System.out.println("a");
        }






    }


    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
    }

}



Measured memory_bytes: 32640
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:isize,
    b:isize,
    }
    println!("{}",if a*b%2==0 {"Even" }else{"Odd"})
}

Measured memory_bytes: 2112
#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() {
    int x, a, b;
    cin >> x >> a >> b;
    string ans = "A";
    if (abs(x - a) > abs(x - b)) ans = "B";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>  
#include <bitset>
#include <cassert>
#include <ctime>  
#include <cmath>  
#include <cstdlib>  
#include <cstring>  
#include <functional>  
#include <iostream>  
#include <deque>  
#include <stack>
#include <queue>  
#include <vector>  
#include <map>  
#include <set>  
#include <string>  
#include <unordered_map>  
#include <unordered_set>  
#pragma warning(disable:4996)

using namespace std;

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;

const int INF = 1e9;
const int MAXN = 2e5 + 5;

char s[MAXN];

bool chk(int l, int r) {
	while(l < r) {
		if(s[l] != s[r]) return 0;
		l++; r--;
	}
	return 1;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> s+1;
	int N = strlen(s+1);
	if(chk(1, N/2) && chk(N/2+2, N) && chk(1, N)) cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;



int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    map<ll,ll>mp;
    vector<ll>v(200000,0);
    rep(i,n){
        v[a[i]]++;
    }
    sort(v.rbegin(),v.rend());
    ll tmp = 0;
    rep(i,k){
        tmp += v[i];
    }
    cout << n-tmp << endl;

    return 0;
}


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

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

const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;

#define FOR(i, b, e) for (int i = b; i <= e; i++)
#define FORD(i, b, e) for (int i = b; i >= e; i--)
#define SIZE(x) ((int)(x).size())
#define pb push_back
#define st first
#define nd second
#define all(a) begin(a), end(a)
#define watch(x) cerr << (#x) << " is " << (x) << '\n';

int t[100010];

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

    int n, k, q;

    cin >> n >> k >> q;

    FOR(i, 1, q) {
        int x;
        cin >> x;
        t[x]++;
    }

    FOR(i, 1, n) {
        cout << ((k - q + t[i] > 0) ? "Yes" : "No") << '\n';
    }

    return 0;
}


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

const int MAX_N = int(1e5) + 5;
#define REP(i, n) for (int i = 0; i < n; i++)

struct UnionFindTree {
    int par[MAX_N];
    int rank[MAX_N];

    void init(int n) {
        for (int i = 0; i < n; i++) {
            par[i] = i;
            rank[i] = 0;
        }
    }
    int find(int x) {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = find(par[x]);
        }
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) rank[x]++;
        par[y] = x;
    }
    bool is_same(int x, int y) {
        return find(x) == find(y);
    }
};

int main() {
    int n, m, p[MAX_N];
    cin >> n >> m;
    UnionFindTree g;
    g.init(n);
    REP(i,n)cin >> p[i];
    REP(i,m){
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        g.unite(x,y);
    }
    int ans = 0;
    REP(i,n){
        if(g.is_same(i,p[i]-1))ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>


#define REP(i,N) for(auto i = 0; i <N; i++)
const int MAX = INT_MAX;
using namespace std;
typedef long long ll;


int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}



int main() {

    int N = in();
    int K = in();
    
    
    int counter[200005] = {0};
    
    int numb;
    
    for(auto i = 0; i<N; i++){
        numb = in();
        counter[numb]++;
    }
    
    vector<int> vec;
    for(auto i = 0; i<=N; i++){
        vec.push_back(counter[i]);
    }
    
    sort(vec.begin(),vec.end());
    
    int greaters = 0;
    
    for(auto k = 0; k < K; k++){
        greaters+=vec.back();
        vec.pop_back();
    }
    
    cout << N - greaters << endl;
    
    
    return 0;
}


                          
                        




Measured memory_bytes: 2168
def resolve():
    import bisect
    n = int(input())
    a = [int(input()) for _ in range(n)]
    m = []
    for i in range(n-1, -1, -1):
        if i == n-1:
            m.append(a[i])
        else:
            if m[-1] <= a[i]:
                m.append(a[i])
            else:
                j = bisect.bisect_right(m, a[i])
                m[j] = a[i]
    print(len(m))

resolve()

Measured memory_bytes: 55896
#include "bits/stdc++.h"
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> memo(N);
    vector<int> data(N);
    for(int i = 0; i < N; i++){
        cin >> memo.at(i);
        data.at(memo.at(i) - 1) = i + 1;
    }//入力完了
    for(int i = 0; i < N; i++){
        cout << data.at(i);
        if(i != N - 1)
        cout << " ";
        else 
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
N, K, Q = [int(x) for x in input().strip().split()]
A = [int(input().strip()) for _ in range(Q)]

dp = {p:0 for p in range(N)}

for a in A:
  dp[a-1] += 1

for n in range(N):
  if dp[n] + K - Q > 0:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 61780
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
	string s;
	cin>>s;
	int e=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='C'){
			 e=1;
		}
		if(s[i]=='F'&&e==1){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
if __FILE__==$0
	inf=Float::INFINITY
	readln_i=lambda{|dl|gets.chomp.split(dl).map(&:to_i)}
	read_i=lambda{fp.gets.chomp.to_i}
	readln_s=lambda{|dl|fp.gets.chomp.split(dl)}
	read_s=lambda{fp.gets.chomp}
	
	line=readln_i[" "]
	num=readln_i[" "]
	
	dpt=Array.new(line[0]+1){Array.new(num.inject(&:+)+1){0}}
	dpt[0][0]=1
	
	for i in 0..dpt.length-2
		for j in 0..dpt[0].length-1
			if dpt[i][j]>0 && j+num[i]<=dpt[0].length
				dpt[i+1][j+num[i]]+=dpt[i][j]
			end
			dpt[i+1][j]+=dpt[i][j]
		end
	end
	
	#dpt.each do |d| p d end
	ans=0
	
	for i in 0..dpt[0].length-1
		if i%2==line[1]
			ans+=dpt[dpt.length-1][i]
		end
	end
	
	p ans
end

Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    S = SI()
    N = len(S)
    S = reversed(S)
    dp = [[0 for j in range(13)] for i in range(N)]
 
    for i, es in enumerate(S):
        c = es
        if i == 0:
            if c == '?':
                for j in range(10):
                    dp[i][j] = 1
            else:
                dp[i][int(c)] = 1
        else:
            if c == '?':
                for j in range(10):
                    amari = (j * pow(10, i, 13)) % 13
                    for k in range(13):
                        dp[i][k] = (dp[i][k] + dp[i-1][(k-amari)%13]) % MOD
            else:
                amari = (int(c) * pow(10, i, 13)) % 13
                for k in range(13):
                    dp[i][k] += (dp[i][k] + dp[i - 1][(k-amari) % 13]) % MOD
 
    dprint(dp)
    print(dp[N-1][5])


solve()

Measured memory_bytes: 65756
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int a=sc.nextInt();
int b=sc.nextInt();
if(a%2==0||b%2==0){
    out.println("No");
}else{
    out.println("Yes");
}
}}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  int n;
  cin >> n;
  
  vector<ll> a(n);
  REP(i, n){
    cin >> a[i];
    a[i] -= i + 1;
  }
  
  sort(a.begin(), a.end());
  ll b;
  if(n % 2 == 1)
    b = a[(n-1)/2+1-1];
  else
    b = a[n/2-1];

  ll sum = 0;
  REP(i, n)
    sum += abs(a[i] - b);
  //cout << b << endl;
  cout << sum << endl;

}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string s;
	cin>>s;
	for (int i=0;i<s.length();i++){
		if (s[i]=='9'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;

    vector<string> S(n);
    map<char,int>A;

    REP(i,n){
        cin >> S[i];
    }
    REP(i,n){
        map<char,int>B;
        REP(j,S[i].length()){
            if(i==0) A[S[i][j]]++;
            else{
                B[S[i][j]]++;
            } 
        }
        
        REP(k,26){
            // cout << A[char('a'+k)];
            if(i!=0) A[(char)('a'+k)]= min(A[(char)('a'+k)], B[(char)('a'+k)]);
            // cout << B[(char)('a'+k)];
        }
            // cout << endl; 
        

    }
    // cout << char('a' +2) << endl;
    REP(k,26){
        int t= A[(char)('a'+k)];
        REP(i,t){
            // cout<<" SSS" << endl;
            cout << char('a'+k);
        }
    }cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int a[8][8] = {{}};
int row[8] = {};
int l[15] = {};
int r[15] = {};
int s[8] = {};
 
void print(){
 
  for(int i = 0;i < 8;i++){
    for(int j = 0;j < 8;j++){
      if(a[i][j] == 1){
        if(row[i] != j) {
          return;
        }
      }
    }
  }
  for(int i = 0;i < 8;i++){
    for(int j = 0;j < 8;j++){
      if(row[i] == j) cout << "Q";
      else cout << ".";
    }
    cout << endl;
  }
 
}
 
void backtrack(int i){
 
  if(i == 8){
    print();
    return;
  }
 
  for(int j = 0;j < 8;j++){
    if(s[j] == 1 || l[i + j] == 1 || r[i - j + 7] == 1) continue;
 
    row[i] = j;
    l[i + j] = r[i - j + 7] = s[j] = 1;
 
    backtrack(i + 1);
 
    row[i] = s[j] = l[i + j] = r[i - j + 7] = 0;
 
  }
 
}
 
 
int main(){
 
  int r,c,k;
 
  cin >> k;
 
  for(int i = 0;i < k;i++){
    cin >> r >> c;
    a[r][c] = 1;
  }
  backtrack(0);
}

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

int main(){
  int n;
  int a;
  cin >> n;
  cin >> a;

  cout << n*n - a << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n, m;
    cin >> n >> m;
    vint a(n);
    rep(i, n) cin >> a[i];
    
    vll sum(n);
    sum[0] = a[0];
    srep(i, 1, n) sum[i] = sum[i-1] + a[i];

    map<int, ll> mp;
    rep(i, n) {
        mp[sum[i]%m]++;
    }

    ll ans = 0;

    for (auto x : mp) {
        if (x.se >= 2) {
            ans += (x.se*x.se - x.se)/2ll;
        }
    }
    ans += mp[0];

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

Measured memory_bytes: 5376
#include <cstdio>
#include <iomanip>
#include <iostream>

using namespace std;

typedef long double ld;

class Point {
public:
	ld x, y;
	Point(ld x, ld y) :
			x(x), y(y) {
	}
	Point operator +(Point p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator -(Point p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator *(ld a) {
		return Point(x * a, y * a);
	}
};

class Segment {
public:
	Point p1, p2;
	Segment(Point p1, Point p2) :
			p1(p1), p2(p2) {
	}
};

ld norm(Point p) {
	return p.x * p.x + p.y * p.y;
}

ld dot(Point p1, Point p2) {
	return p1.x * p2.x + p1.y * p2.y;
}

Point project(Segment s, Point p) {
	Point base = s.p2 - s.p1;
	ld r = dot(p - s.p1, base) / norm(base);
	return s.p1 + base * r;
}

Point reflect(Segment s, Point p) {
	return p + (project(s, p) - p) * 2.0;
}

int main() {

	int p1x, p1y, p2x, p2y;
	scanf("%d %d %d %d", &p1x, &p1y, &p2x, &p2y);
	Point p1(p1x, p1y);
	Point p2(p2x, p2y);
	Segment s(p1, p2);

	int q;
	scanf("%d", &q);

	for (int i = 0; i < q; ++i) {
		int qx, qy;
		scanf("%d %d", &qx, &qy);
		Point p(qx, qy);
		Point ans = reflect(s, p);
		cout << fixed << setprecision(10) << ans.x << " " << ans.y << endl;
	}

	return 0;
}

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

void swap(int &x, int &y){
	int tmp;
	tmp = x;
	x = y;
	y = tmp;
}

int gcd(int x,int y){
	int a;

	if(x < y){
		swap(x,y);
	}

	a = x%y;

	if(x == y) return x;

	for(int i = a;i > 0;--i){
		if(x%i == 0 && y%i == 0){
			return i;
		}
	}
}
/*
int gcd(int x,int y){
	int a;
	if(x < y){
		a = x;
	}else{
		a = y;
	}

	for(int i = a;i > 0;i--){
		if(x%i == 0 && y%i == 0){
			return i;
		}
	}
}
*/
int main()
{
	int a,b;

	// 入力
	cin >> a >> b;

	// 最大公約数を求めて出力
	cout << gcd(a,b) << endl;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
    #define REP(i, n) for(int i=0; i<(int)(n); i++)
    #define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
    #define ALL(x) begin(x),end(x)
    #define PB push_back
    using namespace std;
    typedef unsigned long long LL;
    typedef vector<int> VI;
    typedef pair<int,int> PII;
     
    template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
    template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
    template<class T> using MaxHeap = priority_queue<T>;
    template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
    template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
        sort(begin(v),end(v),f);
        v.resize(unique(begin(v),end(v))-begin(v));
    }
     
    int main() {
        ios::sync_with_stdio(0);
        cin.tie(0);
        LL a;
        double b;
        cin >> a >> b;
        LL c=round(b*100);
        LL s=a*c;
        s/=100;
        cout << s << '\n';
        return 0;
    }

Measured memory_bytes: 3780
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	int a,b;
	int ans=0;
	
	cin>>a>>b;
	ans = (a+b)%24;
	cout<<ans<<endl;
	return 0;
}

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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    string s;
    cin >> s;
    
    reverse(all(s));
    ll ans = 0;

    ll white_num = 0;
    
    rep(i, s.size())
    {
        if( s[i]=='W') white_num++;
        else if( s[i] == 'B' )
        {
            if( white_num > 0 )
            {
                ans += white_num;
            }
            else white_num = 0;
        }
        //cout << ans << endl;
        //cout << s << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;

int M;
int const MSIZE = 4;
using matrix = int[MSIZE][MSIZE];

inline int madd(int x,int y) {
	if (x+y<M) return x+y; else return x+y-M;
}
inline int msub(int x,int y) {
	if (x-y>=0) return x-y; else return x-y+M;
}
inline int mmul(int x,int y) {
	return int(ll(x)*y % M);
}

void matmul(matrix &res, const matrix &A, const matrix &B,
            int n, int p, int m) {  // res[n x m] = A[n x p] * B[p x m]
	static matrix tmp;
	rep(i,0,n) rep(j,0,m) tmp[i][j]=0;
	rep(i,0,n) rep(j,0,m) rep(k,0,p) {
		tmp[i][j]=madd(tmp[i][j], mmul(A[i][k],B[k][j]));
	}
	rep(i,0,n) rep(j,0,m) res[i][j]=tmp[i][j];
}

void matpow(ll pow, matrix &res, const matrix &A,
            int n, int m) {  // res[n x m] = res[n x m] * (A[m x m]^pow)
	static matrix tmp;
	rep(i,0,m) rep(j,0,m) tmp[i][j]=A[i][j];

	while (pow>0) {
		if (pow%2) matmul(res,res,tmp,n,m,m);
		matmul(tmp,tmp,tmp,m,m,m);
		pow/=2;
	}
}


int len(ll x) {
	assert(x>0);
	int res=0;
	while (x>0) {
		x/=10;
		res++;
	}
	return res;
}

ll find_len(ll S0,ll L,ll B) {
	int z=len(S0);
	ll l=0,r=L;
	while (l<r) {
		ll m=l+(r-l)/2;
		ll Sm=S0-B*m;
		if (z==len(Sm)) l=m+1; else r=m;
	}
	return l;
}

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

	ll L,A,B;
	cin>>L>>A>>B>>M;
	
	ll S0=A+B*(L-1);
	int pp=1;
	int res=0;
	while (L>0) {
		ll k=find_len(S0,L,B);
		ll z=len(S0);
//~ cerr<<z<<" "<<k<<" "<<S0<<" "<<pp<<endl;
		int z10=1;
		rep(i,0,z) z10=mmul(z10,10);
//~ cerr<<z10<<endl;
		
		int a0=int((S0-B*(k-1))%M);
		int b0=int(ll(a0)*pp % M);
//~ cerr<<a0<<" "<<b0<<endl;
		matrix r={{int(B%M), a0, b0, z10},};
		matrix X={
			{1, 1,    pp,   0},
			{0, 1,    pp,   0},
			{0, 0,   z10,   0},
			{0, 0,     0, z10},
		};
		
		matpow(k-1,r,X,1,4);
		res=madd(res,r[0][2]);
//~ cerr<<res<<endl;
		
		L-=k;
		S0=S0-B*k;
		pp=mmul(pp,r[0][3]);
	}
	
	cout<<res<<"\n";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;



int main()
{
    int n, k, tmp=1, a[200005], res[200005];
    cin >> n >> k;
    for(int i = 1; i <= n; ++i)
    {
        cin >> a[i];
    }
//    for(int i = 1; i <= k; ++i)
//    {
//        if(a[i] == 0)
//        {
//            tmp = 0;
//            break;
//        }
//        else
//        {
//            tmp *= a[i];
//        }
//    }
//    res[k] = tmp;
//    for(int i = k + 1; i <= n; ++i)
//    {
//        if(a[i-k] != 0 && a[i] != 0)
//        {
//            res[i] = res[i-1]/a[i-k]*a[i];
//        }
//        else
//        {
//            res[i] = 0;
//        }
//    }
    for(int i = k+1; i <= n; ++i)
    {
        if(a[i] > a[i-k])
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    return 0;
}


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

int main() {
    int64_t n, a, b;
    cin >> n >> a >> b;
    int64_t q, r;
    q = n / (a + b);
    r = n % (a + b);
    if(r >= a) {
        cout << q * a + a << endl; 
    } else {
        cout << q * a + r << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
priority_queue <int> q;
int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    int x;
    for(int i=1;i<=n;i++) {
        scanf("%d",&x);
        q.push(x);
    }
    while(q.top()&&m) {
        int tmp=q.top();
        q.pop();
        q.push(tmp/2);
        m--;
    }
    ll res=0;
    while(!q.empty()) {
        res+=q.top();
        q.pop();

    }
    cout<<res<<endl;
}


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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
  NodePointer cur = nil->next;
  while(1){
    if ( cur == nil ) break;
    if(cur->key == key)return cur;
    cur = cur->next;
  }
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  if(nil->prev == t)nil->prev = t->prev;
  t->prev->next = t->next;
  t->next->prev = t->prev;
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
  nil->prev = nil->prev->prev;
  nil->prev->next = nil;
}

void delete(int key){
  /* your code */
  NodePointer cur = nil->next;
 
  while(1){
    if ( cur->key == key ) break;
    cur = cur->next;
    if(cur == nil)return;
  }

  deleteNode(cur);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  /* 

   your code 


  */

  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
  if(nil->prev == nil)nil->prev = x;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ) {
      scanf("%d",&key);
      insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	scanf("%d",&key);
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



Measured memory_bytes: 36116
#AtCoder b 161 q1
x,y,z = map(int,input().split())

def swap(a,b):
    temp = b
    b = a
    a = temp
    return a,b

x,y = swap(x,y)
x,z = swap(x,z)
print(str(x)+" "+str(y)+" "+str(z))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	string s = "0123456789";
	string t; cin >> t;
	int n = t.size();
	string ans;
	ll dif = -1;
	do
	{
		string ss = s.substr(0, n);
		ll a = abs(stoll(ss) - stoll(t));
		ll b = min(a, ll(pow(10, n) - a));
		if (dif < b)
		{
			dif = b;
			ans = ss;
		}
		if (dif == b)
		{
			chmin(ans, ss);
		}
	} while (next_permutation(ALL(s)));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3404
n = int(input())
A = list(map(int, input().split()))

for i in range(n):
    v = A[i]
    j = i-1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(*A)


Measured memory_bytes: 5976
#include <cstdio>
#include <cstring>
#include <cctype>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

typedef long long LL;
int n,m,c[100100],cnt[3],cnte;
LL ans;
struct edge
{
    int v,w;
    edge *nxt;
} pool[200100],*tp=pool,*fst[100100];

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()));
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}

bool dfs(int x,int w)
{
    if (c[x]!=-1)
        return c[x]!=w;
    ++cnt[c[x]=w];
    bool flag=0;
    for (edge *i=fst[x]; i; ++cnte,i=i->nxt)
        flag|=dfs(i->v,(w+i->w)%3);
    return flag;
}

int main()
{
    scanf("%d%d",&n,&m);
    while (m--)
    {
        int u=getint(),v=getint();
        *tp=(edge){v,1,fst[u]},fst[u]=tp++;
        *tp=(edge){u,2,fst[v]},fst[v]=tp++;
    }
    memset(c,255,sizeof(c));
    repu(i,1,n)
        if (c[i]==-1)
        {
            cnt[0]=cnt[1]=cnt[2]=cnte=0;
            if (dfs(i,0))
            {
                ans+=LL(cnt[0]+cnt[1]+cnt[2])*(cnt[0]+cnt[1]+cnt[2]);
                continue;
            }
            if (!cnt[0] || !cnt[1] || !cnt[2])
                ans+=cnte/2;
            else
                ans+=LL(cnt[0])*cnt[1]+LL(cnt[1])*cnt[2]+LL(cnt[2])*cnt[0];
        }
    printf("%lld\n",ans);
    return 0;
}

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

int main()
{
    int n;
    string s;
    cin >> n;
    cin >> s;
    char c = s[0];
    for(int i = 1; i < s.size(); i++)
    {
        if(c == s[i])
        {
            s[i] = '*';
        }else
        {
            c = s[i];
        }
    }
    s.erase(remove(s.begin(), s.end(), '*'), s.end());
    cout << s.size() << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int X; cin >> X;
  for(long int A = -200; A < 200; A++){
    for(long int B = -200; B < 200; B++){
      if(pow(A, 5) - pow(B, 5) == X){
        cout << A << ' ' << B;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 4044
#pragma region template 2.3
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    IN(ll, M);
    AIN(ll, A, N);
    RSORT(A);
    ll s = 0;
    FOR(a, A)
    {
        s += a;
    }
    YES(4 * M * A[M - 1] >= s);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <set>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;

    double probSums = 0;
    for (int i = 1; i <= N; i++)
    {
        int sums = i;
        int cnt = 0;
        //値iでの確率
        double thProb = (1.00000000000000/N);
        while(sums < K ){
            sums *= 2;
            cnt++;
        }
        for (int j = 0; j < cnt; j++)
        {
            thProb *= (0.5);
        }
        probSums += thProb;
    }

    cout << fixed << setprecision(12) << probSums<< endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(ll i=ll(x);i<(ll)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long;
using P = pair<ll, ll>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;

bool f(ll a, ll b) {
    return a > b;
}

int main() {
    ll n, k;
    cin >> n >> k;
    vector<vector<ll>>x(n);
    rep(i, n) {
        ll t, d;
        cin >> t >> d;
        t--;
        x[t].push_back(d);
    }
    rep(i, n) {
        sort(x[i].begin(), x[i].end(), f);
        if(x[i].empty())x[i].push_back(-INF);
    }
    priority_queue<ll>pq, cq;
    rep(i, n) {
        pq.push(x[i][0]);
        arep(j, 1, (ll)x[i].size()) {
            cq.push(x[i][j]);
        }
    }
    priority_queue<ll, vector<ll>, greater<ll>>q;
    ll sum=0;
    rep(i,k){
        sum+=pq.top();
        q.push(pq.top());
        pq.pop();
    }
    ll ans = sum +k*k;
    
    for(ll x=k-1;x>0;x--){
        sum -= q.top(); 
        cq.push(q.top());
        q.pop();
        sum += cq.top(); cq.pop();

        ans = max(ans, sum + x * x);
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 8700
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 2e9;

/*
!) 0-indexed
!) [a, b)に対する演算
!) m0 / l0 : 初期化する値
!) merge, updateNode, propagateを書く
*/
template <typename Monoid>
struct LazySegtree {
    int n;
    vector<Monoid> dat, lazy;
    Monoid M0, L0;

    void init(int sz, Monoid m0, Monoid l0) {
        n = 1;
        M0 = m0;
        L0 = l0;
        while (n < sz) n *= 2;
        dat.assign(2*n-1, M0);
        lazy.assign(2*n-1, L0);
    }

    LazySegtree(int sz, Monoid m0, Monoid l0){
        init(sz, m0, l0);
    }

    LazySegtree(int sz, Monoid m0) {
        init(sz, m0, m0);
    }

    Monoid merge(Monoid a, Monoid b){
        // ##### WRITE HERE #####
        // 区間をマージする二項演算
        return a+b;
    }

    void updateNode(int k, Monoid x){
        // ##### WRITE HERE #####
        // 区間を更新する二項演算
        lazy[k] += x;
    }

    void propagate(int k){
        // ##### WRITE HERE #####
        // 遅延配列の伝搬のさせ方
        dat[k] += lazy[k];
    }

    void eval(int k, int l, int r) {
        if(lazy[k] == L0) return;
        propagate(k);
        if(r-l > 1) {
            updateNode(2*k+1, lazy[k]);
            updateNode(2*k+2, lazy[k]);
        }
        lazy[k] = L0;
    }

    void update(int a, int b, Monoid x, int k, int l, int r) {
        eval(k, l, r);
        // 範囲外
        if (r <= a || b <= l) return;
        // [a, b)が[l, r)を被覆
        if (a <= l && r <= b) {
            updateNode(k, x);
            eval(k, l, r);
        }else{
            update(a, b, x, k*2+1, l, (l+r)/2);
            update(a, b, x, k*2+2, (l+r)/2, r);
            dat[k] = merge(dat[2*k+1], dat[2*k+2]);
        }
    }

    void update(int a, int b, Monoid x) {
        update(a, b, x, 0, 0, n);
    }

    Monoid query(int a, int b, int k, int l, int r) {
        eval(k, l, r);
        // 範囲外
        if (r <= a || b <= l) return M0;
        // [a, b)が[l, r)を被覆
        if (a <= l && r <= b) return dat[k];
        else {
            Monoid L = query(a, b, k*2+1, l, (l+r)/2);
            Monoid R = query(a, b, k*2+2, (l+r)/2, r);
            return merge(L, R);
        }
    }

    Monoid query(int a, int b){
        return query(a, b, 0, 0, n);
    }

    Monoid operator[](const int &k){ return dat[k + n - 1]; }
};

int main(){
    int n, q;
    cin >> n >> q;
    LazySegtree<int> seg(n+1, 0);

    rep(i, q){
        int p;
        cin >> p;
        if(p == 0){
            int s, t, x;
            cin >> s >> t >> x;
            seg.update(s, t+1, x);
        }else{
            int x;
            cin >> x;
            cout << seg.query(x, x+1) << endl;
        }
    }
}



Measured memory_bytes: 4940