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

using namespace std;

int n;
long long x[55], lo, hi, mi, u;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", x + i);
		hi += x[i];
	}
	lo = max((long long)0, hi - n * (n - 1));
	hi++;
	for (mi = lo; mi < hi; mi++) {
		u = 0;
		for (int i = 0; i < n && u != -1; i++)
			if ((x[i] + mi) % (n + 1) == n)
				u = -1;
			else
				u += (x[i] + mi) / (n + 1);
		if (u == mi) {
			printf("%lld\n", mi);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,cnt = 0, k[11],p[11],s[11][11],sw[11] = {0};
bool judge(){
    for(int i = 1; i <= m; i++){
        int sum = 0;
        for(int j = 0; j < k[i]; j++){
            if(sw[s[i][j]] == 1)
                sum++;
        }
        if(sum % 2 != p[i]) 
            return 0;
    }
    return 1;
}

int main(){
    cin >> n >> m;
    for(int i = 1; i <= m; i++){
        cin >> k[i];
        for(int j = 0; j < k[i]; j++){
            cin >> s[i][j];
        }
    }
    for(int i = 1; i <= m; i++)
        cin >> p[i];
    for(int i = 0; i < (1 << n+1); i+=2){
        for(int j = 1; j <= n; j++){
            if(i >> j & 1)
                sw[j] = 1; 
            else
                sw[j] = 0;
        }
        if(judge())
            cnt++;
    } 
    cout << cnt << endl;
}


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

def is_prime(n):
    if n <= 1: return False

    i = 2
    while i*i <= n:
        if n%i == 0: return False
        i += 1
    return True


def solve():
    X = int(input())

    # Xから素数判定をすればよい
    x = X
    while not is_prime(x):
        x += 1
    print(x)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 2940
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = sum(b)

for i in range(1,len(a)):
  if a[i-1]+1 == a[i]:
    ans += c[a[i]-2]
    
print(ans)

Measured memory_bytes: 3060
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
    }
    let mut a = vec![0; n + 1];
    for x in 1..=100 {
        for y in 1..=100 {
            for z in 1..=100 {
                let r = x * x + y * y + z * z + x * y + y * z + z * x;
                if r <= n {
                    a[r] += 1;
                }
            }
        }
    }
    for i in 1..=n {
        println!("{}", a[i]);
    }
}


Measured memory_bytes: 2248
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    R, C, K, *RCV = map(int, read().split())

    item = [[0] * C for _ in range(R)]
    for r, c, v in zip(*[iter(RCV)] * 3):
        item[r - 1][c - 1] = v

    dp = [0] * (C + 1)
    for i in range(R):
        value = [0] * 4
        for j in range(C):
            for k in range(4):
                if value[k] < dp[j + 1]:
                    value[k] = dp[j + 1]
                else:
                    break
            if item[i][j] > 0:
                for k in range(2, -1, -1):
                    if value[k + 1] < value[k] + item[i][j]:
                        value[k + 1] = value[k] + item[i][j]
            dp[j + 1] = value[3]

    print(dp[C])

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 200220
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
const ll mod=2019 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

int main() {
   int n,k ;
   cin >> n>>k ;
   vector<int> d(n) ;
   rep(i,k) {
     int m ;
     cin >> m;
     rep(j,m){
       int a ;
       cin >>a ;
       d[a-1] =1 ;
     }
   }
   int ans=0 ;
   rep(i,n) if(d[i]==0) ans++ ;
   cout<<ans <<endl;
    return 0;
}



