akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.StringTokenizer;

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

        long n = in.nextInt();
        long m = in.nextInt();

        if (n == 1 && m == 1) {
            out.println(1);
        } else if (n == 1) {
            out.println(m - 2);
        } else if (m == 1) {
            out.println(n - 2);
        } else {
            out.println((n - 2) * (m - 2));
        }


        out.close();
        //INT OVERFLOW -> USE LONG
        //ARR OUT OF BOUNDS
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

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

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

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

        public double[] nextDoubleArray(int n) {
            double[] arr = new double[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextDouble();
            }
            return arr;
        }

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

        public char[] nextCharArray(int n) {
            char[] arr = nextLine().trim().replaceAll("\\s", "").toCharArray();
            return arr;
        }

        public String[] nextStringArray(int n) {
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = next();
            }
            return arr;
        }
    }
}


Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
}

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

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

    int n, x;
    cin >> n >> x;
    vector<int> vec(n);
    for (int i = 0; i < n; i++) cin >> vec[i];
    int res = 1;
    int d = 0;
    for (int i = 0; i < n; i++) {
        d += vec[i];
        if (x < d) break;
        res++;
    }
    cout << res << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,a[100005],qs[100005],cnt1=0,cnt2=0,kmp1=0,kmp2=0;
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(int i=1;i<=n;i++)
	{
		qs[i]=qs[i-1]+a[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(i%2==1)
		{
			if(qs[i]+kmp1<=0)
			{
				cnt1+=(1-qs[i]-kmp1);
				kmp1+=(1-qs[i]-kmp1);
			}
		}else
		{
			if(qs[i]+kmp1>=0)
			{
				cnt1+=(qs[i]+kmp1+1);
				kmp1-=(qs[i]+kmp1+1);
			}
		}
		//printf("%lld ",kmp1);
	}
	//printf("\n");
	for(int i=1;i<=n;i++)
	{
		if(i%2==0)
		{
			if(qs[i]+kmp2<=0)
			{
				cnt2+=(1-qs[i]-kmp2);
				kmp2+=(1-qs[i]-kmp2);
			}
		}else
		{
			if(qs[i]+kmp2>=0)
			{
				cnt2+=(qs[i]+kmp2+1);
				kmp2-=(qs[i]+kmp2+1);
			}
		}
	}
	//printf("%lld %lld\n",cnt1,cnt2);
	printf("%lld\n",min(cnt1,cnt2));
}

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

using namespace std;

inline int f(int n, int i, int L, const vector<int>& sum_rev){
    return (sum_rev[i - n] - sum_rev[i]) + L * (n - 1);
}

int dp[50010];
int sum_dp[50010];

int main(){
    int W, N;
    while(cin >> W >> N && N){
        vector<int> x(N);
        REP(i, N) cin >> x[i];

        vector<int> sum_rev(N + 1);
        sum_rev[N] = 0;
        for(int i = N - 1; i >= 0; i--){
            sum_rev[i] = sum_rev[i + 1] + x[i];
        }

        int lb_L = 0, ub_L = W; // ub
        while(ub_L - lb_L > 1){
            int L = (lb_L + ub_L) / 2;
            dp[0] = 1;
            dp[1] = 0;
            sum_dp[1] = 1;
            sum_dp[2] = 1;

            for(int i = 2; i < N; i++){
                dp[i] = 0;
                sum_dp[i] = sum_dp[i - 1] + dp[i - 1];
 
                int lb = 1, ub = min(i, (W + L)/(L + 1) + 1); // ub  true ??
                while(ub - lb > 1){
                    int n = (ub + lb) / 2;
                    if(f(n, i, L, sum_rev) >= W){
                        ub = n;
                    }else{
                        lb = n;
                    }
                }
                int begin_n = ub;

                //printf("dp[%d] : begin %d \n", i, begin_n);
                if(f(begin_n, i, L, sum_rev) < W){
                    continue;
                }

                lb = begin_n, ub = min(i + 1, W + 2); // lb
                while(ub - lb > 1){
                    int n = (ub + lb) / 2;
                    if(f(n, i, 1, sum_rev) <= W){
                        lb = n;
                    }else{
                        ub = n;
                    }
                }
                int end_n = lb; 

                //printf("dp[%d] : end %d \n", i, end_n);
                if(f(end_n, i, 1, sum_rev) > W) {
                    continue;
                }

                int begin = i - end_n;
                int end = i - begin_n;
                // [begin, end]
                if(sum_dp[end + 1] - sum_dp[begin] > 0){
                    dp[i] = 1;
                }
                //printf("dp[%d] : [dp[%d], dp[%d]] (%d) -> %d\n", i, begin, end, sum_dp[end + 1] - sum_dp[begin], dp[i]);
            }

            bool ok = false;
            for(int n = 1; n <= N && (n - 1) + sum_rev[N - n] <= W; n++) {
                //printf("n - 1 + sum_rev[%d] = %d\n", i, n - 1 + sum_rev[i]);
                if(dp[N - n]){
                    ok = true;
                    break;
                }
            }
            //printf("L %d  is %d\n", L, ok);

            if(ok){
                ub_L = L;
            }else{
                lb_L = L;
            }
        }

        cout << ub_L << endl;
    }
    return 0;
}

