akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABCGene solver = new ABCGene();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABCGene {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            List<Character> list = new ArrayList<>();
            String ss = S;
            while (S.length() > 3) {
                StringBuilder sb = new StringBuilder();
                char c = 'B';
                if (S.startsWith("ABC")) {
                    c = 'A';
                } else if (S.endsWith("ABC")) {
                    c = 'C';
                }
                for (int i = 0; i < S.length(); i++) {
                    if (i + 2 < S.length() && S.charAt(i) == 'A' && S.charAt(i + 1) == 'B' && S.charAt(i + 2) == 'C') {
                        sb.append(c);
                        i = i + 2;
                    } else {
                        sb.append(S.charAt(i));
                    }
                }
                if (S.equals(sb.toString())) {
                    break;
                }
                list.add(c);
                S = sb.toString();
            }
            if (S.equals("ABC")) {
                Collections.reverse(list);
                for (char key : list) {
                    StringBuilder sb = new StringBuilder();
                    for (char c : S.toCharArray()) {
                        if (c == key) {
                            sb.append("ABC");
                        } else {
                            sb.append(c);
                        }
                    }
                    S = sb.toString();
                }
                out.println(S.equals(ss) ? "Yes" : "No");
            } else {
                out.println("No");
            }
        }

    }
}




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

int main() {
  string S;
  cin >> S;
  if (S == "ABC") {
    cout << "ARC" << endl;
  } else {
    cout << "ABC" << endl;
  }
}


Measured memory_bytes: 3636
from bisect import bisect_right

if __name__ == "__main__":
    N = int(input())
    L = list(map(int, input().split()))

    L.sort()

    ans = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            k = bisect_right(L, L[i] + L[j] - 1)
            ans += max(k - j - 1, 0)

    print(ans)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

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

	if (N % 2 == 1)
	{
		N++;
	}

	if (N / 2 >= K)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long
int main (){
    int h,w;
    cin >> h >> w;
    char s[50][50];
    int k[52][52]={};
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
            cin >> s[i][j];
            if (s[i][j] == '#'){
                for (int m = -1;m<2;m++){
                    for (int l = -1; l < 2; l++){
                        k[1+i+m][1+j+l]++;
                    }
                }
            }
        }
    }
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
            if (s[i][j]=='.') cout << k[i+1][j+1];
            else cout << "#";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

void main() {
    int H, W; scanf("%d %d\n", &H, &W);
    auto r = new int[H],
         c = new int[W];
    auto F = new int[][](H, W);
    foreach (i; 0 .. H) {
        foreach (j; 0 .. W) {
            int x; scanf("%d", &x);
            if (x == 0) {
                r[i]++; c[j]++;
                F[i][j] = 1;
            }
        }
    }
    int Ans = 0;
    int C(size_t y, size_t x) {
        return (r[y] + c[x] - F[y][x]) % 2;
    }
    foreach (i; 0 .. H) {
        write(C(i, 0));
        foreach (j; 1 .. W) {
            write(" ", C(i, j));
        }
        writeln;
    }
}

Measured memory_bytes: 6968
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
#define pll              pair<long,long>
#define pii              pair<int,int>
#define scn(a)           scanf("%d", &a)
#define scn2(a, b)       scanf("%d%d", &a, &b)
#define scn3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pairl            pair<ll , ll >
#define scnl(a)          scanf("%lld", &a)
#define scnl2(a, b)      scanf("%lld%lld", &a, &b)
#define scnl3(a, b, c)   scanf("%lld%lld%lld", &a, &b, &c)
#define scns(s)          scanf("%s",s)
#define prts(s)          printf("%s\n",s)
#define prt(a)           printf("%d\n", a)
#define prtl(a)          printf("%lld\n", a)
#define prs(a)           printf("%d ", a)
#define prt2(a, b)       printf("%d %d\n", a, b)
#define prt3(a, b, c)    printf("%d %d %d\n", a, b, c)
#define prsl(a)          printf("%lld ", a)
#define prtl2(a, b)      printf("%lld %lld\n", a, b)
#define prtl3(a, b, c)   printf("%lld %lld %lld\n", a, b, c)
#define ptcs(a)          printf("Case %d: ", a)
#define pf               printf
#define sc               scanf
#define m_p              make_pair
#define vi               vector<int >
#define vil              vector<ll >
#define pb               push_back
#define mem(a, b)        memset((a), (b), sizeof(a))
#define lg2(n)           (31-__builtin_clz(n))
#define N                200005
#define inf              9999999
#define ll               long long
#define ull              unsigned long long
#define MIN              INT_MIN
#define MAX              INT_MAX
#define fast             ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
ll gcd(ll a, ll b){if(b==0) {return a;}return gcd(b, a % b);}
ll BigMod(ll B,ll P,ll M){     ll R=1; while(P>0)      {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
//___________________________________________________________________________________________________________________

vector<ll>v[N],v1;
map<string,ll>mp;
bool ok=true;
int main()
{
    ll n,m,k,c=0,x,y;
    string s;
    char a;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        if(mp[s]) ok=false;
        mp[s]++;
        if(i)
        {
            if(s[0]!=a)
            {
                ok=false;
                //cout<<"gg"<<endl;
            }
            a=s[s.size()-1];
        }
        else a=s[s.size()-1];
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 4992
n,m=map(int,input().split())
X=list()
Y=list()
Z=list()
for i in range(n):
    x,y,z=map(int,input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)
A=list()
B=list()
C=list()
D=list()
for i in range(n):
    A.append(X[i]+Y[i]+Z[i])
    B.append(-X[i]+Y[i]+Z[i])
    C.append(X[i]-Y[i]+Z[i])
    D.append(X[i]+Y[i]-Z[i])
import functools
A.sort()
B.sort()
C.sort()
D.sort()
if m==0:
    print(0)
else:
    x1=functools.reduce(lambda x,y:x+y,[A[i] for i in range(m)])
    x2=functools.reduce(lambda x,y:x+y,[A[-i] for i in range(1,m+1)])
    y1=functools.reduce(lambda x,y:x+y,[B[i] for i in range(m)])
    y2=functools.reduce(lambda x,y:x+y,[B[-i] for i in range(1,m+1)])
    z1=functools.reduce(lambda x,y:x+y,[C[i] for i in range(m)])
    z2=functools.reduce(lambda x,y:x+y,[C[-i] for i in range(1,m+1)])
    w1=functools.reduce(lambda x,y:x+y,[D[i] for i in range(m)])
    w2=functools.reduce(lambda x,y:x+y,[D[-i] for i in range(1,m+1)])
    print(max(abs(x1),abs(x2),abs(y1),abs(y2),abs(z1),abs(z2),abs(w1),abs(w2)))


Measured memory_bytes: 3956
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		int r, c;
		Scanner stdIn = new Scanner(System.in);

		r = stdIn.nextInt();
		c = stdIn.nextInt();

		int[][] ss = new int[r + 1][c + 1];

		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				ss[i][j] = stdIn.nextInt();
				ss[i][c] += ss[i][j];
				ss[r][j] += ss[i][j];
				ss[r][c] += ss[i][j];
			}
		}

		for (int i = 0; i < r + 1; i++) {
			for (int j = 0; j < c + 1; j++) {
				System.out.print(ss[i][j]);
				if (j != c) {
					System.out.print(" ");
				}
			}
			
				System.out.println();
			
		}

	}
}

