akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
pair<vector<T>, vector<T>> slide_minmax(const vector<T> &v, int k){

	vector<T> ret_min, ret_max;
	deque<int> deq_min, deq_max;
	for (int i = 0; i < v.size(); i++) {

		while (!deq_min.empty() && v[deq_min.back()] >= v[i]) deq_min.pop_back();
		while (!deq_max.empty() && v[deq_max.back()] <= v[i]) deq_max.pop_back();
		
		deq_min.push_back(i);
		deq_max.push_back(i);

		if (i - k + 1 >= 0) {
			ret_min.emplace_back(v[deq_min.front()]);
			ret_max.emplace_back(v[deq_max.front()]);
			if (deq_min.front() == i - k + 1) deq_min.pop_front();
			if (deq_max.front() == i - k + 1) deq_max.pop_front();
		}

	}
	return { ret_min, ret_max };
}

template< typename T >
vector< T > operator-(const vector< T > &v) {
	vector< T > res(v.size());
	for (int i = 0; i < v.size(); i++) res[i] = -v[i];
	return res;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	vector<int> P(N);
	for (int i = 0; i < N; i++) {
		int p; cin >> p;
		P[i] = p;
	}

	//auto [smin, smax] = slide_minmax(P, K);
	vector<int> smin, smax;
	tie(smin, smax) = slide_minmax(P, K);
	DMP(smin, smax);

	int cnt1 = 0;
	for (int i = 0; i < N - K; i++) if (smin[i] == P[i] && smax[i + 1] == P[i + K]) cnt1++;

	int seq = 0, cnt2 = 0;
	for (int i = 0; i < N - 1; i++) {
		if (P[i] < P[i + 1]) seq++;
		else seq = 0;
		if (seq == K - 1) cnt2++;
	}

	DMP(N - K + 1, cnt1, cnt2);
	cout << N - K + 1 - cnt1 - max(cnt2 - 1, 0) << "\n";

	return 0;
}


Measured memory_bytes: 4460
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	
	public static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
		Console.WriteLine(n*n*n);
	}
	
	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

}



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

int main() {
  long long int A, B, C, K;
  cin >> A >> B >> C >> K;
  if (K <= A) cout << K << endl;
  else if (K <= A + B) cout << A << endl;
  else cout << 2 * A + B - K << endl;
}


Measured memory_bytes: 3624
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)

#include <bits/stdc++.h>
using namespace std;

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=1e7+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

ll ans;
ll n;