Measured memory_bytes: 1836
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(a: int, b: int, c: int):
    if c-a-b <=0:
        print(NO)
        return
    ab = a*b*4
    r = (c-a-b)**2
    print(YES if ab < r else NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    c = int(next(tokens))  # type: int
    solve(a, b, c)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const int maxn = 1e5 + 5 ;
int n ;
ll m ;
ll a[maxn] ;
ll cal(ll x , ll y)
{
	return x * y / __gcd(x , y) ;
}
bool ok(ll x)
{
	if(x > m)  return 0 ;
	for(int i = 1 ; i <= n ; i ++)
	  if((x - a[i] / 2) % a[i] != 0)  return 0 ;
	return 1 ;
}
int main()
{
	scanf("%d%lld" , &n , &m) ;
	for(int i = 1 ; i <= n ; i ++)
	  scanf("%lld" , &a[i]) ;
	sort(a + 1 , a + n + 1) ;
    ll lcm = a[1] ;
	bool flag = 1 ;
	for(int i = 2 ; i <= n ; i ++)
	{
	   if(a[i] == a[i - 1])  continue ;
	   lcm = cal(lcm , a[i]) ;
	   if(lcm / 2 > m){flag = 0 ; break ;}
	}	
	ll x = lcm / 2 ;
	if(ok(x) && flag)
	{
		ll ans = 0 ;
		ans ++ ;
		ans += (m - x) / lcm ;
		printf("%lld\n" , ans) ;
	}
	else  printf("0\n") ;
	return 0 ;
}

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

int main(){
    int r, g, b, k;
    int rx, gx, bx;
    string ans = "No";

    cin >> r >> g >> b >> k;

    for (int i = 0; i < k; i++){
        rx = r * std::pow(2, i);
        for (int j = 0; j < k - i; j++){
            gx = g * std::pow(2, j);
            bx = b * std::pow(2, k-i-j);

            if (rx < gx && gx < bx){
                ans = "Yes";
            }
        }
    }


    cout << ans << endl;
}

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

A_dic = dict()
for i in range(N):
    if A[i] in A_dic:
        A_dic[A[i]] += 1
    else:
        A_dic[A[i]] = 1
        
max_key = 0
sub_max_key = 0
for k, v in A_dic.items():
    if v <= 1:
        pass
    elif v <= 3:
        if k > max_key:
            sub_max_key = max_key
            max_key = k
        elif k > sub_max_key:
            sub_max_key = k
    else:
        if k > max_key:
            sub_max_key = k
            max_key = k
            
print(max_key * sub_max_key)

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

int main(){
  string A,B,C;
  cin>>A>>B>>C;
  if(A[A.size()-1]==B[0]){
    if(B[B.size()-1]==C[0])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  else cout<<"NO"<<endl;
    
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;
using ll=long long;

ll gcd(int a,int b){
  if(!(a%b))return b;
  else return gcd(b,a%b);
}

ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}


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

Measured memory_bytes: 256
A, B, C, X, Y = gets.split.map(&:to_i)

ans = 1 << 60
(0..([X, Y].max * 2)).each do |c|
  sum = c * C
  sum += A * ([X - c / 2, 0].max)
  sum += B * ([Y - c / 2, 0].max)
  ans = sum if sum < ans
end
puts ans

Measured memory_bytes: 1788
#include <stdio.h>

int main(void)
{
	int n1, n2;
	char op;
	int res;
	
	scanf("%d %c %d", &n1, &op, &n2);
	
	if (op == '+'){
		res = n1 + n2;
	} else if (op == '-'){
	 	res = n1 - n2;
	}
	
	printf("%d\n", res);
	
	return (0);
}

Measured memory_bytes: 128
line = function()
	local t = {}
	string.gsub(io.read(),"(%S+)", function (v) table.insert(t,tonumber(v)) end)
	return t[1], t[2]
end

N, M = line()

ans = {}

for i=1, N do
	ans[i] = 0	
end

for i = 1, M do
	a, b = line()
	ans[a] = ans[a] + 1
	ans[b] = ans[b] + 1
end

for i = 1, N do
	print(ans[i])	
end

Measured memory_bytes: 760
$N = <STDIN>+0;
@A=split " ",<STDIN>;


$max=$A[0];$min=$A[0];$maxi=0;$mini=0;
for($i=1;$i<=$#A;$i++){
	if($max<$A[$i]) { $max=$A[$i];$maxi=$i; }
	if($min>$A[$i]) { $min=$A[$i];$mini=$i; }
}

$,=" ";
$\="\n";
$k=0;

if($max*$min<0) {
	print $#A*2;
	if($max>=-$min) {
		for($i=0;$i<=$#A;$i++){
			next if ($i==$maxi);
			print $maxi+1,$i+1;
		}
		for($i=0;$i<=$#A-1;$i++) {
			print $i+1,$i+2;
		}
	} else {
		for($i=0;$i<=$#A;$i++){
			next if ($i==$mini);
			print $mini+1,$i+1;
		}
		for($i=$#A;$i>=1;$i--) {
			print $i+1,$i;
		}
	}
} elsif( $min>=0 ) {
	print $#A;
	for($i=0;$i<=$#A-1;$i++) {
		print $i+1,$i+2;
	}
} elsif ($max<=0) {
	print $#A;
	for($i=$#A;$i>=1;$i--) {
		print $i+1,$i;
	}
}


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

int main(){
    int n, p, i, m = 0, s = 0;
    cin >> n;
    for(i=0; i<n; i++){
        cin >> p;
        s += p;
        m = max(m, p);
    }
    cout << s - m/2;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

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

    vector<int>v(5);
    for(int i=0;i<5;i++)
        cin>>v[i];
    for(int i=0;i<5;i++)
    {
        if(v[i] == 0)
        {
            cout<<i+1;
            break;
        }
        
    }

    return 0;
}

Measured memory_bytes: 3636
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) REV(SORT(V)) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
double n,m,a,b,c,x,y,z;
double d,e,f;
string s,t;
//

signed main() {
  RAPID;
  IN2(n,a);
  OUT(ceil(n/(2*a+1)));
}

Measured memory_bytes: 256
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;



int main(){

int N;
cin>>N;
ll A[N],E[N/2+N%2],O[N/2];
rep(i,N){
    cin>>A[i];
    if(i%2==0){
    E[i/2]=A[i];
    }
    else{
    O[i/2]=A[i];
    }

}
sort(A,A+N);
map<ll,int> m;
rep(i,N){
    m[A[i]]=i;
}
int count=0;
rep(i,N/2+N%2){
    if(m[E[i]]%2!=0)count++;
}
cout<<count<<endl;


return 0;
}

Measured memory_bytes: 11444
#include <stdio.h>

void main(){
  int n,i;
  long sum=0;
  
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    if((i%3)!=0 && (i%5)!=0)
      sum += i;
  }
  printf("%ld\n",sum);
}

