akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.nextLine();
		ArrayList<String> arr1 = new ArrayList<String>(Arrays.asList(scanner.nextLine().split(" ")));
		scanner.nextLine();
		int count=0;
		for(String str: scanner.nextLine().split(" ")) {
			if(arr1.contains(str)) {
				count++;
			}
		}
		System.out.println(count);

	}
}



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

#define fori( tt,aa)      for(long long i= tt; i<aa; i++)
#define forj( yy,bb)      for(long long j=yy; j<bb; j++)
#define fork( uu,cc)      for(long long k=uu; k<cc; k++)
#define sz(v)    v.size()
#define all(v)   v.begin(), v.end()
#define endl "\n";
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define EPS 1e-7
#define F first
#define S second
#define THINK_TWICE_CODE_ONCE; fast();

typedef long long ll;
typedef long double ld;
typedef double dd;
typedef string String;
typedef string str;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef pair<int, int> pii;


void accuSum2D(vector<vector<int>>&a){
    //accumulate each row
    fori(1, 101)
     forj(1, 101)
        a[i][j] +=a[i][j-1];

    //accumulate each col
    forj(1, 101)
     fori(1, 101)
        a[i][j] +=a[i-1][j];
}

int sum_range(int i, int j, int k, int l, vector<vector<int>>&s){
    return s[k][l] - s[k][j-1] - s[i-1][l] + s[i-1][j-1];
}

void fast(){
    cin.tie(0);
    cout.tie(0);
    cin.sync_with_stdio(0);
}

ld pow (ll a, ll b);
ll numOfDigits(ll n);
int freq[128];
int main()
{
    THINK_TWICE_CODE_ONCE;
    //freopen("great Vova Wall1.txt", "r", stdin);
    str s; cin>>s;
    if(s=="abc" || s=="acb" || s=="bac" || s== "bca" || s== "cab" || s== "cba")
    cout<<"Yes";
    else cout<<"No";
    return 0;
}
ld pow (ll a, ll b){
    ld pow = 1;
    fori(0,b)
        pow *=a;
    return pow;
}

ll numOfDigits(ll n){
    if(!n) return 1;
    return (ll)(log10(n)+1);
}


Measured memory_bytes: 256
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long