Measured memory_bytes: 42620
until(s=gets.gsub(/\d+/){|k|?1*k.hex})[?#]
n=1+s.index(?/)
eval"s[n*x-n+y-1]=?1;s[n*z-n+w-1]=?b!&%".tr('x!y&z%w',gets)
$><<s.gsub(/1+/,&:size)
end

Measured memory_bytes: 8812
w = input()
a,b,c,d = w[0],w[1],w[2],w[3]
if a == b and b != c and c == d:
    print('Yes')
elif a == c and b != c and b == d:
    print('Yes')
elif a == d and b == c and a != b:
    print('Yes')
else:
  print('No')


Measured memory_bytes: 2940
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(10000000)

n = input()

for loop in range(n):
    S = map(int, list(raw_input()))
    cnt = 0
    while len(S) > 1:
        num = S[-1] + S[-2]
        if num >= 10:
            S[-2] = 1
            S[-1] = num % 10
        else:
            S[-2] = num
            S.pop()
        cnt += 1
    if cnt % 2 == 0:
        print "Audrey wins."
    else:
        print "Fabre wins."


Measured memory_bytes: 5044
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    string s;
    cin >> s;

    char prev = -1;
    int64_t ans = 0;
    for (auto c : s) {
        if (c != prev) {
            ++ans;
        }

        prev = c;
    }

    cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i=0;i<n;i++){
        cin >> A[i];
    }
    map<int,int> M;
    for(int i=0;i<n;i++){
        M[A[i]]++;
    }
    int m = M.size();
    int ans = 0;
    for(auto x:M){
        if(x.first != x.second){
            if(x.first < x.second){
                ans += (x.second - x.first);
            }else{
                ans += x.second;
            }
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 5120
using System;
using System.Linq;

namespace _0505
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x.Max() == 0) break;
                int[] ret = new int[x[1]];
                for (int i = 0; i < x[0]; i++)
                {
                    int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                    for (int j = 0; j < x[1]; j++) ret[j] += a[j];
                }
                bool found = false;
                for (int i = x[0]; i >= 0; i--)
                {
                    for (int j = 0; j < x[1]; j++)
                    {
                        if (ret[j] == i)
                        {
                            if (found) Console.Write(" ");
                            else found = true;
                            Console.Write(j + 1);
                        }
                    }
                }
                Console.WriteLine();
            }
        }
    }
}


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


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

  int n; cin >> n;
  map<int, int> a, b;
  for(int i = 0; i < n; i++) {
  	int v; cin >> v;
  	(i % 2 == 0 ? a[v]++ : b[v]++);
  }
  int s = 0, t = 0, p = 0, q = 0;
  int mx1 = 0, mx2 = 0;
  for(int i = 0; i < 100005; i++) {
  	if(a[i] >= s) {
  		t = s;
  		s = a[i];
  		mx1 = i;
  	}
  	if(b[100005 - i] >= p) {
  		q = p;
  		p = b[100005 - i];
  		mx2 = 100005 - i;
  	}
  }
  if(mx1 != mx2) {
  	cout << n - s - p << endl;
  }
  else {
  	cout << min(n - s - q, n - t - p) << endl;
  }
  
  return 0;
}	