Measured memory_bytes: 1696
#include <stdio.h>
#include <string>
#include <iostream>
#include <map>
using namespace std;

int main(void){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    a=a*b>=c*d?a*b:c*d;
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>                   
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define ROF(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vlli vector<long long int>
#define pb push_back
#define mp make_pair
#define ll long long
#define all(c)  ((c).begin()), ((c).end())
#define dbg(x) cout<<#x<<" = "<<x<<"\n"
#define FOREACH(i,t) for (auto &i:t)

const ll MOD = 1e9+7;

using namespace std;

int main(void) {
    int n;
    cin>>n;
    vi a(n);
    FOREACH(it,a) cin>>it;
    vi dp(n);
    dp[0] = 0;
    dp[1] = abs(a[1] - a[0]);
    FOR(i,2,n) dp[i] = min(dp[i-1] + abs(a[i] - a[i-1]) ,dp[i-2] + abs(a[i] - a[i-2]) );
   //FOREACH(it,dp) cout<<it<<" ";
    cout<<dp[n-1]<<endl;
}                              


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int log(ll x,ll count){
  if(x==1){return count;}
  else{count++;return log(x/2,count);}
}
ll pow(ll a,ll b){
  if(b==1){
  }else if(b%2==0){
    return(pow(a*a,b/2));
  }else{
    return(a*pow(a,b-1));
  }
}
int main() {
  ll H,ans=0;
  cin>>H;
  ll a=pow(2,log(H,0)+1)-1;
  cout<<a<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

#import
#import math
#import numpy as np
N = int(input())
abc = [list(map(int, input().split())) for _ in range(N)]

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

for i in range(N):
    if i == 0:
        dp[i][0] = abc[i][0]
        dp[i][1] = abc[i][1]
        dp[i][2] = abc[i][2]
        continue

    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j])



print(max(dp[-1]))

Measured memory_bytes: 105188
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
#define int ll

const int INF = 1e9 + 10;

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  for (auto it : s) {
    if (it == '?') {
      cout << 'D';
    }
    else {
      cout << it;
    }
  }
  cout << '\n';
}

