akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unordered_map>
#include <queue>
#define MOD 1000000007
#define REP(i,num)for(int i=0;i<(num);++i)
#define ll long long
using namespace std;

// -9 -7 -4 -3 1 2 3 4
int main() {
    ios::sync_with_stdio(false);
    int N,K,pCnt=0,nCnt=0,ans=999999999,t;
    cin>>N>>K;
    vector<int> candles;
    REP(i,N){
        cin>>t;
        candles.push_back(t);
    }
    int x=0,y=K-1;
    REP(i,N-K+1){
        if(candles[x]>=0){
            ans=min(ans,abs(candles[y]));
            break;
        }
        if(candles[x]<=0&&candles[y]<=0) ans=min(ans,abs(candles[x]));
        else if(candles[x]>=0&&candles[y]>=0) ans=min(ans,abs(candles[y]));
        else {
            ans=min(ans,abs(candles[x])*2+candles[y]);
            ans=min(ans,abs(candles[y])*2+abs(candles[x]));
        }
        x++;y++;
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 892
n = gets.to_i
d = []
f = true
s = gets.chomp
d.push(s)
e = s[-1]
(n-1).times do |i|
  s = gets.chomp
  if d.include?(s)
    f = false
  end
  if e != s[0]
    f = false
  end
  d.push(s)
  e = s[-1]
end
if f
  puts("Yes")
else
  puts("No")
end

Measured memory_bytes: 1788
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	int j, l, N;
	j=0;
	cin >> N;
	int a[N];
	for(int i=1; i<=N; i++)
	{
		cin >> a[i];
		l=1;
		if(a[i]==2)
		{
			j+=1;
		}
		else
		{
			for(int k=2; k<= sqrt(a[i]); k++)
			{
				if(a[i]%k==0)
				{
					l=0;
				}
				else{}
			}
			j+=l;
		}
	}
	cout << j << endl;
	return 0;
}

Measured memory_bytes: 1196
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    public static void Main()
    {
        int N = NextInt();
        int M = NextInt();
        int[] X = LineInt();
        if (N >= M) { Console.WriteLine(0); return; }
        Array.Sort(X);
        int[] right = new int[M - 1];
        for (int i = 1; i < M; i++) right[i - 1] = X[i] - X[i - 1];
        Array.Sort(right);
        Console.WriteLine(right.Take(M-N).Sum());
    }
}

public class Input
{
    private static Queue<string> queue = new Queue<string>();
    private static void Confirm() { if (queue.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) queue.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(queue.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(queue.Dequeue()); }
    public static string NextString() { Confirm(); return queue.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(queue.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 19936
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))

a=1
b=1

import math

def dfs(i):
    global a
    global b
    if i==n-1:
        return abs(a-b)

    else:
        N=math.factorial(n-i)

        p_list=p[:]
        q_list=q[:]
        del p_list[0:i]
        del q_list[0:i]
        p_list.sort()
        q_list.sort()
        for j in range(n-i):
            if p[i]==p_list[j]:
                a+=j*N/(n-i)
            if q[i]==q_list[j]:
                b+=j*(N/(n-i))
        dfs(i+1)
dfs(0)
print(abs(int(a-b)))

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

typedef long long ll;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int a,b,q;
    cin >> a >> b >> q;
    vector<ll> s(a),t(b),ans(q);
    for (int i = 0;i < a;++i) scanf("%lld", &s[i]);
    for (int i = 0;i < b;++i) scanf("%lld", &t[i]);
    for (int i = 0;i < q;++i) {
        ll x,n = INT64_MAX,m = INT64_MAX;
        scanf("%lld", &x);
        int c = lower_bound(s.begin(),s.end(),x)-s.begin();
        if (c != a) {
            int d = lower_bound(t.begin(),t.end(),s[c])-t.begin();
            if (d != 0) {
                d--;
                if (t[d] > x) n = s[c]-x;
                else n = -t[d]+s[c]+min(x-t[d],s[c]-x);
                d++;
            }
            if (d != b) n = min(n,t[d]-x);
        }
        if (c != 0) {
            c--;
            int d = lower_bound(t.begin(),t.end(),s[c])-t.begin();
            if (d != b) {
                if (t[d] < x) m = x-s[c];
                else m = t[d]-s[c]+min(t[d]-x,x-s[c]);
            }
            if (d != 0) {
                d--;
                m = min(m,x-t[d]); 
            }
        }
        printf("%lld\n",min(n,m));
    }
    return 0;
}

Measured memory_bytes: 3712
def resolve():
    N, M = list(map(int, input().split()))
    ACs = [0 for _ in range(N)]
    WAs = [0 for _ in range(N)]
    for _ in range(M):
        p, result = list(input().split())
        p = int(p)
        if result == "AC":
            ACs[p-1] += 1
        else:
            if ACs[p-1] == 0:
                WAs[p-1] += 1
    nac = 0
    nwa = 0
    for i in range(N):
        if ACs[i] >= 1:
            nac += 1
            nwa += WAs[i]
    print(nac, nwa)


if '__main__' == __name__:
    resolve()

Measured memory_bytes: 10704
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    string s;
    cin>>s;
    vector<string> v{"AKIHABARA","AKIHABAR","AKIHABRA","AKIHABR",
    "AKIHBARA","AKIHBAR","AKIHBRA","AKIHBR",
    "KIHABARA","KIHABAR","KIHABRA","KIHABR",
    "KIHBARA","KIHBAR","KIHBRA","KIHBR"};
    for(int i=0;i<16;i++){
        if(s==v[i]){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <array>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <algorithm>
#include <string>
using namespace std;
int a, b;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)

typedef double db;

int main()
{
	int cnt = 0;
	string s;
	cin>>s;
	int k;
	REP(k, 3) {
		if (s[k] == s[k + 1]) {
			cnt++;
		}
	}
	if (cnt == 0) { cout << "Good" << endl; }
	else cout << "Bad" << endl;
		return 0;
	}


Measured memory_bytes: 256
//#include <boost/multiprecision/cpp_int.hpp> 
#include<bits/stdc++.h>
#define ll long long 
#define ull unsigned ll
#define pb push_back
#define mp make_pair
#define in insert
#define F first
#define S second
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define test    ll t=0;cin>>t;while(t--)
#define fast    ios_base::sync_with_stdio(false);cin.tie(NULL)
//using namespace boost::multiprecision; 
using namespace std;
ll INF=10000000000;
int main(void) {
	fast;
	ll n,k;
	cin>>n>>k;
	ll a[n],b[n]={0};
	rep(i,0,n)
	cin>>a[i];

    rep(i,0,n){ 
        ll c=INF;
        rep(j,1,k+1){
            if(i<j)
            break;
            c=min(c,b[i-j]+abs(a[i]-a[i-j]));
        }
        if(c!=INF)
        b[i] = c;
    }
    cout<<b[n-1];
	return 0;
}



Measured memory_bytes: 5212
#include <iostream>

using namespace std;

#define N 8

int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];

bool X[N][N];

void print() {
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			cout << (row[i] == j ? "Q" : ".");
		}
		cout << endl;
	}
}