int main()
{
    // freopen("D.out","w",stdout);
    scanf("%lld",&n);
    Rep(i,1,n)ans+=(n/i*i+i)*(n/i)/2;
    printf("%lld\n",ans);
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  rep(i,20){
    if(s[i] == ','){
      s[i] = ' ';
    }
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
(defn input []
  (->> (.split #"\s" (read-line))
    (map #(Integer/parseInt %))))

(defn SmallAndLargeInteger [[A B K]]
  (->>  (concat (take K (range A (inc B))) (take K (take-while #(<= A %) (iterate dec B))))
    (apply sorted-set)
    (map println-str)
    (apply str)))

(->> (input)
  SmallAndLargeInteger
  print)

Measured memory_bytes: 69372
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
typedef long long ll;

#define in(x) (0 <= x && x <= 1)

struct Point{
    double x, y, z;
    Point(double x, double y, double z) : x(x),y(y),z(z) {}
    double norm(){
        return x*x+y*y+z*z;
    }
    Point operator* (double d){
        return Point{x*d, y*d, z*d};
    }
    Point operator- (const Point& other){
        return Point{x-other.x, y-other.y, z-other.z};
    }
    double cross(const Point& other){
        return x*other.x+y*other.y+z*other.z;
    }
};

int main(){
    int n, q;
    cin >> n >> q;
    vector<Point> vp;
    vector<double> vr;
    vector<ll> vs;
    for(int i = 0; i < n; i++){
        double x, y, z, r;
        ll l;
        cin >> x >> y >> z >> r >> l;
        vp.push_back(Point{x,y,z});
        vr.push_back(r);
        vs.push_back(l);
    }
    while(q-- > 0){
        double sx, sy, sz, tx, ty, tz;
        cin >> sx >> sy >> sz >> tx >> ty >> tz;
        Point P{sx,sy,sz}, Q{tx,ty,tz};
        Point D = Q-P;
        double a = D.norm();
        ll ans = 0;
        for(int i = 0; i < n; i++){
            double b = 2*P.cross(D)-2*D.cross(vp[i]);
            double c = P.norm()+vp[i].norm()-2*P.cross(vp[i])-vr[i]*vr[i];
            if(b*b-4*a*c < 0)  continue;
            if(in((-b+sqrt(b*b-4*a*c))/2/a) || in((-b-sqrt(b*b-4*a*c))/2/a))    ans += vs[i];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
typedef vector<int> vi;
#define PB push_back
#define MP make_pair
#define ln "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=e; i>=s; i--)
#define vasort(v) sort(v.begin(), v.end())
#define vdsort(v) sort(v.begin(), v.end(),greater<int>())
#define F first
#define S second

#define out1(x1) cout << x1 << ln
#define out2(x1,x2) cout << x1 << " " << x2 << ln
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
#define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
#define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
#define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

#define in1(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
#define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
#define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;

#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


int main(){
    ll n;
    in1(n);
    vl a,b,c;
    ll a1,b1,c1;
    a.PB(0);
    b.PB(0);
    c.PB(0);
    forn(i,n){
        in3(a1,b1,c1);
        a.PB(a1);
        b.PB(b1);
        c.PB(c1);
    }
    ll n1[n+1],n2[n+1],n3[n+1];
    n1[0]=0;
    n2[0]=0;
    n3[0]=0;
    for(ll i=1;i<=n;i++){
        n1[i]=a[i]+max(n2[i-1],n3[i-1]);
        n2[i]=b[i]+max(n1[i-1],n3[i-1]);
        n3[i]=c[i]+max(n2[i-1],n1[i-1]);
    }
    if (n1[n]>=n2[n]) out1(max(n1[n],n3[n]));
    else out1(max(n2[n],n3[n]));
    return 0;
}

Measured memory_bytes: 5216
#include <iostream>
#include <vector>
#include <string>

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

    std::vector<char> buffer;
    buffer.reserve(10);
    for (const char &s : str)
    {
        if (s == 'B')
        {
            if (buffer.empty())
            {
                continue;
            }
            buffer.pop_back();
        }
        else
        {
            buffer.push_back(s);
        }
    }

    for (const char &s : buffer)
    {
        std::cout << s;
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define sd(x) scanf("%d",&x)
#define F first
#define S second
#define sz(x) (int)(x.size())
#define sd2(x,y) scanf("%d%d",&x,&y);
#define mp make_pair
#define pb push_back
#define pi pair <int, int > 
#define pl pair <ll, int >
#define infl (1ll << 60)
#define inf (1 << 30)
#define nax  100020
#define MOD 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
string str;
ll dp[2][nax];
ll solve(int pos, int tight, int len)
{
    if(pos == len)
        return dp[tight][pos] = 1;

    if(dp[tight][pos] != -1)
        return dp[tight][pos];
    if(tight)
    {
        if(str[pos] == '1')
            return dp[tight][pos] = (solve(pos + 1, 0, len) + 2ll * solve(pos + 1, 1, len)) % MOD;
        else
            return dp[tight][pos] = solve(pos + 1, 1, len);
    }
    else
        return dp[tight][pos] = (3ll * solve(pos + 1, 0, len)) % MOD;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> str;
    int l = str.length();
    memset(dp, -1, sizeof dp);
    cout << solve(0, 1, str.length()) << '\n';
    return 0;    
}

Measured memory_bytes: 8704
N, M, X = map(int, input().split())

C = [None] * N
A = [None] * N
for i in range(N):
    inp = list(map(int, input().split()))
    C[i] = inp[0]
    A[i] = inp[1:]


min_val = sum(C)
ans = False

for bit in range(1 << N):
    R = [0] * M
    c = 0

    for i in range(N):
        if bit & (1 << i):
            c += C[i]
            for m in range(M):
                R[m] += A[i][m]

    if all([r >= X for r in R]):
        ans = True
        min_val = min(min_val, c)


if ans:
    print(min_val)
else:
    print('-1')


Measured memory_bytes: 9216
#include<iostream>
using namespace std;
int main(void){
  long long int val=0;
  cin >> val;
  
  long long int sum=0;
  for(long long int i=0;i<=val;i++){
  	if(i % 15 == 0){
  	}
  	else if(i % 3 ==0  && i % 5 != 0){ 
  	}
  	else if(i % 3 != 0 && i % 5 == 0){
  	}
  	else{
      sum+= i;
    }
  }
  cout << sum << endl;
  
  return 0; 
}

Measured memory_bytes: 3620
s = list(input())

count1  = 0
count2 = 0

for i in range(len(s)):
    if i % 2 == 0 and s[i] == '1':
        count1 += 1
    elif i % 2 and s[i] == '0':
        count1 += 1

    if i % 2 == 0 and s[i] == '0':
        count2 += 1
    elif i % 2 and s[i] == '1':
        count2 += 1

print(min(count1, count2))

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

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

    long long int ans = 0;
    while(1){
        //cout << a << " " << b << " " << c << endl;
        if(a % 2 == 0 && b % 2 == 0 && c % 2 == 0) ans += 1;
        else break;

        if(a == b && b == c){
            cout << -1 << endl;
            return 0;
        }
        long long int na = b / 2 + c / 2;
        long long int nb = c / 2 + a / 2;
        long long int nc = a / 2 + b / 2;

        a = na;
        b = nb;
        c = nc;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3568
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]


N,K = map(int, input().split())
p = [int(i) for i in input().split()]
p.sort()
ans= 0

for i in range(K):
  ans += p[i]

print(ans)


Measured memory_bytes: 74524
import math
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
s=[]
n=int(input())
for i in range(2,55555):
    if is_prime(i)==True:
        if i%5==1:
            s.append(i)
print(' '.join(map(str, s[:n])))

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

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

    vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    sort(A.begin(), A.end());
    int ans = 0;
    for (int i = 0; i < N;) {
        int res = 0;
        for (int k = 0; i + k < N; k++) {
            if (A[i] == A[i + k]) {
                res++;
            }
            else {
                break;
            }
        }
        if (res >= A[i]) {
            ans += res - A[i];
        }
        else {
            ans += res;
        }
        i += res;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fr first
#define se second

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

vector<int> memo(50,0);

vector<vector<int>>dp(110,vector<int>(11000,0));

signed main(){
  int N,W;cin>>N>>W;
  vector<int> weight(N),value(N);
  REP(i,0,N)cin>>value[i]>>weight[i];
  REP(n,1,N+1)REP(w,0,W+1){
    if(w>=weight[n-1]&&dp[n-1][w]<=dp[n-1][w-weight[n-1]]+value[n-1]){
      dp[n][w]=dp[n-1][w-weight[n-1]]+value[n-1];
    }
    else dp[n][w]=dp[n-1][w];
  }
  print(dp[N][W])



}



Measured memory_bytes: 12284
#include <bits/stdc++.h>
using namespace std;
#define LL long long

void print() { std::cout << std::endl; }
template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
    std::cout << head;
    if(sizeof...(tail) != 0)
        std::cout << " ";
    print(std::forward<Tail>(tail)...);
}
template <class T> void print(std::vector<T> &vec) {
    for(auto &a : vec) {
        std::cout << a;
        if(&a != &vec.back())
            std::cout << " ";
    }
    std::cout << std::endl;
}
template <class T> void print(std::vector<std::vector<T>> &df) {
    for(auto &vec : df) {
        print(vec);
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> stairs(n + 1, true);
    for(int i = 0; i < m; i++) {
        int a;
        cin >> a;
        stairs[a] = false;
    }

    vector<LL> dp(n + 1, 0);
    dp[0] = 1;
    if(stairs[1]) {
        dp[1] = 1;
    }

    for(int i = 2; i <= n; i++) {
        if(stairs[i]) {
            if(stairs[i - 1]) {
                dp[i] += dp[i - 1];
            }
            if(stairs[i - 2]) {
                dp[i] += dp[i - 2];
            }
        }
        dp[i] %= 1000000007;
    }
    print(dp[n]);
}

Measured memory_bytes: 1408
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = Console.ReadLine().Trim();

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iSum = sS.Length;
            int iTmp = sS.Replace("1", "").Length;
            
            // 出力
            Console.WriteLine("{0}", (iSum - iTmp).ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


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

int main(){
    int A, B, C, X, Y, cost, cost2;
    cin >> A >> B >> C >> X >> Y;
    if(X >= Y){
        cost = C * 2 * Y + A * (X - Y); 
        cost2 = C * 2 * X;
    } else {
        cost = C * 2 * X + B * (Y - X);
        cost2 = C * 2 * Y;
    }

    cost = cost < cost2 ? cost : cost2;

    if(cost < A * X + B * Y){
        cout << cost << endl;
    } else {
        cout << A * X + B * Y << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll inf = 1e10;
int main() {
    int n, a, b; cin >> n >> a >> b;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    sort(h.rbegin(), h.rend());
    ll l = 0, r = inf;
    while(l < r) {
        ll m = (l+r)/2;
        ll B_sum = m * b;
        bool ok = false;
        ll cnt = 0;
        rep(i, n) {
            ll x = h[i] - B_sum;
            if(x <= 0) {
                break;
            } else {
                cnt += (x+a-b-1)/(a-b);
            }
        }
        if(cnt <= m) ok = true;
        if(ok) r = m;
        else l = m + 1;
    }
    cout << r << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
using namespace std;

const int MX = 10000000;
bool p[MX];

int main() {
    memset(p, false, sizeof p);
    p[0] = p[1] = true;
    for (int i=2; i*i<MX; ++i) {
        if ( ! p[i]) {
            for (int j=i*i; 0<j && j<MX; j+=i) {
                p[j] = true;
            }
        }
    }
    int n;
    while (cin >> n, n) {
        for (int i=n; i>=0; --i) {
            if (p[i-8] + p[i-6] + p[i-2] + p[i] == 0) {
                cout << i << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 10932
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

static inline void MainTask() {
  string S, T;
  cin >> S >> T;
  uint32_t res = 0;
  for (uint32_t i = 0; i < 3; ++i) {
    if (S[i] == T[i]) res++;
  }
  cout << res << endl;
}

int main() {
  MainTask();
  return 0;
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    int N;
    cin >> N;
    vector<lli> A(N, 0);
    REP(i, 0, N) {
        cin >> A[i];
    }
    lli ans = 0;
    vector<lli> B(N + 1, 0);
    map<lli, lli> m;
    m[0]++;
    REP(i, 0, N) {
        B[i + 1] += B[i] + A[i];
        ans += m[B[i + 1]];

        //        dump(ans);
        m[B[i + 1]]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define P pair<int,int>
#define PP pair<P,int>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
signed main(){
    int n;
    cin>>n;
    vi vec(3LL*n);
    REP(i,3LL*n)cin>>vec[i];
    sort(all(vec),greater<int>());
    int ans=0;
    REP(i,n){
        ans+=vec[i*2+1];
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {

  int X;
  cin >> X;

  int count = X / 100;
  int r = X % 100;

  if (ceil((double) r / count) < 6) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }

}

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

const int INF = 1000000000;

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

  vector<int> dp(n + 1, INF);
  dp.at(0) = 0;
  queue<int> que;
  que.push(0);
  while (que.size()){
    int i = que.front();
    que.pop();
    if (i + 1 <= n){
      if (dp.at(i + 1) > dp.at(i) + 1){
      dp.at(i + 1) = dp.at(i) + 1;
      que.push(i + 1);
      }
    }
    
    int s = 6;
    while (i + s <= n){
      if (dp.at(i + s) > dp.at(i) + 1){
        dp.at(i + s) = dp.at(i) + 1;
        que.push(i + s);
      }
      s *= 6;
    }

    int t = 9;
    while (i + t <= n){
      if (dp.at(i + t) > dp.at(i) + 1){
        dp.at(i + t) = dp.at(i) + 1;
        que.push(i + t);
      }
      t *= 9;
    }
  }
  cout << dp.at(n) << endl;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
int main(){
 
  string s;
  cin >> s;
  int ans = 0;
  int n = s.size();
  
  for(int i=0;i<n;i++){
    int cnt =0;
    for(int j=i;j<n;j++){
      if (s[j]!='A' && s[j]!='C' && s[j]!='G' && s[j]!='T'){
        break;
      }
      cnt++;
  	}
    ans = max(ans,cnt);
  }
  cout << ans << endl;
}

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

int main(){
  string abcd;
  cin >> abcd;

  vector<int> n(4);
  rep(i,4) n[i] = abcd[i] - '0';

  if(n[0]+n[1]+n[2]+n[3]==7) printf("%d+%d+%d+%d=7",n[0],n[1],n[2],n[3]);
  else if(n[0]+n[1]+n[2]-n[3]==7) printf("%d+%d+%d-%d=7",n[0],n[1],n[2],n[3]);
  else if(n[0]+n[1]-n[2]+n[3]==7) printf("%d+%d-%d+%d=7",n[0],n[1],n[2],n[3]);
  else if(n[0]+n[1]-n[2]-n[3]==7) printf("%d+%d-%d-%d=7",n[0],n[1],n[2],n[3]);
  else if(n[0]-n[1]+n[2]+n[3]==7) printf("%d-%d+%d+%d=7",n[0],n[1],n[2],n[3]);
  else if(n[0]-n[1]+n[2]-n[3]==7) printf("%d-%d+%d-%d=7",n[0],n[1],n[2],n[3]);
  else if(n[0]-n[1]-n[2]+n[3]==7) printf("%d-%d-%d+%d=7",n[0],n[1],n[2],n[3]);
  else if(n[0]-n[1]-n[2]-n[3]==7) printf("%d-%d-%d-%d=7",n[0],n[1],n[2],n[3]);

  return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
typedef long long ll;
typedef vector<ll> vl;

ll n, n1, n2, k, l, r, a[40], res;
vl p[44];

int main() {
	scanf("%lld %lld %lld %lld",&n,&k,&l,&r);
	rep(i,n) scanf("%lld",&a[i]);
	n1 = n/2, n2 = n-n1;
	rep(i,1<<n1) {
		ll c = 0, s = 0;
		rep(j,n1) if (i>>j&1) c++, s += a[j];
		p[c].pb(s);
	}
	rep(i,k+1) sort(all(p[i]));
	rep(i,1<<n2) {
		ll c = 0, s = 0;
		rep(j,n2) if (i>>j&1) c++, s += a[n1+j];
		if (c<=k) res += upper_bound(all(p[k-c]), r-s) - lower_bound(all(p[k-c]), l-s);
	}
	printf("%lld\n",res);
}

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

using namespace std;
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007
#define INF (1<<28)
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define floot10 cout<<fixed<<setprecision(10);
#define int long long

signed main(){
	int n;
	int a[1000];
	cin>>n;
	lps(i,1,n+1) cin>>a[i];
	lps(i,1,n+1){
		cout<<"node "<<i<<": key = "<<a[i]<<", ";
		if(i!=1) cout<<"parent key = "<<a[i/2]<<", ";
		if(i*2<=n) cout<<"left key = "<<a[i*2]<<", ";
		if(i*2+1<=n) cout<<"right key = "<<a[i*2+1]<<", ";
		cout<<endl;
	}
	return 0;
}



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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

template<typename T>
struct SegmentTree {
	T id;
	function<T(T, T)> op;
	vector<T> dat;
	int size;

	SegmentTree(int n, T id, function<T(T, T)> op) : id(id), op(op) {
		size = 1;
		while (size < n) size <<= 1;
		dat.assign(size * 2 + 10, id);
	}

	void update(int k, T x) {
		k += size, dat[k] = x;
		while (k > 1) k >>= 1, dat[k] = op(dat[k << 1], dat[(k << 1) | 1]);
	}

	void merge(int k, T x) { update(k, op(x, dat[k + size])); }
	//[a, b)
	T query(int a, int b) {
		T tl = id, tr = id;
		for (int l = a + size, r = b + size; l < r; l >>= 1, r >>= 1) {
			if (l & 1) tl = op(tl, dat[l++]);
			if (r & 1) tr = op(tr, dat[--r]);
		}
		return (op(tl, tr));
	}
};


void Main() {
	int N; cin >> N;
	SegmentTree<int> seg(N, 0, [](int a, int b) { return (a | b); });
	string S; cin >> S;
	for (int i = 0; i < N; i++) {
		seg.update(i, 1<<(S[i]-'a'));
	}
	int Q;
	cin >> Q;
	while (Q--) {
		int a; cin >> a;
		if (a == 1) {
			int i; char c;
			cin >> i >> c; --i;
			S[i] = c;
			seg.update(i, 1<<(S[i]-'a'));
		} else {
			int l, r;
			cin >> l >> r; --l;
			cout << __builtin_popcount(seg.query(l, r)) << el;
		}
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 5268
n = gets.to_i
ar = gets.chomp.split(' ')
result = []
a=0

for i in 0..(n-1) do
  if i == 0
      result.push(ar[0].to_i)
  elsif i == (n-1)
    result.push(ar[i-1].to_i)
  else
    if ar[i-1].to_i > ar[i].to_i
        result.push(ar[i].to_i)
    else
        result.push(ar[i-1].to_i)
    end
  end
end
 
result.each do |k|
  a += k
end
puts a


Measured memory_bytes: 1788
while(1):
    [n,k]=[int(x) for x in raw_input().split()]
    if n==0:
        break
    else:
        a=[]
        for i in range(n):
            a.append(int(raw_input()))
        sumnow=sum(a[0:k])
        M=sumnow
        for top in range(1,n-k+1):
            sumnow=sumnow-a[top-1]+a[top-1+k]
            M=max(sumnow,M)
        print M

Measured memory_bytes: 10488
import fractions

a,b,c,d=map(int,input().split())
g=(fractions.gcd(c,d))
l=int((c*d)/g)
C=int(b//c)-int((a-1)//c)
D=int(b//d)-int((a-1)//d)
E=int(b//l)-int((a-1)//l)
print(b-a+1-C-D+E)


Measured memory_bytes: 5048
#include <bits/stdc++.h>
using namespace std;
const int INF=1000010000;
typedef long long ll;
int main() {
  int n,W;cin >> n >> W;
  vector<int> w(n),v(n);
  for(int i=0; i<n; i++) cin >> w[i] >> v[i];
  vector<vector<ll>> dp(110,vector<ll>(100100,INF));
  dp[0][0]=0;
  for(int i=1; i<=n; i++){
    for(int j=0; j<=100000; j++){
      if(j-v[i-1]>=0) dp[i][j]=min(dp[i-1][j-v[i-1]]+w[i-1],dp[i-1][j]);
      else dp[i][j]=dp[i-1][j];
    }
  }
  ll ans=0;
  for(int i=0; i<=100000; i++){
    if(dp[n][i]<=W) ans=i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 87296
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define len(x) ((int)(x).size())
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef pair<ll, ll> pll;

const ll LINF = 1e18;
const ll INF = 1e9;
const int MOD = 1e9+7;

/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){
	fastio;
	ll n, d, a;
	cin >> n >> d >> a;
	vector<pll> v(n);
	for(pll& x : v){
		cin >> x.fs >> x.sc;
	}
	sort(v.begin(), v.end());
	ll ans = 0, qtd = 0, ponto = 0;
	set<pll> rmv;
	for(int i = 0; i < n; i++){
		for(auto& x : rmv){
			if(x.fs < v[i].fs){ /// se tem um range que ja passou, removo o dano dele
				qtd -= x.sc;
				rmv.erase(x);
			}else{
				break;
			}
		}
		v[i].sc -= qtd;
		if(v[i].sc <= 0) continue; /// morreu
		//cout << a << endl;
		ll k = (v[i].sc + a-1)/a;
		ans += k;
		qtd += k*a;
		ponto = v[i].fs+2*d;
		rmv.insert({ponto, k*a});
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void print() { cout << "\n"; }
template <class T> void print(const T &x) { cout << x << "\n"; }
template <class T, class... Args> void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
template <class T> void printVector(const vector<T> &v) {
    for(const T &x : v) {
        cout << x << " ";
    }
    cout << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

ll power(ll n, ll k) {
    if(k == 0) {
        return 1;
    } else if(k & 1) {
        return power(n, k - 1) * n;
    } else {
        ll t = power(n, k / 2);
        return t * t;
    }
}

using P = pair<ll, ll>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n + 1), sum(n + 1, 0);
    for(int i = 0; i < n + 1; i++) {
        cin >> a[i];
        sum[i] = a[i];
    }
    for(int i = 0; i < n; i++) {
        sum[i + 1] += sum[i];
    }
    auto calc_sum = [&](int l, int r) {
        return (l == 0 ? sum[r] : sum[r] - sum[l - 1]);
    };
    if(n == 0) {
        print(a[0] == 1 ? 1 : -1);
        return 0;
    }
    if(a[0] == 1) {
        print(-1);
        return 0;
    }
    vector<ll> R(n + 1), L(n + 1);
    R[0] = L[0] = 1;
    R[n] = L[n] = a[n];
    for(int i = 1; i <= n; i++) {
        R[i] = min(calc_sum(i, n), (R[i - 1] - a[i - 1]) * 2);
    }
    for(int i = n - 1; i >= 0; i--) {
        L[i] = (L[i + 1] + 1) / 2 + a[i];
        if(L[i] > R[i]) {
            print(-1);
            return 0;
        }
    }
    print(accumulate(ALL(R), 0LL));
}

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

int main() {
  char c;
  cin >> c;
  if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;
set<ll> factrize(ll n)
{
    set<ll> res;
    for (ll i = 2; i <= sqrtl(n); i++)
    {
        ll k = i;
        ll cnt = 0;
        while (n % k == 0)
        {
            n /= k;
            cnt++;
            res.insert(k);
        }
    }
    if (n != 1)
    {
        res.insert(n);
    }
    return res;
}
int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n;
    cin >> n;
    set<ll> res = factrize(n);
    ll ans = 0;
    for (auto v : res) {
        ll k = v;
        ll tmp = k;
        while (n % tmp == 0) {
            n /= tmp;
            ans++;
            tmp *= k;
        }
    }
    cout << ans << endl;
}

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

using namespace std;
static const int MAX = 200000;

int main()
{
	int n, R[MAX];
	
	
	cin >> n;
	
	for (int i=0; i<n; i++)
		cin >> R[i];
		
	int maxv = -2000000000;
	int minv = R[0];
		
	for(int j=1; j<n; j++){
		maxv = max(maxv, R[j]-minv);
		minv = min(minv, R[j]);
	}
	
	cout << maxv << endl;
	
	return 0;
	
}

Measured memory_bytes: 3880
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main (String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] strArr = br.readLine().split(" ");
        int[] intArr = new int[strArr.length];
        for (int i = 0; i < strArr.length; i++) {
            intArr[i] = Integer.parseInt(strArr[i]);
        }
        if (intArr[0] == intArr[1]) {
            System.out.println("a == b");
        } else if (intArr[0] < intArr[1]) {
            System.out.println("a < b");
        } else {
            System.out.println("a > b");
        }
    }
}


Measured memory_bytes: 24192
/*
 * https://atcoder.jp/contests/abc144/tasks/abc144_b
 */
#include <bits/stdc++.h>
 
using namespace std;

// ショートハンド
// #define ll intに変えればメモリ節約
#define ll long long


/* 
 * ループ系のマクロ
 * `REP(i, 10) { cout << i; }`のように、変数名,回数で動く
 */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/*
 * 正規表現
 */
#define MATCH(_str, _ptn) regex_match(_str, regex(_ptn))
#define REPLACE(_str, _ptn, _replacement) regex_replace(_str, regex(_ptn), _replacement)

# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())

# define pb push_back

# define INIT() cin.tie(0); ios::sync_with_stdio(false)

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
// `chmax(a, b)` aがbより小さければ、aをbに上書きする。chminは逆
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1e9 + 7;
ll memo1[201][201];
ll memo[201][201][201];
ll Gcd(ll a,ll b) {
    if(memo1[a][b] == 0) {
        memo1[a][b] = __gcd(a, b);
    }
    return memo1[a][b];
}
ll Gcd(ll a,ll b, ll c) {
    if(memo[a][b][c] == 0) {
        memo[a][b][c] = Gcd(Gcd(a, b), c);
    }
    return memo[a][b][c];
}
int main() {
    INIT();

    ll k;
    ll a[3];
    ll result = 0;
    cin >> k;
    REP(i1,k) {
        REP(i2,k) {
            REP(i3,k) {
                a[0] = i1 + 1;
                a[1] = i2 + 1;
                a[2] = i3 + 1;
                sort(a, a + SIZE_OF_ARRAY(a));
                result += Gcd(a[0], a[1], a[2]);
            }
        }
    }
    cout << result;
    return 0;
}

Measured memory_bytes: 36100
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int N;
ll x[112345], d[112345], t[112345], ans[112345];
int a[112345], b[64][112345];
ll M, K;

int main() {
	cin >> N;
	REP(i, N) scanf("%lld", x + i);
	cin >> M >> K;
	REP(i, M) scanf("%d", a + i), a[i]--;
	
	REP(i, N - 1) d[i] = x[i + 1] - x[i];
	
	REP(i, N) b[0][i] = i;
	REP(i, M) swap(b[0][a[i] - 1], b[0][a[i]]);
	REP(i, 63) REP(j, N) b[i + 1][j] = b[i][ b[i][j] ];
	
	REP(i, N) t[i] = i;
	REP(i, 64) if (K >> i & 1) {
		REP(j, N) t[j] = b[i][ t[j] ];
	}
	
	ans[0] = x[0];
	REP(i, N - 1) ans[i + 1] = ans[i] + d[t[i]];
	
	REP(i, N) printf("%lld\n", ans[i]);
	return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
#define ll long long
static const int MAX = 1000010;
static const ll INFTY = 1e12;
static const int NUMMAX = 300;

int change( int N,  int a, int b ){

    int ans = 0;
    int tmp;

    if(a > b) swap(a, b);
    tmp = a - 1;
    REP(i, tmp){
      N--; 
      ans += N;
    }
    return ans + ( b-a-1 );

}

int toposort( int N, vector<int> G[MAX], int h[MAX] ){

  //入次数が0の頂点の集合
  stack<int> st;
  int ansans = 0;
  int dp[MAX] = {0,};

  //入次数が0の頂点であればstに追加
  REP(i, N) if(h[i] == 0) st.push(i);

  //ソートされた後のグラフ
  vector<int> ans;
  //stがなくなるまでループ
  while(st.size()) {
    //stの集合のから一つ取り出す
    int i = st.top(); st.pop();
    ans.push_back(i);
    for(auto& j: G[i]) {
      //隣接する頂点の入次数をマイナス1
      h[j]--;
      dp[j] = max( dp[j], dp[i] + 1 );
      ansans = max(ansans, dp[j]);
      //これによって入次数が0になればstに追加
      if(h[j] == 0) st.push(j);
    }
  }

  if( ans.size() != N ){
    ansans = -2;
  }

  return ansans;
}


int main() {

  //int M[MAX][MAX] = {0,};
  int hash;
  int tmpi, tmpj;
  int maehash;
  int N;
  int hyouN;
  vector<int> G[MAX];
  //頂点の入次数を管理
  int h[MAX] = {0,};
  int ans;

  cin >> N;

  REP(i, N){
    tmpi = i+1;
    REP(j, N-1){
      cin >> tmpj;
      hash = change(N, tmpi, tmpj);
      if(j != 0){
       // if(M[maehash][hash] == 0){
       //   M[maehash][hash] = 1;
          G[maehash].push_back(hash);
          h[hash]++;
     //   }
      } 
      maehash = hash;
    }
  }

  hyouN = 1;
  for(int i = 2; i < N; i++){
    hyouN += i; 
  }

  ans = toposort(hyouN, G, h);

  cout << ans + 1<< endl;

  return 0;

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 49272
#include<bits/stdc++.h>
using namespace std;
#define int  long long int
#define fi first
#define se second
#define pb push_back
#define soo(v) sort(v.rbegin(),v.rend())
#define so(v) sort(v.begin(),v.end())
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define endl '\n'
#define dbv(v) cout<<endl;cout<<#v<<"-->> ";for(auto it:v){cout<<it<<" ";}cout<<endl;
#define dbm(m)cout<<endl;cout<<#m<<"-->> ";for(auto it:m){cout<<it.fi<<" "<<it.se<<endl;}
#define dbs(s)cout<<endl;cout<<#s<<"-->> ";for(auto it:s){cout<<it<<" ";}cout<<endl;
#define mod 2019
#define db1(x) cout<<#x<<"="<<x<<endl;
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl;
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<endl;
#define mx 1e18
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v)  *min_element(v.begin(),v.end())
#define double long double
#define re(s) reverse(s.begin(),s.end())
#define io std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
int powe(int x,int n)
{
  if(n==0)return 1;
  if(n%2==0)
    return powe((x%mod*x%mod)%mod,n/2)%mod;
  return (x%mod*powe((x%mod*x%mod)%mod,(n-1)/2))%mod;
}
int gcd(int A,int B)
{
  if(B==0)return A;
  return gcd(B,A%B);
}


int32_t main()
{
  io
  string s,r;
  cin>>s>>r;
  string pp=r+s;
  cout<<pp<<endl;
}

Measured memory_bytes: 3628
N, K = map(int, input().split())

rules = []
for i in range(N):
    a, b = map(int, input().split())
    rules.append((a, b))

rules = sorted(rules, key=lambda x: x[0])
for rule in rules:
    K -= rule[1]
    if K <= 0:
        print(rule[0])
        break


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

template<typename T, typename U> void dmin(T &x, U y) { if (x > y) x = y; }

const int MAX_N = 40, MAX_ab = 10, INF = 0x3f3f3f3f;
int N, Ma, Mb, a[MAX_N], b[MAX_N], c[MAX_N], ans = INF;
int dp[MAX_N+1][MAX_N*MAX_ab+1][MAX_N*MAX_ab+1];

int main() {
  cin >> N >> Ma >> Mb;
  for (int i=0; i<N; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  for (int i=0; i<=N; i++)
    for (int j=0; j<MAX_N*MAX_ab+1; j++)
      for (int k=0; k<MAX_N*MAX_ab+1; k++)
        dp[i][j][k] = INF;
  dp[0][0][0] = 0;

  for (int i=0; i<N; i++) {
    for (int ca=0; ca<MAX_N*MAX_ab+1; ca++) {
      for (int cb=0; cb<MAX_N*MAX_ab+1; cb++) {
        if (dp[i][ca][cb] == INF) continue;
        dmin(dp[i+1][ca][cb], dp[i][ca][cb]);
        dmin(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb] + c[i]);
      }
    }
  }

  for (int ca=1; ca<MAX_N*MAX_ab+1; ca++) {
    for (int cb=1; cb<MAX_N*MAX_ab+1; cb++) {
      if (ca * Mb == cb * Ma) {
        dmin(ans, dp[N][ca][cb]);
      }
    }
  }

  cout << (ans == INF ? -1 : ans) << endl;
  return 0;
}


Measured memory_bytes: 25984
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename Container>
int SZ(const Container& S) { return S.size(); }

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg_var(x) clog << #x  << ": " << x << endl;
    #define dbg_array(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg_var(x)
    #define dbg_array(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!
    
    int N;
    cin >> N;
    if (N == 3) {
		cout << "2 5 63\n";
		return 0;
	}
    vector<int> poss;
    for (int i = 4; i <= 30000; i++) {
		if (i % 2 == 0 or i % 3 == 0) poss.push_back(i);
	}
	while (1) {
		random_shuffle(poss.begin(), poss.end());
		int S = 5;
		for (int i = 0; i < N-2; i++) S += poss[i];
		if (S % 6 == 0) {
			cout << "2 3 ";
			for (int i = 0; i < N-2; i++) cout << poss[i] << " ";
			return 0;
		}
	}
}



Measured memory_bytes: 640