Measured memory_bytes: 3776
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int p[] = new int[N];
		for (int i=0;i<N;i++) {
			p[i] = sc.nextInt();
		}
		int count =0;
		for (int i=1;i<N-1;i++) {
			if (((p[i]>p[i-1])&&(p[i]<p[i+1]))||(p[i]<p[i-1])&&(p[i]>p[i+1])) {
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 35652
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=100006;
int a[maxn];
int f[maxn][36];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    int l;
    scanf("%d",&l);
    int q;
    scanf("%d",&q);
    for(int i=1;i<=n;i++)
    {
        int id=(int)(upper_bound(a+1,a+n+1,a[i]+l)-a-1);
        f[i][0]=id;
    }
    for(int j=1;j<=30;j++)
    {
        for(int i=1;i<=n;i++)
        {
            f[i][j]=f[f[i][j-1]][j-1];
        }
    }
    while(q--)
    {
        int bx,by;
        scanf("%d%d",&bx,&by);
        if(bx>by)swap(bx,by);
        int sum=0;
        int x=bx;
        for(int i=30;i>=0;i--)
        {
            if(f[x][i]<by)
            {
                sum+=(1<<i);
                x=f[x][i];
            }
        }
        printf("%d\n",sum+1);
    }
    return 0;

}
/*
9
1 3 6 13 15 18 19 29 31
10
6
1 2
1
1 4
*/


Measured memory_bytes: 15232
# 17-Character-Counting_Characters.py

# ?????????????????????
# ?????????????????±??????????????????????????¢???????????????????????°?????°??????????????°????????????????????????????????? 
# ??????????°?????????¨??§??????????????\???????????????

# Input
# ?????°????????????????????????????????±???????????????????????????
# Output
# ?????????????????±???????????????????????¢???????????????????????°?????\??????????????¢?????§????????????????????????

# a : a????????°
# b : b????????°
# c : c????????°
#   .
#   .
# z : z????????°
# Constraints
# ??±???????????????????????° < 1200
# Sample Input
# This is a pen.
# Sample Output
# a : 1
# b : 0
# c : 0
# d : 0
# e : 1
# f : 0
# g : 0
# h : 1
# i : 2
# j : 0
# k : 0
# l : 0
# m : 0
# n : 1
# o : 0
# p : 1
# q : 0
# r : 0
# s : 2
# t : 1
# u : 0
# v : 0
# w : 0
# x : 0
# y : 0
# z : 0

import sys
 
s = str()
alphabet = "abcdefghijklmnopqrstuvwxyz"
 
for line in sys.stdin:
    s += line.lower()
    # print(list(s))

 
for c in alphabet:
    print(c+" : "+str(s.count(c)))

Measured memory_bytes: 7392
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define INF 1e15
#define MOD 1e9+7
int n;
signed main() {
	cin >> n;
	if (n % 2 == 0) {
		cout << (n - 2)*n/2 << endl;
		for (int i = 1; i <= n; i++) {
			for (int j = i; j <= n; j++) {
				if (i == j)continue;
				if (i + j == n+1)continue;
				cout << i << " " << j << endl;
			}
		}
	}
	else {
		cout << (n - 1)*(n - 1)/2 << endl;
		for (int i = 1; i < n; i++) {
			for (int j = i; j <= n; j++) {
				if (i == j)continue;
				if (i + j == n)continue;
				cout << i << " " << j << endl;
			}
		}
	}
	return 0;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=(ll)1e9+7;

int main(){
    string S; cin >> S;
    for(int i=0; i<S.size(); i++){
        cout << "x";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3628
package main

import (
	"fmt"
)

func main() {
	var sx, sy, tx, ty int
	fmt.Scan(&sx, &sy, &tx, &ty)

	for i := 0; i < tx - sx; i++ {
		fmt.Print("R")
	}

	for i := 0; i < ty - sy; i++ {
		fmt.Print("U")
	}

	for i := 0; i < tx - sx; i++ {
		fmt.Print("L")
	}

	for i := 0; i < ty - sy; i++ {
		fmt.Print("D")
	}

	fmt.Print("D")

	for i := 0; i < tx - sx + 1; i++ {
		fmt.Print("R")
	}

	for i := 0; i < ty - sy + 1; i++ {
		fmt.Print("U")
	}

	fmt.Print("L")
	fmt.Print("U")

	for i := 0; i < tx - sx + 1; i++ {
		fmt.Print("L")
	}

	for i := 0; i < ty - sy + 1; i++ {
		fmt.Print("D")
	}

	fmt.Println("R")
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;

int main(){
    string S;
    cin >> S;
    
    //cout << S.size() << endl;
    
    if (S.size()==2)
        cout << S << endl;
    else if (S.size()==3){
        int i;
        for (int i=0;i<3;i++) {
            cout << S[2-i];
        }
        cout << endl;
    }
    
    
    return 0;
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n; ll k;
	cin >>n >>k;
	
	
	vector<VL> z = {{1, 0}};
	rep(i, 50){
		z.push_back({z.back()[0]*2+1, z.back()[1]*2+2});
	}

	auto f=[&](auto f, int rn, ll rx)-> ll{
		if(rn ==0) return rx<=0? 0LL: 1LL;
		else if( rx<=1 + z[rn-1][0] + z[rn-1][1]) return f(f, rn-1, rx-1);
		else return z[rn-1][0] + 1LL + f(f, rn-1, rx-2-z[rn-1][0] - z[rn-1][1]);
	};
	
	cout << f(f, n, k) <<"\n";;
	return 0;
}


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

int main()
{
    int a,b,c;

    cin>>a>>b>>c;
    if((a== b && a!=c) || (a== c && a!=b) || (c== b && a!=c))
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>

using namespace std;

int main()
{
  int N;
  string s;

  cin >> N;
  cin >> s;

  int ans = 0;
  auto beginit = begin(s);
  auto endit = end(s);

  for (int i = 1; i < N; ++i) {
    int tmp = 0;
    set<char> before(beginit, beginit + i);
    set<char> after(beginit + i, endit);
    for (auto it = begin(before); it != end(before); ++it) {
      if(after.find(*it) != end(after)) {
        ++tmp;
      }
    }
    ans = max(ans, tmp);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
from heapq import heappush, heappop

X, Y, Z, K = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse=True)
B = sorted(list(map(int,input().split())),reverse=True)
C = sorted(list(map(int,input().split())),reverse=True)

ans_list = []
s = set()
pq = []
item = (-(A[0]+B[0]+C[0]),0,0,0)
heappush(pq,item)

for _ in range(K):
    value, i, j, k = heappop(pq)
    ans_list.append(-value)
    if len(ans_list) == K:
        break
    if i <= X-2 and (i+1,j,k) not in s:
        item = (-(A[i+1]+B[j]+C[k]),i+1,j,k)
        heappush(pq,item)
        s.add((i+1,j,k))
    if j <= Y-2 and (i,j+1,k) not in s:
        item = (-(A[i]+B[j+1]+C[k]),i,j+1,k)
        heappush(pq,item)
        s.add((i,j+1,k))
    if k <= Z-2 and (i,j,k+1) not in s:
        item = (-(A[i]+B[j]+C[k+1]),i,j,k+1)
        heappush(pq,item)
        s.add((i,j,k+1))

for ans in ans_list:
    print(ans)

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

#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,t,ans=0;
    cin>>n>>t;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=1;i<n;i++){
        if(a[i]-a[i-1]>t){
            ans+=t;
        }
        else{
            ans+=(a[i]-a[i-1]);
        }
    }
    cout <<ans+t<<endl;
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main(){
  ll N,H;cin>>N>>H;
  vl a(N);
  vl b(N);
  rep(i,N)cin>>a[i]>>b[i];
  vector<pair<ll,ll>> p(N);
  rep(i,N){
    p[i]=make_pair(b[i],a[i]);
  }
  sort(all(p));
  sort(all(a));
  reverse(all(a));
 
  sort(all(b));
  reverse(all(b));
  ll ans =0;
  rep(i,N){
    if(a[0]<=b[i]){H -= b[i];ans++;}
    if(H<=0)break;
  }
  while(H>0){
    H -= a[0];
    ans++;
  }
  cout<<ans<<endl;
  
  
}
  


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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))

using namespace std;

typedef long long ll;

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 main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,m;
  cin>>n>>m;
  
  vector<pair<int, int>> v(n);
  
  rep(i,n) {
    pair<int, int> ab;
    cin>>ab.first>>ab.second;
    v[i]=ab;
  }
  
  sort(all(v));
  ll sum=0;
  
  rep(i,n) {
    auto ab=v[i];
    for(int j=1; j<=ab.second; ++j) {
      --m;
      sum += ab.first;
      if(m==0) {
        cout<<sum;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3992
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
#include <algorithm>
#include <string.h>
using namespace std;
 
#define MAX_V 10005
#define MAX_E 20005
 
struct edge{
    int to, dist, cost;
    edge(int to=0,int dist=0,int cost=0):
        to(to), dist(dist), cost(cost){}
};
int d[MAX_V];
vector<edge>G[MAX_V];
//前&#39537;&#32467;点 注意不要个prev迭代器混淆
vector<edge>Prev[MAX_V];
//距&#31163; &#33410;点
typedef pair<int, int>P;
int N, M;
void dijstra(){
    memset(d, 0x3f, sizeof(d));
    for (int i = 0; i < N; i++) Prev[i].clear();
    priority_queue<P, vector<P>, greater<P> >que;
    d[0] = 0;
    que.push(P(0, 0));
    while (!que.empty()){
        auto cur = que.top(); que.pop();
        int v = cur.second;
        if (d[v] < cur.first)continue;
        for (auto& k : G[v]){
            if (d[k.to]>d[v] + k.dist){
                d[k.to] = d[v] + k.dist;
                Prev[k.to].clear();
                Prev[k.to].push_back(k);
                que.push(P(d[k.to], k.to));
            }
            else if (d[k.to] == d[v] + k.dist)
                Prev[k.to].push_back(k);
        }
    }
}
int cost(int v){
    int min_cost = 0x3f3f3f3f;
    for (int i = 0; i < Prev[v].size(); ++i)
        min_cost = min(min_cost, Prev[v][i].cost);
    return min_cost;
}
 
int main()
{
 
    while (cin >> N >> M){
        for (int i = 0; i < N; ++i)G[i].clear();
        for (int i = 0; i < N; ++i)Prev[i].clear();
        if (!N&&!M)
            return 0;
        int a, b, c, d;
        for (int i = 0; i < M; ++i){
            cin >> a >> b >> c >> d;
            --a; --b;
            G[a].push_back(edge(b, c, d));
            G[b].push_back(edge(a, c, d));
        }
        dijstra();
        int res = 0;
        for (int i = 1; i < N; ++i)
            res += cost(i);
        cout << res << "\n";
    }
    return 0;
}

Measured memory_bytes: 3824
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;
 
ll MAXN=100001;
ll spf[100001]; 
 
ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
 

 
void solve()
{
	int n ; 
	cin>>n ;
	int k  ;
	cin>> k;
	int p[n] ;
	rep(i , n)cin>>p[i] ;
	sort(p  ,p+n) ;
	int ans = 0 ;
	int i = 0;
	while(k--){
		ans +=p[i] ;
		i++;
	}
	cout<<ans<<endl;
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3864
#include<stdio.h>

int main(void)
{
int n;
int max=0;
  int result=0;
  int count=0;
int i,j;
  int amari=0;
  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
   count=0;
    j=i;
    while(j%2==0){
      j=j/2;
    count++;
  }
    
   
    if(count>max){max=count;result=i;}
  }
 if(n==1)result=1;
  printf("%d",result);
 return 0; 
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;

int main()
{
    int N, M, R;
    cin >> N >> M >> R;

    vector<vector<ll>> dist(N, vector<ll>(N, INF));
    rep(i, N) dist[i][i] = 0;

    vector<ll> root(R);
    rep(i, R) {
        cin >> root[i];
        root[i]--;
    }

    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        dist[a][b] = c;
        dist[b][a] = c;
    }

    rep(k, N) {
        rep(i, N) {
            rep(j, N) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    ll ans = INF;
    sort(root.begin(), root.end());
    do {
        ll res = 0;
        rep(i, R - 1) {
            res += dist[root[i]][root[i + 1]];
        }
        ans = min(ans, res);
    } while (next_permutation(root.begin(), root.end()));

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(llong i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(llong i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
llong mod = 1000000007;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};


int main(){
  llong N;cin>>N;
  llong D;cin>>D;
  llong a =2* D +1;
  if(N % a ==0)cout<<(N/a)<<endl;
  else cout <<N/a +1<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,n;
	while(cin>>n){
		int count=0;
	for(a=0;a<=9;a++){
		for(b=0;b<=9;b++){
			for(c=0;c<=9;c++){
				for(d=0;d<=9;d++){
				if(a+b+c+d==n)
						count++;
						
				}
			}
		}
	}
	cout<<count<<endl;
	}
	return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>

using namespace std;



int main()
{
	string S;

	cin >> S;


	int flag = 1;
	for (int si = 0; si < S.length(); si++){
		if (si % 2 == 0 && S[si] == 'L') flag = 0;
		if (si % 2 == 1 && S[si] == 'R') flag = 0;
	}

	if (flag) printf("Yes");
	else printf("No");


	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
  int n,h,w,x1,x2,cnt=0;
  int odd[200],even[200];
  cin>>n>>h>>w;
  for(int i=0;i<(n/2);i++){
     for(int j=0;j<(2*w);j++){
       if(j%(2*w)<w){
	 odd[j]=1;
	 even[j]=0;
       }else{
	 odd[j]=0;
	 even[j]=1;
       }
     }
    cin>>x1>>x2;
    for(int j=w-1;j>=0;j--){
      if(x1!=0){
      odd[j+x1]=1;
      odd[j]=0;
      }
    }
    for(int j=w;j<(w*2);j++){
      if(x2!=0){
      even[j-x2]=1;
      even[j]=0;
      }
    }
    for(int j=0;j<(w*2);j++){
      if(odd[j]==0 && even[j]==0) cnt++;
    }
  }
  cout<<cnt*h<<endl;
  return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array.at(0)))

ll count(vector<string> map){
    ll ret = 0;
    for(auto s: map){
        for(auto c: s){
            ret += c == '#';
        }
    }
    return ret;
}


int main(void){
    ll h; cin >> h; ll w; cin >> w;
    ll k; cin >> k;
    vector <string> map;
    REP(i, h){
        string s; cin >> s;
        map.push_back(s);
    }
    ll ans = 0;
    REP(i, pow(2, h)){
        REP(j, pow(2, w)){
            vector <string> newmap = map;
            ll ii = i;
            ll cnt = 0;
            while(ii > 0){
                if (ii % 2 == 1){
                    REP(l, w){
                        newmap.at(cnt).at(l) = 'R';
                    }
                }
                cnt += 1;
                ii /= 2;
            }
            ll jj = j;
            cnt = 0;
            while(jj > 0){
                if (jj % 2 == 1){
                    REP(l, h){
                        newmap.at(l).at(cnt) = 'R';
                    }
                }
                cnt += 1;
                jj /= 2;
            }
            dump(i)
            dump(j)
            ans += count(newmap) == k;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4108
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int taro = 0, hanako = 0;
        int i, j;
        char taroCard, hanakoCard;
        String[] cards;

        outside: for (i = 0; i < n; i++) {
            cards = br.readLine().split(" ");

            for (j = 0; j < cards[0].length() && j < cards[1].length(); j++) {
                taroCard = cards[0].charAt(j);
                hanakoCard = cards[1].charAt(j);
                if (taroCard > hanakoCard) {
                    taro += 3;
                    continue outside;
                } else if (taroCard < hanakoCard) {
                    hanako += 3;
                    continue outside;
                }
            }

            if (cards[0].length() > cards[1].length()) {
                taro += 3;
            } else if (cards[0].length() < cards[1].length()) {
                hanako += 3;
            } else {
                taro++;
                hanako++;
            }
        }

        System.out.println(taro + " " + hanako);
    }
}

Measured memory_bytes: 25052
import sys
mod = 7 + 10 ** 9

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    ans = 0
    for k in range(K, N + 2):
        minSum = (0 + k - 1) * k // 2
        maxSum = (N - k + 1 + N) * k // 2
        ans += (maxSum - minSum + 1) % mod
        ans %= mod
    print(ans)
    


    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9196
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int sx=sc.nextInt();
		int sy=sc.nextInt();
		int tx=sc.nextInt();
		int ty=sc.nextInt();
		int h=ty-sy;
		int w=tx-sx;
		int t=h+1,g=w+1;
		int[]c={w,h,1,t,g,t,w,1,g,t,1};
		String r="R",u="U",l="L",d="D";
		String[]s={r,u,r,d,l,u,r,u,l,d,r};
		for(int i=0;i<11;i++)
			for(int j=0;j<c[i];j++)
				System.out.print(s[i]);
		System.out.println();
	}
}

Measured memory_bytes: 24388
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
typedef long long ll;

int const N=1e6+5, M=1e3+5, MOD=1e9+7;
ll const OO=0x3f3f3f3f3f3f3f3f;

ll n,m,k,sx,sy,ex,ey;
string grid[N];
vector<vector<ll>>dis;
vector<vector<bool>>vis;

int dr[]={0,0,-1,1};
int dc[]={-1,1,0,0};

bool valid(int r, int c)
{
    return r>=0 && r<n && c>=0 && c<m && grid[r][c]=='.';
}

void BFS()
{
    ll ur,uc,vr,vc,c;
    queue<pair<int,int>>q;
    dis[sx-1][sy-1]=0;
    q.push({sx-1,sy-1});
    vis[sx-1][sy-1]=1;
    while(!q.empty())
    {
        ur=q.front().first;
        uc=q.front().second;
        q.pop();
        if(ur==ex-1 && uc==ey-1)
            break;
        for(int i=0; i<4; i++)
        {
            vr=ur;
            vc=uc;
            for(int j=0; j<k; j++)
            {
                vr+=dr[i];
                vc+=dc[i];
                if(valid(vr,vc))
                {
                    if(!vis[vr][vc])
                    {
                        vis[vr][vc]=1;
                        dis[vr][vc]=dis[ur][uc]+1;
                        q.push({vr,vc});
                    }
                    else if(dis[vr][vc]>=dis[ur][uc]+1)
                        dis[vr][vc]=dis[ur][uc]+1;
                    else
                        break;
                }
                else
                    break;

            }
        }
    }
}

int main()
{
    FIO
//    freopen("input.txt","rt",stdin);
//    freopen("output.txt","wt",stdout);
    cin>>n>>m>>k>>sx>>sy>>ex>>ey;
    for(int i=0; i<n; i++)
        cin>>grid[i];
    dis=vector<vector<ll>>(n+5,vector<ll>(m+5,OO));
    vis=vector<vector<bool>>(n+5,vector<bool>(m+5,0));
    BFS();
    if(dis[ex-1][ey-1]==OO)
        cout<<"-1\n";
    else
        cout<<dis[ex-1][ey-1]<<"\n";
    return 0;
}


Measured memory_bytes: 90412
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

string s, t;

llint calc(string s)
{
	llint ret = 0;
	for(int i = 0; i < t.size(); i++){
		if(t[i] != s[i]) ret++;
	}
	return ret;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> s >> t;
	
	llint ans = inf;
	for(int i = 0; i < s.size(); i++){
		if(i + t.size() > s.size() ) break;
		ans = min(ans, calc(s.substr(i, t.size())));
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>

using namespace std;

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

	switch (s[0]){
	case 'S':
		if (s[1] == 'U') {
			cout << 7 << endl;
		}
		else {
			cout << 1 << endl;
		}
		break;
	case 'M':
		cout << 6 << endl;
		break;
	case 'T':
		if (s[1] == 'U') {
			cout << 5 << endl;
		}
		else {
			cout << 3 << endl;
		}
		break;
	case 'W':
		cout << 4 << endl;
		break;
	case 'F':
		cout << 2 << endl;
		break;
	}

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int x,k,a=0;
    scanf("%d %d",&x,&k);
    int n[x];
    for(int i=0;i<x;i++){
        scanf("%d",&n[i]);
        if(n[i]>=k){
            a++;
        }
    }
    printf("%d\n",a);
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
int main(){
    int N,M;
    std::cin >> N;
    std::map<std::string,int> mp;
    std::string s;
    for(int i=0;i<N;i++){
        std::cin >> s;
        mp[s]++;
    }
    std::cin >> M;
    for(int i=0;i<M;i++){
        std::cin >> s;
        mp[s]--;
    }
    int ans=0;
    for(auto i:mp){
        ans=std::max(i.second,ans);
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
long ryuka(long N){
  vector<long> L(N + 1);
  L.at(0) = 2; L.at(1) = 1;
  if(N > 1){
    for (int i = 2; i < N + 1; i++){
      L.at(i) = L.at(i-2) + L.at(i-1);
    }
  }
  return L.at(N);
}
 
int main() {
  long N;
  cin >> N;
  cout << ryuka(N) << endl;
}

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

void solve(int N, vector<char> c) {
    int score[26] = {};
    for (int i=0; i<N; ++i) {
        score[c[i] - 'A'] ++;
        for (int j=0; j<26; ++j) {
            bool win = true;
            for (int k=0; k<26; ++k) {
                if (j != k && score[j] <= score[k]+N-1-i) {
                    win = false;
                    break;
                }
            }
            if (win) {
                cout << char('A'+j) << " " << i+1 << endl;
                return;
            }
        }
    }
    cout << "TIE" << endl;
}

int main() {
    int N;
    while (cin >> N, N) {
        vector<char> c(N);
        for (int i=0; i<N; ++i) cin >> c[i];
        solve(N, c);
    }
    return 0;
}


Measured memory_bytes: 3148
#include<stdio.h>

int main(){
	int g=0,i,ans=0;
	char s[100000];
	scanf("%s",s);
	for(i=0;s[i]!=0;i++){
		if(s[i]=='g'){
			if(g>0){
				ans++;
				g--;
			}else g++;
		}
		if(s[i]=='p'){
			if(g>0)g--;
			else {
				ans--;
				g++;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
# モンスターの体力は H
# アライグマは N 種類の必殺技を使うことができ
# i番目の必殺技を使うとモンスターの体力を Ai 減らすことができます。
# モンスターの体力を0以下にすれば、アライグマ勝ち
# アライグマが同じ必殺技を 2 度以上使うことなくモンスターに勝つことができるなら Yes を、
# できないなら No を出力してください。

H, N = map(int, input().split())
data = list(map(int, input().split()))

if H - sum(data) > 0:
    print('No')
else:
    print('Yes')


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

typedef struct {
    int a;
    int no;
    int order;
} DATA;

DATA a[300000];

int comp1(const void *a, const void *b)
{
    return ((*(DATA *)a).a - (*(DATA *)b).a);
}

int comp2(const void *a, const void *b)
{
    return ((*(DATA *)a).no - (*(DATA *)b).no);
}

int main(void)
{
    int N, Q, x, y;
    int diff;
    int i;
    int out;
    DATA tmp;
    int sort_flag;
    
    
    scanf("%d", &N);
    for (i = 0; i < N; i++){
        scanf("%d", &a[i].a);
        a[i].no = i;
    }
    
    qsort(a, N, sizeof(DATA), comp1);
    for (i = 0; i < N; i++){
        a[i].order = i;
    }
    
    qsort(a, N, sizeof(DATA), comp2);
    
//for (i = 0; i < N; i++){
//    printf("%d:%d:%d ", a[i].no, a[i].a, a[i].order);
//}
//printf("\n");
    
    diff = 0;
    for (i = 0; i < N; i++){
        if (a[i].no != a[i].order){
            diff++;
        }
    }

    sort_flag = 0;
    for (i = 0; i < N - 1; i++){
        if (a[i].a > a[i + 1].a){
            sort_flag = 1;
            break;
        }
    }
    
    if (sort_flag == 0){
        out = 0;
    }
    else {
        out = -1;
    }

    scanf("%d", &Q);
    for (i = 0; i < Q; i++){
        scanf("%d%d", &x, &y);
        x--;
        y--;

        if (out != -1){
            continue;
        }
        
        if (x == a[y].order){
            diff--;
        }
        if (y == a[x].order){
            diff--;
        }
        if (x == a[x].order){
            diff++;
        }
        if (y == a[y].order){
            diff++;
        }
        
        tmp = a[x];
        a[x] = a[y];
        a[y] = tmp;
        
        if (diff == 0){
            out = i + 1;
        }
    }
    
    printf("%d\n", out);
    
    return (0);
}


Measured memory_bytes: 8760