Measured memory_bytes: 3608
#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>;
//解答例写し  
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//解答例写し 
int main() {
  int n,k;
  cin>>n>>k;
  vector<int>s,t,b(n);
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    b[i]=a;
    if(a<0)t.push_back(a);
    else s.push_back(a);
  }
  int S=s.size();
  int T=t.size();
  bool ok=false;
  if(S>0){
    if(n==k)ok=(T%2==0);
    else ok=true;
  }else{
    ok=(k%2==0);
  }
  mint ans=1;
  if(!ok){
    sort(b.begin(),b.end(),[](int x,int y){
      return abs(x)<abs(y);
    });
    for(int i=0;i<k;i++)ans*=b[i];
  }else{
    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());
    if(k%2==1){
      ans*=s.back();
      s.pop_back();
    }
    vector<long long>p;
    while(s.size()>=2){
      long long x=s.back();s.pop_back();
      x*=s.back();s.pop_back();
      p.push_back(x);
    }
    while(t.size()>=2){
      long long x=t.back();t.pop_back();
      x*=t.back();t.pop_back();
      p.push_back(x);
    }
    sort(p.rbegin(),p.rend());
    for(int i=0;i<k/2;i++){
      ans*=p[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6220
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <cmath>
#include <climits>
#include <cstdint>
using namespace std;

inline namespace atcoder {
    template <typename T, size_t Depth>
    struct vector_helper { using type = vector<typename vector_helper<T, Depth - 1>::type>; };
    template <typename T>
    struct vector_helper<T, 0> { using type = T; };
    template <typename T, size_t Depth>
    using vector_t = typename vector_helper<T, Depth>::type;

    template <typename T> using vec = vector_t<T, 1>;
    template <typename T> using vvec = vector_t<T, 2>;
    template <typename T> using vvvec = vector_t<T, 3>;
}

void dfs(int v, vec<bool> &visited, vvec<bool> &graph) {
    visited[v] = true;
    for (int i = 0; i < graph[v].size(); ++i) {
        if (!graph[v][i]) continue;
        if (visited[i]) continue;
        dfs(i, visited, graph);
    }
}

int main() {
    int n, m; cin >> n >> m;

    vvec<bool> graph(n, vec<bool>(n, false));
    vec<array<int, 2>> edge(m);
    for (int i = 0; i < m; ++i) {
        int a, b; cin >> a >> b; --a; --b;
        graph[a][b] = graph[b][a] = true;
        edge[i][0] = a; edge[i][1] = b;
    }

    int ans = 0;
    for (int i = 0; i < m; ++i) {
        graph[edge[i][0]][edge[i][1]] = graph[edge[i][1]][edge[i][0]] = false;
        vec<bool> visited(n, false);

        dfs(0, visited, graph);

        bool bridge = false;
        for (auto e : visited) {
            if (!e) {
                bridge = true;
            }
        }

        if (bridge) {
            ++ans;
        }

        graph[edge[i][0]][edge[i][1]] = graph[edge[i][1]][edge[i][0]] = true;
    }

    cout << ans << endl;
}



Measured memory_bytes: 3636
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		
		if((x-r) < 0 || (x+r) > W || (y-r) < 0 || (y+r) > H){
		    System.out.println("No");
		}else if((x-r) >= 0 && (x+r) <= W && (y-r) >= 0 && (y+r) <= H){
		    System.out.println("Yes");
		}
    }
}


Measured memory_bytes: 26388
use std::io;
use std::io::BufRead;

fn main() {
    let mut sc = Scanner::new(std::io::stdin());
    let H: usize = sc.next().unwrap();
    let W: usize = sc.next().unwrap();
    let h: usize = sc.next().unwrap();
    let w: usize = sc.next().unwrap();
    let res = f(H, W, h, w);
    if let Some(res) = res {
        println!("Yes");
        for i in 0..H {
            for j in 0..W {
                if j > 0 {
                    print!(" ");
                }
                print!("{}", res[i][j]);
            }
            println!();
        }
        return;
    }
    let res = f(W, H, w, h);
    if let Some(res) = res {
        println!("Yes");
        for i in 0..H {
            for j in 0..W {
                if j > 0 {
                    print!(" ");
                }
                print!("{}", res[j][i]);
            }
            println!();
        }
        return;
    }
    println!("No");
}

const B: i32 = 100000;

fn f(H: usize, W: usize, h: usize, w: usize) -> Option<Vec<Vec<i32>>> {
    if H % h == 0 {
        return None;
    }
    let d = H % h;
    let mut res = vec![];
    for i in 0..H {
        if i % h == d {
            res.push(vec![-B * (h as i32- 1) - 1; W]);
        } else {
            res.push(vec![B; W]);
        }
    }
    Some(res)
}

/// Scanner
///
/// # Example
/// ```
/// use contest::io::scanner;
/// let mut sc = scanner::Scanner::new("1 2 \n\n \r\t \n 3.5".as_bytes());
/// assert_eq!("1".to_string(), sc.next::<String>().unwrap());
/// assert_eq!(2, sc.next().unwrap());
/// assert_eq!(3.5, sc.next().unwrap());
/// assert_eq!(None, sc.next::<i32>());
/// ```

pub struct Scanner<R: io::Read> {
    br: io::BufReader<R>,
    // Read tokens are stored in reversed order per line.
    buf: Vec<String>,
}

impl<R: io::Read> Scanner<R> {
    pub fn new(r: R) -> Scanner<R> {
        Scanner {
            br: io::BufReader::new(r),
            buf: vec![],
        }
    }
    #[inline]
    pub fn next<T>(&mut self) -> Option<T>
        where T: std::str::FromStr,
              T::Err: std::fmt::Debug
    {
        self.next_string().map(|s| s.parse::<T>().expect("Parse failed: "))
    }
    fn next_string(&mut self) -> Option<String> {
        self.buf.pop().or_else(|| match self.update() {
            true => self.next_string(),
            false => None,
        })
    }
    #[inline]
    fn update(&mut self) -> bool {
        let mut s = String::new();
        let res = self.br.read_line(&mut s);
        match res.expect("I/O error.") {
            0 => false,
            _ => {
                self.buf = s.split_whitespace().map(|x| x.to_string()).rev().collect();
                true
            }
        }
    }
}


Measured memory_bytes: 6140
S=input()
L,R=len(S),-1
for i in range(len(S)):
  if(S[i]=='C'):
    L=i
    break
for i in range(len(S)):
  if(S[len(S)-1-i]=='F'):
    R=len(S)-1-i
    break
