akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 300;
int n;
int v[N][N];
ll cost[N];
vector<int> p[N];
ll e[N][N];
void Dijkstra(int u) {
	for (int i = 0; i < n; ++i) {
		cost[i] = 1e18;
		p[i].clear();
	}
	cost[u] = 0;
	for (int i = 0; i<n; ++i) {
		int u = -1;
		ll mn = 1e18;
		for(int i=0;i<n;++i)
			if (cost[i] < mn && cost[i] != -1) {
				mn = cost[i];
				u = i;
			}
		for (int v = 0; v<n; ++v) {
			if (!e[u][v] || cost[v] == -1)
				continue;
			if(cost[v]>cost[u]+e[u][v]){
				cost[v] = cost[u] + e[u][v];
				p[v].clear();
				p[v].push_back(u);
			}else if (cost[v] == cost[u] + e[u][v])
				p[v].push_back(u);
		}
		cost[u] = -1;
	}
	for (int i = 0; i < n; ++i)
		if (p[i].size() > 1 && e[i][u])
			e[i][u] = e[u][i] = 0;
}
int main()
{
	scanf("%d", &n);
	for(int i=0;i<n;++i)
		for (int j = 0; j < n; ++j) {
			scanf("%d", &v[i][j]);
			e[i][j] = v[i][j];
		}
	for (int i = 0; i < n; ++i)
		Dijkstra(i);
	ll res = 0;
	for (int i = 0; i < n; ++i)
		for (int j = i + 1; j < n; ++j) {
			res += e[i][j];
		}
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			if (!e[i][j] && i != j)
				e[i][j] = 1e18;
	for (int k = 0; k < n; ++k)
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < n; ++j)
				e[i][j] = min(e[i][j], e[i][k] + e[k][j]);
	for(int i=0;i<n;++i)
		for(int j=0;j<n;++j)
			if (e[i][j] != v[i][j]) {
				res = -1;
				i = j = n;
			}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

signed main() {
  ll A, B;
  cin >> A >> B;
  COUT(A * B);
  return 0;
}

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

int main (){
  unsigned long long A, B, N, c, x, ans;
  ans = 0;
  cin >> A >> B >> N;
  x = min ( B-1, N );
  c = A * ( x % B ) / B;
  ans = max ( ans, c );
  cout << ans << endl;
}

Measured memory_bytes: 3600
import fractions
from functools import reduce
import collections

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)



n, m = map(int, input().split())
a = list(map(int, input().split()))
a=set(a)
b=list(a)
n1=len(b)
count=0
v=[]

x=lcm_list(b)

for i in range(n1):
    while b[i]%2==0:
        b[i]=b[i]//2
        count+=1
    v.append(count)
    count=0

for i in range(n1-1):
    if v[i]!=v[i+1]:
        print(0)
        exit()

print((m-x//2)//x+1)

Measured memory_bytes: 89580
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int mv[65][200005];

int main() {
    // 繰り返し二乗法
    int N;
    ll K;
    cin >> N >> K;
    rep(i, N) {
        int x;
        cin >> x;
        --x;
        mv[0][i] = x;
    }
    for (int i = 1; i < 65; i++) {
        for (int j = 0; j < 200005; j++) {
            mv[i][j] = mv[i-1][mv[i-1][j]];
        }
    }
    int ans = 0;
    int cur = 0;
    while (K > 0) {
        if (K&1) ans = mv[cur][ans];
        K >>= 1;
        cur++;
    }
    cout << ++ans << '\n';    
    return 0;
}


Measured memory_bytes: 54380
using System;
using System.Collections.Generic;
class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] s1 = Console.ReadLine().Split(' ');
            string[] s2 = Console.ReadLine().Split(' ');
            int[] a = new int[n], b = new int[n];
            for (int i=0; i<n; i++)
            {
                a[i] = int.Parse(s1[i]);
                b[i] = int.Parse(s2[i]);
            }

            long ans = 0;
            int p = 0;
            int lockAll = 0;
            while (lockAll < n)
            {
                if (b[p] < a[p])
                {
                    Console.WriteLine(-1);
                    return;
                }
                else if (b[p] == a[p])
                {
                }
                else
                {
                    int sum = b[(p + 1) % n] + b[(p + n - 1) % n];
                    if (b[p] - sum >= a[p])
                    {
                        int buf = (b[p] - a[p]) / sum;
                        ans += buf;
                        b[p] -= buf * sum;
                        lockAll = 0;
                    }
                }
                lockAll++;
                p = (p + 1) % n;
            }
            for (int i=0; i<n; i++)
            {
                if(b[i] != a[i])
                {
                    Console.WriteLine(-1);
                    return;
                }
            }
            Console.WriteLine(ans);
            
        }
    }
    //mcs Main.cs
    //mono Main.exe

Measured memory_bytes: 46824
//
//*****************
//Created by corol
//*****************
//

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define wv(a, n) for (int i=0;i<(n);i++) {cin >> (a)[i];}
#define w(t) while (t--)
#define vi vector <int>
#define vs vector <string>
#define vll vector <long long>
#define vii vector <pair <int,int>>
#define MM <<
#define all(x) sort((x).begin(), (x).end());
#define rall(x) sort((x).rbegin(), (x).rend());
#define it int64_t
it mod = 1000000007;


template<class A>
void read(vector<A> &v);

template<class A, size_t S>
void read(array<A, S> &a);

template<class T>
void read(T &x) {
    cin >> x;
}

template<class H, class... T>
void read(H &h, T &... t) {
    read(h);
    read(t...);
}

template<class T>
void print(T &x) {
    cout << x;
}

struct graph {
    int first, second;
};

bool cmputd(pair<int, int> a, pair<int, int> b) {
    return a.first > b.first;
}

bool cmpdtu(pair<int, int> a, pair<int, int> b) {
    return a.first < b.first;
}

bool cmpdtu_struct(graph a, graph b) {
    return a.first < b.first;
}

