akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }
        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var A = cin.ReadIntArray(N + 1);
            var B = cin.ReadIntArray(N);
            UInt64 ans = 0;
            for(int i = 0; i < N; i++)
            {
                ans += (UInt64)Min(A[i], B[i]);
                ans += (UInt64)Min(A[i + 1], B[i] - Min(A[i], B[i]));
                A[i + 1] -= Min(A[i + 1], B[i] - Min(A[i], B[i]));
            }
            WriteLine(ans);
        }
    }
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


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

int main() {
  int N;
  cin >> N;
  int x = 0;
  int y = N;
  
  for(int i=0; i<8; i++) {
    x += N % 10;
    N /= 10;
  }
  
  if(y % x == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
using in = int64_t;


int main(){
 string a,b;
  cin>>a>>b;
  cout<<b<<a;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

bool isPalindrome(string s) {
    string t = s;
    reverse(t.begin(), t.end());
    return t == s;
}

int main(void) {
    ll N;
    string S;
    cin >> S;
    N = S.size();
    if(isPalindrome(S) && isPalindrome(S.substr(0, (N - 1) / 2)) && isPalindrome(S.substr((N + 3) / 2 - 1))) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define MININF -1e18L
using namespace std;
typedef long long ll;
typedef pair<int, int> intint;

int main(void)
{
    int H, W, h, w;
    cin >> H >> W >> h >> w;

    cout << (H - h) * (W - w);

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define putchar putchar_unlocked
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

inline void putints(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) putchar(*(C + i));
	putchar(' ');
}

inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) putchar(*(C + i));
	putchar('\n');
}

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


	int K, N;
	K = getint();
	N = getint();

	if (K % 2) {
		vector<ll> A;
		A.pb(1);
		ll S = A.back() * (K / 2) + 1;
		int doko;
		rep(i, N) {
			if (S >= N / 2) {
				doko = i;
				break;
			}
			A.pb((A.back() * K) + 1);
			S += A.back() * (K / 2) + 1;
		}
		ll kazu = S - N / 2;
		
		vector<int> kotae;
		for (int i = N - 1; i >= 0; i--) {
			if (i > doko) kotae.pb((K + 1) / 2);
			else {
				if (kazu == 0) break;
				else {
					kazu--;
					ll kari = kazu / A[i];
					if (kari > K - 1) kari = K - 1;
					kazu -= kari * A[i];
					kotae.pb(kari + 1);
				}
			}
		}
		for (auto itr = kotae.begin(); itr < --kotae.end(); itr++) {
			putints(*itr);
		}
		putint(kotae.back());
	}
	else {
		if (N > 1) {
			putints(K / 2);
			rep(i, N - 2) putints(K);
			putint(K);
		}
		else putint(K / 2);
	}

	Would you please return 0;
}

Measured memory_bytes: 3568
#include <stdio.h>
#include <stdlib.h>

int compare(const void *x,const void *y){
    return *(int*)x - *(int*)y;
}

int main(){
    int N,K;
    int p[1010];
    scanf("%d%d",&N,&K);
    for(int i=0;i<N;i++){
        scanf("%d",&p[i]);
    }
    qsort(p,N,sizeof(int),compare);
    int sum=0;
    for(int i=0;i<K;i++){
        sum+=p[i];
    }
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 1736
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(N) for (int i = 0; i < N; i++)

long get_factorial(long n){
    long result = 1;
    for (long i = 2; i <= n; i++){
        result *= i;
    }
    return result;
}

long get_combination(long n, long r){
    return get_factorial(n) / (get_factorial(n-r) * get_factorial(r));
}

long solve(vector<long> count){
    long result = 0;
    long char_count, elem_combination;
    bitset<5> combination;
    for (long i = 0; i < (1 << 5); i++){
        char_count = 0;
        elem_combination = 1;
        combination = i;
        for (long j = 0; j < 5; j++){
            if (combination[j] == 1){
                char_count++;
                elem_combination *= count[j];
            }
        }
        if (char_count == 3){
            result += elem_combination;
        }
    }
    return result;
}

int main(){
    long N;
    cin >> N;
    string str;
    vector<long> count(5, 0);
    long answer;
    for (long i = 0; i < N; i++){
        cin >> str;
        switch (str[0]){
            case 'M':
                count[0]++;
                break;
            case 'A':
                count[1]++;
                break;
            case 'R':
                count[2]++;
                break;
            case 'C':
                count[3]++;
                break;
            case 'H':
                count[4]++;
                break;
        }
    }

    answer = solve(count);
    cout << answer << endl;
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define all(x) begin(x),end(x)

using namespace std;

typedef vector<int> vi; typedef pair<int,int> pii;
typedef long long ll; typedef vector<long long> vl;
typedef vector<string> vs;

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

	int n;
	cin >> n;
	vi a(n);
	REP(i, n) cin >> a[i];
	sort(all(a));

	int cn = a[n-1];
	int cr = a[0];
	FOR(i, 1, n-1) {
		if (abs(cn-2*cr) > abs(cn-2*a[i])) {
			cr = a[i];
		}
	}

	cout << cn << " " << cr << endl;


	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string.h>
using namespace std;
int main(){
	int x,y;
	cin>>x>>y;
	int num[4]={0,300000,200000,100000};
	if(x>3&&y>3){//不符合条件 
		cout<<0<<endl;
	}else{
		if(x==1&&y==1){//都是第一名 
			cout<<1000000<<endl;
		}else if(x>3&&y<=3){
			cout<<num[y]<<endl;
		}else if(x<=3&&y>3){
			cout<<num[x]<<endl;
		}else{
			cout<<num[x]+num[y]<<endl;
		}
	}
	return 0;
} 

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

int x,y,z[51]={};

int mySet(int d,int e){
	int a=0;
	for(int i=1;i<d;i++){
		if(z[i]>=z[i+1]){
			return 0;
		}
	}
	if(d==x){
		if(e==y){
			return 1;
		}else{
			return 0;
		}
	}
	for(int j=0;j<=9;j++){
		z[d+1]=j;
		a+=mySet(d+1,e+j);
	}
	return a;
}

int main(void){
	while(1){
		cin>>x>>y;
		if(x==0&&y==0){
			break;
		}else{
			cout<<mySet(0,0)<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3088
N,M = map(int, input().split())
import numpy as np
AB = np.array([list(map(int, input().split())) for _ in range(N)])
idx = np.argsort(AB[:,0],axis=0)
AB = AB[idx]
l = []
for a,b in AB:
  l.extend([a]*b)
  if len(l) > M:
    break
print(sum(l[:M]))

Measured memory_bytes: 37896
from bisect import bisect_left

n = int(input())
lll = list(map(int, input().split()))
lll.sort()
ans = 0


def get_bisect_left():
    cache = {}

    def _f(x):
        if x in cache:
            return cache[x]
        cache[x] = bisect_left(lll, x)
        return cache[x]

    return _f


bisect_left_cache = get_bisect_left()

for i in range(n - 2):
    li = lll[i]
    for j in range(i + 1, n - 1):
        k = bisect_left_cache(li + lll[j])
        ans += k - j - 1
print(ans)


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,ans=0;
  long long D;
  cin >> N >> D;
  for(int i = 0; i < N; i++){
	long long X,Y;
    cin >> X >> Y;
    long long p = (X + Y)*(X + Y) -1 * 2*X*Y;
    if(p <= D*D) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
using ll=long long;

int main(){
    ll N;
    cin>>N;
    vector<pair<ll,ll> > works(N);
    for(ll i=0;i<N;i++){
        ll a,b;
        cin>>a>>b;
        works[i]=make_pair(b,a);
    }
    sort(works.begin(),works.end());
    ll task_sum=0;
    for(ll i=0;i<N;i++){
        task_sum+=works[i].second;
        if(task_sum>works[i].first){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 6408
fun list() = readLine()!!.split(" ").map {it.toInt()}

fun main() {
	val (h,w,m) = list()
	val r = IntArray(h) {0}
	val c = IntArray(w) {0}

	val a = Array(m) {
		val (y,x) = list()
		++r[y-1]
		++c[x-1]
		y-1 to x-1
	}

	val rm = r.max()!!
	val cm = c.max()!!

	val rc = (0 until h).count {r[it]==rm}
	val cc = (0 until w).count {c[it]==cm}
	val t = rc.toLong()*cc

	val u = a.count {(y,x)-> r[y]==rm&&c[x]==cm}.toLong()

	println(if(t==u) rm+cm-1 else rm+cm)
}


Measured memory_bytes: 92272
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <stack>
#include <set>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;

void solve() {
	const int mod = 1e9 + 7;
	int n; cin >> n;
	string s1, s2; cin >> s1 >> s2;
	int start = 1;
	ll ans = 0;
	if (s1[0] == s2[0])ans = 3;
	else {ans = 6; start = 2;}
	for (int i = start; i < n; i++) {
		if (i >= n) {cout << ans; return ;}
		if (s1[i] == s2[i]) {
			if (s1[i - 1] == s2[i - 1])ans = ans * 2 % mod;

		}
		else {
			if (s1[i - 1] == s2[i - 1])ans = ans * 2 % mod;
			else {
				ans = ans * 3 % mod;
			}
			i++;
		}
	}
	cout << ans;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	// int t; cin >> t;
	// while (t--)
	solve();

}

Measured memory_bytes: 3620
# https://atcoder.jp/contests/abc126/tasks/abc126_c


N, K = gets.split.map(&:to_i)

# サイコロで K 以上の場合 -> 勝ち
p1 = [(N - K + 1).to_f / N, 0.0].max

# サイコロで K 未満の場合
# (1..(K-1)) の数字が K を超えるまでに何回コインを振る必要があるか？という話
# 例えば x * (2 ** m) >= K としよう
p2 = 0.0
(1..([K - 1, N].min)).each do |x|
  l = K.to_s(2).length - x.to_s(2).length
  m = (x * (2 ** l) >= K) ? l : l + 1
  p2 += (1.0 / N) * (0.5 ** m)
end

puts p1 + p2


Measured memory_bytes: 1916
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


///////////////////////////////////////////////////
#include <cmath>

int main()
{
    int N;
    io >> N;
    vi x(N), y(N);
    for (int i = 0; i < N; i++)
        io >> x[i] >> y[i];
    
    double sum = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            int dx = x[i] - x[j];
            int dy = y[i] - y[j];
            sum += sqrt(dx * dx + dy * dy);
        }
    }
    
    double ave = sum * 2 / N;
    io << ave << BR;
}

Measured memory_bytes: 3796
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n;cin>>n;string s;cin>>s;
    int ans=0;
    rep1(i,n-1){
        map<char,bool>mp;
        string head=s.substr(0,i);
        string tail=s.substr(i,n-i);
        int cnt = 0;
        rep(j,head.size()){mp[head[j]]=true;}
        rep(j,tail.size()){if(mp[tail[j]]){cnt++;mp[tail[j]]=false;}}
        ans = max(ans,cnt);
    }
    co(ans);

}

Measured memory_bytes: 256
from itertools import combinations
import numpy as np
import sys
input   = sys.stdin.readline
        #買う本
N, M, X = map(int, input().split())
C_np    = np.array([list(map(int, input().split())) for _ in range(N)], dtype=int)
all_book= [i for i in range(N)]  
flag    =False
price_list  =[]
#C_np        =np.array(C,dtype=int)
price       =C_np[:,0]
understand  =np.delete(C_np,0,1)
for num in range(1,N+1): #1冊からN冊まで
    for t in combinations(all_book,num): #参考書を買う組合せ、全列挙
        book_buy        =np.array(t,dtype=int) 
        understand_now  = understand[book_buy] 
        understand_sum  = np.sum(understand_now, axis=0)
        if np.all(understand_sum >= X):
            price_now =price[book_buy]
            price_list.append(np.sum(price_now))
            flag =True
if flag ==True:
    print(min(price_list))
else:
    print(-1)

Measured memory_bytes: 27376
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    cout.precision(10);
    ll combi[51][51];
    for(int i = 0; i <= 50; i++){
        combi[i][0] = 1;
        combi[i][i] = 1;
    }
    for(int i = 1; i <= 50; i++){
        for(int j = 1; j <= i - 1; j++){
            combi[i][j] = combi[i - 1][j - 1] + combi[i - 1][j];
        }
    }
    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> v;
    for(int i = 0; i < n; i++){
        ll in;
        cin >> in;
        v.push_back(in);
    }
    int number[51];
    for(int i = 0; i < 51; i++){
        number[i] = 0;
    }
    sort(v.begin(), v.end());
    number[0]++;
    int itr = 0;
    for(int i = v.size() - 2; i >= 0; i--){
        if(v[i] != v[i + 1]){
            itr++;
        }
        number[itr]++;
    }
    if(number[0] >= a){
        ll ans = 0;
        for(int i = a; i <= b; i++){
            if(i <= number[0]){
                ans += combi[number[0]][i];
            }
        }
        cout << v[v.size() - 1] << endl;
        cout << ans << endl;
        return 0;
    }
    ll value = 0;
    ll numbers = 0;
    ll acopy = a;
    for(int i = 1; i <= a; i++){
        value += v[v.size() - i];
    }
    for(int i = 0; i < v.size(); i++){
        if(v[i] == v[v.size() - acopy]){
            numbers++;
        }
        if(v[i] > v[v.size() - acopy]){
            a--;
        }
    }
    cout << (long double)value / acopy << endl;
    cout << combi[numbers][a] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

  int a,b,c;
  cin >> a >> b >> c;
  int K;
  cin >> K;

  int res;
  if(a >= b && a >= c) {
    res = a * (1 << K) + b + c;
  } else if(b > a && b >= c) {
    res = b * (1 << K) + a + c;
  } else {
    res = c * (1 << K) + a + b;
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll * dp;
vector<ll> *gr;
ll mx=0;
ll solve(ll src)
{
	if(dp[src]!=-1)
	return dp[src];
	dp[src]=0;
	for(int i=0;i<gr[src].size();i++)
	{
		ll j=gr[src][i];
		dp[src]=max(dp[src],solve(j)+1);
	}
	return dp[src];
}
int main() {
	ll n,m;
	cin>>n>>m;
	dp=new ll[n];
	gr=new vector<ll> [n];
	for(int i=0;i<n;i++){dp[i]=-1;}
	for(int i=0;i<m;i++)
	{
		ll x,y;
		cin>>x>>y;
		x--;y--;
		gr[x].push_back(y);
	}
	for(int i=0;i<n;i++)
	{
		dp[i]=solve(i);
	}
	for(int i=0;i<n;i++)
	mx=max(dp[i],mx);
	cout<<mx;
}

Measured memory_bytes: 8576
#include <stdio.h>

int a, b, c;

int main(){
    scanf("%d %d %d", &a, &b, &c);
    
    if(a < b && a < c){
        printf("%d ", a);
        if(b < c)
            printf("%d %d\n", b, c);
        else
            printf("%d %d\n", c, b);
    }
    else if(b < a && b < c){
        printf("%d ", b);
        if(a < c)
            printf("%d %d\n", a, c);
        else
            printf("%d %d\n", c, a);
    }
    else{
        printf("%d ", c);
        if(a < b)
            printf("%d %d\n", a, b);
        else
            printf("%d %d\n", b, a);
    }
        
    return 0;
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define Set set<int>
#define int long long
#define P pair<int,int>
const int maxn = 3e5+5;
const int INF = 1e17 +6;
using namespace std;
int n,m,a[maxn],b[maxn],d[maxn],c[maxn],ans;
int32_t main()
{
    IOS;
    cin>>n>>m;
    ans=1;
    int sum=0;
    fu(i,1,n)
    {
        int x;
        cin>>x;
        sum+=x;
        if(sum<=m)ans++;
    }
    cout<<ans;
    return 0;
}


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

#define charToInt(c) (c-'0')

int main()
{
    string s;
    int sum = 0;
    cin >> s;

    for (int i=0; i<s.length(); ++i)
    {
        sum += charToInt(s[i]);
    }
    cout << ((sum % 9 == 0) ? "Yes" : "No");
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	int A, B;
	cin >> A >> B;
	if(A==B) cout << "Draw" << endl;
	else if(A==1) cout << "Alice" << endl;
	else if(B==1) cout << "Bob" << endl;
	else if(A>B) cout << "Alice" << endl;
	else cout << "Bob" << endl;

	return 0;
}

Measured memory_bytes: 3576
N =  int(input())
A =  list(map(int, (input().split(' '))))
A = A[::-1]

for i in range(len(A)):
    if i == 0:
        continue
    if A[i] > A[i-1]:
        A[i] = A[i] - 1
        if A[i] > A[i-1]:
            print('No')
            exit()
print('Yes')
exit()

Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int c[3][3];
int ab,bc;

int main(){
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin>>c[i][j];
		}
	}
	ab=c[0][0]-c[0][1];
	bc=c[0][1]-c[0][2];
	bool f=true;
	for(int i=1;i<3;i++){
		if(c[i][0]-c[i][1]!=ab||c[i][1]-c[i][2]!=bc){
			f=false;
			break;
		}
	}
	if(f){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#define PI 3.141592
using namespace std;

int main() {
int a[5];
cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
for(int k=0;k<=3;k++){
	for(int l=k+1;l<=4;l++){
		if(a[k]<a[l]){
			int c;
		c=a[k];
		a[k]=a[l];
		a[l]=c;
	}
}
}
cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" "<<a[3]<<" "<<a[4]<<endl;
	return 0;
}

Measured memory_bytes: 1164
x,k,d=map(int,input().split())
if x<=0:
  x*=-1
mi=x//d
if mi>=k:
  print(x-k*d)
  exit()
else:
  if (mi-k)%2==0:
    print(x-mi*d)
  else:
    print(abs(x-mi*d-d))

Measured memory_bytes: 9124
import java.util.Scanner;
 
public class Main {
 
    static int n;
    static boolean[] primes;
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
 
        sieve();
 
        solve();
    }
 
    static void solve() {
        int count = 0;
        for (int i = 5; i < primes.length; i++) {
            if (!primes[i]) {
                continue;
            }
 
            if (i % 5 == 1) {
                count++;
                if (count != n) {
                    System.out.print(i + " ");
                } else {
                    System.out.println(i);
                    break;
                }
            }
        }
    }
 
    static void sieve() {
        int n = 55555;
 
        final int MAX = n + 1;
        primes = new boolean[MAX];
 
        for (int i = 3; i < MAX; i+=2) {
            primes[i] = true;
        }
        primes[2] = true;
 
        for (int i = 3; i <= Math.sqrt(MAX); i += 2) {
            if (primes[i]) {
                for (int j = i*2; j < MAX; j += i) {
                    primes[j] = false;
                }
            }
        }
    }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll N,M;
    cin>>N>>M;
    multiset<ll> ms;
    for(ll i=0;i<N;i++){
        ll temp;
        cin>>temp;
        ms.insert(-1*temp);
    }
    while(M>0){
        if(ms.empty()){
            cout<<0<<endl;
            return 0;
        }
        auto it=ms.begin();
        ll val=*it;
        val=-1*val;
        ll temp2=val/2;
        if(temp2>0){
            ms.insert(-1*temp2);
        }
        ms.erase(it);
        M--;
    }
    ll ans=0;
    for(auto iit=ms.begin();iit!=ms.end();iit++){
        ll x=(*iit);
        x=-1*x;
        ans+=x;
        //ms.erase(iit);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <iomanip>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;



int main(){
    int h,w,k;
    cin >> h >> w >> k;
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    char mp[h+2][w+2];
    ll done[h+2][w+2];
    for(int i = 0; i < h+2; i++){
        for(int j = 0; j < w+2; j++){
            if(i == 0 || j == 0 || i == h+1 || j == w+1){
                mp[i][j] = '@';
                done[i][j] = 1;
            } else {
                cin >> mp[i][j];
                done[i][j] = INF;
            }
        }
    }

    priority_queue<pair<ll,tuple<int,int> >, vector<pair<ll,tuple<int,int>> >, greater<pair<ll,tuple<int,int>> > > q;
    q.push(make_pair(0,make_tuple(x1,y1)));
    done[x1][y1] = 0;

    int dir_x[] = {1, 0, -1, 0};
    int dir_y[] = {0, 1, 0, -1};
    ll ans = -1;
    while(q.size() > 0){
        auto tmp = q.top();
        q.pop();
        auto tpl = tmp.second;
        ll w = tmp.first;
        ll tx = get<0>(tpl);
        ll ty = get<1>(tpl);

        if(tx == x2 && ty == y2){
            ans = w;
            break;
        }

        for(int i = 0; i < 4; i++){
            ll nx=tx, ny=ty;
            ll cnt = 1;
            while(cnt <= k){
                ny += dir_y[i];
                nx += dir_x[i];
                if(mp[nx][ny] == '@') break;
                if(done[nx][ny] <= w) break;
                if(done[nx][ny] > w+1){
                    q.push(make_pair(w+1, make_tuple(nx,ny)));
                    done[nx][ny] = w+1;
                }
                cnt++;
            }
        }
    }

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

Measured memory_bytes: 30008
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	private static final boolean TEST = true;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n, y;
		n = in.nextInt();
		y = in.nextInt();
		solve(n, y);
		in.close();
	}

	private static void solve(int n, int y) {
		y /= 1000;
		y -= n;
		for (int i = y / 9; i >= 0; i--) {
			int m = y - i * 9;
			if (m / 4 > n - i)
				break;
			if (m % 4 == 0) {
				System.out.println(i + " " + (m / 4) + " " + (n - i - m / 4));
				return;
			}
		}
		System.out.println(-1 + " " + -1 + " " + -1);
	}
}

Measured memory_bytes: 21844
N = int(input())
A = list(map(int, input().split()))

ans = 0
tmp = A[0]
end = 0
for start in range(N):
    while end < N-1 and tmp ^ A[end+1] == tmp + A[end+1]:
        end += 1
        tmp += A[end]
    ans += (end - start + 1)
    tmp -= A[start]
    if start == end and end < N - 1:
        end += 1
        tmp += A[end]
print(ans)

Measured memory_bytes: 100760
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop, heapify
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

K = INT()
print("ACL"*K)

Measured memory_bytes: 10456
#include <bits/stdc++.h>
using namespace std;
const int maxn=912345;
const long long mod=1000000007;
int n,m,k;
long long fac[maxn],rev[maxn],p3[maxn],f[maxn];
inline long long ksm(long long x,long long n) {
    long long ret=1;
    while (n) {
        if (n&1) ret=ret*x%mod;
        n>>=1;
        x=x*x%mod;
    }
    return ret;
}
inline long long C(int x,int y) {
    return fac[x]*rev[y]%mod*rev[x-y]%mod;
}
int main()
{
    scanf("%d%d%d",&n,&m,&k);
    fac[0]=p3[0]=1;
    for (int i=1;i<maxn;++i) {
        fac[i]=fac[i-1]*i%mod;
        p3[i]=p3[i-1]*3%mod;
    }
    rev[maxn-1]=ksm(fac[maxn-1],mod-2);
    for (int i=maxn-2;i>=0;--i) rev[i]=(i+1)*rev[i+1]%mod;
    f[0]=1;
    for (int i=1;i<maxn;++i) {
        f[i]=2*f[i-1]%mod;
        if (i>m) f[i]=((f[i]-C(i-1,m))%mod+mod)%mod;
        if (i>k) f[i]=((f[i]-C(i-1,k))%mod+mod)%mod;
    }
    long long res=0;
    for (int i=n;i<=n+m+k;++i)
        res=(res+p3[n+m+k-i]*C(i-1,n-1)%mod*f[i-n]%mod)%mod;
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 32148
#include <iostream>
#include<algorithm>
#include <vector>
#include<string>
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define max(x,y) (((x)>(y)) ? x:y)
#define min(x,y) (((x)<(y)) ? x:y)
#define FOR(a) for(int i=0;i<a;i++)
#define ender {return 0;}
#define tosasuretu(a) (a*(a+1)/2)
inline ll kaizyo(ll);
ll gcd(ll, ll);
ll combination(ll, ll);
int main() {
	int a, b;
	cin >> a >> b;
	if (a % 3 != 0 && b % 3 != 0 && (a + b) % 3 != 0) {
		cout << "Impossible" << endl;
	}
	else {
		cout << "Possible" << endl;
	}
	return 0;
}


inline ll kaizyo(ll x) {
	long ans = 1;
	for (int z = 0; z < x; z++) {
		ans *= (x - z);
	}
	return ans;
}
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

const int N = 1e5;

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(N + 2);
  for (int i = 1; i <= n; i++) {
    int t;
    cin >> t;
    a[t]++;
    a[t + 1]++;
    a[t + 2]++;
  }
  int ans = 0;
  for (int i = 0; i <= N + 1; i++) {
    ans = max(ans, a[i]);
  }
  cout << ans << '\n';
}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  n *= 3;
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  sort(all(a));
  int ans = 0;
  for (int i = n - 2; i >= n - n / 3 * 2; i -= 2) {
    ans += a[i];
  }
  cout << ans << '\n';
}


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

int main(int, char**) {
        int N;
        std::string S;
        std::cin >> N;
        std::cin >> S;
        int64_t r = 0;
        int64_t g = 0;
        int64_t b = 0;
        for (int i=0; i<N; i++) {
                if( S.at(i) == 'R') {
                        r += 1;
                } else if (S.at(i) == 'G') {
                        g += 1;
                } else {
                        b += 1;
                }
        }
        int64_t sum = r * g * b;
        //std::cout << sum << std::endl;

        for (int i=0; i<N-2; i++) {
                char a = S.at(i);
                for (int j=i+1; j<N-1; j++) {
                        char b = S.at(j);
                        if (a == b) continue;
                        int k = 2*j - i;
                        if (k >= N) continue;
                        if ((b != S.at(k)) && (a != S.at(k))){
                                sum -= 1;
                        } else {
                                continue;
                        }
                }
        }
        std::cout << sum << std::endl;
        return 0;
}


Measured memory_bytes: 3572
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b>c+d){
        put("Left");
    }else if(a+b<c+d){
        put("Right");
    }else{
        put("Balanced");
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

struct datat {
	int a, b;
};

// 比較関数を定義
bool asc(const datat& left, const datat& right) {
	return left.a == right.a ? left.b < right.b : left.a < right.a;
}

int main() {
	int N;
	long long K;
	datat d[100005];
	cin >> N >> K;
	for (int i = 0;i <= N - 1;i++) {
		cin >> d[i].a >> d[i].b;
	}

	sort(d, d+N, asc);
	
	for (int i = 0;i <= N - 1;i++) {
		K -= d[i].b;
		if (K <= 0) {
			cout << d[i].a << endl;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.IO;

class Solve{
    static void Main(string[] args){
        var s = int.Parse(Console.ReadLine());
        var hash = new HashSet<int>();
        var answer = 1;
        while (!hash.Contains(s))
            if (s % 2 == 0){
                hash.Add(s);
                s /= 2;
                answer++;}
            else{
                hash.Add(s);
                s = s * 3 + 1;
                answer++;}
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

Measured memory_bytes: 27804
#include<stdio.h>
int main(){
int h,w,a[555][555],i,j,n=0,x1[200000],x2[200000],y1[200000],y2[200000];
scanf("%d%d",&h,&w);
for(i=1;i<=h;i++){
for(j=1;j<=w;j++)
scanf("%d",&a[i][j]);
}
for(i=1;i<=h;i++){
for(j=1;j<w;j++){
if(a[i][j]%2==1){
y1[n]=i;
y2[n]=i;
x1[n]=j;
x2[n]=j+1;
n++;
a[i][j]--;
a[i][j+1]++;
}
}
}
for(i=1;i<h;i++){
if(a[i][w]%2==1){
y1[n]=i;
y2[n]=i+1;
x1[n]=w;
x2[n]=w;
n++;
a[i][w]--;
a[i+1][w]++;
}
}
printf("%d\n",n);
for(i=0;i<n;i++)
printf("%d %d %d %d\n",y1[i],x1[i],y2[i],x2[i]);
return 0;
}


Measured memory_bytes: 6016
N, x = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)

sum = 0
(N - 1).times do |i|
    next if as[i] + as[i + 1] <= x
    if as[i] > x
        sum += as[i] + as[i + 1] - x
        as[i] = x
        as[i + 1] = 0
    else
        sum += as[i] + as[i + 1] - x
        as[i + 1] = x - as[i]
    end
end
p sum

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

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

    int A, B;
    cin >> A >> B;
    if (A >= 13) {
        cout << B << '\n';
    } else if (6 <= A && A <= 12) {
        cout << B / 2 << '\n';
    } else if (A <= 5) {
        cout << 0 << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <functional>
#include <tuple>
#include <climits>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <numeric>
#include <map>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;

int main()
{
    string s;
    cin >> s;
    string a;
    for(int i=0; i<s.size(); i++) {
        if(s[i] == 'B') {
            if(!a.empty())
                a.pop_back();
        }
        else {
            a += s[i];
        }
    }
    cout << a << endl;
}


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

typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<pair<int,int>> vec1 (100000,pair<int,int>(0,0));
    vector<pair<int,int>> vec2 (100000,pair<int,int>(0,0));
    for(int i = 0;i < 100000;i++){
        vec1[i].second = i;
        vec2[i].second = i;
    }
    for(int i = 0;i < N/2;i++){
        int dummy1, dummy2;
        cin >> dummy1 >> dummy2;
        vec1[dummy1].first++;
        vec2[dummy2].first++;
    }
    SORT(vec1);
    SORT(vec2);
    REV(vec1);
    REV(vec2);
    if(vec1[0].second == vec2[0].second){
        if(vec1[1].first > vec2[1].first){
            cout << N - vec1[1].first - vec2[0].first << endl;
        }
        else{
            cout << N - vec1[0].first - vec2[1].first << endl;
        }
        ED
    }
    cout << N - vec1[0].first - vec2[0].first << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n,k,a[101010];
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	cout<<(n-1+k-2)/(k-1)<<endl;
	return 0;
}

Measured memory_bytes: 640
#define LOCAL
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos((ld)-1.0))
#define MAXN (300006)
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < (ll)ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll((x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
string to_string(char c) {string s(1,c);return s;}string to_string(bool b){return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void degug_out() { cerr << endl; }template <typename Head, typename... Tail>void degug_out(Head H, Tail... T) {cerr << " " << to_string(H);degug_out(T...);}
#ifdef LOCAL
#define degug(...) cerr << "[" << #__VA_ARGS__ << "]:", degug_out(__VA_ARGS__)
#else
#define degug(...) 42
#define cerr if(0)cout
#endif
ll n,A[MAXN],dp[MAXN],m;
const ll MOD=1e9+7;
int main()
{
	FAST
	cin>>n>>m;
	FOR(i,0,m){
		ll a;cin>>a;A[a]=1;
	}
	dp[0]=1;
	FOR(i,0,n+1){
		if(A[i]||!i)continue;
		dp[i]=((i>1?dp[i-2]:0ll)+dp[i-1])%MOD;
	}
	cout<<dp[n];
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
int main() {
    string a  , b ;
    cin >> a >> b ;
    int ans = 0 ;
    for(int i = 0 ; i < a.length();i++){
        if(a[i]!=b[i])
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3928
N, M = map(int, input().split())
X = [-1] * N#[-1,-1,-1.....]
for _ in range(M):
    s, c = map(int, input().split())
    if s == 1 and N > 1 and c==0:
        print(-1)
        exit()#プログラム終了 １桁目が0で２桁以上あるため-1

#もしリストにまだ数字が入っていなかったらCを代入
    if X[s-1] < 0:
        X[s-1] = c
    
#もしすでにリストに数字が入っている場合は-1を出力する
    elif X[s-1] != c:
        print(-1)
        exit()
#このfor文でリストが完成する

if X[0] < 0 :#もし1桁目の数字が指定されていないなら
    X[0] = 1 if N>1 else 0#もし2桁以上ならならX[0]=1、違うならX[0]=0 
print("".join([str(x) if x >= 0 else "0" for x in X]))
#リストを文字列に変換する。もし指定されていない桁の数字があるなら0を代入する

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

hito_dict = {(i+1) : ((n[2]-n[1])*-1) for i in range(n[0])}
for i in range(n[2]):
    d = int(input())
    hito_dict[d] = hito_dict[d] + 1
for j in range(n[0]):
    if hito_dict[j + 1] > 0:
        print('Yes')
    else:
        print('No')

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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define vvi vector<vector<int>>
#define vvii vector<vector<pair<int, int>>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = 2e18;
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 5e3 + 3;

vector<int> cur;
vector<int> nxt(MAXN);
vector<int> v(MAXN);
vector<int> vis(MAXN);
vector<int> cycle(MAXN);
vector<int> vt;

void dfs(int u) {
  cur.eb(v[nxt[u]]);
  vt.eb(u);
  vis[u] = true;
  if (!vis[nxt[u]])
    dfs(nxt[u]);
  else
    cycle[u] = cycle[nxt[u]] = true;
}

// #define MULTIPLE_TEST_CASES
void solve() {
  int n;
  int k;
  cin >> n;
  cin >> k;

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

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

  int ans = -INF;
  for (int i = 1; i <= n; ++i) {
    int kk = k;
    vis.assign(n + 1, 0);
    cycle.assign(n + 1, 0);
    cur.clear();
    vt.clear();
    dfs(i);
    reverse(all(cur));
    reverse(all(vt));
    int vans = 0;
    while (kk > 0 && !cycle[vt.back()]) {
      vans += cur.back();
      --kk;
      cur.pop_back();
      vt.pop_back();
    }
    reverse(all(cur));
    int val = accumulate(all(cur), 0ll);
    if (val > 0) {
      if (kk / (int)cur.size() > 1) {
        kk -= cur.size();
        vans += (kk / (int)cur.size()) * val;
        ans = max(ans, vans);
        kk = kk % cur.size() + cur.size();
      }
    } else if (kk > (int)cur.size()) {
      for (int i = 0; i < min(kk, (int)cur.size()); ++i) {
        vans += cur[i];
        ans = max(ans, vans);
      }
      continue;
    }

    for (int i = 0; i < cur.size() && kk; ++i, --kk) {
      vans += cur[i];
      ans = max(ans, vans);
    }

    for (int i = 0; kk; ++i, --kk) {
      vans += cur[i];
      ans = max(ans, vans);
    }
  }

  cout << ans << endl;
}

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

  int t = 1;
#ifdef MULTIPLE_TEST_CASES
  cin >> t;
#endif
  while (t--)
    solve();
}

Measured memory_bytes: 4112
#include <iostream>

int main(){
    std::string s;
    std::cin >> s;

    int count = 0;
    for(int i = 0; i < s.size() - 1; ++i){
        if(s.at(i) != s.at(i + 1)){
            ++count;
        }
    }

    std::cout << count << std::endl;

    return 0;
}


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

using namespace std;

const int MAX_N = 100000;

int n, a[MAX_N + 1];

set<int> values;

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

    cin >> n;

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

    for (int i = 1; i <= n; i++) {
        values.insert(a[i]);
    }

    cout << values.size() + values.size() % 2 - 1 << endl;

    return 0;
}


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

#define ALL(a) (a).begin(), (a).end()
#define ll long long

using namespace std;

signed main(){
	int n; cin >> n;
	if(n == 3 || n == 5 || n == 7)cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n,i;
    cin >>n;
    for (i=1;i<=n;i++){
        if (i%3==0){
           cout<<" "<<i;
        }    
        else if(i%10==3){
            cout<<" "<<i;
        }
        else if(30<=i &&i<40){
            cout<<" "<<i;
        }
        else if(30<=i%100 && i%100<40){
            cout<<" "<<i;
        }
        else if(300<=i%1000 && i%1000<400){
            cout<<" "<<i;
        }
        else if(3000<=i%10000 && i%10000<4000){
            cout<<" "<<i;
        }
    }
    cout<<endl;
    return 0;   
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int res = 1e9;
	for(int i = 1; i < n; ++i){
		int x = i;
		int y = n - i;
		int sum = 0;
		while(x != 0){
			int r = x % 10;
			sum += r;
			x /= 10;
		}
		while(y != 0){
			int r = y % 10;
			sum += r;
			y /= 10;
		}
		res = min(res, sum);
	}
	cout<<res<<endl;			   
	return 0;
}


Measured memory_bytes: 256
from collections import deque
import numpy as np


def isPossible(grid):
    v = deque([[0, 0]])

    while v:
        x, y = v.popleft()
        grid[x][y] = 0
        if grid[x][y + 1]:
            v.append([x, y + 1])
            continue
        elif grid[x + 1][y]:
            v.append([x + 1, y])
            continue

    if grid.sum() == 0:
        return True
    else:
        return False


if __name__ == "__main__":
    h, w = map(int, input().split())
    grid = [[0 if i == "." else 1 for i in input()+"."] for _ in range(h)]
    grid.append([0]*(w+1))
    grid = np.array(grid)
    if isPossible(grid):
        ans = "Possible"
    else:
        ans = "Impossible"
    print(ans)


Measured memory_bytes: 20548
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vll vector<ll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
ll mod1 = 1e9 + 7;
ll mod2 = 998244353;

ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=(z*x);x =(x*x) ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll max(ll a,ll b,ll c){
	return max(max(a,b),c);
}
//to check overlap of intervals
bool overlap(pll p1,pll p2){
	if(p1.ss <= p2.ff)return false;
	if(p1.ff >= p2.ss)return false;
	return true;
	
}
void solve(ll tn){
	}






int main(){
	ll x,y,z;
	cin>>x>>y>>z;
	cout<<z<<" "<<x<<" "<<y<<endl;





}

Measured memory_bytes: 256