void solve(int i) {
	if (i == N) {
		print();
		return;
	}
	if (row[i] != -1) {
		solve(i + 1);
		return;
	}
	for (int j = 0; j < N; ++j) {
		if (col[j] != -1 || dpos[i + j] != -1 || dneg[i - j + N - 1] != -1) continue;
		row[i] = j; col[j] = dpos[i + j] = dneg[i - j + N - 1] = 1;
		solve(i + 1);
		row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = -1;
	}
}

int main() {
	for (int i = 0; i < N; ++i) row[i] = col[i] = -1;
	for (int i = 0; i < 2 * N - 1; ++i) dpos[i] = dneg[i] = -1;

	int k; cin >> k;
	while (k--) {
		int r, c; cin >> r >> c;
		X[r][c] = true;
		row[r] = c; col[c] = dpos[r + c] = dneg[r - c + N - 1] = 1;
	}

	solve(0);

	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define ff first
#define ss second

using namespace std ;

long double PI = 3.14159265 ;
const int N = 2e6 + 1000 ;
long long int ans , ans1 , ans2 , ans3 ;
long long int n , m , h ;
long long int a[N] ;
long long int b[N] ;
long long int c[N] ;
string s , t ;

int main (){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin >> n ;
	for(int i = 0 ; i < n ; i++){
		cin >> a[i] >> b[i] ;
		ans -= b[i] ;
		c[i] = a[i] + b[i] ;
	}
	sort(c,c+n, greater<int>()) ;
	for(int i = 0 ; i < n ; i++){
		if(0 == i % 2)
		ans += c[i] ;
	}
	cout << ans ;
 	return 0 ;
}


Measured memory_bytes: 7168
#include <stdio.h>
#include <iostream>
#include <numeric>
#include <array>
#include <vector>
#include <algorithm>

using namespace std;
pair<pair<string, int>, int> p[110];
int main() {
	int a; cin >> a;
	string pl; int t;
	for (int i = 0; i < a; i++) {
		cin >> pl>>t;
		p[i] = make_pair(make_pair(pl, -t), i);
	}
	sort(p, p + a);
	for (int i = 0; i < a; i++) {
		cout << p[i].second + 1<< endl;
	}
}

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

using namespace std;

int main(void){
    int N, M;

    scanf("%d%d", &N, &M);

    int i, tmp;
    multiset<int> st;

    for(i = 0; i < N; i ++){
        scanf("%d", &tmp);
        
        st.insert(tmp);
    }
    int A;

    for(i = 0; i < M; i ++){
        auto itr = st.end();

        itr --;

        A = *itr / 2;

        st.erase(itr);
        st.insert(A);
    }
    long long int sum = 0;

    for(auto itr = st.begin(); itr != st.end(); itr ++){
        sum += *itr;
    }
    printf("%lld\n", sum);
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using vl = vector<long long>;
using P = pair<long long,long long>;
const ll mod = 1000000007;

int main(){
	ll l,r; cin >> l >> r;
	if(r - l >= 2018){
		cout << 0 << endl;
		return 0;
	}
	r %= 2019;
	l %= 2019;
	if(l > r)r += 2019;
	ll ans = 2019;
	for(ll i = l;i<r;i++){
		for(ll j = i+1;j<r+1;j++){
			ll m = i*j%2019;
			ans = min(ans,m);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
let kVMax = 100_000
let n = Scanf.scanf " %d" @@ (+) 0
let vs = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let css = Array.init 2 @@ fun _ -> Array.init (kVMax + 1) @@ fun i -> 0, i
let _ =
  if n = 2 then (Printf.printf "%d\n" @@ if vs.(0) = vs.(1) then 1 else 0; exit 0);
  for i = 0 to n - 1 do
    let m, j = css.(i land 1).(vs.(i)) in
    css.(i land 1).(vs.(i)) <- m + 1, j
  done;
  for i = 0 to 1 do Array.sort (fun x y -> compare y x) css.(i) done;
  let (max0, i), (max1, j) = css.(0).(0), css.(1).(0) in
  Printf.printf "%d\n" @@ if i <> j then n - max0 - max1
    else n - max (max0 + fst css.(1).(1)) (fst css.(0).(1) + max1)

Measured memory_bytes: 13184
//--- pA ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	public Solution () {
		reader = new Reader();
		while (reader.hasNext()) {
			run_case();
		}
	}
	private void run_case() {
		int[] arr = new int[]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
		int k = reader.ni();
		System.out.println(arr[k - 1]);
		return;
	}
}

class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public String ns() {return this.next();}
}


Measured memory_bytes: 22868
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
vector<vi> graph;
vector<int> ans;

int main(void) {
	ll A, B, C, K;

	cin >> A >> B >> C >> K;

	int a = K - A;
	int count = 0;

	if (a <= 0) {
		cout << K;
		return 0;
	}
	else {
		count = A;
	}

	int b = a - B;

	if (b <= 0) {
		cout << count;
		return 0;
	}
	else {
		cout << count - b;
	}


	return 0;
}

Measured memory_bytes: 3584
module Main where

import           Debug.Trace
import qualified Data.Vector.Unboxed           as VU
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe


getVUIntFromInputLineAtBSC8 :: IO (VU.Vector Int)
getVUIntFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
getListIntFromInputLineAtBSC8 =
    unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
readInt = fst . fromJust . BSC8.readInt
readIntList = map readInt . BSC8.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main :: IO ()
main = do
    [aM,aN] <- getListIntFromInputLineAtBSC8
    --aP                   <- getVUIntFromInputLineAtBSC8
    --aQ                   <- getVUIntFromInputLineAtBSC8
    --aR                   <- getVUIntFromInputLineAtBSC8

    --vP <- VU.fromList . take aX . reverse . sort <$> getIntList
    --vQ <- VU.fromList . take aY . reverse . sort <$> getIntList
    --vR <- VU.fromList . take (aX + aY) . reverse . sort <$> getIntList

    let combi = aM*(aM-1) `div` 2 + aN*(aN-1) `div` 2
    print combi



Measured memory_bytes: 380
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    long long A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    long long ans = min(A * X + B * Y, max(X, Y) * 2 * C);
    ans = min(ans, min(X, Y) * 2 * C + (X - min(X, Y)) * A + (Y - min(X, Y)) * B);
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>


int main(void)
{
    int n,a[100],i;
    int max,min;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    max=a[0];
    min=a[0];
    for(i=1;i<n;i++){
        if(max<a[i]) max=a[i];
        else if(min>a[i]) min=a[i];
    }   
    printf("%d\n",max-min);


    return 0;
}



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

void show(int arr[], int N){
	for(int i=0; i<N; i++)
		if(i<N-1)
			cout<<arr[i]<<' '<<flush;
		else
			cout<<arr[i]<<flush;
	cout<<endl;
}


void swap(int& a, int& b){
	int t=a;
	a=b;
	b=t;
}


int ShellSort(int* arr, int N);
int InsertionSort_r(int* arr, int N, int r);

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

	int* arr= new int[N];

	for(int i=0; i<N; i++)
		cin>>arr[i];

	int count=ShellSort(arr, N);

	cout<<count<<endl;

	for( int i=0; i<N; i++)
		cout<<arr[i]<<endl;

	delete[] arr;
}


int ShellSort(int* arr, int N)
{
	int counter=0;




	int* range= new int[N];  //range= { 1, 4, 13, 40 ...}


	range[0] = 1;

	int i;
	for( i=1; range[i-1]*3+1 < N; i++){
		range[i] = range[ i-1 ]*3+1;
	}
	int range_len =i; //range ?????????????????§????????\??£????????????

	
	cout<<range_len<<endl;

	for( int i=1; range_len - i >=0; i++ )
		cout<<range[ range_len - i ]<<' '<<flush;
	cout<<endl;







	 

	for( int i=0; range_len -i -1 >=0; i++) 
		counter=InsertionSort_r(arr, N, range[ range_len - i -1 ]);
	
	
	return counter;

	delete[] range;
	
	



	
}

int InsertionSort_r(int arr[], int N, int r)
{

	static int counter=0;
	int compindex;
	int comp;
	int j;
	bool changed=false; //??????????????¨???????????¨.??????????????????????????????????????????????????????????????????

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


		for( int compindex=N- r -1 -i; compindex> -1; compindex-=r ){
			
			comp=arr[compindex];
			j=r;
			for( ; compindex+j<N; j+=r ){

				if(comp > arr[compindex+j]){
					arr[compindex + j -r] = arr[compindex + j];
					counter++;
					changed =true;
				}
				else
					break;
				
			}
			arr[compindex + j - r] = comp;

		
			changed=false;


		}
	}


	return counter;



	
}