if(L<R):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}
int comb(int n, int k) {
	k = min(k, n - k);
	int x = 1, y = 1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

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

	int h, w;
	cin >> h >> w;
	if (h == 1 || w == 1) {
		cout << 1 << endl;
	}
	else if ((h * w) % 2 == 0) {
		cout << h * w / 2 << endl;
	}
	else {
		cout << h * w / 2 + 1 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
 
int power(int a,int n,int p)
{
    a %= p;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%p,n/2,p)%p))%p;
    return power((a*a)%p,n/2,p)%p;
}
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2,mod)%mod;//little fermat....
}

set<int>adj[30];

void solve(){
    int n,q;
    string s;
    cin >> n >> s >> q;
    FOR(i,0,n)adj[s[i]-'a'].insert(i);
    while(q--){
        int type;
        cin >> type;
        if(type == 1){
            int i;
            char c;
            cin >> i >> c;
            i--;
            if(s[i] == c)continue;
            adj[s[i]-'a'].erase(i);
            adj[c-'a'].insert(i);
            s[i] = c;
        }
        else {
            int tot = 0,l,r;
            cin >> l >> r;
            l--;
            r--;
            FOR(i,0,26){
                if(adj[i].empty())continue;
                auto it = adj[i].lower_bound(l);
                if(it != adj[i].end() && (*it) <= r)tot++;
            }
            cout << tot << "\n";
        }
    }
}

signed main()   
{
    showoff;
    int T = 1;
    //cin >> T;
    FOR(t,1,T+1){
        solve();
    }
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...


Measured memory_bytes: 24220
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
	for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
	os << "]";
	return os;
}

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); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	string s;
	cin >> s;
	isYes(s == "hi" || s == "hihi" || s == "hihihi" || s == "hihihihi" || s == "hihihihihi");
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	for (int n; cin >> n&&n;) {
		vector<int> a(n); rep(i, 0, n) { cin >> a[i]; }
		sort(a.begin(), a.end());
		int ans = INF;
		rep(i, 1, a.size()) {
			ans = min(ans, a[i] - a[i - 1]);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3112
#define DIN freopen("input.txt","r",stdin);
#define DOUT freopen("output.txt","w",stdout);
#include <bits/stdc++.h>
#include <cstdio>
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=(a);i<=(int)(b);i++)
#define REP_(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
using namespace std;
typedef long long LL;
typedef std::vector<int> VI;
typedef std::pair<int,int> P;
int read()
{
    int x=0,flag=1; char c=getchar();
    while((c>'9' || c<'0') && c!='-') c=getchar();
    if(c=='-') flag=0,c=getchar();
    while(c<='9' && c>='0') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return flag?x:-x;
}

const int maxn=3005;
LL a[maxn][maxn],f[maxn][maxn][4];

int main()
{
    int n=read(),m=read();
    int k=read();
    REP(i,1,k)
    {
        int x=read(),y=read(),v=read();
        a[x][y]=v;
    }
    REP(i,1,n) REP(j,1,m)
    {
        REP(k,0,3) f[i][j][k]=max(f[i][j-1][k],f[i-1][j][k]);
        if(a[i][j]>0)
        {
            REP(k,1,3) f[i][j][k]=max(f[i][j][k],f[i][j-1][k-1]+a[i][j]);
            REP(k,1,3) REP(kk,0,3)
                f[i][j][k]=max(f[i][j][k],f[i-1][j][kk]+a[i][j]);
        }
    }
    LL ans=0;
    REP(i,0,3) ans=max(ans,f[n][m][i]);
    cout<<ans;

    return 0;
}


Measured memory_bytes: 355704
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int H = sc.nextInt();
		int W = sc.nextInt();
		char[][] f = new char[H + 2][W + 2];
		for (int i = 0; i < H; ++i) {
			char[] row = sc.next().toCharArray();
			System.arraycopy(row, 0, f[H - i], 1, W);
		}
		ArrayList<State> states = new ArrayList<State>();
		for (int i = 1; i <= H; ++i) {
			for (int j = 1; j <= W; ++j) {
				if (f[i][j] == '#' && f[i - 1][j] != '#' && f[i][j + 1] != '#') {
					states.add(new State(Math.atan2(i - 1, j), 1));
				} else if (f[i][j] != '#' && f[i - 1][j] == '#' && f[i][j + 1] == '#') {
					states.add(new State(Math.atan2(i - 1, j), 1));
				} else if (f[i][j] == '#' && f[i + 1][j] != '#' && f[i][j - 1] != '#') {
					states.add(new State(Math.atan2(i, j - 1), -1));
				} else if (f[i][j] != '#' && f[i + 1][j] == '#' && f[i][j - 1] == '#') {
					states.add(new State(Math.atan2(i, j - 1), -1));
				}
			}
		}
		Collections.sort(states);
		int count = 1;
		int ans = 1;
		for (int i = 0; i < states.size();) {
			State st = states.get(i);
			while (i < states.size() && states.get(i).a - st.a < 1e-8) {
				count += states.get(i).add;
				++i;
			}
			ans = Math.max(ans, count);
		}
		System.out.println(ans);
	}

	static class State implements Comparable<State> {
		double a;
		int add;

		public State(double a, int add) {
			this.a = a;
			this.add = add;
		}

		public int compareTo(State o) {
			return Double.compare(this.a, o.a);
		}
	}

}