void test_cases();

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

    test_cases();
    //cout << "Time elapsed: " << 1.000 * clock() / CLOCKS_PER_SEC << " ms. \n";
    return 0;
}

int d_min(vector<int> &a, int p) {
    int l = -1;
    int r = (int) a.size();
    while (r > l + 1) {
        int m = (l + r) / 2;
        if (a[m] <= p) l = m;
        else r = m;
    }
    return l;
}

int d_max(vector<int> &a, int p) {
    int l = -1;
    int r = (int) a.size();
    while (r > l + 1) {
        int m = (l + r) / 2;
        if (a[m] < p) l = m;
        else r = m;
    }
    return r;
}
bool cmp(pair <int,int> a, pair <int,int> b) {
    return a.first==a.second && b.first==b.second;
}
void test_cases() {
    int n;
    cin >> n;
    vector <pair <int,int>> a(n);
    for (int i=0;i<n;i++) {
        int x,y;
        cin >> x >> y;
        a[i]={x,y};
    }
    bool ok = false;
    for (int i=0;i<n;i++) {
        if (a[i].first==a[i].second && a[i+1].first==a[i+1].second && a[i+2].first==a[i+2].second) {ok=true; break;}
    }
    cout << (ok==true ? "Yes": "No");
}



Measured memory_bytes: 3680
def main():
    mod = 10**9 + 7
    h, w, k = map(int, input().split())

    if w == 1:
        print(1)
        exit()
    if w == 2:
        print(pow(2, h-1, mod))
        exit()

    k -= 1

    fibo = [1, 2, 3, 5, 8, 13, 21]

    dp = [0] * w
    dp[0] = 1
    for _ in range(h):
        new_dp = [0] * w
        new_dp[0] = (dp[0] * fibo[w-2] + dp[1] * fibo[w-3]) % mod
        new_dp[1] = (dp[0] * fibo[w-3]) % mod
        new_dp[w-1] = (dp[w-1] * fibo[w-2] + dp[w-2] * fibo[w-3]) % mod
        new_dp[w-2] += (dp[w-1] * fibo[w-3]) % mod
        for i in range(1, w-1):
            new_dp[i] += ((fibo[i-1] * fibo[w-i-2]) * dp[i]) % mod
        for i in range(1, w-2):
            new_dp[i] += (fibo[i-1] * fibo[w-i-3]) * dp[i+1]
            new_dp[i] %= mod
            new_dp[i+1] += (fibo[i-1] * fibo[w-i-3]) * dp[i]
            new_dp[i+1] %= mod
        dp = new_dp

    print(dp[k] % mod)

main()

Measured memory_bytes: 9192
h, w = map(int, input().split())
a = []
a.append('.' * (w + 2))
for i in range(h):
    a.append('.' + input() + '.')
a.append('.' * (w + 2))

xy = [[1, 0], [0, 1], [0, -1], [-1, 0]]
for i in range(1, h):
    for j in range(1, w):
        if a[i][j] == '#':
            flag = False
            for k in range(4):
                x = xy[k][0]
                y = xy[k][1]
                if a[i + x][j + y] == '#':
                    flag = 1
                    
            if not flag:
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

struct Node {
    int key;
    Node *prev, *next;
};

Node *nil;

void init() {
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void insert(int key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

Node* listSearch(int key) {
    Node *cur = nil->next;
    while (cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void deleteNode(Node *t) {
    if (t == nil) {
        return;
    }
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() {
    deleteNode(nil->next);
}

void deleteLast() {
    deleteNode(nil->prev);
}

void deleteKey(int key) {
    deleteNode(listSearch(key));
}

void output() {
    Node* node = nil->next;
    int cnt = 0;
    while (node != nil) {
        if (cnt > 0) {
            printf(" ");
        }
        printf("%d", node->key);
        node = node->next;
        cnt++;
    }
    printf("\n");
}

int main () {
    int n;
    scanf("%d", &n);
    init();

    char cmd[20];
    int key;
    for (int i = 0; i < n; i++) {
        scanf("%s%d", cmd, &key);
        if (cmd[0] == 'i') {
            insert(key);
        } else if (cmd[0] == 'd') {
            if (strlen(cmd) == 6) {
                deleteKey(key);
            } else {
                if (cmd[6] == 'F') {
                    deleteFirst();
                } else if (cmd[6] == 'L') {
                    deleteLast();
                }
            }
        }
    }
    output();

    return 0;
}

Measured memory_bytes: 33844
#include<iostream>

int main()
{
	int n;
	int a[4][3][10] = { 0 };
	int b, f, r, v;
	std::cin >> n;

	for (int i = 0; i < n; i++) {
		std::cin >> b >> f >> r >> v;
		a[b - 1][f - 1][r - 1] += v;
	}

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				std::cout << " " << a[i][j][k];
			}
			std::cout << std::endl;
		}
		if (i < 3)
			std::cout << "####################" << std::endl;
	}
}

Measured memory_bytes: 3108
<?php
    list($h, $n) = explode(" ", trim(fgets(STDIN)));
    $atk = explode(" ", trim(fgets(STDIN)));
    for($i = 0; $i < $n; $i++){
        $h -= $atk[$i];
    }
    if($h <= 0){
        echo "Yes";
    }else{
        echo "No";
    }
?>

Measured memory_bytes: 12792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int N; cin >> N;
    vector<ll> x(N), y(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
    }
    ll m1, m2, M1, M2;
    m1 = INF; m2 = INF; M1 = 0; M2 = 0;
    m1 = x[0] - y[0];
    M1 = x[0] - y[0];
    m2 = x[0] + y[0];
    M2 = x[0] + y[0];
    for (int i = 1; i < N; i++) {
        m1 = min(m1, x[i] - y[i]);
        m2 = min(m2, x[i] + y[i]);
        M1 = max(M1, x[i] - y[i]);
        M2 = max(M2, x[i] + y[i]);
    }
    ll ans = max(M1 - m1, M2 - m2);
    printf("%lld\n", ans);

}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll h,w; cin >> h >> w;
    vs s(h);
    rep(i,h)cin >> s[i];

    vvl l(h,vl(w)),r(h,vl(w)),u(h,vl(w)),d(h,vl(w));

    //左を見たときの壁からの距離
    rep(i,h){
        ll num = 0;
        rep(j,w){
            if(s[i][j] == '#')num=0;
            else num++;
            l[i][j] = num;
        }
    }
    rep(i,h){
        ll num = 0;
        for(int j = w-1;j>=0;j--){
            if(s[i][j] == '#')num = 0;
            else num++;
            r[i][j] = num;
        }
    }
    rep(j,w){
        ll num = 0;
        rep(i,h){
            if(s[i][j] == '#')num=0;
            else num++;
            u[i][j] = num;
        }
    }
    rep(j,w){
        ll num = 0;
        for(int i = h-1;i>=0;i--){
            if(s[i][j] == '#')num=0;
            else num++;
            d[i][j] = num;
        }
    }

    ll res = 0;
    rep(i,h)rep(j,w)res = max(res,l[i][j]+r[i][j]+u[i][j]+d[i][j]-3);
    out(res);
}