Measured memory_bytes: 4896
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    string s;cin >> s;
    ll k; cin >> k;
    vector<vector<ll>> table(26);
    set<string> ret;
    ll n = s.size();
    rep(i,s.size()){
        ll t = s[i] - 'a';
        table[t].emplace_back(i);
    }
    ll cnt = 0, ind = 0;
    while(cnt < k){
        for(auto i : table[ind]){
            rep(j,k)ret.insert(s.substr(i,j+1));
        }
        cnt = ret.size();
        ind++;
    }
    // string r;
    auto itr = ret.begin();
    rep(i,k-1)itr++;
    cout << *itr << endl;
}

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

int main()
{
    int a[10], n;

    for(int i = 0; i < 9; i++) cin >> a[i];

    cin >> n;

    int x;

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

        for(int i = 0; i < 9; i++){
            if(a[i] == x){
                a[i] = 0;
                break;
            }
        }
    }

    bool f = 0;

    if(a[0] == 0 && a[1] == 0 && a[2] == 0) f = 1;
    else if(a[3] == 0 && a[4] == 0 && a[5] == 0) f = 1;
    else if(a[6] == 0 && a[7] == 0 && a[8] == 0) f = 1;
    else if(a[0] == 0 && a[3] == 0 && a[6] == 0) f = 1;
    else if(a[1] == 0 && a[4] == 0 && a[7] == 0) f = 1;
    else if(a[2] == 0 && a[5] == 0 && a[8] == 0) f = 1;
    else if(a[0] == 0 && a[4] == 0 && a[8] == 0) f = 1;
    else if(a[2] == 0 && a[4] == 0 && a[6] == 0) f = 1;

    if(f == 1) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
