akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair <int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
const char nl = '\n';

const int N = 50000;

void solve() {
    char c;
    cin >> c;
    if(isupper(c)){
        cout << "A" << nl;
    }
    else{
        cout << "a" << nl;
    }
}

int main() {
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}

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

vector<P> prime_factorize(ll n) {
    vector<P> res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main() {
  ll n,p,ans = 1;
  cin >> n >> p;
  vector<P>factor = prime_factorize(p);
  rep(i,0,factor.size()){
    rep(j,0,factor[i].second/n) ans *= factor[i].first;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
xl=list(map(int,input().split()))
sxl=sorted(xl[:])
if n==2:
    print(xl[1])
    print(xl[0])
    exit()
m1=sxl[n//2-1]
m2=sxl[n//2]
if m1==m2:
    for _ in range(n):
        print(m1)
    exit()
for x in xl:
    if x<=m1:
        print(m2)
    else:
        print(m1)

Measured memory_bytes: 25620
#include <bits/stdc++.h>
using namespace std;
// 单点修改
struct SegTree{
	int N;
	int a[400005];// 最小值 
	void init(int n){
		N=1;while(N<n)N*=2;
		for(int i=0;i<=2*N;i++)a[i]=INT_MAX;
	}
	void update(int i,int v){
		i+=N-1;
		a[i]=v;
		while(i){
			i=(i-1)/2;
			a[i]=min(a[i*2+1],a[i*2+2]);
		}
	}
	int query(int l,int r,int L,int R,int i){
		if(R<=l||r<=L)return INT_MAX;
		if(l<=L&&R<=r)return a[i];
		int v1=query(l,r,L,(L+R)/2,i*2+1);
		int v2=query(l,r,(L+R)/2,R,i*2+2);
		return min(v1,v2);
	}	
};
int main(){
	ios::sync_with_stdio(false);
//	freopen("b.txt","w",stdout);
	int n,q,type,p1,p2;
	cin>>n>>q;
	SegTree st;
	st.init(n);
	while(q--){
		cin>>type>>p1>>p2;
		if(type==0){
			st.update(p1,p2);
		}else{
			cout<<st.query(p1,p2+1,0,st.N,0)<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 4204
#include <iostream> 
#include<math.h>
#include <vector> // vector

using namespace std;

bool isprime(int x) {
	if (x == 2) return true;
	if (!(x % 2) || x < 2) return false;

	int i = 3;
	double a = sqrt(x);

	while (i <= a) {
		if (x%i == 0) return false;
		i += 2;
	}
	return true;
}

int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	for (int &x : p)cin >> x;

	int cnt = 0;

	for (int x : p) {
		if (isprime(x)) {
			cnt++;
		}
	}
	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int m,d;
  int d1,d10;
  int count=0;
  
  cin >> m >> d;
  
  for (int i = 22; i <= d; i++){
    d1 = i%10; d10 = i/10%10;
    if(d1 >= 2 && d1*d10<=m){
      count ++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

		for(int i = 0; i < 10; i++) {
			array[i] = sc.nextInt();
		}

		Arrays.sort(array);

		for(int i = 9; i > 6; i--) {
			System.out.println(array[i]);
		}
	}
}

Measured memory_bytes: 26244
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#define log(args...)
#else
#define log(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); logf(_it, args); }
void logf(istream_iterator<string> it) {
}
template<typename T, typename ... Args>
void logf(istream_iterator<string> it, T a, Args ... args) {
	cout << *it << " = " << a << endl;
	logf(++it, args...);
}
#endif

#define forn(i,k,n) for(ll i=(k); i<(n); i++)

const double PI = acos(-1);
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

void solve() {
	cini(n);
	cini(m);
	if (n == m)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

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



Measured memory_bytes: 892
import sys
from collections import defaultdict as dd

#sys.stdin = open("third.txt","r")

def main():

	d = dd(int)
	for x in xrange(int(raw_input())):
		s = raw_input().rstrip()
		v = {i:0 for i in xrange(26)}
		for c in s:
			v[ord(c)-97]+= 1
		tu = ()
		for i in xrange(26):
			tu = tu + (v[i],)

		d[tu]+=	 1	

	ans = 0
	for k in d:
		ans+= (d[k]*(d[k]-1))/2

	print "%d"%ans

raw_input = sys.stdin.readline

if __name__ == '__main__':
	#for j in xrange(int(raw_input())):
	main()

Measured memory_bytes: 35660
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = [] ;count = 0 ;pro = 1
def ceil(x,y):
  return (x-1)//y+1
k=int(input())
X,Y=map(int,input().split())
sign = [1]*2
swapsign = 0
def redef(x,y):
  global swapsign
  if x < 0:
    x = -x; sign[0] = -1
  if y < 0:
    y = -y; sign[1] = -1
  if x < y:
    swapsign = 1; x,y = y,x
  return x,y
X,Y=redef(X,Y)
D=X+Y
# print(X,Y)
if (k % 2 == 0) and (D % 2 == 1):
  print(-1); exit()
elif k % 2 == D % 2:
  case = 0
elif (k % 2 == 1) and (D % 2 == 0):
  case = 1
x = y = 0
if case == 0:
  m=ceil(D,k)
  if k % 2 == 1 and D % 2 == 1 and D % k != 0:
    m += (ceil(D,k)+1) % 2
    m = max (m,3)
  elif D % k !=0:
    m = max(m,2)
else:
  T = ceil(D,k)%2
  m = ceil(D,k)+T
  # if D % k != 0 and T == 0:
  #   m += 2

l = (k*m-D)//2
while k <= l:
  x-=k; l-=k
  ans.append([x,y])
if l != 0:
  x+=k-l; y -= l;
  ans.append([x,y])

# print(ans)
# exit()

while (x,y) != (X,Y):
  s = min(k, X - x)
  x += s; y += k - s
  ans.append([x,y])
  # print(x,y)
  # if len (ans) == 10:
  #   exit()

print(len(ans))
for x,y in ans:
  if swapsign: x,y = y,x
  x*=sign[0]; y*=sign[1]
  print(x,y)

Measured memory_bytes: 71036
#include <iostream>

int main() {
	char a, b, c;
	std::cin >> a >> b >> c;
	if (a == 'A' && b == 'A' && c == 'A') std::cout << "No\n";
	else if (a == 'B' && b == 'B' && c == 'B') std::cout << "No\n";
	else std::cout << "Yes\n";
return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int64)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

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

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

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

template<typename T,T MOD,T B>
struct RollingHash{
  using ll = long long;
  vector<T> hash,po;
  RollingHash(){}
  RollingHash(vector<T> vs){init(vs);}
  RollingHash(string &s){
    vector<T> vs;
    for(char c:s) vs.emplace_back(c);
    init(vs);
  }
  void init(vector<T> vs){
    int n=vs.size();
    hash.assign(n+1,0);
    po.assign(n+1,1);
    for(int i=0;i<n;i++){
      hash[i+1]=((ll)hash[i]*B+vs[i])%MOD;
      po[i+1]=(ll)po[i]*B%MOD;
    }
  }
  //S[l, r)
  T find(int l,int r){
    T res=(ll)hash[r]+MOD-(ll)hash[l]*po[r-l]%MOD;
    return res>=MOD?res-MOD:res;
  }
};

int main(void) {
  vector<int> v(2);
  REP(i, 2) cin >> v[i];
  cout << 6 - v[0] - v[1] << endl;
}


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

int n, res;
int arr[10010];

int main(){
	int i;
	scanf("%d", &n);
	for(i = 0; i < n; i++) scanf("%d", &arr[i]);
	for(i = 1; i < n; i++){
		if(arr[i] == arr[i - 1]) res++, i++;
	}
	printf("%d", res);
	return 0;
}

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

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader buff = null;
		buff = new BufferedReader(new InputStreamReader(System.in));

		String[] box = buff.readLine().split("");
		int ans = 0;
		for(int i = 0; i < 3; ++i){
			if(box[i].equals("a")){
				ans += 4;
			} else if (box[i].equals("b")){
				ans += 2;
			} else if(box[i].equals("c")){
				ans += 1;
			}
		}

		if(ans == 7){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>


using namespace std;

ll max2val(ll a, ll b) {
    if (a > b) {
        return a;
    }
    else {
        return b;
    }
}

int main() {
 ll N,D;
 cin>>N;
 cin>>D;
 ll a,b;
 ll ans=0;
 rep(i,N){
  cin>>a>>b;
  if(sqrt((a*a+b*b))<=D)ans++;
 }
cout<<ans<<endl;
 }
 



Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll K,A,B;
	cin >> K >> A >> B;
	ll ans = 1;
	if(A-1>K){
		cout << 1+K << endl;
		return 0;
	}else{
		ans = A;
		K -= A-1;
	}

	if(B-A<=2){
		cout << ans+K << endl;
		return 0;
	}

	ans += (K/2)*(B-A);
	ans += K%2;

	cout << ans << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);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;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    deque<int> b;
    b.push_back(a[0]);
    repf(i,1,n) {
        int pos = lower_bound(b.begin(), b.end(), a[i]) - b.begin() - 1;
        if (pos == -1) b.push_front(a[i]);
        else b[pos] = a[i];
    }
    cout << b.size() << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(){
	int mt[10]={};
	int i,j;
	int temp;
	for(i=0;i<=9;i++){
		scanf("%d",&mt[i]);
	}
	for(i=0; i<10; i++){
	    for(j=10-1; j>i; j--){
			if(mt[j] < mt[j-1]){
	        temp = mt[j];
			mt[j] = mt[j-1];
		    mt[j-1] = temp;
			}
		}
    }
	printf("%d\n",mt[9]);
	printf("%d\n",mt[8]);
	printf("%d\n",mt[7]);
	
	return 0;
}

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

using namespace std;

const long long N=10000005;

vector<long long>v(N,1);

void f()
{
    for(long long i=2;i<N;i++){
        for(long long j=i;j<N;j+=i){
            ++v[j];
        }
    }
    for(long long i=2;i<N;i++){
        v[i]=v[i-1]+(i*v[i]);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    f();
    long long n;
    cin>>n;
    cout<<v[n]<<endl;
}


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

using namespace std;
#define ll long long int

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);	
	string s;
	cin >> s;
	string t;
	cin >> t;
	string b = t.substr(0,(int)s.size());
	if(b==s)cout << "Yes";
	else cout << "No";
}


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

class Dice{
    public:
    Dice(int t, int s, int e, int w, int n, int b){
        top = t;
        south = s;
        east = e;
        west = w;
        north = n;
        bottom = b;
    };

    int getTop(){return top;}
    int getSouth(){return south;}
    int getEast(){return east;}
    int getWest(){return west;}
    int getNorth(){return north;}
    int getBottom(){return bottom;}

    void rollNorth();
    void rollWest();
    void rollEast();
    void rollSouth();

    void rotateLeft();
    void rotateRight();
    
    bool compare(const Dice d);
    bool rotateAndCompare(const Dice d);
    
    bool operator==(const Dice &d);
    
    private:
    int top, south, east, west, north, bottom;
};

bool Dice::compare(Dice d){
    if(top == d.getTop() && south == d.getSouth() && east == d.getEast() && west == d.getWest() && north == d.getNorth() && bottom == d.getBottom()) return true;
    else return false;
}

bool Dice::rotateAndCompare(const Dice d){
    Dice tmp1(top, south, east, west, north, bottom);
    int i;
    
    for(i = 0; i < 4; i++){
    tmp1.rotateRight();
    if(tmp1.compare(d)) return true;
    }
    
    return false;
}

bool Dice::operator==(const Dice &d){
    Dice tmp1(top, south, east, west, north, bottom);
    
    if(tmp1.rotateAndCompare(d)) return true;
    
    tmp1.rollNorth();
    if(tmp1.rotateAndCompare(d)) return true;
    
    tmp1.rollWest();
    if(tmp1.rotateAndCompare(d)) return true;
    
    tmp1.rollWest();
    if(tmp1.rotateAndCompare(d)) return true;
    
    tmp1.rollWest();
    if(tmp1.rotateAndCompare(d)) return true;
    
    tmp1.rollNorth();
    if(tmp1.rotateAndCompare(d)) return true;
    
    return false;
}

void Dice::rollNorth(){
    int tmp;
    tmp = top;
    top = south;
    south = bottom;
    bottom = north;
    north = tmp;
}

void Dice::rollSouth(){
    int tmp;
    tmp = top;
    top = north;
    north = bottom;
    bottom = south;
    south = tmp;
}

void Dice::rollEast(){
    int tmp;
    tmp = top;
    top = west;
    west = bottom;
    bottom = east;
    east = tmp;
}

void Dice::rollWest(){
    int tmp;
    tmp = top;
    top = east;
    east = bottom;
    bottom = west;
    west = tmp;
}

void Dice::rotateLeft(){
    int tmp;
    tmp = north;
    north = east;
    east = south;
    south = west;
    west = tmp;
}

void Dice::rotateRight(){
    int tmp;
    tmp = north;
    north = west;
    west = south;
    south = east;
    east = tmp;
}

int main(void){
    int t, s, e, w, n, b;
    
    cin >> t >> s >> e >> w >> n >> b;
    Dice dice1(t, s, e, w, n, b);
    
    cin >> t >> s >> e >> w >> n >> b;
    Dice dice2(t, s, e, w, n, b);
    
    char op;
    while(cin.get(op)){
        switch(op){
            case 'N':
            dice1.rollNorth(); break;
            case 'E':
            dice1.rollEast(); break;
            case 'W':
            dice1.rollWest(); break;
            case 'S':
            dice1.rollSouth(); break;

            default: break;
        }
    }
    
    if(dice1 == dice2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3104
'use strict'
function main(input) {
	let words = input;
  	let even = "";
  	for(let i = 0; i < input.length; i++) {
    	if(i % 2 === 1) {
        	continue;
        }else{
          even += words[i];
        }
    }
     console.log(even);
}
main(require("fs").readFileSync("/dev/stdin","utf8"))

Measured memory_bytes: 15180
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define Cout(s) cout << s << endl;
using ll = long long;
using P = pair<int, int>;

const ll INF = 1ll << 60;
ll MOD = 1e9 + 7;

int main()
{

    ll a, b, c, d, e;
    ll n;
    cin >> n;
    //vector<ll> a(5);
    cin >> a >> b >> c >> d >> e;
    ll mini = min({a, b, c, d, e});
    ll ans = (n + mini - 1) / mini + 4;
    Cout(ans);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define mem(x,y) for(int i=0;i<x.size()i++){ x[i]=y; }
#define fo(i, l, r)  for((i) = (l); (i) < (r); (i)++)
#define fok(i,r,k)  for((i) = 0; (i) < (r); (i)=i+(k))
#define mp make_pair
#define pb push_back
#define pi pair<int,int> 
#define pll pair<long long,long long>
#define vi vector<int> 
#define vl vector<long long>
#define vpl vector<pair<long long,long long>> 
#define vpi vector<pair<int,int>> 
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define br cout<<endl;
#define io { freopen("input.txt","r",stdin);  freopen("output.txt","w",stdout); }
ll modexpo(ll x,ll y,ll m){    x=x%m;if(y==0){return 1;}if(y%2==0){return modexpo(x*x,y/2,m); }else{    return  (x*modexpo(x*x,y/2,m))%m; }}
const int mod  = 1e9+7;
const int maxn = 1e5 + 10;

int func(int n)
{
int cnt=0;
while(n%2==0){n=n/2;cnt++;}
return cnt;
}
int n,a[maxn];
int main()
{
fastio; 

int i,j;
cin>>n;
int ans=0;
fo(i,0,n){cin>>a[i];}
fo(i,0,n){ans+=func(a[i]);}
cout<<ans; 
return 0;
}
//g++ -g c.cpp -o c.exe

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int a,v,b,w,t,t1,t2;
    long double ans;
    cin>>a>>v;
    cin>>b>>w;
    cin>>t;
    if(v-w>0){
    t1=abs(b-a);
    t2=v-w;
    ans=(double)t1/t2;
    }
    else{
        cout<<"NO";
        return 0;
    }
    
    if(ans<=t)
    cout<<"YES";
    else
    cout<<"NO";
    return 0;
}

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

int main()
{
	int n;
	long long int temp,*a;
	long long int sum=0;
	cin>>n;
	a=new long long int[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	sum-=2*a[0];
	temp=abs(sum);
	for(int i=1;i<n-1;i++)
	{
		sum-=2*a[i];
		if(temp>abs(sum))
			temp=abs(sum);
		}
	cout<<temp;
	return 0;
 }
  

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

int main(){
    string s;
    cin >> s;
    reverse(s.begin(), s.end());

    vector<string> v = {"dream", "dreamer", "erase", "eraser"};
    for(int i=0; i<v.size(); i++) reverse(v[i].begin(), v[i].end());
    string t = "";
    for(int i=0; i<s.size(); i++){
        for(int j=0; j<v.size(); j++){
            int sz = v[j].size();
            if((s.substr(i, sz)).size() < v[j].size()) continue;
            if(s.substr(i, sz) == v[j]){
                i += sz - 1;
                t += v[j];
                break;
            }
        }
    }

    if(s == t) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
 
int main() {
 
  int long long t=0,i=0,j=0,N;
  int long long ans=0,max=0;

  cin >> N;
  vector<int> A(N);

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

  for ( i = 0; i < N; i++)
  {
    if (max>A[i])
    {
      ans+=max-A[i];
    }
    if (max<A[i])
    {
      max=A[i];
    }
    
    
  }
  
  
  
  cout << ans << endl;
  
  return 0;
}

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

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

    int s[N];
    int x[N];
    for (int i = 0; i < N; ++i) {
        std::cin >> x[i];
        s[i] = x[i];
    }

    std::sort(s, s + N);

    const int m1 = s[(N - 1) / 2]; 
    const int m2 = s[N / 2]; 
    for (int i = 0; i < N; ++i) {
        if (x[i] <= m1) {
             std::cout << m2 << std::endl;
        } else {
             std::cout << m1 << std::endl;
        }
    }

    return 0;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}

struct Edge{
    int from;
    int to;
    ll  cost;

    Edge(int a, int b, ll c) : from(a), to(b), cost(c) {}
};

struct Graph{
    int N;
    vector<vector<Edge>> edges;
    vector<int> deg;

    Graph(int n) : N(n), edges(n), deg(n, 0) {}

    void connect(int a, int b, ll c){
        edges[a].emplace_back(Edge(a, b, c));
        deg[b]++;
    }

    bool isAcyclic(){
        static vector<int> status(N, 0);
        for(int i=0; i<N; i++){
            if(!isAcyclicDfs(status, i)) return false;
        }
        return true;
    }

    bool isAcyclicDfs(vector<int>& status, int v){
        status[v] = 1;
        for(auto e : edges[v]){
            if(status[e.to] == 1){
                return false;
            }else if(status[e.to] == 0){
                if(!isAcyclicDfs(status, e.to)){
                    return false;
                }
            }
        }
        status[v] = 2;
        return true;
    }

    int criticalLength(){
        vector<int> source;
        for(int i=0; i<N; i++){
            if(deg[i] == 0) source.push_back(i);
        }

        int cnt = 1;

        while(true){
            vector<int> v;
            for(int s : source){
                for(auto e : edges[s]){
                    deg[e.to]--;
                    if(deg[e.to] == 0){
                        v.push_back(e.to);
                    }
                }
            }
            if(v.empty()) break;
            source = v;
            cnt++;
        }
        return cnt;
    }
};

signed main(){
    int n;
    cin >> n;
    Graph G(n*n);
    REP(i, n){
        vector<int> v(n-1);
        REP(j, n-1){
            int a;
            cin >> a;
            v[j] = a - 1;
        }
        REP(j, n-2){
            int x1 = max(i, v[j]), y1 = min(i, v[j]);
            int x2 = max(i, v[j+1]), y2 = min(i, v[j+1]);
            G.connect(x1*n + y1, x2*n + y2, 1);
        }
    }

    if(!G.isAcyclic()){
        cout << -1 << endl;
        return 0;
    }

    cout << G.criticalLength() << endl;


    return 0;
}


Measured memory_bytes: 58868
A, B, Q = gets.split.map(&:to_i)
s_list = A.times.map { gets.to_i }
t_list = B.times.map { gets.to_i }
x_list = Q.times.map { gets.to_i }

MAX = 1 << 60

x_list.each do |x|
  si = s_list.bsearch_index do |s|
    s >= x
  end
  ti = t_list.bsearch_index do |t|
    t >= x
  end
  s_candidates = []
  t_candidates = []
  if si && ti
    s_candidates.push(s_list[si])
    t_candidates.push(t_list[ti])
    s_candidates.push(s_list[si - 1]) if si > 0
    t_candidates.push(t_list[ti - 1]) if ti > 0
  elsif si
    s_candidates.push(s_list[si])
    t_candidates.push(t_list[-1])
    s_candidates.push(s_list[si - 1]) if si > 0
  elsif ti
    s_candidates.push(s_list[-1])
    t_candidates.push(t_list[ti])
    t_candidates.push(t_list[ti - 1]) if ti > 0
  else
    s_candidates.push(s_list[-1])
    t_candidates.push(t_list[-1])
  end
  ans = MAX
  s_candidates.each do |s|
    t_candidates.each do |t|
      n = (s - t).abs + [(x - s).abs, (x - t).abs].min
      ans = n if n < ans
    end
  end
  puts ans
end


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

int main() {
    int d, m, y;
    scanf("%d/%d/%d", &y, &m, &d);
    if(y > 2019)
    {
        cout << "TBD";
    }
    else
    {
        if(m > 4)
        {
            cout << "TBD";
        }
        else
        {
            cout << "Heisei";
        }
    }
    
    return 0;
}

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

using namespace std;

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

    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x % 2 == 0 && (x % 3 != 0 && x % 5 != 0)) {
            cout << "DENIED\n";
            return 0;
        }
    }
    cout << "APPROVED\n";
}


Measured memory_bytes: 256
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_asc(const void* a, const void* b) {
    return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_i64_asc(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_i64_desc(const void* a, const void* b) {
    return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}

int compare_c_asc(const void* a, const void* b) {
    return *((char*)a) < *((char*)b) ? -1 : 1;
}

int compare_c_desc(const void* a, const void* b) {
    return *((char*)a) > * ((char*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

#define MOD_VAL ((size_t)1000000007)

static size_t dp[2001][2001];

int main(void) {
    size_t N, K;

    scanf("%zu %zu", &N, &K);

    for (size_t i = 0; i <= N; i++) {
        for (size_t j = 0; j <= N; j++) {
            if (j == 0 || j == i) {
                dp[i][j] = 1;
            }
            else if (i < j) {
                dp[i][j] = 0;
            }
            else {
                dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % MOD_VAL;
            }
        }
    }

    for (size_t i = 1; i <= K; i++) {
        printf("%zu\n", (size_t)((uint64_t)(dp[N - K + 1][i]) * (uint64_t)(dp[K - 1][i - 1]) % MOD_VAL));
    }

    return 0;
}


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

int main(){
    int n,k;
    cin >> n >> k;
    vector <int> a(n);
    for(int i = 0; i<n; i++){
        int h;
        cin >> h;
        a.at(i) = h;
    }
    sort(a.begin(), a.end());
    int min = 1e9;
    for(int j = k-1; j < n; j++){
        if(a.at(j) - a.at(j-k+1) < min){
            min = a.at(j) - a.at(j-k+1);
        }
    }
    cout << min << endl;
}


Measured memory_bytes: 640
import collections
import sys
from functools import lru_cache
sys.setrecursionlimit(int(10**9))
n, m  = [int(i) for i in input().strip().split(' ')] 
edges = collections.defaultdict(list)
for i in range(m):
    s,d = [int(i) for i in input().strip().split(' ')]
    edges[s-1].append(d-1) 
# dp = [-1]*n
maxPath = 0 
@lru_cache(None)
def dfs(node): 
    ans = 0 
    for i in edges[node]:
        ans = max(ans,dfs(i)+1)
    return ans

for i in range(n):
    maxPath = max(dfs(i), maxPath) 
print(maxPath)


Measured memory_bytes: 91140
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string>
int main()
{
    int n,i;
    scanf("%d",&n);getchar();
    char a[100005];
    for(i=1;i<=n;i++)
        scanf("%c",&a[i]);
    int k;
    scanf("%d",&k);
    for(i=1;i<=n;i++)
    {
        if(a[i]!=a[k])
            a[i]='*';
    }
    for(i=1;i<=n;i++)
        printf("%c",a[i]);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;


ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
bool root(string s){
    int n=s.length();
    if(n==2){
        if(s[0]==s[1]){
            return true;
        }
        else return false;
    }
    if(n==3){
        if(s[0]==s[2]){
            return true;
        }
        else return false;
    }
 
    return false;
}
 
 
//深さ優先
vector<int> seen;
vector<ll> h;
 
//普通の深さ優先探索seenを返す感じ
void dfs(const Graph &G,int v){

    seen[v] = 0; //v探索済み
 
    P good=make_pair(v,h[v]);
    for(auto next_v :G[v]){
        if(seen[next_v]!=-1) continue;//もう探索していた
        if(h[next_v]>good.second){
            good=make_pair(next_v,h[next_v]);
        }
        dfs(G,next_v);
    }
 
    if(!(h[v]==good.second && v==good.first)){
        seen[good.first]=1;
    }
}


int n;

void dfs(string s, char mx){
    if(s.length()==n){
        cout<<s<<endl;
    }else{
        for(char c='a';c<=mx;c++){
            dfs(s+c,((c==mx) ? (char)(mx+1) : mx));
        }
    }
}

signed main(){
    string s,t;
    cin>>s>>t;
    int n=s.length();

    if(s+t[n] == t){
        cout<<"Yes"<<endl;

    }else{
        cout<<"No"<<endl;
    }
}  

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

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define REV(i,j,k) for(int i=j;i>=k;i--)
#define FORR(i,j,k,l) for(int i=j;i<=k;i+=l)
#define inf         freopen("in.txt", "r", stdin)
#define outf        freopen("out.txt", "w", stdout)
#define pf          printf
#define sf(n)       scanf("%d", &n)
#define sff(a,b)    scanf("%d %d", &a, &b)
#define sfff(a,b,c)    scanf("%d %d %d", &a, &b, &c)
#define clean(mat,n)   FOR(i,0,n) mat[i].clear()
#define minn          (long long)-1000000000000000000
#define maxx          (long long) 1000000000000000000
#define mod          998244353
#define M_PI           3.14159265358979323846  /* pi */
#define LL           long long
#define NL '\n'
#define cnd tree[idx]
#define lnd (idx<<1)
#define rnd ((idx<<1)+1)
#define PB push_back
#define F first
#define S second
#define MAX 16
#define MP make_pair
#define valid(nx,ny)  ((nx >= 0) && (nx < row) && (ny >= 0) && (ny < col))
#define LD long double
typedef pair<int,int> PR;

LL dp[(1<<MAX) + 5], val[(1<<MAX) + 5], mat[MAX][MAX];
int n, gigi;

int main()
{
    ios::sync_with_stdio(false);
    //inf;
    //outf;

    cin >> n;

    FOR(i,0,n-1)
        FOR(j,0,n-1)
            cin >> mat[i][j];

    for(int mask = 0; mask < (1<<n); mask++)
    {
        FOR(i,0,n-1)
            FOR(j,i+1,n-1)
                if(mask & (1<<i) && mask & (1<<j))
                    val[mask] += mat[i][j];
    }

    for(int mask = 0; mask < (1<<n); mask++)
    {
        for(int submask = mask; submask > 0; submask = (submask - 1) & mask)
        {
            gigi = mask ^ submask;
            dp[mask] = max(dp[mask], dp[gigi] + val[submask]);
        }
    }

    cout << dp[(1<<n) - 1] << endl;

    return 0;
}




Measured memory_bytes: 1280
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long 

int main(int argc, char const *argv[]){
	int x,a,b;
	scanf("%d%d%d",&x,&a,&b);
	if(abs(x - a) < abs(x - b))	puts("A");
	else puts("B");
	return 0;
}


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

maxA = max(a)
dp = [0]*(maxA+1)
count = 0

for e in a:
    for i in range(e,maxA+1,e):
        dp[i] += 1

for e in a:
    if dp[e] == 1:
        count += 1

print(count)


Measured memory_bytes: 121872
N = int(input())
D = {}
SUM = 0

for n in range(N):
  s = input()
  l = sorted(s)
  l = ''.join(l)
  
  if l in D:
    SUM = SUM + D[l]
    D[l] = D[l] + 1
  else:
    D[l] = 1
  
print(SUM)

Measured memory_bytes: 17892
import queue
q = queue.Queue()
exetime = 0

n, quantum = map(int, input().split())
for i in range(n):
    q.put(tuple(input().split())) # tupleで渡す

while not q.empty():
    process = q.get()
    #print(process)
    time = int(process[1])
    if time > quantum:
        exetime += quantum
        q.put((process[0], time - quantum))
    else:
        exetime += time
        print(process[0], exetime)


Measured memory_bytes: 13640
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N,K = map(int,readline().split())
A = np.array(readline().split(),np.int64)
F = np.array(readline().split(),np.int64)

A.sort(); F.sort(); F=F[::-1]

Asum = A.sum()

def test(x):
    # 全員がx秒以下に収めるための必要コストがK以下である
    return Asum - np.minimum(A,x//F).sum() <= K

left = -1 # 不可能目標
right = 10**13 # 可能目標
while left+1 < right:
    mid = (left+right)//2
    if test(mid):
        right = mid
    else:
        left = mid

answer = right
print(answer)

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

int main(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  if(c==a+1 || (a==12 && c==1 )){
    cout<<1;
  }else{
    cout<<0;
  }
}


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

int main(){
 int k,s;
 cin >> k >> s;
 int count = 0;
 for(int x=0;x<k+1;x++){
     for(int y=0;y<k+1;y++){
             int z;
             z = s-x-y;
             if(0<=z && z<=k) count++;
     }
 }
 cout << count << endl;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

constexpr int inf = 1e9 + 7;
constexpr ll inf_ll = 1e18L + 7;

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

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

void add_it(int& a, int b) {
  a += b;
  if (a >= inf) a -= inf;
}

void sub_it(int& a, int b) {
  a -= b;
  if (a < 0) a += inf;
}

int main() {
  int n, K;
  scanf("%d %d", &n, &K);
  std::vector<int> A(n);
  for (int& a : A) scanf("%d", &a);

  // Two dimentional solution.
  // dp(child, k) <---  number of ways to distribute k candies among first i
  // childs...
  // vector<vector<int>> dp(n + 1, vector<int>(K + 1, 0));
  // dp[0][0] = 1;
  // for (int child = 1; child <= n; ++child) {
  //   for (int k = K; k >= 0; --k) {
  //     // ith child  can receive at [0, a] candies.
  //     for (int a = 0; a <= A[child - 1]; ++a)
  //       if (k - a >= 0) dp[child][k] += dp[child - 1][k - a];
  //   }
  // }
  // cout << dp[n][K] << endl;

  // One dimentional transformation pay attention to a = 0 to a = 1.
  // vector<int> dp(K + 1, 0);
  // dp[0] = 1;
  // for (int i = 0; i < n; ++i)
  //   for (int k = K; k >= 0; --k)
  //     for (int a = 1; a <= min(A[i], K - k); ++a) dp[k + a] += dp[k];
  // cout << dp[K];

  vector<int> dp(K + 1, 0);
  dp[0] = 1;
  for (int i = 0; i < n; ++i) {
    vector<int> fake(K + 1, 0);
    for (int k = K; k >= 0; --k) {
      int v = dp[k];
      int L = k+1;
      int R = k + min(A[i], K - k);
      if (L <= R) {
        add_it(fake[L], v);
        if (R+1 <= K)
          sub_it(fake[R+1], v);
      }
    }

    int pref = 0;
    for (int k=0; k<=K; ++k) {
      add_it(pref, fake[k]);
      add_it(dp[k], pref);
    } 
  }
  cout << dp[K] << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
  int A,B,C;
  scanf("%d %d %d", &A, &B, &C);

  if(A==B && B==C && C==A)
  {
    printf("No");
  }
  else if(A==B || B==C || C==A){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1696
N=int(input())

nums=[]
for _ in range(N):
    nums.append(list(map(int, input().split())))

dp = [[0 for _ in range(3)] for _ in range(N)]


for i in range(N):
    a,b,c=nums[i]
    dp[i][0]=max(dp[i-1][1]+a,dp[i-1][2]+a)
    dp[i][1]=max(dp[i-1][0]+b,dp[i-1][2]+b)
    dp[i][2]=max(dp[i-1][0]+c,dp[i-1][1]+c)
num = max(dp[-1])
if N==1:
    num = max(nums[0])
print(num)


Measured memory_bytes: 50052
#include <iostream>
#include <math.h>

using namespace std;
int main(){
    int i,count;
    string S,T;
   
    cin >> S;
    cin >> T;

    for(i=0;i<3;i++){
        if(S[i] == T[i]){
            count++;
        }
    }

    cout << count << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n;
char c[60],d[60];
ll p=0,sum=1;
int main(){
	cin>>n;
	cin>>c>>d;
	for(ll i=0; i<n; i++){
		if(c[i]==c[i+1]){
			if(!p) sum*=6;
			else if(p==1) sum*=2;
			else sum*=3;
			p=2;
			i++;
			sum%=1000000007;
		}
		else{
			if(!p) sum*=3;
			else if(p==1) sum*=2;
			else sum*=1;
			p=1;
			sum%=1000000007;
		}
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll INFl = 1e18;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int k; cin >> k;
	string s; cin >> s;
	string ans = "";
	for (int i = 0; i < min((int)s.size(), k); i ++) {
		ans += s[i];
	}
	if (s.size() > k) {
		ans += "...";
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3660
sx, sy, tx, ty = list(map(int, input().split()))
x = tx - sx
y = ty - sy

ans = ''
ans += x * 'R'
ans += y * 'U'
ans += x * 'L'
ans += y * 'D'
# 2
x += 1
y += 1
ans += 'D'
ans += x * 'R'
ans += y * 'U'
ans += 'LU'
ans += x * 'L'
ans += y * 'D'
ans += 'R'

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i=0; i<n; ++i)
using ll = long long;

int main() {
    char s;
    cin >> s;
    if (isupper(s)) cout << 'A' << endl;
    else cout << 'a' << endl;
}


Measured memory_bytes: 3628
#include<stdio.h>
int main(){
    int A[10000];
    int n,i,x,j,cnt=0;
    scanf("%d",&n);
    for(i=0;i<10000;i++){
        A[i]=0;
    }
    for(i=0;i<n;i++){
        scanf("%d",&x);
        A[x]++;
    }
    for(i=0;i<10000;i++){
        for(j=0;j<A[i];j++){
            printf("%d",i);
            if(cnt<n-1){
                printf(" ");
                cnt++;
            }
        }
    }
    printf("\n");
    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REP2(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
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; }
typedef long long ll;

int main() {
    vector<int> vec1(5);
    vector<int> vec2(5);
    rep(i, 5) cin >> vec1[i];
    for(int i = 0; i < 5; i++){
        if(vec1[i] % 10 == 0) vec2[i] = vec1[i];
        else vec2[i] = (vec1[i] / 10 + 1) * 10;
    }

    int m = 0;
    rep(i, 5){
        int tmp = vec2[i] - vec1[i];
        m = max(m, tmp);
    }

    int sum = 0;
    rep(i, 5) sum += vec2[i];
    OP(sum - m);
}


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

typedef long long ll;

void printArray(vector<int> arr) {
	for (int a: arr) cout << a << " ";
	cout << '\n';
}


int main() {
	std::ios_base::sync_with_stdio(false);
	int n,k;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i<n; i++) cin >> p[i];
	sort(p.begin(), p.end());
	int ret = 0;
	for (int i = 0; i<k; i++) ret += p[i];
	cout << ret << '\n';
}



Measured memory_bytes: 3664
N = int(input())
x = 0

for i in range(1, N+1):
    if i%3==0:
        print(' %d'%i, end="")
    else:
        x = i
        while (x):
            if x%10==3:
                print(" %d"%i, end="")
                break
            x //= 10
print()


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


int main(void){
  int a,b,c;
  cin>>a>>b>>c;
  if(b-a==c-b)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  char c = 'A';
  char d = 'B';
  char e = 'C';
  int a;
  scanf("%d",&a);
  if(a<1000){
    printf("%c%c%c",c,d,e);
  } else if (a >= 1000){
    printf("%c%c%c",c,d,e+1);
  } else {
    return 1;
  }
  return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long large = a < b ? b : a;
    long small = a < b ? a : b;
    while (large % small > 0) {
      long temp = small;
      small = large % small;
      large = temp;
    }
    System.out.println(a * b / small);
  }
}

Measured memory_bytes: 23252
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Fri Jan 25 20:32:42 2019
//
package main

import (
	"fmt"
	"sort"
)

type cake struct {
	x, y, z int
}

func (c cake) val() int {
	return c.x + c.y + c.z
}

type cakes []cake

func (cs cakes) Len() int {
	return len(cs)
}

func (cs cakes) Swap(i, j int) {
	cs[i], cs[j] = cs[j], cs[i]
}

func (cs cakes) Less(i, j int) bool {
	return cs[i].val() > cs[j].val()
}

func max(slice ...int) int {
	sort.Ints(slice)
	return slice[len(slice)-1]
}

var N, M int

func main() {
	fmt.Scan(&N, &M)

	cs := [8]cakes{}
	for i := range cs {
		cs[i] = make(cakes, N)
	}

	for i := 0; i < N; i++ {
		var x, y, z int
		fmt.Scan(&x, &y, &z)
		cs[0][i] = cake{x: x, y: y, z: z}
		cs[1][i] = cake{x: x, y: y, z: -z}
		cs[2][i] = cake{x: x, y: -y, z: z}
		cs[3][i] = cake{x: x, y: -y, z: -z}
		cs[4][i] = cake{x: -x, y: y, z: z}
		cs[5][i] = cake{x: -x, y: y, z: -z}
		cs[6][i] = cake{x: -x, y: -y, z: z}
		cs[7][i] = cake{x: -x, y: -y, z: -z}
	}

	ans := 0
	for i := range cs {
		sort.Sort(cs[i])
		sum := 0
		for j := 0; j < M; j++ {
			sum += cs[i][j].val()
		}
		ans = max(ans, sum)
	}

	fmt.Println(ans)
}


Measured memory_bytes: 768
#include <iostream>

using namespace std;

int main(){
    // Your code here!
    int n;
    cin>>n;
    int A[5][4][11];
    
    //初期化
    for(int i=0; i<5; i++){
        for(int j=0; j<4; j++){
            for(int k=0; k<11; k++){
                A[i][j][k]=0;
            }
        }
    }
    
    for(int i=0; i<n; i++){
        int b,f,r,v;
        cin>>b>>f>>r>>v;
        A[b][f][r]+=v;
    }
    
    
    for(int i=1; i<=4; i++){
        for(int j=1; j<=3; j++){
            for(int k=1; k<=10; k++){
                if(k!=10){
                    cout<<" "<<A[i][j][k];
                }
                else{
                    cout<<" "<<A[i][j][k]<<endl;
                }
            }
        }
        if(i!=4){
            cout<<"####################"<<endl;
        }
        
    }
    
    return 0;
}



Measured memory_bytes: 3116
#include<iostream>
using namespace std;
int main(){
    int m, f, r;
    cin >> m >> f >> r;
    while(m != -1||f != -1||r != -1){
        if(m == -1||f == -1){
            cout << "F" << endl; 
        }
        else if(m+f >= 80){
            cout << "A" << endl;
        }
        else if(m+f >= 65){
            cout << "B" << endl; 
        }
        else if(m+f >= 50){
            cout << "C" << endl;
        }
        else if(m+f >= 30){
            if(r >= 50){
                cout << "C" << endl;
            }
            else{
                cout << "D" << endl;
            }
        }
        else {
            cout << "F" << endl;
        }
        cin >> m >> f >> r;
    }
    return 0;
}


Measured memory_bytes: 3092
<?php
  for($i=0;$i<10;$i++){
  	fscanf(STDIN,"%d",$var[]);
  }
  rsort($var);
  //fscanf(STDIN,"%d",$r);
  print $var[0]."\n";
  print $var[1]."\n";
  print $var[2]."\n";
  ?>

Measured memory_bytes: 6548
#!python3

# input
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))


def main():
    s = N - K
    k = K - 1
    ans = 1
    ans += s // k
    if s % k != 0:
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14008