Measured memory_bytes: 129920
from collections import defaultdict
d = defaultdict(int)
N = int(input())
for i in range(N):
    d[input()] += 1
m = max(d.values())
d = sorted(d.items(), key=lambda x:x[1])
d.reverse()
ans = []
for s in d:
    if s[1] == m:
        ans.append(s[0])
    else:
        break
ans.sort()
for a in ans:
    print(a)

Measured memory_bytes: 43484
N, M = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]

if N >= M:
    print(0)
    exit()
Xs = sorted(X)
dst = []
for i in range(M-1):
    dst.append(Xs[i+1] - Xs[i])
#print(Xs)
#print(dst)
dsts = sorted(dst)
#print(dsts[:len(dsts)-N+1])
print(sum(dsts[:len(dsts)-N+1]))

Measured memory_bytes: 19828
#include<stdio.h>
#include<string.h>
#define M 1001
void len(char *x, char*y)
{
  int ch[M][M];
  int i, j, n, m;
  n = strlen(x);
  m = strlen(y);
  for(i = 1; i <= n; i++)
    {
      ch[i][0] = 0;
    }
  for(j = 0;j <= m; j++)
    {
      ch[0][j] = 0;
    }
  for(i = 1; i <= n; i++)
    {
      for(j = 1; j <= m; j++)
	{
	  if(x[i-1] == y[j-1])
	    {
	      ch[i][j] = ch[i-1][j-1] +1;
	    }
	  else if(ch[i-1][j] >= ch[i][j-1])
	    {
	      ch[i][j] = ch[i-1][j];
	    }
	  else
	    {
	      ch[i][j] = ch[i][j-1];
	    }
	}
    }
  printf("%d\n", ch[n][m]);
}

int main()
{
  char x[M], y[M];
  int i, n;
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      scanf("%s %s", x, y);
      len(x, y);
    }
  return 0;
}



Measured memory_bytes: 5620
from collections import Counter

N = int(input())
C = [None] * N
res = Counter(input())

for _ in range(N - 1):
    ok = False
    C = Counter(input())
    # print(C)
    tmp = list(res.keys())
    for r in tmp:
        if r in C:
            res[r] = min(res[r], C[r])
            ok = True
        else:
            res.pop(r)
    if ok is False:
        exit()
# print(sorted(list(res.items())))
for s in sorted(list(res.items())):
    print(s[0] * int(s[1]), end="")
print()


Measured memory_bytes: 3316
import sys

#+++++


def gh(n):
	return n // 2 + n % 2
	
def gn(n):
	return  n // 2
			
def main():
	l = list(input())
	ret = [0 for _ in l]
	n=len(l)
	
	p='L'
	count=0
	for i, (c, nc) in enumerate(zip(l,l[1:])):
		if p=='L' and c == 'R':
			count=0
		
		if c == 'R' and nc == 'L':
			count+=1
			#print(count)
			ret[i]+=gh(count)
			ret[i+1]+=gn(count)
			#print(ret)
			p='R'
		elif c == 'R':
			p='R'
			count+=1
			#print(ret)
		else:
			p='L'
	
	p='R'
	count=0
	for i, (c, nc) in enumerate(zip(l[-1::-1],l[-2::-1])):
		#print(c,nc,i)
		if p=='R' and c == 'L':
			count=0
		
		if c == 'L' and nc == 'R':
			count+=1
			ret[n-i-1]+=gh(count)
			ret[n-i-2]+=gn(count)
			#print(ret)
			p='L'
		elif c == 'L':
			p='L'
			count+=1
		else:
			p='R'
	
	ret=' '.join([str(i) for i in ret])
	print(ret)
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 11140
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <sstream>
#include <climits>
#include <cstdlib>
using namespace std;

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

class Car{
public:
	int id,time;

	Car(int tid,int ttime){
		id = tid;
		time = ttime;
	}
};

int n;
stack<Car> space[10];
queue<Car> q;
vector<int> ans;

void minusTime(int time){
	rep(i,n){
		stack<Car> tmp;

		while(!space[i].empty()){
			Car car = space[i].top();
			space[i].pop();
			car.time -= time;
			tmp.push(car);
		}

		while(!tmp.empty()){
			space[i].push(tmp.top());
			tmp.pop();
		}
	}
}

int leftCar(void){
	int res = 0;

	rep(i,n){
		while(!space[i].empty() && space[i].top().time <= 0){
			ans.push_back(space[i].top().id);
			space[i].pop();
			res++;
		}
	}

	return res;
}