int main()
{
  char s[1000];
  scanf("%s",s);
  if ((strlen(s)>=4)&&(s[0]=='Y')&&(s[1]=='A')&&(s[2]=='K')&&(s[3]=='I'))
    printf("Yes\n");
  else printf("No\n");
  return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int N;
  cin >> N;
  vector<ll> A(N), B(N);

  ll a_sum = 0;
  ll b_sum = 0;

  for(int i = 0; i < N; i++){
    cin >> A.at(i);
    a_sum += A.at(i);
  } 
  for(int i = 0; i < N; i++){
    cin >> B.at(i);
    b_sum += B.at(i);
  } 
  string ans;
  ll change_time = b_sum - a_sum;
  // 変更していい回数
  cerr << "change_time: " << change_time << endl;


  if(change_time < 0){
    ans = "No";
  } else { 
    ll b_stock = 0; // Bに+1していい回数
    
    for(int i = 0; i < N; i++){
      ll tmp = B[i] - A[i];

      if(tmp >= 0){
        // A[i]をB[i]以上になる様に最小限変更する
        ll change_num = (tmp+1)/2;
        change_time -= change_num;
        a_sum += 2 * change_num;

        // 差が奇数なら、B[i]++しておく その分、自由なb_stockは減る
        if(tmp%2 == 0){
          b_stock += change_num;
        } else {
          b_stock += change_num - 1;
          b_sum += 1;
        }
      }
    }
    cerr << "change_time: " << change_time << endl;

    if(change_time < 0){
      ans = "No";
    } else if(change_time > 0){
      // 余ったら適当に足しておく
      a_sum += 2 * change_time;
      b_stock += change_time;
    }

    // 差を埋められるかどうか
    if(a_sum - b_sum == b_stock){
      ans = "Yes";
    } else { 
      ans = "No";
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<queue>
using namespace std;
int n, t, a, ans = 999999, ansi;

int main(){
	cin >> n >> t >> a;
	a *= 1000;
	t *= 1000;
	for (int i = 1; i <= n; i++) {
		int h;
		cin >> h;
		if (abs(ans - a) > abs(t - (h * 6) - a)) {
			ans = t - (h * 6);
			ansi = i;
		}
	}
	cout << ansi << endl;
	return 0;
}


Measured memory_bytes: 256
var n, i, ans : longint;
    s : ansistring;
 
begin
    readln(n); readln(s); 
    ans := 0;
    for i := 1 to n - 2 do
    begin
        if (s[i] = 'A') and (s[i + 1] = 'B') and (s[i + 2] = 'C') then inc(ans);
    end;
    writeln(ans);
end.

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

int a[100000];
int main(){
	int n,k;
	cin >> n >> k;
	
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	sort(a,a+n);
	
	if(n==k){
		cout << a[n - 1] - a[0];
		return 0;
	}
	
	int min = 1000000000;
	for(int i = 0;i <= n - k;i++){
		if(a[i+k-1]-a[i]<min) min = a[i+k-1] - a[i];
	}
	
	cout << min;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <limits.h>
#include <float.h>
#include <numeric>
#include <queue>

using namespace std;

typedef long long ll;
typedef pair<string, int> P;

const ll mod = 1000000007;
ll fact[200200];
ll invfact[200200];

inline ll take_mod(ll a){
    return (a % mod + mod) % mod;
}

inline ll add(ll a, ll b){
    return take_mod(a+b);
}

inline ll sub(ll a, ll b){
    return take_mod(a-b);
}


inline ll mul(ll a, ll b){
    return take_mod(a * b);
}

inline ll pow(ll x, ll n){
    ll res = 1LL;
    while(n > 0){
        if(n & 1) res = mul(res, x);
        x = mul(x, x);
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x){
    return pow(x, mod-2);
}

// nは上限
void make_fact(ll n){
    fact[0] = 1;
    ll res = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = res;
        res = mul(res, i+1);
    }
}

// nは上限
void make_invfact(ll n){
    invfact[0] = 1;
    invfact[n] = mod_inv(fact[n]);
    for(int i = n-1; i >= 1; i--){
        invfact[i] = mul(invfact[i + 1], i + 1);
    }
}

ll perm(ll n, ll k){
    return mul(fact[n], invfact[n-k]);
}

ll comb(ll n, ll k){
    return mul(mul(fact[n], invfact[n-k]), invfact[k]);
}


int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int w = tx - sx;
    int h = ty - sy;

    for(int i = 0; i < w; i++){
        cout << 'R';
    }
    for(int i = 0; i < h; i++){
        cout << 'U';
    }
    for(int i = 0; i < w; i++){
        cout << 'L';
    }
    for(int i = 0; i < h; i++){
        cout << 'D';
    }
    cout << 'D';
    for(int i = 0; i < w+1; i++){
        cout << 'R';
    }
    for(int i = 0; i < h+1; i++){
        cout << 'U';
    }
    cout << 'L';
    cout << 'U';
    for(int i = 0; i < w+1; i++){
        cout << 'L';
    }
    for(int i = 0; i < h+1; i++){
        cout << 'D';
    }
    cout << 'R';
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
HEIGHTS = gets.split(' ').map(&:to_i)

sum_steps = 0
max_heigtht = HEIGHTS[0]
HEIGHTS.each_with_index do |height, i|
  if max_heigtht > height
    sum_steps += max_heigtht - height
  elsif max_heigtht < height
    max_heigtht = height
  end
end
puts sum_steps


Measured memory_bytes: 28048
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
class team {
public:
	int ac = 0, pe = 0, tid;
	vector<int>pid;

	bool operator <(team &other)const {
		if (this->ac == other.ac&&this->pe == other.pe)return this->tid < other.tid;
		else if (this->ac == other.ac)return this->pe < other.pe;
		else return this->ac > other.ac;
	}

};
int main() {
	int t, p, r;
	while (cin >> t >> p >> r,t||p||r) {
		vector<team>v(t);
		for (int i = 0; i < t; i++) {
			v[i].tid = i;
			v[i].pid = vector<int>(p, 0);
		}
		for (int i = 0; i < r; i++) {
			int tid, pid, time;
			string mes;
			cin >> tid >> pid >> time >> mes;
			tid--;
			pid--;
			if (mes == "WRONG") {
				v[tid].pid[pid]++;
			}
			else if (mes == "CORRECT") {
				v[tid].ac++;
				v[tid].pe += v[tid].pid[pid] * 1200 + time;
			}

		}
		sort(v.begin(), v.end());
		for (auto it = v.begin(); it != v.end(); it++) {
			cout << it->tid + 1 << " " << it->ac << " " << it->pe << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3148
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    string s;
    cin >> s;
    int n = s.length();
    if((n % 2) ^ (s[0] != s[n - 1]))    cout << "Second\n";
    else    cout << "First\n";
}

Measured memory_bytes: 3744
import sys
from collections import deque
s = deque(map(str, input().rstrip()))

# 辞書の最後は-1
if "".join(s) == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
    sys.exit()

# 使える文字リスト作成
s = [ord(x) for x in s]

# 26文字未満なら、未使用の１文字を追加して終わり
if len(s) < 26:
    can_use = set(range(97, 123)) - set(s)
    s = s + [min(can_use)]

# 26文字の時は例外処理を入れる
else:
    add = []
    s = s[::-1]
    prev = s[0]
    add.append(prev)

    # 末尾がzならzを消去し、1文字前をzにして終わり
    if prev == 122:
        s[1] = 122
        s = s[::-1]
        s = s[:-1]

    # そうでなければ、初めて増加する値が減少するタイミングまで見る
    # 減少するポイントで、その時点で使える中で最小の文字に差し替え
    else:
        for i in range(1, len(s)):
            if prev > s[i]:
                add = [x for x in add if x > s[i]]
                s[i] = (min(add))
                s = s[::-1]
                s = s[:-i]
                break
            prev = s[i]
            add.append(prev)

# 文字列に戻す処理
s = [chr(x) for x in s]

print("".join(s))

Measured memory_bytes: 3436
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define FOR(i, n, m) for (ll i = (n); i < (m); ++i)
#define FORR(i, n, m) for (ll i = (m) - 1; i >= (n); --i) 
#define FORE(x, xs) for (auto &x: (xs))
#define ALL(v) v.begin(), v.end()
#define ZERO(a) memset(a,0,sizeof(a))

const int INF = 1000000009;
const int MOD = 1000000007;
const double EPS = 1e-14;
const double PI = acos(-1);

const int MAX = 1e5+1;

ll N, M;
bool a[MAX];

int main() {
  cin >> N >> M;
  REP (i, N) a[i] = true;

  REP (i, M) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    a[x] = !a[x];
    a[y] = !a[y];
  }

  bool ans = true;
  REP (i, N) ans &= a[i];
  cout << (ans ? "YES" : "NO") << endl;

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll N, K, T, W, H, M, C;

const int MAX = 510000;
const int MOD = 1e9;

const double PI=3.14159265358979323846;

/*
long long fac[MAX], finv[MAX], inv[MAX];

vector<double> cx, cy, c;
 ll MM = 1e12;

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

std::vector<int> Eratosthenes(int n ){
    std::vector<bool> is_prime( n + 1 );
    for( int i = 0; i <= n; i++ ) is_prime[ i ] = true;
    std::vector<int> P;
    for( int i = 2; i <= n; i++ ){
        if( is_prime[ i ] ){
            for( int j = 2 * i; j <= n; j += i ){
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}*/

int length(vector<int> v, int u, int HW){
    if(v.size() == 0) return HW;
    if(v[0] > u) return v[0];
    if(v[v.size() - 1] < u) return HW - v[v.size()- 1] -1;
    else{
        int i = lower_bound(ALL(v), u)- v.begin();
        return v[i] - v[i-1] -1;
    }
}

int st[200001], t[10000];

int main(){
    cin >> H >> N;
    vector<ll> dp(H + 20000, 1e12);
    vector<pair<ll, ll>> v;
    REP(i,N){
        ll a,b; cin >> a >> b;
        v.push_back(make_pair(a,b));
    }
    dp[0] = 0;
    sort(ALL(v));
    for(auto u:v){
        for(int i = 0; i < H; ++i){
            dp[i + u.first] = min(dp[i+ u.first], dp[i] + u.second);
        }
    }
    ll ans = 1e12;
    for(int i = H; i < dp.size(); ++i){
        ans = min(ans, dp[i]);
    }
    cout << ans ;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
 int main(void)
 {          
    int N,i,j,A,c=0;
    scanf("%d",&N);
     for(i=1;i<=9;i++){
      for(j=1;j<=9;j++){
        A=i*j;
        if(N==A) c=1;                                                
      }   
     }   
      if   (c==1) printf("Yes\n");
      else        printf("No\n");
         
    return 0;
 }          


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

string x="mcxi";
int y[]={1000,100,10,1};

int deco(string t){
    int ret=0;
    int tt=1;
    for(int i=0;i<t.size();i++){
        int f=-1;
        for(int j=0;j<4;j++){
            if(t[i]==x[j]){
                f=j;
                break;
            }
        }
        if(f==-1){
            tt=t[i]-'0';
        }else{
            ret+=tt*y[f];
            tt=1;
        }
    }

    return ret;
}

string enco(int n){
    string ret="";
    for(int i=0;i<4;i++){
        int t=n/y[i];
        n%=y[i];
        if(t==0){
            continue;
        }else if(t==1){
            ret+=x[i];
        }else{
            ret+=to_string(t)+x[i];
        }
    }
    return ret;
}

int main(){

    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        string s,t;
        cin >> s >> t;
        int ss=deco(s);
        int tt=deco(t);
        int st=ss+tt;
        string ans=enco(st);
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long A,B,C,K;
  cin >> A >> B >> C >> K;
  
  if(abs(A-B) > pow(10,18)){
    cout << "Unfair" << endl;
  }else if(K%2==0){
    cout << A - B << endl;
  }else{
    cout << B-A << endl;
  }
}

Measured memory_bytes: 256
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int main()
{
    int N,K;
    double ans = 0;
    cin >> N >> K;
    vector<double> p(N);

    rep(i, N){
        cin >> p.at(i);
    }

    vector<double> sum(N + 1, 0);
    rep(i, N){
        sum.at(i + 1) = sum.at(i) + (1 + p.at(i)) / 2;
    }

    rep(i, N - K + 1){
        ans = max(sum[i + K] - sum[i], ans);
    }

    cout << fixed << setprecision(12);
    cout << ans << endl;
}

Measured memory_bytes: 3328
//https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_c
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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() {
    ll X; cin>>X;    

    auto check_func =[&](ll n){
        ll mi=n*100;
        ll mx=n*105;
        return (mi<=X&&X<=mx);
    };
    ll num=X/100;
    bool ans=false;
    FOR(i,1,num+1){
        ans|=check_func(i);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())

const int N = 3e5 + 100;
vector<int> er(N, 0), wl(N, 0);
signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    string s;
    cin >> s;
    s = " " + s;

    for (int i = 1; i <= n; i++) {
        wl[i] = wl[i - 1];
        if (s[i] == 'W') {
            wl[i]++;
        } 
    }

    for(int i = n; i >= 1; i--) {
        er[i] = er[i + 1];
        if (s[i] == 'E') {
            er[i]++;
        } 
    }
    
    int ans = INT64_MAX;
    for(int i = 1; i <= n; i++) {
        ans = min(ans, wl[i - 1] + er[i + 1]);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 5652
# coding: utf-8
# Your code here!
n,k = [int(i) for i in input().split()]
a = [int(i)-1 for i in input().split()]

z=0
for i, ai in enumerate(a):
#    print(i,ai)
    if ai == 0:
        z=i
        break


        
p=(n-1+k-1-1)//(k-1)

print(p)

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

int main () {
    int N;
    cin >> N;
    vector<int> vec(N);
    for (int i = 0; i < N; i++) {
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());

    int alice = 0, bob = 0;

    for (int i = 0; i < vec.size(); i++) {
        if (i % 2 == 0) {
            alice += vec.at(i);
        }
        else if (i % 2 == 1) {
            bob += vec.at(i);
        }
    }
    cout << alice - bob << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
    return b==0?a:gcd(b,a%b);
}
int main()
{
    ll a,b;
    cin>>a>>b;
    cout<<a*b/gcd(a,b)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t;
	int flag=0;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]==t[i]) continue;
		else 
		{
			flag=1;break;
		}
	}
	if(flag) cout<<"No\n";
	else cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 3572
N = int(input())
W = list(map(int,input().split()))

S_N = sum(W)
S_1 = 0
S_2 = 0
ans = 10000

for t in range(len(W)):
    S_1 += W[t]
    S_2 = S_N - S_1
    ans = min(ans,abs(S_1 - S_2))

print(ans)

Measured memory_bytes: 3064
n = gets.chomp.to_i

count = 0
begin_b_count = 0
end_a_count = 0
begin_b_end_a_count = 0
n.times do
  str = gets.chomp
  count += str.scan(/AB/).size
  begin_b_count += 1 if str[0] == 'B'
  end_a_count += 1 if str[-1] == 'A'
  begin_b_end_a_count += 1 if str[0] == 'B' && str[-1] == 'A'
end

if end_a_count > 0 && end_a_count == begin_b_count && end_a_count == begin_b_end_a_count
  count -= 1
end

puts count + [begin_b_count, end_a_count].min


Measured memory_bytes: 1788
#include <iterator>
#include<iomanip>
#include<string>
#include <stdio.h>  
#include <iostream>
#include<fstream>
#include<queue>
#define MAXN 1000005
#define ll long long
using namespace std;
ll n, m, root[105 * 105], k;


int main() {
	int a[10005], b, sum=0, n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum = sum + a[i] - 1;
	}
	cout << sum << endl;
	return 0;
}

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

int main(void) {
  string s;
  cin >> s;
  int zero = 0, one = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') zero++;
    if (s[i] == '1') one++;
  }
  cout << min(zero, one) * 2 << endl;

  return 0;
}

Measured memory_bytes: 512
k,s=map(int,input().split())
count=0
if s%3==0:
    count+=1
for i in range(0,s//2+1):
    if 0<=s-2*i<=k and i<=k and s-2*i!=i:
        count+=3
for i in range(0,k-1):
    for j in range(i+1,k):
        if k>=s-i-j>j:
            count+=6
print(count)

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

int main(){
    long N,M;
    cin >> N >> M;
    long sum = 0L;
    for(int i = 0; i < M; i++){
        int A;
        cin >> A;
        sum += A;
    }
    if(N >= sum){
        cout << N -sum << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}

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

int main(){
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin >> a[i];
  
  sort(a.begin(), a.end());
  
  int i;
  for(i=0; i<n; i++){
    x -= a[i];
    if(x<0) break;
  }
  if(x>0) i--;
  
  cout << i << endl;
  return 0;
}


Measured memory_bytes: 256
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    ll n;cin>>n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++)
        cin>>a[i];
    ll ans=0;
    for(ll i=0;i<n;i++){
        while(a[i]%2==0){
            ans++;
            a[i]/=2;
        }
    }
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 384
#include <bits/stdc++.h>
#define lli long long int
#define timesave ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;


const int M = 1e7 + 5;
lli div_cnt[M];

lli SIEVE(lli n)
{
    for(lli i = 1; i <= n; i++){
        for(lli j = i; j <= n; j += i){
            div_cnt[j]++;
        }
    }

    lli ans = 0;

    for(lli i = 1; i <= n; i++){
        ans += (i * div_cnt[i]);
    }

    return ans;
}

void solve(int t_case)
{
    lli n;
    cin >> n;

    cout << SIEVE(n) << "\n";
}
 
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    timesave;

    int tc = 1, t_case = 1;
    //cin >> tc;
    while(tc--) solve(t_case++);
 
    return 0;
}

Measured memory_bytes: 81700
n, m = map(int, input().split())
s = [[0] * 10] * 10
for i in range(m):
    s[i] = list(map(int, input().split()))
p = list(map(int, input().split()))
ans = 0

for i in range(2 ** n):
    flag = True
    for j in range(m):
        bit = 0
        for l in range(s[j][0]):
            bit += (i >> (s[j][l + 1] - 1)) & 1
        if not(bit % 2 == p[j]):
            flag = False
    if flag:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdlib>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <numeric>

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

#define loopi(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define loop(i, n) for (int i = 0; i < (int)n; i++)
#define loopeq(i, n) for (int i = 0; i <= (int)n; i++)
#define loopll(i, n) for (ll i = 0; i < (ll)n; i++)
#define looplleq(i, n) for (ll i = 0; i <= (ll)n; i++)

int main() {
    string s; cin >> s;
    loop(i, s.size()) {
        if (s[i] == '?') s[i] = 'D';
    }
    cout << s << endl;
}


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

int main(){
	int N;
	cin >> N;
	vector<int> L(N);
	int sumR = 0;
	int sumL = 0;
	for(int i = 0; i < N; i++){
		cin >> L.at(i);
		sumR += L.at(i);
	}
	int dis = abs(sumR - sumL);
	
	for(int i = 0; i < N; i++){
		sumR -= L.at(i);
		sumL += L.at(i);
		dis = min(dis, abs(sumR - sumL));
	}
	
	cout << dis << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s ; 
    cin >> s ; 
    int n = (int) s.size() ;
    for(int i = 0; i < n; i += 2){
        if ( s[i] == 'L' ) return cout << "No" << endl , 0;
    }
    for(int i = 1; i < n; i += 2){
        if ( s[i] == 'R' ) return cout << "No" << endl , 0;
    }
    cout << "Yes" << endl;
    return 0 ;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

double q;

int main(){
	while(cin>>q){
		if(q==-1)return 0;
		double x=q/2;
		while(fabs(x*x*x-q)>=q*1e-5)x-=(x*x*x-q)/3/x/x;
		printf("%.6f\n",x);
	}
}

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

int main() {
	int sum=0;

	std::vector<int> v(5);

	std::vector<int> vv;

	std::vector<int> vvv;

	std::multimap<int, int> mp;

	for (int& x : v) {
		std::cin >> x;
	}

	/*
	for (int& x : v) {
		std::cout << x << std::endl;
	}
	*/

	mp.insert(std::pair<int, int>((v[0]) % 10, v[0]));
	mp.insert(std::pair<int, int>((v[1]) % 10, v[1]));
	mp.insert(std::pair<int, int>((v[2]) % 10, v[2]));
	mp.insert(std::pair<int, int>((v[3]) % 10, v[3]));
	mp.insert(std::pair<int, int>((v[4]) % 10, v[4]));

/*
	mp[(v[0]) % 10] = v[0];
	mp[(v[1]) % 10] = v[1];
	mp[(v[2]) % 10] = v[2];
	mp[(v[3]) % 10] = v[3];
	mp[(v[4]) % 10] = v[4];
*/

	for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
		//std::cout << itr->second << std::endl;
		vv.push_back(itr->second);
	}

	/*
	for (int& x : vv) {
		std::cout << x << std::endl;
	}
	*/
	


	
	
	for (int j = 0; j < 5; j++) {
		if ((vv[j]) % 10 != 0) {
			vvv.push_back(vv[j]);
		}
	}

	for (int j = 0; j < 5; j++) {
		if ((vv[j]) % 10 == 0) {
			vvv.push_back(vv[j]);
		}
	}



	///*
	for (int i = 1; i < 5; i++) {
		if (vvv[i] % 10 != 0) {
			vvv[i] = ((vvv[i] )/ 10 + 1) * 10;
		}
	}
	//*/

	/*
	for (int& x : vvv) {
		std::cout << x << std::endl;
	}
	*/
	

	///*
	for (int i = 0; i < 5; i++) {
		sum += vvv[i];
	}
	//*/

	std::cout << sum << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<complex>
#include<algorithm>
#include<set>
#define rep(i,n) for(int i = 0;i < n ; ++i)

using namespace std;

using ll = long long;
using Point = complex<double>;


int main(){
    int n, q;
    cin>>n>>q;
    ll a[n];
    rep(i,n)cin>>a[i];
    vector<ll> st;
    rep(i,n)st.push_back(a[i]);
    sort(st.begin(),st.end());
    multiset<ll> lead;
    while(q--){
        string s;
        cin>>s;
        int x;
        cin>>x;
        if(s=="ADD"){
            --x;
            lead.insert(a[x]);
        }
        else if(s=="REMOVE"){
            --x;
            auto itr = lead.lower_bound(a[x]);
            lead.erase(itr);
        }
        else {
            ll ok=1e9+7, ng = -1;
            while(ok-ng>1){
                ll mid = (ok+ng)/2;
                int cur = 0;
                int sum = 0;
                for(auto e : lead){
                    int idx = lower_bound(st.begin(),st.end(),e-mid)-st.begin();
                    cur = max(cur,idx);
                    idx = upper_bound(st.begin(),st.end(),e)-st.begin();
                    sum += idx - cur;
                    cur = idx;
                }
                if(sum+x>=n)ok=mid;
                else ng = mid;
            }
            if(ok==1e9+7)cout<<"NA\n";
            else cout<<ok<<"\n";
        }
    } 
}


Measured memory_bytes: 19060
#include <iostream>
#include <vector>

int main()
{
  int n;
  std::cin >> n;
  int count_eight = 0;
  for (int i = 1; i <= n; i++)
  {
    int count_divisor=0;
    for(int j = 1;j <= i; j+=2)
    {
      if(i%j==0)
      {
        count_divisor++;
      }
    }
    if(count_divisor == 8)
    {
      count_eight++;
    }
  }
  std::cout << count_eight << std::endl;

}


Measured memory_bytes: 256
s = list(input())
t = list(input())

for i in range(len(s)-len(t), -1, -1):
    flag = True
    for j in range(len(t)):
        if not(s[i+j] == t[j] or s[i+j] == '?'):
            flag = False 
    if flag :
        for j in range(len(t)):
            s[i+j] = t[j]
        for k in range(len(s)):
            if s[k] == '?':
                s[k] = 'a'
        print(''.join(s))
        exit()
print('UNRESTORABLE')


Measured memory_bytes: 9000
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <vector>

using namespace std;

int main(){
  string s = "CODEFESTIVAL2016";
  string in;
  cin >> in;
  int counter = 0;
  for (int i = 0; i < 16; i++){
    if (s[i] != in[i]){
      counter++;
    }
  }  
  cout << counter << endl;
  return 0;
}


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

int main(){
    string s;
    cin >> s;
    if(s == "zyxwvutsrqponmlkjihgfedcba"){
        cout << -1 << endl;
    } else if(s.size() == 26){
        int num = 0;
        for(int i = 25; i >= 0; i--){
            if(s[i-1] < s[i]){
                num = i-1;
                break;
            }
        }
        string g = s.substr(0,num);
        cout << g;
        for(char x = s[num] + 1; x <= 'z'; x++){
            int found = 0;
            for(int j = 0; j < g.size(); j++){
                if(g[j] == x) found = 1;
            }
            if(!found){
                cout << x << endl;
                break;
            }
        }
    } else {
        cout << s;
        for(char x = 'a'; x <= 'z'; x++){
            int found = 0;
            for(int j = 0; j < s.size(); j++){
                if(s[j] == x) found = 1;
            }
            if(!found){
                cout << x << endl;
                break;
            }
        }
    }
}
 

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

int main() {
	int h, w;
	cin >> h >> w;
	char grid[h][w];
	bool c[h][w];
	for (int i = 0;i < h;i++) {
		bool a = false;
		for (int j = 0;j < w;j++) {
			cin >> grid[i][j];
			if (grid[i][j] == '#')a = true;
		}
		for (int j = 0;j < w;j++) {
			c[i][j] = a;
		}
	}
	for (int j = 0;j < w;j++) {
		bool b = false;
		for (int i = 0;i < h;i++) {
			if (grid[i][j] == '#')b = true;
		}
		for (int i = 0;i < h;i++) {
			if (c[i][j] == true)c[i][j] = b;
		}
	}
	for (int i = 0;i < h;i++) {
		bool d = false;
		for (int j = 0;j < w;j++) {
			if (c[i][j]) {
				cout << grid[i][j];
				if (d == false)d = true;
			}
		}
		if (d)cout << endl;
	}
}

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


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

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

    ll sum = 0;

    rep(i,n) rep(j,n) rep(k,n) {
        int gcd_temp1 = gcd(i,j);
        int gcd_temp2 = gcd(gcd_temp1,k);
        sum += gcd_temp2;
    }

    cout << sum << endl;







    return 0;
}



Measured memory_bytes: 3632
//うるるん解
#include<stdio.h>
int main(void)
{
  int H,W,i,j,count;
  //範囲外アクセスが起こって死んでそうなので
  //余裕を持って宣言したら通った
  char S[52][52];
  scanf("%d %d",&H,&W);
  for(i=0;i<H;i++){
    scanf("%s",S[i]);
  }
  for(i=0;i<H;i++){
    for(j=0;j<W;j++){
      count=0;
      if(S[i][j]=='#'){
	printf("#");
      } else if(S[i][j]=='.'){
	if(S[i][j+1]=='#'){
	  count++;
	}
	if(S[i][j-1]=='#'){
	  count++;
	}
	if(S[i+1][j]=='#'){
	  count++;
	}
	if(S[i-1][j]=='#'){
	  count++;
	}
	if(S[i+1][j+1]=='#'){
	  count++;
	}
	if(S[i+1][j-1]=='#'){
	  count++;
	}
	if(S[i-1][j+1]=='#'){
	  count++;
	}
	if(S[i-1][j-1]=='#'){
	  count++;
	}
	printf("%d",count);
      }
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ff first
#define se second
using namespace std;
int n,m,a,b,c,d,k;
const int inf=1e8+5;
queue<pair<pair<int,int>,int> > q;
bool cek(int a,int b)
{
	if(a>=1&&a<=n&&b>=1&&b<=m) return true;
	return false;
}
int main()
{
	cin>>n>>m>>k>>a>>b>>c>>d;
	int flag[n+2][m+2]={inf};
	char arr[n+2][m+3]={'*'};
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++) cin>>arr[i][j];
	}
	q.push({{a,b},0});
	flag[a][b]=0;
	while(!q.empty())
	{
		int x,y,z;
		x=q.front().ff.ff;
		y=q.front().ff.se;
		z=q.front().se;
		q.pop();
		//cout<<x<<" "<<y<<" "<<z<<endl;
		if(x==c&&y==d)
		{
			cout<<flag[c][d]<<endl;
			return 0;
		}
		for(int i=1;i<=k;i++) 
		{
			if(cek(x,y-i)&&flag[x][y-i]==0&&arr[x][y-i]!='@') flag[x][y-i]=z+1,q.push({{x,y-i},z+1});
			else if(!cek(x,y-i)||arr[x][y-i]=='@'||flag[x][y-i]==z) break;
		}
		for(int i=1;i<=k;i++) 
		{
			if(cek(x+i,y)&&flag[x+i][y]==0&&arr[x+i][y]!='@') flag[x+i][y]=z+1,q.push({{x+i,y},z+1});
			else if(!cek(x+i,y)||arr[x+i][y]=='@'||flag[x+i][y]==z) break;
		}
		for(int i=1;i<=k;i++) 
		{
			if(cek(x,y+i)&&flag[x][y+i]==0&&arr[x][y+i]!='@') flag[x][y+i]=z+1,q.push({{x,y+i},z+1});
			else if(!cek(x,y+i)||arr[x][y+i]=='@'||flag[x][y+i]==z)break;
		}
		for(int i=1;i<=k;i++) 
		{
			if(cek(x-i,y)&&flag[x-i][y]==0&&arr[x-i][y]!='@') flag[x-i][y]=z+1,q.push({{x-i,y},z+1});
			else if(!cek(x-i,y)||arr[x-i][y]=='@'||flag[x-i][y]==z)break;
		}
	}
	cout<<"-1"<<endl;
}

Measured memory_bytes: 13236
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        string[] LRd = Console.ReadLine().Split(' ');
        int[] vs = new int[3];
        int count = 0;
        for (int i = 0; i < 3; i++)
        {
            vs[i] = Convert.ToInt32(LRd[i]);
        }

        for (int i = vs[0]; i <= vs[1]; i++)
        {
            if ((i % vs[2]) == 0)
            {
                count++;
            }
        }

        
        Console.WriteLine(count);

    }
}

Measured memory_bytes: 17760
a, b, c = gets.split.map(&:to_i)
 
i = 0
loop do
    unless [a, b, c].all?{|d|d%2==0}
        puts i
        exit
    end
    if a == b && b == c
        puts -1
        exit
    end
    a, b, c = (b+c)/2, (c+a)/2, (a+b)/2
    i += 1
end

Measured memory_bytes: 1788
#include<iostream>
#include<cstring>
using namespace std;
#define F(I,N) for(int I=0;I<N;I++)
void swap(char *a,char *b){
	char t=*a;
	*a=*b;
	*b=t;
}

int main(){
	char str[30];
	while(cin>>str){
		int l=strlen(str);
		F(i,l/2) swap(&str[i],&str[l-i-1]);
		cout<<str<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <unordered_map>
typedef long long ll;
using namespace std;
const int mod=1e9+7;
const ll inf=(1e14);

ll solve(){
	ll n,ans=0;
	string s;
	cin>>n>>s;
	int r[n],g[n],b[n];
	g[n-1]=r[n-1]=b[n-1]=r[0]=g[0]=b[0]=0;
	unordered_map<char,int*> m;
	m['R']=r,m['G']=g,m['B']=b;
	for(const char c:{'R','G','B'}){
		for(int i=n-2;i>=0;i--) m[c][i]=m[c][i+1]+(s[i+1]==c);
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(const char c:{'R','G','B'}){
				if(s[i]!=c && s[j]!=c && s[i]!=s[j]){
					ans+=(m[c][j]);
					if(j+(j-i) < n && s[j+(j-i)] == c) ans--;
				}
			}
		}
	}
	return ans;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    int t=1;
    //cin>>t;
    while(t--) cout<<solve()<<'\n';
    //while(t--) solve(),cout<<'\n';
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-9;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
 
char in[120];
pair<pair<string,int>,int> p[110];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		int t;scanf("%s%d",in,&t);
		string tmp=in;
		p[i]=make_pair(make_pair(in,-t),i);
	}
	std::sort(p,p+a);
	for(int i=0;i<a;i++)printf("%d\n",p[i].second+1);
}

Measured memory_bytes: 256
import sys
import numpy as np
import math
# for AtCoder
# import fractions
from collections import deque 
from functools import reduce
 
# input = sys.stdin.readline
 
n = int(input())
 
sum = 0
for i in range(1, n+1):
    if ((i % 3) == 0 or (i % 5) == 0):
        continue
    else:
        sum += i
    
print(sum)

Measured memory_bytes: 27112
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
	int a,s,d,f;
	cin >> a >> s >> d >> f;
	int count=0;
	for(int i=0;i<110;i++){
		if(i>=a&&i<=s){
			if(i>=d&&i<=f){
				count++;
			}
		}
	}
	if(count==0){
		cout << 0 << endl;
	}else{
		cout << count-1 << endl;
	}
	
}

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

int main(){
    int a,b;
    cin >> a >> b;
    if(a<b) swap(a,b);
    
    int ans=max(a+a-1,a+b);
    
    cout << ans << endl;
    
    return 0;
}




Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CBackAndForth solver = new CBackAndForth();
        solver.solve(1, in, out);
        out.close();
    }

    static class CBackAndForth {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int sx = in.ints(), sy = in.ints(), tx = in.ints(), ty = in.ints();
            int dx = tx - sx, dy = ty - sy;
            IntStream.range(0, dy).forEach(i -> out.print('U'));
            IntStream.range(0, dx).forEach(i -> out.print('R'));
            IntStream.range(0, dy).forEach(i -> out.print('D'));
            IntStream.range(0, dx).forEach(i -> out.print('L'));
            out.print('L');
            IntStream.range(0, dy + 1).forEach(i -> out.print('U'));
            IntStream.range(0, dx + 1).forEach(i -> out.print('R'));
            out.print('D');
            out.print('R');
            IntStream.range(0, dy + 1).forEach(i -> out.print('D'));
            IntStream.range(0, dx + 1).forEach(i -> out.print('L'));
            out.println('U');
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

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

        public int ints() {
            return Integer.parseInt(string());
        }

    }
}



Measured memory_bytes: 26708
a,b,c,x = 4.times.map{ gets.to_i }
cnt = 0
(0..a).each do |i|
    (0..b).each do |j|
        (0..c).each do |k|
            cnt += 1 if i * 500 + j * 100 + k * 50 == x
        end
    end
end
 
puts cnt

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

int main(){
  int n, i, count=0;
  cin >> n;
  vector<int> p(n);
  for(i=0; i<n; i++){
    cin >> p[i];
  }

  for(i=0; i<n-2; i++){
    if(p[i] > p[i+1] && p[i+1] > p[i+2] || p[i] < p[i+1]  && p[i+1] < p[i+2]){count++;}
  }

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define repB(i, z, n) for(int i = n - 1; i >= z; i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;

int main(){
    int N;
    cin >> N;
    cout << pow(N, 3) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int a, b, c;
  int temp;
  scanf("%d %d %d", &a, &b, &c);
  

    if(b<a){
      temp = a;
      a = b;
      b = temp;
    }
	if(c<b){
	  temp = b;
	  b = c;
	  c = temp;
	}
	if(b<a){
	  temp = a;
	  a = b;
	  b = temp;
	}
	printf("%d %d %d\n",a, b, c);
    
  
 
 return 0;
}


Measured memory_bytes: 2080
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl '\n'
typedef long long ll;
//	Table is the complete reverse of dp
//	Always think of the pattern (LCM, GCD)
//	Be careful of unsigned
//	Think of a solution that gets TLE and optimize it
//	Use binary search
//	Solve on paper first

int main()
{
    cin.tie(nullptr); ios_base::sync_with_stdio(0);
    string s;
    cin >> s;
    int cnt = s[0] == 'R';
    if(s[1] == 'R' && s[2] == 'R')
    	cnt += 2;
    else if(s[1] == 'R')
    	cnt++;
    else if(s[2] == 'R')
    	cnt = 1;
    cout << cnt;
}


Measured memory_bytes: 3648
#include <cstdio>
#include <iostream>
// 使用flag的冒泡排序法 
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	
	int count=0;
	int flag=1;
	for(int i=0;flag;i++)
	{
		flag=0;
		for(int j=n-1;j>=i+1;j--)
			if(a[j]<a[j-1])
			{
				swap(a[j],a[j-1]);
				flag=1;
				count++;	
			} 
	}
		
	for(int i=0;i<n;i++) 
	{
		if(i>0) cout<<' ';
		cout<<a[i];
	}
	cout<<'\n'<<count<<'\n';
	return 0;
}


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

int maxnum(int n){
  while(n > 9){
    n /= 10;
  }
  return n;
}

int minnum(int n){
  return n % 10;
}

int main(void){
  int N;
  cin >> N;
  
  vector<vector<int>>num(10,vector<int>(10,0));
  for(int i=0;i<=N;i++){
    num[maxnum(i)][minnum(i)]++;
  }
  
  long long ans = 0;
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      ans += num[i][j] * num[j][i];
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


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

/*
// ordered_set 
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
 
using namespace std;
 
typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ld, ld>                                    pll;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define Sort(x)                                         sort(all(x))
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
 
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}

//const ll md = 1e9 + 7;//998244353;
const int xn = 1e5 + 10;
const int xm = -20 + 10;
const int SQ = 320;
const int sq = 320 + 10;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int Md = 998244353;
const int TM = 3;
const int Base = 257;

int k, a, b, c, d, ans;

int main(){
    InTheNameOfGod;
    
    cin >> a >> b >> c >> d >> k;
    if (a == c) ans = d - b;
    else{
    	ans = (c - a - 1) * 60;
    	ans += d + 60 - b;
	}
	cout << ans - k << endl;
	
    return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main{
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int count = 0;
			for(int i =a ; i <=b ; i++) {
			if(c%i==0) {
				count++;
			}
		}
				System.out.println(count);
	}

}


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

x = 0
for i in range(n):
    x = x ^ a[i]
#print(bin(c))


#x = int(x, 2)
for i in range(n):
    ans = a[i] ^ x
    if i < n - 1:
        print(ans,end=' ')
    else:
        print(ans)



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

int main() {
  int N;
  string S, T;
  cin >> N >> S >> T;
   
  string U;
  U = S + T;
  
  for (int i = 0; i < N; i++) {
    U.at(2*i) = S.at(i); 
  }
  for (int i = 0; i < N; i++) {
    U.at(2*i+1) = T.at(i); 
  }
  
  cout << U <<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (int ac, char **av) {
  char buf[21];
  char *p;
  while(fgets(buf,21,stdin) != NULL) {
    for(p=buf;*p!='\n'&&*p!='\0';p++);
    for(;p>buf;putchar(*--p));
  }
  putchar('\n');
  return 0;
}

Measured memory_bytes: 524