Measured memory_bytes: 9600
// https://atcoder.jp/contests/abc175/tasks/abc175_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int N, K;
    cin >> N >> K;
    vector<int> P(N), C(N);
    REP(i, N) cin >> P[i], P[i]--;
    REP(i, N) cin >> C[i];

    int ans = -1e12;
    // スタート位置
    REP(i, N) {
        vector<int> v;
        int now = i;
        while (true) {
            now = P[now];
            v.emplace_back(C[now]);
            if (now == i) {
                break;
            }
        }
        int loopSum = accumulate(ALL(v), 0LL);
        int cnt = v.size();
        int t = 0;
        REP(j, min(cnt, K)) {
            t += v[j];
            // ループ内の合計x残りループ回数を加算する
            // ループ内の合計が負なら無視
            ans = max(ans, t + max(0LL, loopSum) * ((K - j - 1) / cnt));
        }
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 3804
#include <iostream>
#include <algorithm>
using namespace std;
long long int ch[1010]={};
int main(){
  long long int N,i,j,ans=1,a;
  cin >> N;
  for(i=1;i<=N;i++){
    a=i;
    for(j=2;j*j<=a;j++){
      while(a%j==0){
        ch[j]++;
        a/=j;
      }
    }
    if(a!=1)ch[a]++;
  }
  for(i=2;i<=N;i++){
    ans*=(ch[i]+1)%1000000007;
    ans%=1000000000+7;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;


int main()
{

    ll x,y;
    cin>>x>>y;
    if(x*y>1e18 || x%y==0) cout<<-1<<endl;
    else
    {
        cout<<x*(y+1)<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if(!a)
		cout<<1;
	else
		if(!b)
			cout<<2;
		else
			if(!c)
				cout<<3;
			else
				if(!d)
					cout<<4;
				else
					cout<<5;
	return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,j,ma,a[100],x=0;
	char s[101];
	cin>>n>>s;
	for(i=0;i<n;++i)
	{
		if(s[i]=='I')
			a[j++]=++x;
		else if(s[i]=='D')
			a[j++]=--x;
	}
	ma=0;
	for(i=0;i<j;++i)
	{
		if(a[i]>ma)
			ma=a[i];
	}
	cout<<ma;
	return 0;

}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a % 2 == 0 || b % 2 == 0){
    cout << "Even" << endl;
  }
  else{
    cout << "Odd" << endl;
  }  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

bool solve() {
  int N, M, K;
  cin >> N >> M >> K;
  rep(i, 0, N+1) rep(j, 0, M+1) {
    int n = i * M + j * N - 2 * i * j;
    if(n == K) return true;
  }
  return false;
}

int main() {
  cout << (solve() ? "Yes" : "No") << endl;
  return 0;
}


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

using namespace std;

/**
 *  Name: Chris M. Perez
 *  University: Interamerican University Metro Campus
 *
**/

#define endl '\n'
#define MOD 10E9
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define gcd(x , y) __gcd(x , y)
#define all(x) (x).begin() , (x).end()
#define forn(i , a , b) for(int i=(a);i<(b);i++)
#define forrange(j , a , b) for(int j=(a);j<=(b);j++)
#define nestedforn(i , a , b , j , c , d) for(int i=(a);i<=(b);i++) for(int j=(c);j<=(d);j++)
#define sort_all(x) sort(all(x))
#define zeros_at_beginning(x) __builtin_clz(x)
#define zeros_at_end(x) __builtin_ctz(x)
#define ones(x) __builtin_popcount(x)
#define parity_even_or_odd_ones __builtin_parity(x)

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef tuple<int , int , int> tiii;
typedef vector<pii> vpii;
typedef vector<tiii> vtiii;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef long long int lli;

             
inline int input(){
  int n;
  scanf("%d" , &n);
  return n;
}

int dist(int x , int y){
  return (int) sqrt(pow(x , 2) - pow(x , 2));
}
                                                         
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;  

#ifdef LOCAL_DEFINE
  freopen("input.txt" , "rt" , stdin);
#endif
 
  int a; cin >> a;
  int b; cin >> b;
  int c; cin >> c;
  int d; cin >> d;
  int e; cin >> e;
  int k; cin >> k;
  cout << ((e - a <= k) ? "Yay!" : ":(") << endl;
  
                                                   
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif  
  return 0;
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int N;

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

  cin >> N;
  tuple< int, int, int > last;
  last = make_tuple(0, 0, 0);

  bool ans = true;
  
  REP(i, N) {
    CIN(t, x, y);
    int last_time, last_x, last_y;
    tie(last_time, last_x, last_y) = last;
    int diff_time = t - last_time;
    int diff_x = abs(x - last_x);
    int diff_y = abs(y - last_y);
    if (diff_time < diff_x + diff_y) ans = false;
    if (diff_time % 2 != (diff_x + diff_y) % 2) ans = false;
    last = make_tuple(t, x, y);
  }

  OK(ans);
  

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
using namespace std;
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
map<string,int> mp;
int n,mx;
string s;
int main(){
	n=read();
	for(int i=1;i<=n;++i){
		cin>>s;
		mp[s]++;
		mx=max(mx,mp[s]);
	}
	for(map<string,int>::iterator it=mp.begin();it!=mp.end();++it){
		if(it->second==mx){
			cout<<it->first<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 25216
import sys
import numpy as np

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	k,q = MI()
	d = LI()
	d = np.array(d)
	ans = [0]*q
	for i in range(q):
		n,x,m = MI()
		d_modm = d%m
		zero = ((n-1)//k)*np.sum(d_modm==0) + np.sum((d_modm==0)[:(n-1)%k])
		last = x + ((n-1)//k)*np.sum(d_modm) + np.sum((d_modm)[:(n-1)%k])
		ans[i]=(n-1)-zero-(last//m-x//m)
	printV(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 13016
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<tuple>
#include<unordered_map>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

ll calc_id(int x, int y, int z){
    return x + 1001LL * y + 1001LL * 1001LL * z;
}

int main(){
    int x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<ll> a(x), b(y), c(z);
    for(int i = 0; i < x; i++){
        cin >> a[i];
    }
    for(int i = 0; i < y; i++){
        cin >> b[i];
    }
    for(int i = 0; i < z; i++){
        cin >> c[i];
    }
    sort(rbegin(a), rend(a));
    sort(rbegin(b), rend(b));
    sort(rbegin(c), rend(c));
    priority_queue<tuple<ll, int, int, int>> q;
    unordered_map<ll, bool> mp;
    q.push(make_tuple(a[0] + b[0] + c[0], 0, 0, 0));
    mp[calc_id(0, 0, 0)] = true;
    for(int i = 0; i < k; i++){
        ll ans;
        int j, k, l;
        tie(ans, j, k, l) = q.top();
        q.pop();
        cout << ans << endl;
        if(j + 1 < x && !mp[calc_id(j + 1, k, l)]){ q.push(make_tuple(a[j + 1] + b[k] + c[l], j + 1, k, l)); mp[calc_id(j + 1, k, l)] = true;}
        if(k + 1 < y && !mp[calc_id(j, k + 1, l)]){ q.push(make_tuple(a[j] + b[k + 1] + c[l], j, k + 1, l)); mp[calc_id(j, k + 1, l)] = true;}
        if(l + 1 < z && !mp[calc_id(j, k, l + 1)]){ q.push(make_tuple(a[j] + b[k] + c[l + 1], j, k, l + 1)); mp[calc_id(j, k, l + 1)] = true;}
    }
    return 0;
}


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

const int MAX_N=1e5;

int N;
int M;
int f[MAX_N+1];
bool is_f[MAX_N+1];
int ans;

int find(int x){return f[x]?f[x]=find(f[x]):x;}

void merge(int x,int y){
	int fx=find(x);
	int fy=find(y);
	if(fx!=fy)
		f[fx]=fy;
		
	return;
}

int main(){
	cin>>N>>M;
	for(int i=0;i<M;i++){
		int x,y,z;
		cin>>x>>y>>z;
		merge(x,y);
	}
	
	for(int i=1;i<=N;i++)
		is_f[find(i)]=true;
		
	for(int i=1;i<=N;i++)
		ans+=is_f[i];
		
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1152
N, Q = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(Q)]
res = [0] * (Q - 1) + [N * (N - 1) // 2]
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.root = [-1] * (n + 1)
    self.rnk = [0] * (n + 1)

  def Find_Root(self, x):
    if self.root[x] < 0:
      return x
    else:
      self.root[x] = self.Find_Root(self.root[x])
      return self.root[x]

  def Unite(self, x, y):
    x = self.Find_Root(x)
    y = self.Find_Root(y)
    if x == y:
      return 
    elif self.rnk[x] > self.rnk[y]:
      self.root[x] += self.root[y]
      self.root[y] = x
    else:
      self.root[y] += self.root[x]
      self.root[x] = y
      if self.rnk[x] == self.rnk[y]:
        self.rnk[y] += 1

  def isSameGroup(self, x, y):
    return self.Find_Root(x) == self.Find_Root(y)

  def Count(self, x):
    return -self.root[self.Find_Root(x)]

uf = UnionFind(N)
convenience = [0] * (N + 1)
for i in range(Q - 1, 0, -1):
  res[i - 1] = res[i]
  if uf.Find_Root(A[i][0]) != uf.Find_Root(A[i][1]):
    res[i - 1] -= uf.Count(A[i][0]) * uf.Count(A[i][1])
    a, b = uf.Count(A[i][0]), uf.Count(A[i][1])
    uf.Unite(A[i][0], A[i][1])
  #print(uf.root, res, a, b)
for i in range(Q):
  print(res[i])

Measured memory_bytes: 120152
N = int(input())
A = [int(a)-1 for a in input().split()]
B = [int(b) for b in input().split()]
C = [int(c) for c in input().split()]

satisfaction = 0
dinner1 = A[0]
satisfaction += B[dinner1]

for a in A[1:]:
  dinner2 = a
  satisfaction += B[dinner2]
  if dinner1 + 1 == dinner2:
    satisfaction += C[dinner1]
  dinner1 = dinner2

print(satisfaction)

Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;


class Program
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }


    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        var b = Console.ReadLine();
        if (b == "A")
            Console.WriteLine("T");
        else if (b == "T")
            Console.WriteLine("A");
        else if (b == "C")
            Console.WriteLine("G");
        else if (b == "G")
            Console.WriteLine("C");
  

        Console.Out.Flush();
    }
}

Measured memory_bytes: 11092
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val R, G, B, N = sc.nextInt()
  val matched = for {
    r <- 0.to(N)
    g <- 0.to(N)
    i = N - r * R - g * G
    if i % B == 0 && 0 <= i / B
  } yield  ()
  println(matched.length)
}


Measured memory_bytes: 78556
/*
 * Deleted code is debugged code :)
 */
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define pp pair<ll,ll>
#define mp make_pair
#define PI acos(-1.0)
#define all(v) v.begin(),v.end()
#define pb push_back
#define FOR(i,a,b) for(i=a;i<b;i++)
#define FREV(i,a,b) for(i=a;i>=b;i--)
#define FORI(a) for(auto it=a.begin();it!=a.end();it++)
#define READ(a,i,n) FOR(i,0,n) { sll(a[i]);}
#define DEBUG(x) cerr<<"In file "<< __FILE__ <<" at line "<< __LINE__ <<" :: "<< #x <<" = "<<x<<endl
#define sll(n) scanf("%lld", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define INF 1e18
#define MOD 1000000007

using namespace std;

/*******************************************RANDOM STUFF BEGINS HERE**************************************************/

int main() {
	ll i,j,t,n;
	sll(n);
	vi a(n+1,0);
	FOR(i,0,n) {
		sll(j);
		a[j] = a[j-1] + 1;
	}
	printf("%lld\n", n - *max_element(all(a)));
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<stdlib.h>
void sellectionsort(int*,int);
int cnt=0;
int main(){
  int i,j;
  int *num;

  scanf("%d",&j);
  num=(int *)malloc(j * sizeof(int));
  for(i=0;i<j;i++)scanf("%d",&num[i]);
  sellectionsort(num,j);
  printf("%d",num[0]);
  for(i=1;i<j;i++)printf(" %d",num[i]);
  printf("\n");
  printf("%d\n",cnt);
  return 0;
}
void sellectionsort(int *num,int x){
  int j,key,minj,i;
  for(i=0;i<x;i++){
    minj=i;
    for(j=i;j<x;j++){
      if(num[j]<num[minj])minj=j;
    }
    if(i!=minj){
      key=num[i];
      num[i]=num[minj];
      num[minj]=key;
      cnt++;
    }
  }
}



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

int main() {
    int N; cin >> N;
    string c; cin >> c;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (c[i] == 'R') cnt++;
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (c[i] == 'R' && i >= cnt) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3748
#include<stdio.h>

int main (void){
	
	int dice[7]={0};
	int d1,d2,d3,d4,d5,d6;
	int i;
	char d;
	
	for(i=1;i<=6;i++){
		scanf("%d",&dice[i]);
	}
	getchar();
	while(1){
		
		scanf("%c",&d);
		if(d == '\n')break;
		d1=dice[1];d2=dice[2];d3=dice[3];d4=dice[4];d5=dice[5];d6=dice[6];
		if(d=='N'){
			dice[1]=d2;dice[2]=d6;dice[6]=d5;dice[5]=d1;
		}else if(d=='E'){
			dice[1]=d4;dice[4]=d6;dice[6]=d3;dice[3]=d1;
		}else if(d=='S'){
			dice[1]=d5;dice[2]=d1;dice[6]=d2;dice[5]=d6;
		}else if(d=='W'){
			dice[1]=d3;dice[4]=d1;dice[6]=d4;dice[3]=d6;
		}
	}
	
	printf("%d\n",dice[1]);
	
return 0;
}

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

using namespace std;

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define SORT(v) sort(v.begin(), v.end())
typedef long long ll;

int main()
{
    int n;
    string s;

    cin >> n;

    //vector<int> v(/*size*/);

    cout << 2 * n * 3.141592 << endl;
}


Measured memory_bytes: 3756
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] values = new int[N+1];
        for (int i=1; i<=N; i++) {
            values[i] = i;
        }
        int count = 1;
        hoge: while (true) {
            int cnt = 0;
            for (int i=1; i<=N; i++) {
                if (values[i] % 2 == 0) {
	                values[i] = values[i] / 2;
                    count = i;
                } else {
                  cnt++ ;
                }  
            }
            
           
            if (cnt == N) {
              break hoge;
            }
        }
        System.out.println(count);
    }
}

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

using namespace std;

int C(int n, int m) {
  return (n & m) == m;
}

int main() {
  int n;
  string s;
  cin >> n >> s;
  n = s.size();
  int one = 0;
  for (int i = 0; i < n; ++i) {
    s[i] -= '1';
    one += s[i] == 1;
  }
  int target = 2;
  if (one) {
    target = 1;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == target)
      ans ^= C(n-1, i);
  }
  ans *= target;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 1412
import java.util.Scanner;
import java.util.stream.IntStream;

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

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] x = new int[N];
        for (int i = 0; i < x.length; ++i) {
            x[i] = sc.nextInt();
        }

        System.out.println(solve(x, K));

        sc.close();
    }

    static int solve(int[] x, int K) {
        int middleIndex = 0;
        while (middleIndex != x.length && x[middleIndex] < 0) {
            ++middleIndex;
        }

        int middleIndex_ = middleIndex;
        int[] leftDistances = IntStream.range(0, middleIndex).map(i -> -x[middleIndex_ - 1 - i]).toArray();
        int[] rightDistances = IntStream.range(0, x.length - middleIndex).map(i -> x[middleIndex_ + i]).toArray();

        return Math.min(computeMinTime(K, leftDistances, rightDistances),
                computeMinTime(K, rightDistances, leftDistances));
    }

    static int computeMinTime(int K, int[] firstDistances, int[] secondDistances) {
        int result = Integer.MAX_VALUE;
        for (int i = 0; i < firstDistances.length && i < K; ++i) {
            if (i == K - 1) {
                result = Math.min(result, firstDistances[i]);
            } else if (secondDistances.length >= K - i - 1) {
                result = Math.min(result, firstDistances[i] * 2 + secondDistances[K - i - 2]);
            }
        }

        return result;
    }
}

Measured memory_bytes: 59676
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

ll N;
vector<ll> A;
ll sum;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  A.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    sum += A[i];
  }

  vector<ll> ans(N, 0);
  // 山1について
  for (int i = 0; i < N; i++) {
    if (i % 2 != 0) {
      sum -= (2 * A[i]);
    }
  }
  ans[0] = sum;

  // 残りの山について
  for (int i = 1; i < N; i++) {
    ans[i] = 2 * A[i - 1] - ans[i - 1];
  }

  for (int i = 0; i < N; i++) {
    if (i != 0) {
      cout << " ";
    }
    cout << ans[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 2944
import queue

n, k = map(int, input().split())
p = list(map(int, input().split()))

for i in range(n):
    p[i] += 1

s = 0
mx = 0
q = queue.Queue()

for i in range(n):
    s += p[i]
    q.put(p[i])
    if q.qsize() > k:
        s -= q.get()
    if q.qsize() == k:
        mx = max(mx, s)
    
ans = float(mx) / 2.0
print(ans)

Measured memory_bytes: 26328
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int r, d, x2000; cin >> r >> d >> x2000;
  FOR(i, 2001, 2011) {
    x2000 = r * x2000 - d;
    cout << x2000 << '\n';
  }
  return 0;
}


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

int main()
{
        ll N, K; cin >> N >> K;
        ll ans = 1;
        for (int i = 0; i < N; ++i) {
                ll tmp1 = ans * 2;
                ll tmp2 = ans + K;
                if (tmp1 < tmp2) ans = tmp1;
                else ans = tmp2;
        }
        cout << ans << endl;




}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;

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

ll deg(int i){
  ll ret = 1;
  while(i != 0){
    if(i/10 == 0){
      break;
    }
    i/=10;
  }
  return i;
}

void solve(){
  string s;
  cin >> s;
  if(s=="BBB"||s=="AAA") cout << "No" << endl;
  else cout << "Yes" << endl;
}


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


Measured memory_bytes: 256
from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)

def scc(V, E):
    g = defaultdict(list)
    rg = defaultdict(list)
    for u, v in E:
        g[u].append(v)
        rg[v].append(u)

    def dfs(u, done, o):
        done.add(u)
        for v in g[u]:
            if v in done:
                continue
            done.add(v)
            dfs(v, done, o)
        o.append(u)

    def dfs_rev(u, done, c):
        done.add(u)
        c.append(u)
        for v in rg[u]:
            if v in done:
                continue
            dfs_rev(v, done, c)

    done = set()
    o = []
    for v in V:
        if v in done:
            continue
        dfs(v, done, o)


    done = set()
    ans = []
    while o:
        u = o.pop()
        if u in done:
            continue
        vv = []
        dfs_rev(u, done, vv)
        ans.append(vv)


    return ans


def atcoder_practice2_g():
    N, M = map(int, input().split())

    E = []
    for _ in range(M):
        a, b = map(int, input().split())
        E.append((a, b))
    V = list(range(N))
    vv = scc(V, E)
    print(len(vv))
    for r in vv:
        print(len(r), *r)


def test():
    g = {
        1: [2],
        5: [2],
        2: [4, 3],
        3: [4, 7, 6],
        4: [5, 8],
        6: [9],
        7: [8],
        8: [9],
        9: [7, 10],
        10: []
    }

    vv = scc(g)
    for r in vv:
        print(r)


if __name__ == "__main__":
    # test()
    atcoder_practice2_g()


Measured memory_bytes: 381968
#include <cstdio>
#include <iostream>
using namespace std;
#define MAX 500000
#define CENTINEL 2000000000
int L[MAX/2+2],R[MAX/2+2];
int sum=0;
int n,A[MAX];
void merge(int A[],int left,int mid,int right){
  int na=mid-left;
  int nb=right-mid;
  for(int i=0;i<na;i++)L[i]=A[left+i];
  for(int i=0;i<nb;i++)R[i]=A[mid+i];
  L[na]=CENTINEL;R[nb]=CENTINEL;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    sum++;
    if(L[i]<=R[j]) A[k]=L[i++];
    else A[k]=R[j++];
  }
}
void mergesort(int A[],int left,int right){
  if(left+1<right){
    int mid=(left+right)/2;
    mergesort(A,left,mid);
    mergesort(A,mid,right);
    merge(A,left,mid,right);
  }
}
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",&A[i]);
  mergesort(A,0,n);
  for(int i=0;i<n-1;i++)printf("%d ",A[i]);
  printf("%d\n",A[n-1]);
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 7104
using System;
using System.Collections.Generic;

class Program
{
    public void Proc()
    {
        while(true)
        {
            string[] inpt = Console.ReadLine().Split(' ');
            int num1 = int.Parse(inpt[0]);
            int num2 = int.Parse(inpt[1]);
            if (num1 == 0 && num2 == 0)
            {
                return;
            }
            int n1 = Math.Min(num1, num2);
            int n2 = Math.Max(num1, num2);
            Console.WriteLine(n1 + " " + n2);
        }
    }



    static void Main(string[] args)

    {

        Program prg = new Program();
        prg.Proc();

    }
}

Measured memory_bytes: 9128
def man(q,r,s,t):
    #print(q,r,s,t,(abs(q-s)) + (abs(r-t)))
    return (abs(q-s)) + (abs(r-t))

n,m = map(int,input().split())

a=[]
b=[]

for _ in range(n):
    aa,bb = map(int,input().split())
    a.append(aa)
    b.append(bb)

c=[]
d=[]
for _ in range(m):
    cc,dd = map(int,input().split())
    c.append(cc)
    d.append(dd)

for i in range(n):
    nia = 10**10
    ans = 0
    for j in range(m):
        if nia > man(a[i],b[i],c[j],d[j]):
            nia = man(a[i],b[i],c[j],d[j])
            ans = j + 1
    print(ans)    

Measured memory_bytes: 3064
#include <stdio.h>

int main ()
{
    int a, b, c, x, i, j, k, cnt=0;
    scanf("%d%d%d%d", &a, &b, &c, &x);
    for (i=0; i <= a && 500*i<=x; i++)
    {
        for (j=0; j <= b && 100*j+500*i<=x; j++)
        {
            for (k=0; k <= c && 50*k+100*j+500*i<=x; k++)
            {
                if (500*i+100*j+50*k==x)
                {
                    cnt++;
                }
            }
        }
    }

    printf("%d", cnt);

}

Measured memory_bytes: 128
import java.util.Scanner;
 class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if(a<b && b<c){
System.out.println("Yes");
}else{
System.out.println("No");
}
}
}