int getParkingSpace(Car car){
	int min1 = INT_MAX - 1;
	int min2 = INT_MAX - 1;
	int minIdx1 = -1;
	int minIdx2 = -1;

	rep(i,n)if(space[i].size() != 2){
		int diff = abs(space[i].top().time - car.time);

		if(space[i].top().time >= car.time && min1 > diff){
			min1 = diff;
			minIdx1 = i;
		}
		else if(space[i].top().time < car.time && min2 > diff){
			min2 = diff;
			minIdx2 = i;
		}
	}

	if(min1 != INT_MAX - 1) return minIdx1;
	if(min2 != INT_MAX - 1) return minIdx2;
	return -1;
}

void parkCar(Car car){
	rep(i,n)if(space[i].empty()){
		space[i].push(car);
		return;
	}

	int spIdx = getParkingSpace(car);
	if(spIdx == -1) q.push(car);
	else space[spIdx].push(car);
}

void simulateOneMinute(void){
	minusTime(1);
	int res = leftCar();
	for(int k=0;!q.empty() && k<res;k++){
		parkCar(q.front());
		q.pop();
	}
}


int main(void){
	int m;

	while(cin>>n>>m && (n||m)){
		rep(i,n) while(!space[i].empty()) space[i].pop();
		ans.clear();

		REP(i,1,m+1){
			int time;
			cin>>time;
			rep(j,10) simulateOneMinute();
			parkCar(Car(i,time));
		}

		while(ans.size() != m) simulateOneMinute();

		rep(i,m-1) cout<<ans[i]<<" ";
		cout<<ans[m-1]<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
#define ll  long long
#define M 1000000007
#define tc int t; cin>>t; while(t--)
#include <cstring>
#include <cmath>

int main(){
  int x;
  cin>>x;
 if( x >= 30){
   cout << "Yes" << endl;
 }
  else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3092
import java.util.*; 
import java.lang.*; 


public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int N = scan.nextInt();
                int M = scan.nextInt();
                long K = scan.nextLong();
               
                long[] A= new long[N+1];
                long[] B= new long[M+1];
                A[0]=0;
                B[0]=0;
                for(int i=1; i<=N;i++){
                        long P = scan.nextLong();
                        A[i]=A[i-1]+P;
                }
                for(int i=1; i<=M;i++){
                        long Q = scan.nextLong();
                        B[i]=B[i-1]+Q;
                }
                int ans = 0;
                int bn = M;
                for(int i=0; i<=N&&A[i]<=K;i++){
                    for(int j=bn; j>=0;j--){
                        if(A[i]+B[j]<=K){
                            if(ans<i+j){
                                ans=i+j;
                            }
                            bn = j;
                            break;
                        }
                    }
                }
                System.out.println(ans);               
        }               
}

Measured memory_bytes: 64676
#include <iostream>
using namespace std;
int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main() {
    int k;
    cin >> k;
    cout << a[k - 1] << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
adj_path = [[] for _ in range(n)]
paths = []
for _ in range(n-1):
    a,b = map(int,input().split())
    paths.append([a,b])
    adj_path[a-1].append(b-1)
    adj_path[b-1].append(a-1)
c_list = sorted(list(map(int,input().split())),reverse=True)
out = [0 for i in range(n)]
que = [[0,adj_path[0]]]
visited = []
cnt = 0
while(que):
    node_num,children = que.pop(0)
    visited.append(node_num)
    out[node_num] = c_list[cnt]
    cnt += 1
    for child in children:
        if child not in visited:
            que.append([child,adj_path[child]])
score = 0
for path in paths:
    a,b = path
    score += min(out[a-1],out[b-1])
print(score)
print(" ".join(str(x) for x in out))


Measured memory_bytes: 7908
#include <stdio.h>
#define FOUR 4
long long n_base(long long n,long long num);
int main(void) {
    long long num;
    while (1) {
        scanf("%lld",&num);
        if (num==-1) break;
        printf("%lld\n",n_base(FOUR,num));
    }
    return 0;
}

long long n_base(long long n,long long num) {
    long long i=1,ans=0;
    while (num/n!=0||num%n!=0) {
        ans+=(num%n)*i;
        i*=10;
        num/=n;
    }
    return ans;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std; 
int main(){
//  freopen("test.in","r",stdin);
//  freopen("test.out","w",stdout);
	string input;
	cin>>input;
	if(input=="Sunny")	cout<<"Cloudy";
	if(input=="Cloudy")	cout<<"Rainy";
	if(input=="Rainy")	cout<<"Sunny";
    return 0;
}


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

ll rec(ll x){
    if(x <= 1)  return 1;
    else{
        return ( 2*(rec(x/2) )+1) ;
    }
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>h;
    ll ans = 0;
    ans = rec(h);
    cout<< ans <<endl;
    return 0;
}


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

int main()
{
  int n, k;
  cin >> n >> k;
  ll v[50];
  REP(i, n)
  {
    cin >> v[i];
  }

  ll result = 0;
  // i回操作する
  FOR(i, 1, k + 1)
  {
    REP(j, i + 1)
    {
      int res = k - i;
      priority_queue<ll, vector<ll>, greater<ll>> que;
      if (i >= n)
      {
        // 全部取る
        REP(p, n)
        {
          que.push(v[p]);
        }
      }
      else
      {
        // 左からi-j個、右からj個取る
        REP(p, min(i - j, n))
        {
          que.push(v[p]);
        }
        REP(q, min(j, n))
        {
          int p = n - 1 - q;
          que.push(v[p]);
        }
      }

      REP(p, res)
      {
        if (que.empty())
        {
          break;
        }
        ll t = que.top();
        if (t >= 0)
        {
          break;
        }
        que.pop();
      }

      ll tmp = 0;
      while (!que.empty())
      {
        tmp += que.top();
        que.pop();
      }
      result = max(result, tmp);
    }
  }

  std::cout << result << endl;
}


Measured memory_bytes: 256
#include <iostream>
int main()
{
  int X,Y;
  std::cin >> X >> Y;
  
  for(int a=0,b=X;a<=X;a=a+1,b=b-1)
  {
  if(Y==2*a+4*b)
  {std::cout << "Yes" << std::endl;
  return 0;
  }
  }
  std::cout << "No" << std::endl;
  
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> c(n - 1), s(n - 1), f(n - 1);
    REP (i, n - 1) {
        cin >> c[i] >> s[i] >> f[i];
    }
    REP (i, n) {
        int t = 0;
        REP3 (j, i, n - 1) {
            t = max(t, s[j]);
            t = (t + f[j] - 1) / f[j] * f[j];
            t += c[j];
        }
        cout << t << endl;
    }
    return 0;
}


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

int main() {
  int n,y,a,b,c;
  cin >> n >> y;
  int flag=0;
  for(int i=0; i<=n; i++){
    a = i;
    if((y/1000-n-9*a)%4==0) b = (y/1000-n-9*a)/4, c = n-a-b;
    else b = -1, c = -1;
    if(a>=0 && b>=0 && c>=0){
      cout << a << " " << b << " " << c << endl;
      flag = 1;
      break;
    }
  }
  if(flag==0) cout << "-1 -1 -1" << endl;
}

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

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
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 = 1e9;

int N,M;
int X[100000];

//N>=Mなら0回で到達可能
//N+1=Mなら区間の中で最も短い部分を移動して到達可能
//N+2=Mなら区間の中で次に短い部分も足す
//...
//N=1なら全区間の和

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) cin >> X[i];
    if (N >= M) {
        cout << "0" << "\n";
        return 0;
    }
    sort(X,X+M);
    vector<int> Y;
    for (int i = 0; i < M - 1; i++) {
        Y.push_back(X[i+1]-X[i]);
    }
    sort(Y.begin(),Y.end());
    ll res = 0;
    for (int i = 0; i < M - N; i++) {
        res += (ll) Y[i];
    }
    cout << res << endl;

    
}


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

int main(){
    int D;
    ll G; 
    cin >> D >> G;

    vector<int> p(D+1), c(D+1);
    for(int i=1; i<=D; i++){
        cin >> p[i] >> c[i];
    }

    vector<bool> solve(D+1);
    int N = (1<<D);
    int ans = 1000;
    for(int i = 0; i < N; i++){
        int n = i, cnt = 0;
        ll point = 0;
        for(int j = 1; j <= D; j++) solve[j] = false;

        for(int j = 1; j <= D; j++){
            if(n%2==1){
                point += 100*j*p[j] + c[j];
                cnt += p[j];
                solve[j] = true;
            }
            n/=2;
        }
        if(point < G){
            for(int j = D; j >= 1; j--){
                if(solve[j] == false) {
                    int rest = ceil(1.0*(G-point)/100/j);
                    if(rest < p[j]){
                        point += 100*j*rest;
                        cnt += rest;
                    }
                    break;
                }
            }
        }
        if(point >= G) ans = min(ans,cnt);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
//A,Elebereth Gilthoniel mantae!
//For Temeria!
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<cstdio>
#include<map>
#include<stack>
#include<queue>
#include<cstring> 
using namespace std;
int a[300008]; int n;
vector<int> p;int flag;
int is[3000008];
void berk()
{
	if(n==0)
	{
		for(int i=0;i<p.size();i++)
		{
			if(p[i]!=0) cout<<p[i]<<" ";
		}
		flag=1;
		exit(0);
	}
}
int main()
{
 	//freopen("","r",stdin);
	//freopen("","w",stdout);

cin>>n;
if(n==3)
{
	cout<<"2 5 63";return 0;
}
	n=20000-n;
	for(int i=1;i<=15000;i++) p.push_back(i*2);for(int i=1;i<=10000;i+=2) p.push_back(i*3);	for(int i=0;i<p.size();i++)
	{
		berk();
		if(p[i]%6==0) n--,p[i]=0;
	}
	for(int i=1;i<p.size();i++)
	{
		berk();
	
		if(p[i]!=0 and p[i]!=3 and p[i]%6==3)
		for(int j=1+i;j<p.size();j++)
		{
			if(n<=2000) break;
			if(p[j]!=0 and p[j]!=3 and (p[j]+p[i])%6==0)
			{
	//		cout<<(p[i]+p[j])%6;system("pause");
	if(n<2) break;
			p[i]=p[j]=0;n--;n--;break;		//if(n<=10000 and n%3==0)cout<<n,system("pause");
			}
		}
	}
	berk();
		for(int i=1;i<p.size();i++)
	{
		berk();
		if(n<=2000 and n%2==0) break;
		if(p[i]!=0 and p[i]!=3)
		for(int j=1+i;j<p.size();j++)
		{
			if(p[j]!=0 and p[j]!=3 and (p[j]%6)==(p[i]%6) and (p[i]+p[j])%6!=0)
			{
				for(int k=j+1;k<p.size();k++)
				{
					if(p[k]!=0 and p[k]!=3 and (p[k]+p[i]+p[j])%6==0)
					{
						if(n<3) break;
						p[i]=p[j]=p[k]=0;n--;n--;n--;break;
					}
				}break;
			}
		}
	}
	
	berk();
	for(int i=1;i<p.size();i++)
	{
		berk();
	
		if(p[i]!=0 and p[i]!=3)
		for(int j=1+i;j<p.size();j++)
		{
			if(p[j]!=0 and p[j]!=3 and (p[j]+p[i])%6==0)
			{
	//		cout<<(p[i]+p[j])%6;system("pause");
			p[i]=p[j]=0;n--;n--;break;		//if(n<=10000 and n%3==0)cout<<n,system("pause");
			}
		}
	}

berk();
	return 0;
}

Measured memory_bytes: 2560
n=int(input())
a=[[0]*10 for i in range(10)]
for i in range(1,n+1):
    a[int(str(i)[0])][i%10]+=1
def N(x,y): # no of x...y < n
    return a[x][y]

ans=0
for x in range(1,10):
    ans+=N(x,x)*N(x,x)
    for y in range(x+1,10):
        ans+=N(x,y)*N(y,x)*2
print(ans)

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

using namespace std;

int N;
int order[1005][1005 - 1];
int convert[1005][1005 - 1];

vector<vector<int>> E;

const int MAXV = 1005 * (1005 - 1) / 2;

int dp[MAXV];
bool finished[MAXV];
bool reached[MAXV];

int dfs(int pos) {
	if (reached[pos]) {
		if (!finished[pos])return -1;
		return dp[pos];
	}
	dp[pos] = 0;
	reached[pos] = true;
	for (int i = 0; i < E[pos].size(); i++) {
		//cout <<"pos == " << pos <<  "to " << E[pos][i] << endl;
		int res = dfs(E[pos][i]);
		if (res == -1)return -1;
		dp[pos] = max(dp[pos], res + 1);
	}
	finished[pos] = true;
	return dp[pos];
}

int main() {
	cin >> N;
	E.resize(N * (N - 1));

	int cnt1 = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i == j)continue;
			if (j < i)convert[i][j] = convert[j][i];
			else {
				convert[i][j] = cnt1;
				cnt1++;
			}
		}
	}

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N - 1; j++) {
			cin >> order[i][j], order[i][j]--;
			order[i][j] = convert[i][order[i][j]];
		}
	}

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N - 2; j++) {
			E[order[i][j]].push_back(order[i][j + 1]);
			//cout << order[i][j] << " -> " << order[i][j + 1] << endl;
		}
	}

	int ans = 0;

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			int res = dfs(order[i][j]);
			if (res == -1) {
				cout << -1 << endl;
				return 0;
			}
			ans = max(ans, res);
		}
	}
	cout << ans + 1 << endl;
	return 0;
}