Measured memory_bytes: 42144
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 02:06:07 2020

@author: Kanaru Sato
"""

import heapq

n,m = list(map(int, input().split()))
albeit = []
for i in range(m+1):
    albeit.append([])

for i in range(n):
    a,b = list(map(int, input().split()))
    if a <= m:
        albeit[a].append(-1*b)

##print(albeit)
Heap = [0]
sum = 0
for i in range(m):
    day = i+1
    for money in albeit[day]:
        heapq.heappush(Heap, money)
    if Heap[0] != 0:
        daymax = heapq.heappop(Heap)*-1
        sum += daymax

print(sum)

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

using namespace std;
typedef long long ll;

int N;
int cv[26];
int nv[26];

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> N;
    for (int i = 0; i < 26; i++)
    {
        cv[i] = 10000;
        nv[i] = 0;
    }

    for (int i = 0; i < N; i++)
    {
        string s;
        cin >> s;
        for (int j = 0; j < s.length(); j++)
            nv[s[j]-'a']++;

        for (int j = 0; j < 26; j++)
        {
            cv[j] = min (cv[j], nv[j]);
            nv[j] = 0;
        }
    }

    for (int i = 0; i < 26; i++)
        for (int j = 0; j < cv[i]; j++)
            cout << (char) ('a' + i);
    cout << "\n";
}

Measured memory_bytes: 256
fun main (args:Array<String>){
    val intN = readLine()!!.toInt()
    var count = 0
    for(i in 1..9){
        if(i * 1 == intN) count++
        if(i * 2 == intN) count++
        if(i * 3 == intN) count++
        if(i * 4 == intN) count++
        if(i * 5 == intN) count++
        if(i * 6 == intN) count++
        if(i * 7 == intN) count++
        if(i * 8 == intN) count++
        if(i * 9 == intN) count++
    }
    if(count >= 1) print("Yes")
    else print("No")
}

Measured memory_bytes: 34416
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long H = sc.nextLong();
        int N = sc.nextInt();
        long sum = 0;
        for (int i = 0; i < N; i++) {
           sum += sc.nextLong();
        }
        if(sum < H){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 49016
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a[3];
  for(int i=0;i<3;i++)
  {
	cin>>a[i];
  }
  
  sort(a,a+3);
  
  if(a[0]==5 && a[1]==5 && a[2]==7)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 3576
#include<iostream>
#include<string.h>
#define LEFT 1;
#define RIGHT 2;
using namespace std;

int main()
{
	string right_alpha = "yuiophjklnm";
	string str;
	char buf[34];
	while (cin >> buf && strcmp(buf,"#") != 0)
	{
		int status = 0;
		int count = 0;
		str = buf;
		for (int i = 0; i <str.size(); i++)
		{
			char c = str.at(i);
			if (right_alpha.find(c, 0) < right_alpha.size())
			{
				if (status != 0 && status == 1)count++;
				status = 2;
			}
			else
			{
				if (status != 0 && status == 2)count++;
				status = 1;
			}
		}

		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<ll>>;

ll n, m;
vector<bool> seen;

void dfs(const Graph &G, ll v, ll &count)
{
	bool is_end = true;
	for (int i = 0; i < n; ++i)
	{
		if (i == v) continue;
		if (!seen[i])
			is_end = false;
	}
	if (is_end)
	{
		++count;
		return;
	}

	seen[v] = true;
	for (auto nv : G[v])
	{
		if (seen[nv]) continue;
		dfs(G, nv, count);
	}
	seen[v] = false;
}


int main(int argc, char **argv)
{
	cin >> n >> m;
	Graph G(m+1);

	for (int i = 1; i < m+1; ++i)
	{
		int a, b;
		cin >> a >> b;
		G[a-1].push_back(b-1);
		G[b-1].push_back(a-1);
	}

	seen.assign(m, false);
	ll count{0};
	dfs(G, 0, count);
	std::cout << count << std::endl;
}


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

int main()
{

	char s[12];
	char *p=" ";
	scanf("%s",s);

	for(int i=0;i<12;i++){
		printf("%c",s[i]);
		if(i==3){
			printf("%s",p);
		}
	}

	printf("\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793


   
int main(){
    string s;
    cin >> s;
    int n=s.size();
    cout << s.at(0) << n-2 << s.at(n-1) << endl;
  }


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

using namespace std;
int main()
{
    int N, K;
    unsigned long cnt;
    cnt = 0;
    cin >> N >> K;
    vector <unsigned long> H(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    sort(H.begin(), H.end(), greater<unsigned long>());

    for (int i = 0; i < N; i++) {
        if (i >= K) {    //必殺技が使えないとき
            cnt += H[i];
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define regi register int
#define ll long long
int a,b,c;
ll ans;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>a>>b>>c;
    ans+=b;
    ans+=min(a+b+1,c);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
typedef pair<int, int> P;

int n,a[(1<<18)];
P p[(1<<18)];

P g(P x, P y){
    set<P> s;
    s.insert(P(-a[x.first], x.first));
    s.insert(P(-a[x.second], x.second));
    s.insert(P(-a[y.first], y.first));
    s.insert(P(-a[y.second], y.second));
    auto itr=s.begin();
    P r=P(0, 0);
    r.first=(*itr).second;
    itr++;
    r.second=(*itr).second;
    return r;
}

P f(int x){
    if(p[x].first>=0)return p[x];
    int b=0;
    for(int i=0;i<n;i++){
        if(((x>>i)&1)==1){
            b++;
        }
    }
    if(b==0)return P(0, 0);
    if(b==1)return P(x, 0);
    P r=P(x, 0);
    for(int i=0;i<n;i++){
        if(((x>>i)&1)==1){
            P t=f(x-(1<<i));
            r=g(r, t);
        }
    }
    return p[x]=r;
}
int main(void){
    cin>>n;
    for(int i=0;i<(1<<n);i++){
        cin>>a[i];
        p[i]=P(-1, 0);
    }
    int z=0;
    for(int i=1;i<(1<<n);i++){
        P q=f(i);
        //cout << i << " : " << q.first << ", " << q.second << endl;
        int x=a[q.first]+a[q.second];
        z=max(z, x);
        cout << z << endl;
    }
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
ll permutationMethod(int n, int r)
{
    r = n - r;
    ll sum = 1;
    int i;
    for (i = n; i >= r + 1; i--)
        sum = (sum * i) % MOD;
    return sum;
}
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}
long long K;
vector<bool> seen;
vector<int> depthSum(100010);
ll dfs(const Graph &G, int K, int now, int from)
{
    int color = 0;

    if (from == -1)
    {
        color = K - 1;
    }
    else
    {
        color = K - 2;
    }

    // if (K < G[now].size())
    // {
    //     return 0;
    // }

    ll cnt = 1;

    for (auto next_v : G[now])
    {
        if (next_v == from)
        {
            continue;
        }
        cnt *= color;
        color--;
        cnt %= MOD;
    }

    for (auto next_v : G[now])
    {
        if (next_v == from)
        {
            continue;
        }
        cnt *= dfs(G, K, next_v, now);
        cnt %= MOD;
    }
    return cnt;
}

int main()
{
    long long N;
    scanf("%lld", &N);

    scanf("%lld", &K);
    Graph G(N);
    for (int i = 0; i < N - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    seen.assign(N - 1, false);
    cout << (K * dfs(G, K, 0, -1)) % MOD << endl;
}


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

int main(){
	cin>>str;
	char now=str[0];
	int flag=0;
	if(now!='h'){
        printf("No\n");
        flag=1;
	}
	else if(str.length()%2!=0){
		printf("No\n");
        flag=1;
	}
	else{
		for(int i=1;i<str.length();i++){
		   if(now=='h'&&str[i]=='i'){
			   now=str[i+1];
			   i++;
		    } 
		   else{
			  printf("No\n");
			  flag=1;
			  break;
		   }
	    }
	}
	
	if(!flag) printf("Yes\n");
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
while len(a)>1:
    l=len(a)
    a.sort()
    b=[a[0] if i==0 else a[i]%a[0] for i in range(l)]
    a=[b[i] for i in range(l) if b[i]!=0]
print(a[0])


Measured memory_bytes: 14252
# coding=utf-8
import math

if __name__ == '__main__':
    N = int(input())
    answer = 0

    for i in range(1, N+1, 2):
        counter = 0
        for j in range(1, 1+math.floor(math.sqrt(i))):
            if i % j == 0:
                if j**2 == i:
                    counter += 1
                else:
                    counter += 2
        if counter == 8:
            answer += 1

    print(answer)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF LLONG_MAX/3
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int n,x,a[60],b[60];
int sumpaty(int l,int m){
	if(m==0)return 0;
	if(l==0)return 1;
	if(m==1)return 0;
	if(1+a[l-1]>=m){
		return sumpaty(l-1,m-1);
	}
	return b[l-1]+1+sumpaty(l-1,min(a[l-1],m-2-a[l-1]));
}
signed main(){
	cin>>n>>x;
	a[0]=1;
	b[0]=1;
	for(int i=1;i<=50;i++){
		a[i]=a[i-1]*2+3;
		b[i]=b[i-1]*2+1;
	}
	cout<<sumpaty(n,x)<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline int rd_int(void){
  int x;
  rd(x);
  return x;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int X;
int Y;
int A[80][80];
char vis[80][80][7000];
int res;
void solve(int a, int b, int v){
  if(v < 0){
    v = -v;
  }
  if(v >= 7000){
    return;
  }
  if(vis[a][b][v]){
    return;
  }
  vis[a][b][v] = 1;
  if(a==X-1 && b==Y-1){
    chmin(res, v);
    return;
  }
  if(a!=X-1){
    solve(a+1,b,v+A[a+1][b]);
    solve(a+1,b,v-A[a+1][b]);
  }
  if(b!=Y-1){
    solve(a,b+1,v+A[a][b+1]);
    solve(a,b+1,v-A[a][b+1]);
  }
}
int main(){
  int i;
  rd(X);
  rd(Y);
  for(i=(0);i<(X);i++){
    int j;
    for(j=(0);j<(Y);j++){
      A[i][j] += rd_int();
    }
  }
  for(i=(0);i<(X);i++){
    int j;
    for(j=(0);j<(Y);j++){
      A[i][j] -= rd_int();
    }
  }
  for(i=(0);i<(X);i++){
    int j;
    for(j=(0);j<(Y);j++){
      A[i][j] = abs(A[i][j]);
    }
  }
  res = 1073709056;
  solve(0,0,A[0][0]);
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191208-1 [beta]

// --- original code ---
// int X, Y, A[80][80];
// char vis[80][80][7000];
// int res;
// 
// void solve(int a, int b, int v){
//   if(v < 0) v = -v;
//   if(v >= 7000) return;
//   if(vis[a][b][v]) return;
//   vis[a][b][v] = 1;
// 
//   if(a==X-1 && b==Y-1){
//     res <?= v;
//     return;
//   }
// 
//   if(a!=X-1){
//     solve(a+1,b,v+A[a+1][b]);
//     solve(a+1,b,v-A[a+1][b]);
//   }
//   if(b!=Y-1){
//     solve(a,b+1,v+A[a][b+1]);
//     solve(a,b+1,v-A[a][b+1]);
//   }
// }
// 
// {
//   rd(X,Y);
//   rep(i,X) rep(j,Y) A[i][j] += rd_int();
//   rep(i,X) rep(j,Y) A[i][j] -= rd_int();
//   rep(i,X) rep(j,Y) A[i][j] = abs(A[i][j]);
// 
//   res = int_inf;
//   solve(0,0,A[0][0]);
//   wt(res);
// }


Measured memory_bytes: 43776
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
    string s, t;
    cin >> s >> t;

    bool res=false;
    for(int i=0; i<s.size(); i++){
        string u = s.substr(i, s.size() - i) + s.substr(0, i);
        if(u == t) {
            res = true;
            break;
        }
    }
    if(res) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100000

int A[N];

int Partition(int A[],int p,int r){
    int x,i,j;
    int tmp;
    
    x=A[r];
    i = p-1;
    
    for(j=p;j<r;j++){
        if (A[j] <= x){
            i=i+1;
            tmp=A[j];
            A[j]=A[i];
            A[i]=tmp;
        }
    }

        tmp=A[i+1];
        A[i+1]=A[r];
        A[r]=tmp;
        
    
    
    return i+1;
}


int main(int argc, char *argv[]){
    int n,i,x;
    
    scanf("%d",&n);
    if(1>n || n>100000)return 0;
    
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    
    
    x=Partition(A,0,n-1);
    
    for(i=0;i<x;i++){
        printf("%d ",A[i]);
    }
    printf("[%d] ",A[x]);
    
    for(i=x+1;i<n-1;i++){
        printf("%d ",A[i]);
    }
    printf("%d\n",A[n-1]);
    
    return 0;
}//End of main

Measured memory_bytes: 984
#include <iostream>
#include <string>
#include <unordered_map>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;
 
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define y1 abcde
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
#define BUG cout << "acdsfas" << endl

const int mod = 1e9 + 7;
const int inf = 2e9;
const int N = 3e3 + 15;
int n, dp[N][N];
string s;

inline void add(int &a, int b) {
    a += b;
    if(a >= mod)
        a -= mod;
    if(a < 0)
        a += mod;
}

inline void calc_pref(int i) {
    for(int j = 1; j <= n; ++j)
        add(dp[i][j], dp[i][j-1]);
}

main() {
    cin >> n >> s;
    s = '#' + s;
    dp[1][1] = 1;
    for(int i = 1; i < n; ++i) {
        calc_pref(i);
        for(int j = 1; j <= i; ++j) {
            if(s[i] == '<')
                add(dp[i + 1][j + 1], dp[i][j]);
            else
                add(dp[i + 1][1], dp[i][j]),
                add(dp[i + 1][j + 1], -dp[i][j]);
        }
    }
    calc_pref(n);
    calc_pref(n);
    cout << dp[n][n] << endl;
    return 0;
}

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

int main(void) {
  int a, b;
  cin >> a >> b;
  int ans = 1e9;
  ans *= -1;
  ans = max(ans, a+b);
  ans = max(ans, a-b);
  ans = max(ans, a*b);
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int H1 = sc.nextInt();
        int M1= sc.nextInt();
        int H2= sc.nextInt();
        int M2 = sc.nextInt();
        int K = sc.nextInt();

        System.out.println(solve(H1, M1, H2, M2, K));
    }

    private static int solve(int H1, int M1, int H2, int M2, int K) {
        int from = H1*60 + M1;
        int to = H2*60 + M2;


        return to - from - K;
    }
}

Measured memory_bytes: 35800
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<ll> x(m);
	rep(i,m) cin >> x[i];
	if(n >= m){
		cout << 0 << endl;
		return 0;
	}
	sort(x.begin(), x.end());
	vector<ll> dis;
	rep(i,m-1){
		dis.push_back(x[i+1] - x[i]);
	}
	sort(dis.begin(), dis.end());
	ll ans = 0;
	rep(i,m-n) ans += dis[i];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4980
// Last Change: 09/15/2019 21:25:35.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  ll N, M;
  cin >> N >> M;

  priority_queue<ll> pq;
  {
    ll A;
    for (ll i = 0; i < N; ++i) {
      cin >> A;
      pq.push(A);
    }
  }

  {
    ll tmp;
    for (ll i = 0; i < M; ++i) {
      tmp = pq.top();
      pq.pop();
      pq.push(tmp / 2);
    }
  }

  {
    ll ans = 0;
    while (!pq.empty()) {
      ans += pq.top();
      pq.pop();
    }
    cout << ans << endl;
  }
}

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

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

using namespace std;

int n;
string w;
int z[500000];
bool s[500000];
bool t[500000];

void nt(bool* s){
	z[0] = n;
	int i = 1;
	int j = 0;
	while(i < n){
		for(; i + j < n && w[i + j] == w[j]; ++j){}
		z[i] = j;
		if(j == 0){
			++i;
			continue;
		}
		int k = 1;
		for(; k < j && k + z[k] < j; ++k){
			z[i + k] = z[k];
		}
		i += k;
		j -= k;
	}

	fill_n(s, n, true);
	rep(i, n - 1){
		if(s[i]){
			for(int j = i * 2 + 1; j <= i + z[i + 1]; j += i + 1){
				s[j] = false;
			}
		}
	}
}

int main() {
	cin >> w;
	n = w.size();

	nt(s);
	reverse(w.begin(), w.end());
	nt(t);

	int u, v = 0;
	if(s[n - 1]){
		u = 1;
		v = 1;
	}
	else if(z[1] == n - 1){
		u = n;
		v = 1;
	}
	else{
		u = 2;
		rep(i, n - 1){
			if(s[i] && t[n - i - 2]){
				++v;
			}
		}
	}
	cout << u << endl;
	cout << v << endl;
	return 0;
}

Measured memory_bytes: 3844
import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner kbd = new Scanner(System.in);

	char[] m = {'m', 'c', 'x', 'i'};
	int[] s = {1000, 100, 10, 1};

	int count = kbd.nextInt();

	for(int c=1; c<=count; c++) {
	    String s1 = kbd.next();
	    String s2 = kbd.next();
	    
	    int a1 = toInt(s1, m, s);
	    int a2 = toInt(s2, m, s);
	    // System.out.println(a1 + " " + a2);
	    String res = toMCXI(a1+a2, m, s);
	    System.out.println(res);
	}
    }

    static int toInt(String st, char[] m, int[] s) {
	int pt = 0;
	int res = 0;
	char c = st.charAt(pt);

	for(int i=0; i<m.length; i++) {
	    int k = 1;
	    if(c>='2' && c<='9'){
		k *= (c-'0');
		c = st.charAt(++pt);
	    }

	    while(c != m[i]) i++;
	    res += k*s[i];
	    if(++pt >= st.length()) break;
	    c = st.charAt(pt);
	}
	return res;
    }

    static String toMCXI(int res, char[] m, int[] s) {
	String c = "";
	int d = res;
	for(int i=0; i<4; i++) {
	    if(d/s[i] > 1){
		c += d/s[i];
		c += m[i];
	    }
	    if(d/s[i] == 1) {
		c += m[i];
	    }
	    d = d - d/s[i]*s[i];
	}
	return c;
    }
}

Measured memory_bytes: 12000
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int lcm(int x, int y) { return x / gcd(x, y) * y; }

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

  string s, t;
  cin >> s >> t;

  cout << (t + s) << endl;

  return 0;
}


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

bool check(char ch) {
	return ch == 'A' || ch=='G' || ch=='T' || ch=='C';
}

int main(){
   string s;
   cin >> s;
   int mx = 0;
   int sz = s.size();
   int cnt;
   for( int i=0; i<sz; i++){
       if(check(s[i])){
               cnt = 1;
               while( check(s[i]) ){
                    cnt++;
                    i++;
                }
                mx = max(mx,cnt-1);
        }
    }
    cout << mx << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順

int main()
{
    string S;
    cin >> S;
    map<int, int> m;
    for (int i = (int)'a'; i <= (int)'z'; i++)
        m.insert(make_pair(i, 0));
    rep(i, S.size())
    {
        m.at(S.at(i))++;
    }
    for (auto x : m)
    {
        if (x.second % 2 == 1)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>

using namespace std;

using P = pair<int, int>;
using i64 = int64_t;
i64 mod = 1000000007;
int int_max = 2147483647;
int max_n = 1e5;


int main(int argc, char **argv) {
    int n;
    cin >> n;
    std::priority_queue<double, std::vector<double>, std::greater<>> q;
    for (int i=0; i<n; ++i) {
        double tmp;
        cin >> tmp;
        q.push(tmp);
    }

    while(true) {
        if (q.size() < 2) break;
        double d1 = q.top(); q.pop();
        double d2 = q.top(); q.pop();

        q.push((d1+d2) / 2.);
    }

    cout << std::setprecision(10) << q.top() << endl;

    return 0;
}


Measured memory_bytes: 256
#include<queue>
#include<cstdio>

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

using namespace std;

const int INF=1<<29;

struct edge{ int v,cost; };

int main(){
	int n,m,k; scanf("%d%d%d",&n,&m,&k);
	vector<edge> G[3000];
	rep(i,m){
		int u,v,cost; scanf("%d%d%d",&u,&v,&cost); u--; v--;
		G[u].push_back((edge){v,cost});
		G[v].push_back((edge){u,cost});
	}

	int d[3000];
	rep(u,n) d[u]=INF;
	priority_queue< pair<int,int> > Q;
	rep(i,k){
		int u; scanf("%d",&u); u--;
		d[u]=0;
		Q.push(make_pair(0,u));
	}
	while(!Q.empty()){
		int d_now=-Q.top().first,u=Q.top().second; Q.pop();
		if(d[u]<d_now) continue;
		rep(i,G[u].size()){
			const edge &e=G[u][i];
			if(d[e.v]>d[u]+e.cost){
				d[e.v]=d[u]+e.cost;
				Q.push(make_pair(-d[e.v],e.v));
			}
		}
	}

	int ans=0;
	rep(u,n) rep(i,G[u].size()) {
		const edge &e=G[u][i];
		ans=max(ans,(d[u]+d[e.v]+e.cost+1)/2);
	}
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
ll num[1010];
int main() {
	cin >> n;
	num[0] = 1;
	int tot = 1;
	for (tot = 1; ; tot++) {
		num[tot] = num[tot - 1] * 26;
		if (num[tot] > 1e16) break;
	}
	for (int i = 1; i <= tot; i++) {
		if (n > num[i]) {
			n -= num[i];
		} else {
			for (int j = i; j >= 1; j--) {
				for (int k = 0; k < 26; k++) {
					if (n > num[j - 1]) {
						n -= num[j - 1];
					} else {
						putchar(k + 'a');
						break;
					}
				}
			}
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
		string s = "";
		int n, p;
		cin >> n >> p;
		cin >> s;
		if(p == 2 || p == 5){
			int ans = 0;
			for(int i = 0; i < n; i++){
				if((s[i] - '0') % p == 0)
					ans += i + 1;
			}
			cout << ans << endl;
			return 0;
		}
		map<int,int> m;
		++m[0];
		int q = 1, rem = 0, ans = 0;
		for(int i = n-1; i >= 0; i--){
			int dig = (s[i] - '0');
			rem = (dig * q + rem) % p;
			ans += m[rem];
			m[rem]++;
			q = q*10 % p;
		}
		cout << ans << endl;

	return 0;
}



Measured memory_bytes: 1028
N,M=map(int,input().split())
S=list(input())
arr=[]

cur = N
while cur > 0:
  prevC = cur
  cur = max(0,cur-M)
  while S[cur]=='1':
    cur+=1;
  if cur==prevC:
    print(-1)
    exit(0)
  arr.append(str(prevC-cur))
arr.reverse()
print(' '.join(arr))

Measured memory_bytes: 10836
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main(String[] args)throws java.lang.Exception
    {		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int a=Integer.parseInt(br.readLine());
		System.out.println(a+a*a+a*a*a);
	}
}

Measured memory_bytes: 32520
n,a,b,k=map(int,input().split())
m=998244353
I=[0]*n
for i in range(n):
  I[i]=pow(i+1,m-2,m)
c=[0]*(n+1)
c[0]=1
for i in range(1,n+1):
  c[i]=(c[i-1]*(n-i+1)*I[i-1])%m
q=0
for i in range(n+1):
  j=(k-i*a)//b
  if (k-i*a)%b or j<0 or j>n:continue
  q=(q+c[i]*c[j])%m 
print(q%m)

Measured memory_bytes: 26768
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	int N,i;
	string S;
	cin>>N;
	cin>>S;
	size_t strLen=S.size();
	int ans=0;
	int endI=strLen-1;
	int wNum=0;
	for (i=0;i<strLen;i++){
		if (S[i]=='W'){
			wNum++;
		}
	}
	if (wNum==0){
		cout<<0<<endl;
		return 0;
	}
	for (i=0;i<strLen;i++){
		if (S[i]=='W'){
			while (S[endI]=='W'){
				endI--;
				if (endI==i){
					break;
				}
			}
			if (endI==i){
				break;
			}
			if (S[endI]=='R'){
				S[i]='R';
				S[endI--]='W';
				ans++;
			}
		}
		if (i==endI){
			break;
		}
	}
	bool bFindW=false;
	for (i=0;i<strLen;i++){
		if (S[i]=='W'){
			bFindW=true;
		}
		if (bFindW && S[i]=='R'){
			S[i]='W';
			ans++;
		}
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 3412
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#define int long long
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

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

Measured memory_bytes: 256