Measured memory_bytes: 26092
#include <bits/stdc++.h>
#define REP(a,b,c) for(int a=b; a<(int)c; a++)
#define REPE(a,b,c) for(int a=b; a<=(int)c; a++)
#define REPD(a,b,c) for(int a=b; a>=(int)c; a--)
#define rep(a,b) REP(a,0,b)
#define repd(a,b) REPD(a,b,0)

typedef long long int ll;
using namespace std;
typedef pair<int, int> pos;
typedef struct{int h; int num;}dot;

int main(){
  int data[7][4] = {
    {0},
    {5,4,2,3},
    {3,1,4,6},
    {5,1,2,6},
    {2,1,5,6},
    {1,3,6,4},
    {3,2,4,5},
  };
  while(true){
    int n;
    cin >> n;
    if(n==0) break;
    vector<int> t(n,0),f(n,0);
    rep(i,n){
      cin >> t[i] >> f[i];
    }
    map<pos,dot > m;
    rep(i,n){
      pos now = pos(0,0);
      // cout << endl;
      //cout <<"i:"<< i << endl;
    search_start_label:
      int rem_top_num;
      // cout << "now" << now.first << "," << now.second << endl;
      if(m.find(now) == m.end()){
        dot tmp = {1,t[i]};
        m[now] = tmp;
        continue;
      }else{
        rem_top_num = m[now].num;
        m[now].num = t[i];
        m[now].h++;
      }
      // cout <<"h:"<< m[now].h << " num:" << m[now].num << endl;
      
      int front_num = f[i];
      int top_num = t[i];
      int now_h = m[now].h;
      
      int front_idx;
      rep(j,6){
        if(data[top_num][j] == front_num){
          front_idx = j;
          break;
        }
      }
      
      pos next_pos;
      REPD(j,6,4){
        rep(k,4){
          if(data[top_num][k] == j){
            // cout <<"select_num:"<< j << endl;
            int next_t,next_f;
            int sa = k-front_idx;
            switch(sa){
            case 0:
              next_pos = pos(now.first,now.second-1);
              next_f = top_num;
              next_t = data[top_num][(front_idx+2)%4];
              break;
            case 1:
            case -3:
              next_pos = pos(now.first+1,now.second);
              next_f = front_num;
              next_t = data[top_num][(front_idx+3)%4];
              break;
            case 2:
            case -2:
              next_pos = pos(now.first,now.second+1);
              next_f = 7-top_num;
              next_t = front_num;
              break;
            case 3:
            case -1:
              next_pos = pos(now.first-1,now.second);
              next_t = data[top_num][(front_idx+1)%4];
              next_f = front_num;
              break;
            }

            // cout <<"next_pos"<< next_pos.first << "," << next_pos.second << endl;
            //cout << "t:" << next_t << "f:" << next_f << endl;;
            if(m.find(next_pos)==m.end() || m[next_pos].h < (now_h-1)){
              m[now].h--;
              m[now].num = rem_top_num;
              now = next_pos;
              t[i] = next_t;
              f[i] = next_f;
              goto search_start_label;
            }
          }
        }
      }
    }
    vector<int> ans(7,0);
    for(int j=-n; j<=n; j++){
      REPE(k,-n,n){
        if(m.find(pos(j,k)) != m.end()){
          ans[m[pos(j,k)].num]++;
        }
      }
    }
    REP(i,1,7){
      if(i==6) cout << ans[i];
      else  cout << ans[i] << " ";
    }
    cout << endl;
  } 
  
  return 0;
}