Measured memory_bytes: 50176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

//https://dai1741.github.io/maximum-algo-2012/docs/shortest-path/
typedef vector<vector<ll> > Matrix;

const ll INF = 100000000;
Matrix dis; // グラフの距離を格納した2次元配列（隣接行列）
          // d[u][v]は辺e=(u,v)のコスト（辺が存在しない場合はINF、ただしd[i][i]=0）

void warshall_floyd(int n) { // nは頂点数
  for (int i = 0; i < n; i++)      // 経由する頂点
    for (int j = 0; j < n; j++)    // 開始頂点
      for (int k = 0; k < n; k++)  // 終端
        dis[j][k] = min(dis[j][k], dis[j][i] + dis[i][k]);
}

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

  ll h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i, h) {
    cin >> s[i];
  }

  vl dx = {0, 0, 1, -1};
  vl dy = {1, -1, 0, 0};

  const ll d = 30;
  const ll n = h*d+w;

  dis = Matrix(n, vector<ll>(n, INF));
  rep(i, n) {
    dis[i][i] = 0;
  }

  rep(y, h) {
    rep(x, w) {
      rep(i, 4) {
        ll ny = y+dy[i];
        ll nx = x+dx[i];
        if (0 <= ny and ny < h and 0 <= nx and nx < w and s[ny][nx] == '.' and s[y][x] == '.') {
          dis[y*d+x][ny*d+nx] = 1;
        }
      }
    }
  }

  warshall_floyd(n);

  ll ans = 0;
  rep(i, n) {
    rep(j, n) {
      ll dd = dis[i][j];
      if (dd != INF) {
        cmax(ans, dd);
      }
    }
  }
  cout << ans << endl;
}


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