using namespace std;
int N;
int i = 2;
int num, min_i;
long long max_i;
int main()
{

  scanf("%d", &N);
  long long ans = (long long)N * (N + 1) - 1;

  while (i * i <= N)
  {
    num = N / i;
    min_i = i * i;
    max_i = i * num;
    ans += (num - i + 1) * (min_i + max_i);
    ans -= min_i;
    i += 1;
  }
  printf("%lld", ans);
}


Measured memory_bytes: 1732
#include <iostream>

using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	if( -1000>a || a>1000 || -1000>b || b>1000){
		cout << "error." << endl;
		return 0;
	}
	if(a<b){
		cout << "a < b" << endl;
	}else if(a>b){
		cout << "a > b" << endl;
	}else if(a=b){
		cout << "a == b" << endl;
	}
	return 0;
}

Measured memory_bytes: 3044
// https://atcoder.jp/contests/abc149/tasks/abc149_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  string S, T;
  cin >> S >> T;
  string res = T + S;
  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define bitrep(X,N) for(ll X = 0; X < (1 << (N)); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 
#define CERR if(false) cerr

using namespace std;


int main(){

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

    cout << min(a,b) + min(c,d) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int A, B;
    scanf("%d %d",&A, &B);
    //printf("%d\n", A-2*B );
    int ans = A - 2*B;
    if(ans>0){
        printf("%d\n", ans);
    }else{
        printf("0\n");
    }
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
#include<vector>
#include<climits>
#include<stack>

vector<int> graph[100005];
vector<int> topo_sort;
int idk[100005];
int dp[100005];
int n,m;

void topological_sort(){
    
    stack<int> s;
    for(int i=0 ; i<n ; i++){
        if(idk[i]==0){
            s.push(i);
        }
    }

    while(!s.empty()){
        int top = s.top();
        // cout<<top<<endl;
        topo_sort.push_back(top);
        s.pop();
        for(int i=0 ; i<graph[top].size() ; i++){
            idk[graph[top][i]]--;
            if(idk[graph[top][i]]==0){
                s.push(graph[top][i]);
            }
        }
    }

// for(int i=0 ; i<n ; i++){
//     cout<<topo_sort[i]<<" ";
// }
// cout<<endl;


}


int solution(){

    for(int i=0 ; i<n ; i++){
        dp[i] = 0;
    }

    topological_sort();

    dp[topo_sort[0]] = 0;
    int ans = 0;

    for(int i=0 ; i<n ; i++){
        for(int j=0 ; j < graph[topo_sort[i]].size() ; j++){
            int dest = graph[topo_sort[i]][j];
            dp[dest] = max(dp[dest] , dp[topo_sort[i]]+1);
            ans = max(ans , dp[dest]);
        }
    }
    
    return ans;

}



int main(){
    cin>>n>>m;
    
    for(int i=0; i<m ; i++){
        int s,d;
        cin>>s>>d;
        graph[s-1].push_back(d-1);
        idk[d-1]++; 
    }

    cout<<solution()<<endl;

}

// 6 6
// 6 3
// 6 1
// 5 1
// 5 2
// 3 4
// 4 2

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

u = sorted(u)
ans = 0

for i in range(n-1):
  if ans == 0:
    ans = (u[i] + u[i+1])/2
  else:
    ans = (ans + u[i+1])/2
    
print(ans)

Measured memory_bytes: 9184
/**
*    author:  Dooloper
*    created: 06.06.2020 10:26:58
**/

#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <functional>
#include <cassert>


using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main() {
    cin.tie(0);
    int K;
    cin >> K;
    string S;
    cin >> S;
    if(S.size() <= K){
        cout << S << endl;
    }else{
        for (int i = 0; i < K; i++){
            cout << S[i];
        }
        cout << "..." << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.length();
    int ans = 0;
    char now = s[0];
    for (int i = 0; i < n; i++) {
        if (now != s[i]) {
            ans++;
            now = s[i];
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    vector<int> data;
	int n,q;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>q;
		data.push_back(q);
	}	
    std::sort(data.begin(),data.end());
    
	cout<<data[n/2]-data[n/2-1];
    return 0;
} 	

Measured memory_bytes: 892
#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 s;
    cin >> s;
    int l = s.length();
    rep(i,l){
        s[i]='x';
    }
    cout << s << "\n";
    return 0;
}

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

char s[15];
char ans[15];

int main() {

	scanf("%s",s);

	int i;

	int len = 0;

	for (i = 0; i < strlen(s); i++) {
		if (s[i] == '0') { ans[len] = '0'; len++; }
		else if (s[i] == '1') { ans[len] = '1'; len++; }
		else { 
			if (len != 0) {
				len--;
				ans[len] = '\0';
			}
		}
	}
	printf("%s\n",ans);

	return 0;
}

Measured memory_bytes: 128
/*
    coded by - PATHAKCODES ~~Revamped
    AIT PUNE , INDIA 
     
    "The Key is not will to win ......everybody has that "
    "It is will to prepare that is important"  
     
*/
     
#include <bits/stdc++.h>
 
using namespace std ;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
const ll k = 1e9 +7;



int main ()
{
    IOS
    int n, k ; cin >> n >> k;

    vector<int> h(n,0);

    for(int i = 0;i < n ; i++)
         cin >> h[i];

     vector<int> dp(n,INT_MAX);
     dp[0] = 0;
     dp[1] = abs(h[1]-h[0]);

     for(int i= 2 ; i < n ; i++){
        for(int j = 1 ; j <= k && i-j >=0 ; j++){
            if(abs(h[i]-h[i-j])+dp[i-j] < dp[i])
            dp[i] = abs(h[i]-h[i-j])+dp[i-j];
        }
       
     }

     cout << dp[n-1] << endl;
}



Measured memory_bytes: 3992
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<math.h>
#include<cstring>
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    
    string s;
    cin>>s;
    
    string s1="ABC";
    string s2="ARC";
    
    if(s==s1)
    {
    	
    	cout<<"ARC"<<endl;
    	
	}
	
	
	else if(s==s2)
	{
		
		cout<<"ABC"<<endl;
		
	}
     
     
     return 0;
   
   
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <map>

using namespace std;
const int p = 1000000007;

long long fact(int n, int m) {
	if (m == 0)return 1;
	if (n == 0)return 0;
	return n * fact(n - 1, m - 1) % p;
}


int main() {

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

	map<int, vector<int>> go;

	int a, b;

	for (int i = 0; i < N - 1; i++) {
		cin >> a >> b;
		go[a].push_back(b);
		go[b].push_back(a);
	}

	long long ans = K * fact(K - 1, go[1].size()) % p;

	for (int i = 2; i <= N; i++) {
		ans = ans * fact(K - 2, go[i].size() - 1) % p;
	}

	cout << ans << endl;

}

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

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

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

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

	long long ans = 1;

	for (int i = 0; i < N; i++) {
		long long t;
		cin >> t;
		ans = lcm(ans, t);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int a,b,c;
    cin >> a >> b >> c;
    cout << max(0,c-(a-b))<<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>;
#define PI 3.14159265359

int main()
{
    float r;
    cin >> r;
    cout << r * 2 * PI << endl;
    return 0;
}

Measured memory_bytes: 3760
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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; }

string ans;
void dfs(int n, int k, string s){
    cout << n << " " << k << endl;
    pr(s); 
    if(n==k) {
        ans = s;
        return;
    }
    else{
        int len = s.size();
        if(len>30) return;
        dfs(n, k, "0"+s);
        dfs(n, k+(int)pow(-2, len), "1"+s);
    }
}

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

    if(n==0) {pr('0'); return 0;}

    string s="";
    
    while(n!=0){
        // pr(s);
        ll b = (ll)pow(2, s.size()+1);
        if(n%b==0) {
            s = "0" + s; 
        }else{
            s = "1" + s;
            ll k = (ll)pow(-2, s.size()-1);
            n -= k;
        }
    }
    pr(s);
    return 0;}

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

int main() {

  int N;
  int K;

  cin >> N >> K;

  int S = 1;
  for (int i = 0 ; i < N ; i++) {
    if (S * 2 < S + K) {
      S *= 2;
    } else {
      S += K;
    }
  }

  cout << S << endl;

}



Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl
using namespace std;
int max_int = 2147483647;
int prime = 10e9+7;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n;




signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    bool ans = true;
    REP(i,s.size()){
        if(s[i] != t[i]) ans = false;
    }
    if(s.size()+1!= t.size()){
        ans = false;
    }
    (ans)? print("Yes"):print("No");
    
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}

//key以上の初めてのitr
int nibul(auto a,auto b){return lower_bound(All(a),b) - a.begin();}
//key以下の最後のitr
int nibuu(auto a,auto b){return upper_bound(All(a),b) - a.begin()-1;}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
int a[100];

signed main() {
	int i;
	
	cin >> n;
	rep(i, n) cin >> a[i];
	
	double s = 0;
	rep(i, n) {
		s += 1.0 / a[i];
	}
	printf("%.14f\n", 1.0 / s);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
 int sum,i;
 while(scanf("%d", &sum)!=EOF)
 {
     for(i=1;;i++)
     {
         if ( i*i > sum)
         {


         printf("%d\n",(i-1)*(i-1));
         break;
     }
 }
}
}


Measured memory_bytes: 128
import java.io.File;
import java.io.IOException;
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int A = sc.nextInt();
		System.out.println(N*N-A);
		
	}
}

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