Measured memory_bytes: 1204
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;
int main()
{
	int n,t;
	scanf("%d%d", &n,&t);
	for (int i = 0; i <= n && (i * 10000 <= t); i++)
	{
		for (int j = 0; (j <= n - i) && (i * 10000 + j * 5000 <= t); j++)
		{
			int k = n - i - j;
				if (i * 10000 + j * 5000 + k * 1000 == t)
				{
					printf("%d %d %d\n", i, j, k);
					return 0;
				}
			
		}
	}
	printf("-1 -1 -1\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    if(a*b%2==0){
        cout << "Even" << endl;
    }else{
        cout << "Odd" << endl;
    }
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	log.SetFlags(log.Lshortfile)
	H := nextInt()
	W := nextInt()
	K := nextInt()
	cake := make([][]byte, H)
	ans := make([][]int, H)
	for i := 0; i < H; i++ {
		ans[i] = make([]int, W)
	}
	strawberry := make([]Point, 0, K)
	var k int
	for i := 0; i < H; i++ {
		s := nextString()
		cake[i] = []byte(s)
		for j := 0; j < W; j++ {
			if cake[i][j] == '#' {
				k++
				strawberry = append(strawberry, Point{i, j})
				ans[i][j] = k
			}
		}
	}
	for i := 0; i < H; i++ {
		for j := 1; j < W; j++ {
			if ans[i][j] == 0 {
				ans[i][j] = ans[i][j-1]
			}
		}
		for j := W - 1 - 1; j >= 0; j-- {
			if ans[i][j] == 0 {
				ans[i][j] = ans[i][j+1]
			}
		}
	}

	for i := 0; i < W; i++ {
		for j := 1; j < H; j++ {
			if ans[j][i] == 0 {
				ans[j][i] = ans[j-1][i]
			}
		}
		for j := H - 1 - 1; j >= 0; j-- {
			if ans[j][i] == 0 {
				ans[j][i] = ans[j+1][i]
			}
		}
	}

	for i := 0; i < H; i++ {
		var l string
		for j := 0; j < W; j++ {
			l += strconv.Itoa(ans[i][j])
			if j < W-1 {
				l += " "
			}
		}
		fmt.Println(l)
	}
}