using namespace std;

const int MOD = 1e9 + 7, maxn = 1e5 + 500;
int a[maxn], cnt[maxn];
set <int> myset;

int main(){
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        myset.insert(a[i]);
        cnt[a[i]] ++;
    }
    int shm = 0;
    for (int i = 0; i < maxn - 300; i++)
        if (cnt[i] > 0)
            shm += cnt[i] - 1;
    if (shm % 2 == 1)
        cout << myset.size() - 1 << endl;
    else
        cout << myset.size() << endl;
}


Measured memory_bytes: 5760
# AtCoder
sx, sy, tx, ty = map(int, input().split())
path = []

dx = tx-sx
dy = ty-sy

# first
path.append('U'*dy)
path.append('R'*dx)

# second
path.append('D'*dy)
path.append('L'*dx)

# third
path.append('L')
path.append('U'*(dy+1))
path.append('R'*(dx+1))
path.append('D')

# forth
path.append('R')
path.append('D'*(dy+1))
path.append('L'*(dx+1))
path.append('U')

print(''.join(path))


Measured memory_bytes: 3064
n, x, y = gets.split.map(&:to_i)
list = []
(1..n).each do |n1|
  (n1..n).each do |n2|
    d1 = n2 - n1
    d2 = (x - n1).abs + 1 + (y - n2).abs
    s = [d1, d2].min
    list[s] = list[s].to_i + 1
  end
end
(1..n-1).each do |ds|
  puts list[ds].to_i
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int n,k,arr[105],dp[100005];
int main(){
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	dp[k]=2;
	for(int i=k-1;i>=0;i--){
		bool flag=false;
		for(int j=0;j<n;j++){
			if(arr[j]+i<=k){
				if(dp[arr[j]+i]!=1){
					flag=true;
				}
			}
		}
		if(flag==true){
			dp[i]=1;
		}
		else{
			dp[i]=2;
		}
	}
	if(dp[0]==1){
		cout<<"First";
	}
	else{
		cout<<"Second";
	}
	return 0;
}

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

using namespace std;

int N;
int A;
int B;