int main() {
    double t, x;
    cin >> t >> x;

    double ans = t / x;

    printf("%.10f", ans);
    return 0;
}


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

int bubble_sort(vector<int>& nums) {
    int res = 0;
    for (int i = 0; i < nums.size(); i++) {
        for (int j = (int)nums.size() - 1; j > i; j--) {
            if (nums[j] < nums[j - 1]) {
                swap(nums[j], nums[j - 1]);
                res++;
            }
        }
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    vector<int> nums(n);
    for (int i = 0; i < n; i++)
        cin >> nums[i];

    int res = bubble_sort(nums);
    for (int i = 0; i < n; i++) {
        if (i > 0) cout << " ";
        cout << nums[i];
    }
    cout << endl;
    cout << res << endl;
    return 0;
}


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

int calc(int x)
{
    int ret = 0;
    while (x % 100 == 0)
    {
        x /= 100;
        ++ret;
    }
    return ret;
}
int main()
{
    int D, N;
    cin >> D >> N;
    int cnt = 0, val = 0;
    while (cnt < N)
    {
        ++val;
        if (calc(val) == D)
            ++cnt;
    }
    cout << val << endl;
    return 0;
}


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

int main(){
	int n;
	cin>>n;
	int ans=1;
	
	int flag=0;
	int a;
	cin>>a;
	
	for(int i=1;i<n;i++){
		int b;
		cin>>b;
		if(flag==0){
			if(a>b){
				flag=1;
			}else if(a<b){
				flag=2;
			}
		}else if(flag==1){
			if(a<b){
				flag=0;
				ans++;
			}
		}else if(flag==2){
			if(a>b){
				flag=0;
				ans++;
			}
		}
		a=b;
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;


int main() {
    int n, k ;cin >> n >> k;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    sort(p.begin(),p.end());
    int ans = 0;
    rep(i,k) ans += p[i];
    cout << ans << endl;
}




Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	int H,W;
	cin>>H>>W;
	vector<string> S(H);
	for(int i=0;i<H;i++)cin>>S[i];
	
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(S[i][j]=='.')continue;
			bool f = false;
			
			for(int k=0;k<4;k++){
				int x = j;
				int y = i;
				if(k==0)x++;
				if(k==1)x--;
				if(k==2)y++;
				if(k==3)y--;
				if(x<0||x>=W||y<0||y>=H)continue;
				if(S[y][x]=='#')f=true;
			}
			if(!f){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	
	cout<<"Yes"<<endl;
			
	
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		List<String>list =new ArrayList<>();
		
		String tar=scanner.next();
		list.add(tar);
		for(int i=0;i<n-1;i++){
			tar=scanner.next();
			if((!list.contains(tar))&&tar.substring(0,1).equals(list.get(i).substring(list.get(i).length()-1,list.get(i).length()))){
				
			}else{
				System.out.println("No");
				return;
			}
			list.add(tar);
		}
		
		System.out.println("Yes");
	}
}


Measured memory_bytes: 25300
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
 
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define len(x) int((x).size())
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define randint(n) uniform_int_distribution<int>(1, (n))(rng)

ll L[101];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif
 
	int n;
	cin>>n;
	
	for(int i=1; i<=n; i++) cin>>L[i];

    
    int ans=0;
    
    for(int i=1; i<=n; i++)
    {
        for(int j=i+1; j<=n; j++)
        {
            if(L[i]==L[j]) continue;
            
            for(int k=j+1; k<=n; k++)
            {
                if(L[k]==L[i]||L[k]==L[j]) continue;
                
                if(L[i]+L[j]+L[k] - max({L[i],L[j],L[k]}) > max({L[i],L[j],L[k]})) ans++;
            }
        }
    }
    
    cout << ans << "\n";
}



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

int main(){
  int a, b;
  cin >> a >> b;
  int max = -100000000;
  if(a+b > max) max = a+b;
  if(a-b > max) max = a-b;
  if(a*b > max) max = a*b;
  cout << max << "\n";
  return 0;
}


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

int main(){
    int n; cin >> n;
    int ans;
    if(n<600) ans=8;
    else if(n<800) ans=7;
    else if(n<1000) ans=6;
    else if(n<1200) ans=5;
    else if(n<1400) ans=4;
    else if(n<1600) ans=3;
    else if(n<1800) ans=2;
    else ans=1;
    cout << ans << endl;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
using lint         = long long;
constexpr lint inf = 1LL << 60;
constexpr lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, m, k;
    cin >> n >> m >> k;
    vector<lint> a(n + 1), b(m + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    for (int i = 1; i <= m; ++i) {
        cin >> b[i];
    }
    for (int i = 1; i <= n; ++i) {
        a[i] += a[i - 1];
    }
    for (int i = 1; i <= m; ++i) {
        b[i] += b[i - 1];
    }
    lint ret = 0;
    for (int i = 0; i <= n; ++i) {
        lint c = a[i];
        if (c > k)
            continue;
        lint d = upper_bound(b.begin(), b.end(), k - c) - 1 - b.begin();
        ret    = max(ret, i + d);
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 6360
#include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=105;
int line[N][N];
int girl[N],used[N];
int n;
bool found(int x){
    for(int i=1; i<=n; i++){
        if(line[x][i]&&!used[i]){
            used[i]=1;
            if(girl[i]==0||found(girl[i])){
                girl[i]=x;
                return 1;
            }
        }
    }
    return 0;
}
int a[N],b[N],c[N],d[N];
int main(){
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
  	scanf("%d%d",&a[i],&b[i]);
  }
  for(int i=1;i<=n;i++){
  	scanf("%d%d",&c[i],&d[i]);
  }
  memset(line,0,sizeof(line));
  memset(girl,0,sizeof(girl));
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
    	if(a[i] < c[j] && b[i] < d[j]) line[i][j] = 1;
    }
	}
  int sum=0;
  for(int i=1;i<=n;i++){
    memset(used,0,sizeof(used));
    if(found(i)) sum++;
  }
  printf("%d\n",sum);
  return 0;
}

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

using namespace std;

int main(void) {
	int n;
	while (cin >> n, n) {
		vector<int> a(n);
		for (int i = 0; i < n; ++i) {
			cin >> a[i];
		}
		sort(a.begin(),a.end());

		int res = 1000000;
		for (int i = 0; i < n-1; ++i) {
			if (a[i+1]-a[i] < res) {
				res = a[i+1]-a[i];
			}
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 3124
def main():
    n, m = [int(x) for x in raw_input().split()]
    a = [[int(x) - 1 for x in raw_input().split()] for i in xrange(n)]
    ans = n
    for _ in xrange(m):
        cnt = [0] * m
        for ai in a:
            cnt[ai[0]] += 1
        c = max(xrange(m), key=lambda k: cnt[k])
        ans = min(ans, cnt[c])
        for ai in a:
            ai.remove(c)
    return ans


if __name__ == '__main__':
    print(main())


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

dp=[[0,0] for i in range(n)]

dp[0][0]=a[0]
dp[0][1]=-a[0]

for i in range(1,n):
    dp[i][0]=max(dp[i-1][0]+a[i],dp[i-1][1]-a[i])
    dp[i][1]=max(dp[i-1][0]-a[i],dp[i-1][1]+a[i])
print(dp[n-1][0])


Measured memory_bytes: 73760
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    string s;
    string ans = "";
    cin >> s;
    for (auto c : s) {
        if (c == '0')ans += c;
        if (c == '1')ans += c;
        if (c == 'B' && ans.size())ans.pop_back();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define debug(x) cerr<<"\tDEBUG: "<<#x<<" = "<<(x)<<endl
#define debug2(a,x) cerr<<#a<<"\tDEBUG: "<<#x<<" = "<<(x)<<endl
using namespace std;
const int maxn=2100;
int n,a,b;
int main(){
	cin>>n>>a>>b;
	cout<<min(n*a,b)<<endl;
    return 0;
}

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

int main(int argc, const char * argv[]) {
  long long int Q, H, S, D;
  long long int N;
  long long int result = 0;
  cin>>Q>>H>>S>>D;
  cin>>N;
  bool qf,hf,sf,df;
  qf = true;
  hf = true;
  sf = true;
  df = true;

  H = min(Q * 2, H);
  S = min(H * 2, S);
  D = min(S * 2, D);
  if (N % 2 == 0) {
    result = result + N / 2 * D;
  }
  else {
    result = result + N / 2 * D + N % 2 * S;
  }
  cout<< result<<endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A_list = list(map(int,input().split()))
A_max = A_list[0]
cnt = 0
for i in range(N):
    if A_list[i] < A_max:
        cnt += A_max - A_list[i]
    else:
        A_max = A_list[i]
print(cnt)

Measured memory_bytes: 94200
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int n;
struct city{
	int p,num;
	string s;
};
city c[105];
bool cmp(city a,city b){
	if(a.s!=b.s)
		return a.s<b.s;
	return a.p>b.p;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>c[i].s>>c[i].p;
		c[i].num=i;
	}
	sort(c+1,c+n+1,cmp);
	for(int i=1;i<=n;i++)
		cout<<c[i].num<<endl;
	return 0;
}

Measured memory_bytes: 256
S = input()
if S[0] == "R":
    if S[1] == "R":
        if S[2] == "R": print(3)
        else: print(2)
    else: print(1)
elif S[1] == "R":
    if S[2] == "R": print(2)
    else: print(1)
elif S[2] == "R": print(1)
else: print(0)     


Measured memory_bytes: 61660
import java.util.*;
import java.io.*;

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int R = in.nextInt();

        if(N>=10)
        {
            System.out.println(R);
        }
        else
            {
                System.out.println(R+100*(10-N));
            }





    }


 }













Measured memory_bytes: 35812
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
typedef long long int ll;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define form for(int j=0;j<n;j++) 
#define fora(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define mp make_pair 
#define sc second 
#define f first 
#define kek cout<<"\n" 
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
const ll MOD = 1e9 + 7;
const int MAXN = 100005;
const int INF = 1e8;
using namespace std;
int main()

{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
 fast;
  int arr[4][4];
   int a[4][4];
  for(int i=0;i<3;i++) for(int j=0;j<3;j++)  cin>>arr[i][j];
   for(int i=0;i<3;i++) for(int j=0;j<3;j++) a[i][j]=0;
  int t;
  cin>>t;
  vector<int> v(t);
  fora(i,0,t) cin>>v[i];
  fora(k,0,t)
  {
            for(int i=0;i<3;i++) for(int j=0;j<3;j++) if(arr[i][j]==v[k]) a[i][j]=1;
            
  }
   //for(int i=0;i<3;i++) for(int j=0;j<3;j++) cout<<a[i][j]<<" ";
  int s=0;
  int s1=0;
   for(int i=0;i<3;i++) 
   {
             s1=0; s=0;
             for(int j=0;j<3;j++) {
                       s+=a[i][j]; s1+=a[j][i];
                       
             }
             
             if(s==3 || s1==3) {cout<<"Yes"; return 0;}
   } 
   if((a[0][0]+a[1][1]+a[2][2])==3 || (a[0][2]+a[1][1]+a[2][0])==3) {cout<<"Yes"; return 0;}
   cout<<"No";
   return 0;
  
     
 
}

Measured memory_bytes: 256