type Point struct {
	y, x int
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


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

typedef long long int llint;

int main(){
	int N,M;
	cin >> N >> M;
	int roadCnt[N];
	for(int& c : roadCnt)c=0;
	for(int i=0;i<M;i++){
		int a,b;
		cin >> a >> b;
		if(a!=b){
			roadCnt[a-1]++;
			roadCnt[b-1]++;
		}
	}
	for(const int& c : roadCnt){
		cout << c << endl;
	}
	return 0;
}


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

using namespace std;

string func(ll n) {

    ll length = 0;
    ll start = 0;
    while(start + pow(26,(length+1)) < n){
        start += pow(26,(length+1));
        length++;
    }

    length += 1;

    string ans = "";
    n -= start;
    while(length > 1){
        ll val = n / pow(26,(length-1));
        ll p = pow(26,(length-1));
        if(n%p == 0) val -= 1;
        ans += 'a' + val;
        n -= pow(26,(length-1))*(val);
        length--;
    }

    ans += 'a' + (n-1);

    return ans;
}

int main(int argc, char const *argv[]) {

    ll n;
    cin>>n;

    std::cout << func(n) << '\n';
    return 0;
}


Measured memory_bytes: 4096
#include <iostream>

using std::cin;
using std::cout;
using std::endl;
using std::string;

class ListItem {
  public:
    int key;
    ListItem *prev { NULL };
    ListItem *next { NULL };
    ListItem(int key) : key(key) { }
};

class List {
  private:
    ListItem *first { NULL };
    ListItem *last { NULL };

  public:
    void insertKey(int key) {
      ListItem *item = new ListItem(key);
      if (this->first == NULL) {
        this->first = item;
        this->last = item;
      } else {
        item->next = this->first;
        this->first->prev = item;
        this->first = item;
      }
    }

    void deleteFirst() {
      ListItem *item = this->first;
      if (item->next == NULL) {
        this->first = NULL;
        this->last = NULL;
      } else {
        item->next->prev = NULL;
        this->first = item->next;
      }
      delete item;
    }

    void deleteLast() {
      ListItem *item = this->last;
      if (item->prev == NULL) {
        this->first = NULL;
        this->last = NULL;
      } else {
        item->prev->next = NULL;
        this->last = item->prev;
      }
      delete item;
    }
    
    void deleteKey(int key) {
      for (ListItem *item = this->first; item != NULL; item = item->next) {
        if (item->key == key) {
          if (item == this->first) {
            this->deleteFirst();
          } else if (item == this->last) {
            this->deleteLast();
          } else {
            item->prev->next = item->next;
            item->next->prev = item->prev;
            delete item;
          }
          break;
        }
      }
    }

    void dump() {
      for (ListItem *item = this->first; item != NULL; item = item->next) {
        if (item != this->first) {
          cout << " ";
        }
        cout << item->key;
      }
      cout << endl;
    }
};

int main() {
  int n;
  string op;
  int key;
  List list;

  cin >> n;

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

    cin >> op;

    if (op == "insert") {
      cin >> key;
      list.insertKey(key);
    } else if (op == "delete") {
      cin >> key;
      list.deleteKey(key);
    } else if (op == "deleteFirst") {
      list.deleteFirst();
    } else if (op == "deleteLast") {
      list.deleteLast();
    }
  }

  list.dump();

  return 0;
}



Measured memory_bytes: 34388