char S[100005];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N >> A >> B;

    cin >> S;

    int a = 0;
    int b = 0;

    for (int i = 0; i < N; ++i) {

        if (S[i] == 'a') {
            if ((a + b) < (A + B)) {
                cout << "Yes" << endl;
                a++;
            } else {
                cout << "No" << endl;
            }
        } else if (S[i] == 'b') {
            if ((a + b) < (A + B) && b < B) {
                cout << "Yes" << endl;
                b++;
            } else {
                cout << "No" << endl;
            }
        } else if (S[i] == 'c') {
            cout << "No" << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 896
N = int(input())
X = input()
times = {}
times[0] = 0

for i in range(1,200000):
  bi = format(i, 'b')
  arr = list(map(int, bi))
  sbi = sum(arr)
  if i%sbi == 0:
    times[i] = 1
  else:
    times[i] = 1+times[i%sbi]
    
arr = list(map(int, X))
sbX = sum(arr)
X10 = int(X,2)
mo = [1,-1]
if sbX-1 == 0:
  mo2 = [X10%(sbX+1),X10]
else:
  mo2 = [X10%(sbX+1),X10%(sbX-1)]

for i in range(N):
  waru = sbX+mo[int(X[i])]
  if waru == 0:
    print(0)
  else:
    print(times[(mo[int(X[i])]*pow(2,(N-i-1),waru)+mo2[int(X[i])])%waru]+1)
  

Measured memory_bytes: 151900
N,K=map(int,input().split())
'''
N>K
N->N-K
K<N
N->K-N->N
'''
S={N}
while(1):
    if N>K:
        N=N%K
    elif N==K:
        N=0
    else:
        N=K-N
    if N in S:
        break
    S.add(N)
print(min(S))


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

using namespace std;

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

    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    int res = n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) {
                continue;
            }

            int p = x[i] - x[j], q = y[i] - y[j];

            int r = n;
            for (int k = 0; k < n; k++) {
                for (int l = 0; l < n; l++) {
                    if (k != l && p == x[k] - x[l] && q == y[k] - y[l]) {
                        r--;
                    }
                }
            }

            res = min(res, r);
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<u64>()[0];
    let mut s: Vec<u64>= vec![];
    for _ in 0..n{
        s.push(read_as_vec()[0]);
    }
    s.sort();
    let base = s.iter().filter(|x| **x%10 == 0).sum::<u64>();
    let s = s.into_iter().filter(|x| *x%10 != 0).collect::<Vec<u64>>();

    if s.len() == 0{
        println!("0");
        return;
    }
    if s.iter().sum::<u64>()%10 == 0{
        println!("{}", base + s.iter().skip(1).sum::<u64>());
    }else{
        println!("{}", base + s.iter().sum::<u64>());
    }
}


Measured memory_bytes: 4352
M = 10**9 + 7
N = int(input())
A = list(map(int, input().split()))

table = [0] * (N)
for i in range(N-1):
    table[i+1] = table[i] + A[N-i-1]
table = table[::-1]

ans = 0
for i in range(N-1):
    ans = (ans + table[i]*A[i]) % M

print(ans)


Measured memory_bytes: 93976
#include<bits/stdc++.h>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, cnt = 0, w, h;
string s;
vector<ll> v;
vector<ll> v1;
vector < pair<ll, ll > > vp;
vector < pair<ll, ll > > vp1;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/



int main()
{
	string a, b;
	cin >> a >> b;
	if(a.size()==b.size())
	{
		REP(i, a.size())
		{
			cout << a[i];
			cout << b[i];
		}
	}else
	{
		REP(i, a.size()-1)
		{
			cout << a[i];
			cout << b[i];
		}
		cout << a[a.size()-1];
	}
	cout << endl;
}

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

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

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back
int dp[100005], pv[100005];
string s;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    cin >> s;

    memset(dp, -1, sizeof(dp));
    dp[0] = 0;

    deque<int> dq;
    dq.push_back(0);
    n++;
    for(int i=1;i<n;i++){
        if(s[i] == '1') continue;
        while(!dq.empty() && i-dq.front() > m) dq.pop_front();
        if(dq.empty()) continue;
        dp[i] = dp[dq.front()]+1;
        pv[i] = dq.front();
        while(!dq.empty() && dp[dq.back()] > dp[i]) dq.pop_back();
        dq.push_back(i);
    }
    if(dp[n-1] == -1) printf("-1\n");
    else{
        vector<int> ans;
        int u = n-1;
        while(u != 0){
            ans.eb(u-pv[u]);
            u = pv[u];
        }
        reverse(all(ans));

        for(int i=0;i<sz(ans);i++) printf("%d ", ans[i]);
        printf("\n");
    }
}

Measured memory_bytes: 4868
import java.util.*;
import java.lang.*;
import java.io.*;

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

	void run(){
		boolean[] p=new boolean[2000000];
		Arrays.fill(p, true);
		p[0]=p[1]=false;
		for(int i=2; i<p.length; i++){
			if(p[i]){
				for(int j=i*2; j<p.length; j+=i){
					p[j]=false;
				}
			}
		}
		for(;;){
			int m=sc.nextInt();
			if(m==0){
				break;
			}
			int ans=0;
			for(int i=m; i>=0&&!p[i]; i--){
				ans++;
			}
			for(int i=m; i<p.length&&!p[i]; i++){
				ans++;
			}
			println(""+ans);
		}
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 14000
#include <stdio.h>
#include <string.h>
int main(){
	char str[27];
	int a,b;
	scanf("%s",str);
	for(a=0;a<strlen(str);a++){
		for(b=a+1;b<strlen(str);b++)
//			printf("%d %d",a,b);
			if(str[a]==str[b]){
				printf("no");
				return 0;
			}
	}
	printf("yes");
	return 0;
}

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

int main(void){
  char a[4];
 
  scanf("%s", a);
  
  if(!strcmp(&a, "SUN")){
    printf("%d", 7);
  }else if(!strcmp(&a, "MON")){
    printf("%d", 6);
  }else if(!strcmp(&a, "TUE")){
    printf("%d", 5);
  }else if(!strcmp(&a, "WED")){
    printf("%d", 4);
  }else if(!strcmp(&a, "THU")){
    printf("%d", 3);
  }else if(!strcmp(&a, "FRI")){
    printf("%d", 2);
  }else if(!strcmp(&a, "SAT")){
    printf("%d", 1);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;

template <typename T> void max_self(T& a, T b){
	a = max(a,b);
}

const double EPS = 1e-9;

void solve(){	
    int n, m;
    cin>>n>>m;
    vector<double> v(n);
    double tV = 0;
    for(int i = 0; i < n; ++i){
		cin>>v[i];
		tV += v[i];
	}
	double op = (1/(4.0*(double)m));	
	op *= tV;
	sort(v.rbegin(), v.rend());
	
	for(int i = 0; i < m; i++){
		if(v[i]+EPS < op){
			cout<<"No\n";
			return;
		}
	}
	cout<<"Yes\n";
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    //int t; cin >> t;
    //while(t--) solve();
    //
    solve();
    return 0;
}


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

int main(){
  string s;
  string t;
  
  cin>>s;
  cin>>t;
  
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  
  reverse(t.begin(),t.end());
  
if(s<t){
  cout<<"Yes"<<endl;
}
  else{
    cout<<"No"<<endl;
    
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    vector <int> v;
     
    bool ok(int x)
    {
        int flag[10] = {false};
        while (x)
        {
            flag[x % 10] = 1;
            x /= 10;
        }
        if (flag[3] == 0 || flag[5] == 0 || flag[7] == 0) return false;
        return true;
    }
     
    void DFS(int cur, int num)
    {
        if (cur == 10) 
        {
            if (ok(num)) v.push_back(num);
            return;
        }
        DFS(cur + 1, num);
        DFS(cur + 1, num * 10 + 3);
        DFS(cur + 1, num * 10 + 5);
        DFS(cur + 1, num * 10 + 7);
    }
     
    int main()
    {
        DFS(0, 0);
        sort(v.begin(), v.end());
        v.erase(unique(v.begin(), v.end()), v.end());
        int n;
        while (scanf("%d", &n) != EOF) printf("%d\n", (int)(upper_bound(v.begin(), v.end(), n) - v.begin()));
        return 0;
    }

Measured memory_bytes: 6384
package main

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

func main() {
  var sc = bufio.NewScanner(os.Stdin)
  
  var i int
  if sc.Scan() {
    i, _ = strconv.Atoi(sc.Text())
  }
  
  fmt.Print(i * i * i)
}

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

using namespace std;

#define ll					long long
#define vi					vector<int>
#define vii					vector<vi>
#define ALL(s)			(s).begin(),(s).end()
#define ALLn(a)			a,a+n
#define pii					pair<int, int>
#define pll					pair<ll, ll>
#define si					set<int>
#define mp					make_pair
#define F						first
#define S						second
#define pb					push_back
#define tc(t)				int t; cin >> t; while(t--)
#define _						ios_base::sync_with_stdio(false); cin.tie(NULL); 
const ll MOD = 1e9 + 7;
const ll INF = 1<<29;
const ll MAX_N =1e6 + 7;

bool compare(int &a,int &b) {
	return b < a;
}

void solve() {
	int x,y,a,b,c;
	cin >> x >> y >> a >> b >>c;

	vector<int> rem;
	int r[a],g[b], w[c];

	for(int i = 0; i < a; ++i) cin >> r[i];
	for(int i = 0; i < b; ++i) cin >> g[i];
	for(int i = 0; i < c; ++i) cin >> w[i];

	sort(r,r+a,compare);
	sort(g,g+b,compare);

	for(int i = 0; i < x; ++i) rem.pb(r[i]);
	for(int i = 0 ; i <y; ++i) rem.pb(g[i]);
	for(int i = 0 ; i <c; ++i) rem.pb(w[i]);

	sort(ALL(rem),compare);

	//for(auto x : rem) cout << x << " ";
	//cout << "\n";
	
	ll ans = 0;

	for(int i = 0; i < x+y; ++i) {
		ans += rem[i];
	}

	cout << ans << '\n';
}

int main() {_
	solve();

}


Measured memory_bytes: 3572
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int cnt = 0;
	for (int i = 1; i <= n; i++)
		if (i & 1)cnt++;
	cout << fixed << setprecision(10) << 1.0 * cnt / n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;
 
#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using P = pair<long long, long long>;
 
int main() {
  string S;
  vector<long long> v;
  cin >> S;
  long long N = S.size();
  long long key = 0;
  char k[2] = {'R', 'L'};
  rep(i, N) {
    if(S[i] == k[key]) continue;
    else {
      v.push_back(i-1);
      key = key ^ 1;
    }
  }
  v.push_back(N-1);
  long long ans[100000] = {0};
  rep(i, v.size()) {
    if(i % 2 == 1) continue;
    if(i == 0) {
      ans[v[i]] = ((v[i] + 2) / 2) + ((v[i+1]-v[i]) / 2);
      ans[v[i]+1] = ((v[i] + 1) / 2) + ((v[i+1]-v[i]+1) / 2);
    } else {
      ans[v[i]] = ((v[i]-v[i-1]+1) / 2) + ((v[i+1]-v[i]) / 2);
      ans[v[i]+1] = ((v[i]-v[i-1]) / 2) + ((v[i+1]-v[i]+1) / 2);
    }
  }
  rep(i, N) {
    cout << ans[i];
    if(i != N-1) cout << " ";
    else cout << endl;
  }
  return 0;
}

Measured memory_bytes: 4856
#include <bits/stdc++.h>
#define maxn 200086

using namespace std;

int n;
int a[maxn];
long long ans;

int main(){
	scanf("%d", &n);
	for(int i = 1;i <= n;i++) scanf("%d", &a[i]);
	for(int i = 2;i <= n;i++){
		if(a[i] < a[i - 1]) ans += a[i - 1] - a[i], a[i] = a[i - 1];
	}
	printf("%lld", ans);
}

Measured memory_bytes: 4604