akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
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;
}
const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    string S;cin>>S;
    int N=S.size();
    vector<int>piyo;
    if(S[0]=='0'||S[N-1]=='1'){
        cout<<-1<<endl;
        return 0;
    }
    REP(i,N){
        if(S[i]=='1')piyo.pb(i);
    }
  	S[N-1]='1';
    REP(i,N/2){
        if(S[i]!=S[N-2-i]){
            cout<<-1<<endl;
            return 0;
        }
    }
    piyo.pb(N-1);
    REP(i,N-1){
        auto v=upper_bound(piyo.begin(),piyo.end(),i);
        cout<<i+1<<" "<<1+*v<<endl;
    }
}

Measured memory_bytes: 2420
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

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

void YNout(bool check){
	if(check)cout << "Yes" << endl;
	else cout << "No" << endl;
}

signed main(){
	ll n,cnt = 0;
	string s,t,u;
	
	cin >> n >> s >> t >> u;
	
	rep(i,0,n){
		if(s[i] == t[i] && t[i] == u[i]) continue;
		else if(s[i] != t[i] && t[i] != u[i] && s[i] != u[i]) cnt += 2;
		else cnt += 1;
	}
	
	cout << cnt << endl;
	return 0;

}


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

int main(){
	int x1, y1, x2, y2, x3, y3, x4, y4;
	cin>>x1>>y1>>x2>>y2;
	int del_x = x2-x1;
	int del_y = y2-y1;
	
	x3 = x2 - del_y;
	y3 = y2 + del_x;

	int del_x_2 = x3 - x2;
	int del_y_2 = y3 - y2;

	x4 = x3 - del_y_2; 
	y4 = y3 + del_x_2;
	
	cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4;
	return 0;
}


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

public class Main {

	private static void solve(){
		//Implement solution here.
		int n = ni();
		char[] s = next().toCharArray();
		int tmp = 0;
		int result = 0;
		for(int i = 0; i < n - 2; i++) {
			if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')result++;
		}
		System.out.println(result);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

int main(){
    fast;
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if(a >= k)
        cout << k;    
      else if((a+b) >= k)
          cout << a;
      else{
          k = k - (a+b);
          cout <<  a - k;
      }
    return 0;
}

Measured memory_bytes: 3652
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.List;
import java.awt.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    /* 変数宣言 */
    final int r;

    AtCoder(FastScanner sc) {
        r = sc.nextInt();
    }

    void solve(PrintWriter out) {
        out.println(r*r);
    }
}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

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

Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;

#define rep_it(it,x) for (__typeof((x).begin()) it=(x).begin(); it!=(x).end(); it++)
#define ____ puts("\n_______________\n\n") 
#define debug(x) ____; cout<< #x << " => " << (x) << endl
#define debug_pair(x) cout<<"\n{ "<<(x).fir<<" , "<<(x).sec<<" }\n"
#define debug_arr(x,n) ____; cout<<#x<<":\n"; rep(i,0,n+1) cout<<#x<<"["<<(i)<<"] => "<<x[i]<<endl
#define debug_arr2(x,n,m) ____; cout<<#x<<":\n"; rep(i,0,n+1) rep(j,0,m+1) cout<<#x<<"["<<(i)<<"]["<<(j)<<"]= "<<x[i][j]<<((j==m)?"\n\n":"    ")
#define debug_set(x) ____; cout<<#x<<": \n"; rep_it(it,x) cout<<(*it)<<" "; cout<<endl
#define debug_map(x) ____; cout<<#x<<": \n"; rep_it(it,x) debug_pair(*it)

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

const int N=2e6+5,P=924844033;
int n,x,y,siz[N]; ll num[N],fac[N],inv[N],ret[N]; vi V[N];

ll Pow(ll x,ll k) { ll ans=1; for (;k;k>>=1,x=x*x%P) if (k&1) (ans*=x)%=P; return ans; } 

template <class V>
struct FT{
	static const int N=1<<19,_p=P; V w[2][N*2+5],rev[N*2+5],tmp;
	void Init() {
		V w0=Pow(5,(_p-1)/N),m; w[0][0]=w[1][0]=1;
		rep(i,1,N) w[0][i]=w[1][N-i]=(ll)w[0][i-1]*w0%_p;
		for (m=0; (1<<m)!=N; m++);
		rep(i,1,N) rev[i]=(rev[i>>1]>>1)|(i&1)<<m-1;
	}
	void FFT(V A[],int op){
		rep(i,0,N) if (i<rev[i]) swap(A[i],A[rev[i]]);
		for (int i=1; i<N; i<<=1)
			for (int j=0,t=N/(i<<1); j<N; j+=i<<1)
				for (int k=j,l=0; k<j+i; k++,l+=t) {
					V x=A[k],y=(ll)w[op][l]*A[k+i]%_p;
					A[k]=(x+y)%_p,A[k+i]=(x-y+_p)%_p;
				}
		if (op) { tmp=Pow(N,_p-2); rep(i,0,N) A[i]=1ll*A[i]*tmp%_p; }
	}
	void Solve(V A[],V B[],V C[],int op=0) {
		if (op) reverse(B,B+N); FFT(A,0),FFT(B,0); 
		rep(i,0,N) C[i]=(ll)A[i]*B[i]%_p; FFT(C,1); if (op) reverse(C,C+N);
	}
};

void dfs(int x,int p) {
	siz[x]=1;
	for (auto y: V[x]) if (y!=p) dfs(y,x),siz[x]+=siz[y];
	if (p) num[siz[x]]--,num[n-siz[x]]--;
}

FT<ll> T;

int main() {
//	file_put();
	
	scanf("%d",&n);
	rep(i,1,n) scanf("%d%d",&x,&y),V[x].pb(y),V[y].pb(x);
	dfs(1,0),num[n]=n;
	fac[0]=inv[0]=inv[1]=1;
	rep(i,2,n+1) inv[i]=(P-P/i)*inv[P%i]%P;
	rep(i,1,n+1) inv[i]*=inv[i-1],inv[i]%=P,fac[i]=fac[i-1]*i%P;
//	debug_arr(num,n);
	rep(i,0,n+1) (num[i]*=fac[i])%=P,fac[i]=inv[i];
	T.Init();
	T.Solve(fac,num,ret,1);
	rep(i,0,n+1) ret[i]*=inv[i],ret[i]%=P;
	rep(i,1,n+1) printf("%lld\n",ret[i]);
	
	return 0;
}



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

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

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

int main()
{
	int n;
	int ary[100];
	while (cin >> n, n)
	{
		for (int i = 0; i < n; i++) cin >> ary[i];
		int Max = *max_element(ary, ary + n);
		int Min = *min_element(ary, ary + n);
		int Sum = accumulate(ary, ary + n, 0);
		cout << (Sum - Max - Min) / (n - 2) << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ll long long
#define vi vector <int>
#define vll vector<ll>
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define INF 1000000000000000000
#define pi atan(1)*4
#define MOD 1000000000+7L
#define eps 0.0000006
#define MAX_V 10000
 
using namespace std;

vll a;
vll estado;

int k;

int solve(int i){
	if(i == 0) return 0;
	if(i == 1) return abs(a[0]-a[1]);

	if(estado[i] != INF) return estado[i]; 

	for (int j = i-1; j >= (i-k) && j >= 0; --j){
		estado[i] = min(solve(j)+abs(a[i]-a[j]),estado[i]);
	}

	return estado[i];
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	
	int n;

	cin >> n >> k;

	a.assign(n,0);
	estado.assign(n,INF);

	for (int i = 0; i < n; ++i){
		cin >> a[i];
	}	

	cout << solve(n-1) << '\n';

	return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=100010;
namespace T{
	const int E=N<<1;
	int to[E],bro[E],head[N],e=0;
	int f[N];
	inline void init(){
		memset(head,-1,sizeof(head));
	}
	inline void ae(int u,int v){
		to[e]=v,bro[e]=head[u],head[u]=e++;
	}
	int dfs(int x){
		vector<int>vec;
		for(int i=head[x];~i;i=bro[i]){
			vec.push_back(dfs(to[i]));
		}
		sort(vec.begin(),vec.end());
		int ans=0;
		for(int i=0,n=vec.size();i<n;i++){
			apmax(ans,vec[i]+n-i);
		}
		return ans;
	}
}
int main(){
	int n=ni;
	T::init();
	for(int i=2;i<=n;T::ae(ni,i),i++);
	printf("%d\n",T::dfs(1));
	return 0;
}

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

using namespace std;

const int maxn = 200010;
const int mod = 924844033;

int n, l[maxn], a[maxn], ans[maxn], g, e;

struct Edge {
	int v, x;
} E[maxn<<1];

inline void addEdge(int u, int v) {
	E[e].v = v, E[e].x = l[u], l[u] = e++;
}

namespace NTT {
	vector<int> vp;
	int qpow(int x, int y, int mod) {
		int ret = 1;
		while (y) {
			if (y & 1) ret = 1LL * ret * x % mod;
			x = 1LL * x * x % mod;
			y >>= 1;
		}
		return ret;
	}
	int checkg(int p, int x) {
		for (int i = 0; i < vp.size(); i++) {
			if (qpow(x, (p-1) / vp[i], p) == 1) {
				return 0;
			}
		}
		return 1;
	}
	int calg(int p) {
		vp.clear();
		int t = p-1;
		for (int i = 2; i * i <= t; i++) {
			if (t % i == 0) {
				while (t % i == 0) t /= i;
				vp.push_back(i);
			}
		}
		for (int i = 2; i <= p; i++) {
			if (checkg(p, i)) {
				return i;
			}
		}
		return -1;
	}
	int wa[maxn*4], wb[maxn*4], wc[maxn*4], rev[maxn*4];
	void ntt(int *a, int _l, int ty) {
		int len = (1 << _l);
		for (int i = 1; i < len; i++) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (_l - 1));
		for (int i = 0; i < len; i++) if (i < rev[i]) swap(a[i], a[rev[i]]);
		for (int l = 2; l <= len; l <<= 1) {
			int wl = qpow(g, (mod - 1) / l, mod);
			for (int s = 0; s < len; s += l) {
				int w = 1;
				for (int i = 0; i < (l >> 1); i++) {
					int v1 = a[s + i], v2 = 1LL * a[s + i + (l >> 1)] * w % mod;
					a[s + i] = (v1 + v2) % mod;
					a[s + i + (l >> 1)] = (v1 - v2 + mod) % mod;
					w = 1LL * w * wl % mod;
				}
			}
		}
		if (ty == -1) {
			int inv = qpow(len, mod-2, mod);
			for (int i = 0; i < len; i++) a[i] = 1LL * a[i] * inv % mod;
			for (int i = 1; i < len / 2; i++) swap(a[i], a[len-i]);
		}
	}
	int fac[maxn], ifac[maxn];
	void calans() {
		fac[0] = ifac[0] = 1;
		for (int i = 1; i <= n; i++) fac[i] = 1LL * fac[i-1] * i % mod;
		for (int i = 1; i <= n; i++) ifac[i] = qpow(fac[i], mod-2, mod);
		for (int i = 0; i <= n; i++) wa[i] = 1LL * a[i] * fac[i] % mod;
		for (int i = 0; i <= n; i++) wb[i] = ifac[n - i];
		int t = 0; while ((1<<t) <= 2 * n) ++ t;
		ntt(wa, t, 1); ntt(wb, t, 1);
		for (int i = 0; i < (1<<t); i++) wc[i] = 1LL * wa[i] * wb[i] % mod;
		ntt(wc, t, -1);
		for (int i = 1; i <= n; i++) ans[i] = (1LL * ifac[i] * wc[n+i] % mod + 1LL * fac[n] * ifac[i] % mod * ifac[n-i] % mod) % mod;
	}
}

namespace N1 {
	int sz[maxn];
	void dfs(int u, int f) {
		sz[u] = 1;
		for (int p = l[u]; p >= 0; p = E[p].x) {
			int v = E[p].v;
			if (v != f) {
				dfs(v, u);
				sz[u] += sz[v];
			}
		}
		if (f) {
			a[n] = (a[n] + 1) % mod;
			a[sz[u]] = (a[sz[u]] + mod - 1) % mod;
			a[n-sz[u]] = (a[n-sz[u]] + mod - 1) % mod;
		}
	}
}

int main() {
	g = NTT::calg(mod);
	memset(l, -1, sizeof(l));
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		int u, v; scanf("%d%d", &u, &v);
		addEdge(u, v), addEdge(v, u);
	}
	N1::dfs(1, 0);
	NTT::calans();
	for (int i = 1; i <= n; i++) printf("%d\n", ans[i]);
	return 0;
}

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

using namespace std;

int main() {

    int a;
    int c = 0;
    string s;
    cin >> a;
    cin >> s;

    for(int i = 0; i < a; i++) {
        if(s[i] == 'R') {
            c++;
        }
    }

    if(c > (a / 2)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
S=input()
MOD=10**9+7
dp=[0]*13
dp[0]=1
for s in S:
    p=[x for x in dp]
    dp=[0]*13
    if s=="?":
        a=range(10)
    else:
        a=[int(s)]
    for i in range(13):
        for x in a:
            dp[(10*i+x)%13]+=p[i]
    dp=[x%MOD for x in dp]
print(dp[5])

Measured memory_bytes: 44012
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")

// #pragma GCC optimize("O3")
// #pragma GCC target("avx2")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"
ll extgcd(ll a, ll b, ll &x, ll &y) {
  ll g = a;
  x = 1;
  y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}

void solve() {
  int n, t;
  cin >> n >> t;
  vector<int> a(n);
  cin >> a;
  int mx = 0;
  int rmx = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    chmax(mx, rmx - a[i]);
    chmax(rmx, a[i]);
  }
  dmp(mx);
  ll ans = 0ll;
  map<int, int> m;
  for (int i = n - 1; i >= 0; i--) {
    auto it = m.find(a[i] + mx);
    if (it != m.end()) { ans += it->second; }
    m[a[i]]++;
  }
  cout << ans << endl;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


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

using namespace std;

const int maxn=310;

int n,m,k;
long long s[maxn][maxn];

const int inf=0x3f3f3f3f;

void floyd(){
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(s[i][j]>s[i][k]+s[k][j]){
					s[i][j]=s[i][k]+s[k][j];
				}
			}
		}
//		printf("%d\n",k);
	}
}

int main(){
	scanf("%d%d%d",&n,&m,&k);
	memset(s,inf,sizeof(s));
	for(int i=0;i<m;i++){
		int x,y;
		long long w;
		scanf("%d%d%lld",&x,&y,&w);
		s[x][y]=w;
		s[y][x]=w;
	}
	
	floyd();
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(s[i][j]<=k) s[i][j]=1;
			else s[i][j]=inf;
		}
	}
	
	floyd();
	int q;
	scanf("%d",&q);
	while(q--){
		int x,y;
		scanf("%d%d",&x,&y);
//		cout<<s[x][y]<<endl;
		if(s[x][y]!=inf)
			printf("%lld\n",s[x][y]-1);
		else
			printf("-1\n");
	}
	return 0;
}

Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main() {
	int h, w;
	while(1){
	cin >>  h >>  w;
		if (h == 0 && w == 0) {
			break;
		}
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (i % 2 == 0) {
					if (j % 2 == 0) {
						cout <<'#';
					}
					else {
						cout << '.';
					}
				}
				else {
					if (j % 2 != 0) {
						cout << '#';
					}
					else {
						cout << '.';
					}
				}
			}
				cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n) ; ++i)
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define emb emblace_back

using namespace std;
using ll = long long;
using P = pair<int,int>;

template<typename T>
void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << v << ",";
  }
  cout << "]" << endl;
}

int main() {
  int n;
  cin >> n;
  vector<int> x(n,0);
  rep(i,n) cin >> x.at(i);

  ll mn=1e18;
  rep(i,100) {
    ll d=0;
    rep(j,n) {
      d += (i - x.at(j)) * (i - x.at(j));
    }
    mn = min(mn,d);
  }
  cout << mn << endl;

  return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
a, b = map(str, input().split())
import math
ab = int(a+b)
if math.sqrt(ab)==int(math.sqrt(ab)):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
#include <iostream>
#include <cstdint>
#include <algorithm>

int main() {
	int64_t N, T;
	std::cin >> N >> T;

	int64_t ans = 0, begin = 0, end = T;
	std::cin >> begin;
	for (int i = 1; i < N; ++i) {
		int64_t t;
		std::cin >> t;

		if (end < t) {
			ans += end - begin;
			begin = t;
		}

		end = t + T;
	}
	ans += end - begin;

	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>
#include <string>
#include <functional>

using namespace std;

#define rep(i,n) for(int i = 0; i < (int)(n); i++)

int main(void){
    int N;
    cin>>N;
    vector<int> H(N);
    rep(i,N){
        cin>>H[i];
    }
    int ans=0;
    int count=0;
    for(int i=N-2;i>=0;i--){
        if(H[i]>=H[i+1]){
            count++;
        }else{
            if(ans<count){
                ans=count;
            }
            count=0;
        }
    }

    if(ans<count){ans=count;}
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
"use strict";

function main(input) {
  //かかる秒数　開業からの運行開始　運行間隔
  input = input.split("\n");
  input = input.slice(1, -1);
  input = input.map(v => v.split(/\s/).map(x => ~~x));

  let ans = [];
  for (let i = 0; i < input.length; i++) {
    let time = 0;
    for (let j = i; j < input.length; j++) {
      if (time < input[j][1]) {
        //到着した駅の発車時刻が到着時刻より大きい
        time = input[j][1]; // 発車時刻を待つ
      } else if (time % input[j][2] != 0) {
        //到着時に発車間隔が合わなければ、 合わない分だけ待つ
        time += input[j][2] - (time % input[j][2]);
      }
      time += input[j][0]; //乗車時間を追加
    }
    ans.push(time);
  }
  ans.push(0);

  console.log(ans.join("\n"));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7996
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll a[Max];

ll mn=oo,res=oo,mx=0;
void solve(){
	ll n;
	cin>>n;
	rep(i,0,n){
		cin>>a[i];
		mn = min(mn,a[i]);
		mx = max(mx,a[i]); 
	} 
	rep(i,mn,mx+1){
		ll sum=0;
		rep(j,0,n){
			sum+=abs(i-a[j])*abs(i-a[j]);
		}
		res = min(res,sum);
	}
	cout<<res;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





Measured memory_bytes: 256
#include <algorithm>
#include <boost/rational.hpp>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int64_t digit_sum(int64_t n) {
  int64_t result = 0;
  while (n > 0) {
    result += n % 10;
    n /= 10;
  }
  return result;
}

int64_t calc_next(int64_t n) {
  using F = boost::rational<int64_t>;
  const F lb(n, digit_sum(n));
  int d = 0;
  int64_t thr = 1;
  while (lb >= F(thr, 9LL * (d + 1))) {
    thr *= 10;
    d++;
  }

  vector<int> digits;
  int64_t m = n;
  rep(i, d) {
    digits.push_back(m % 10);
    m /= 10;
  }

  using P = pair<F, int64_t>;
  P result = P(lb, n);
  rep(i, 9 * d) {
    const int64_t K = i + 1;
    int64_t s = 0;
    int64_t shift = thr / 10;

    rep(i, d) {
      int64_t j = d - 1 - i;
      s += digits[j];

      if (digits[j] < 9) {
        int64_t res = K - s - 1;
        if (res >= 0) {
          int64_t r = res - 9 * j;
          if (r < 0) {
            int64_t m = res % 9;
            rep(i, res / 9) { m = 10 * m + 9; }
            m += n - n % shift + shift;
            F ratio(m, K);
            result = min(result, P(ratio, m));
          } else if (digits[j] + 1 + r < 10) {
            int64_t m = n - n % shift + (1 + r) * shift + shift - 1;
            F ratio(m, K);
            result = min(result, P(ratio, m));
          }
        }
      }

      shift /= 10;
    }
  }

  return result.second;
}

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

  int64_t result = 1;
  rep(i, K) {
    cout << result << "\n";
    result = calc_next(result + 1);
  }
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
a = [[int(x) for x in input().split()] for _ in range(2)]
ans = 0
from itertools import accumulate
a1 = [0] + list(accumulate(a[0]))
a2 = [0] + list(accumulate(a[1]))

for i in range(1, n + 1):
    res = a1[i] + a2[-1] - a2[i - 1]
    ans = max(ans, res)

print(ans)





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

int main() {
  int N;
  string Color,Res;

  cin >> N ;

  for ( int i = 0 ; i < N; i++) { 
    cin >> Color;
    if ( Color == "Y") {
      Res = "Four";
      break;
    }
    else {
      Res = "Three";
    }
  }
  cout << Res << endl;
}


Measured memory_bytes: 256
s=input()
n=len(s)
res=0
tg,tp=0,0
for i in range(n):
    if s[i]=="g":
        if tg>tp:
            tp+=1
            res+=1
        else:
            tg+=1
    else:
        if tg>tp:
            tp+=1
        else:
            tg+=1
            res-=1
print(res)

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


void solve(std::string S){
    string ss;
    for(int i = S.size()-1; i >= 1; --i){
        ss = S.substr(0, i);
        //cout << ss << endl;
        if(ss.size() % 2 != 0) continue;
        else{
            //cout << ss.substr(0, (ss.size())/2) << endl;
            //cout << ss.substr(ss.size()/2, ss.size()) << endl;
            if(ss.substr(0, (ss.size())/2) == ss.substr(ss.size()/2, ss.size())){
                cout << ss.size() << endl;
                exit(0);
            }
        }
    }
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
a = gets.chomp
b = gets.chomp
c = gets.chomp
d = gets.chomp
e = gets.chomp

array  = [a, b, c, d, e]
array3 = [a.clone, b.clone, c.clone, d.clone, e.clone]
# 末尾の値がすくない順に並び替える0123...9
array2 = []
array.each do |n|
  array2 << if n[-1] == "0"
              n.to_i
            else
              n[-1] = "0"
              n.to_i + 10
            end
end

number = 0

break_flg = false
(1..9).each do |n|
  array3.each do |k|
    if k[-1] == n.to_s
      number    = n
      break_flg = true
    end
    break if break_flg
  end
  break if break_flg
end

if number.zero?
  p array2.inject(:+)
else
  p array2.inject(:+) - 10 + number
end


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

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

int main() {
  int N; ll W; cin >>N >>W;
  vector<ll> weight(N),value(N);
  rep (i,N) cin >>weight.at(i) >>value.at(i);

  vector<vector<ll>> dp(N+2, vector<ll>(100100, 0));
  // dp[i][j]...i-1番目までの品物から重さがj以下となるように選んだ時の勝ちの総和の
  // 最大値
  for (int i=0; i<N; i++){
    for (int j=0; j<=W; j++){
      if (j >= weight[i]) chmax(dp[i+1][j], dp[i][j-weight[i]] + value[i]);
      chmax(dp[i+1][j], dp[i][j]);
    }
  }
  cout <<dp[N][W] <<endl;
  
}


Measured memory_bytes: 81024
n = int(input())
l = list(map(int,input().split()))
l.sort()
dis = l[-1]
if l[-1]% 2 == 0:
    right = l[-1]//2
else:
    right = l[-1]//2+1
for i in range(n-1):
    if abs(l[i]-right) <= dis:
        dis = abs(l[i]-right)
        check = i
print("{} {}".format(l[-1],l[check]))
  


Measured memory_bytes: 14428
a, b, c, d = map(int, input().split())
MOD = 998244353

dp = [[0] * (d - b + 1) for _ in range(c - a + 1)]

dp[0][0] = 1

for x in range(1, d - b + 1):
    dp[0][x] = dp[0][x - 1] * a % MOD
for y in range(1, c - a + 1):
    dp[y][0] = dp[y - 1][0] * b % MOD

for x in range(1, c - a + 1):
    for y in range(1, d - b + 1):
        dp[x][y] = (dp[x - 1][y] * (b + y) + dp[x][y - 1] * (a + x) - dp[x - 1][y - 1] * (a + x - 1) * (b + y - 1)) % MOD

print(dp[-1][-1])

Measured memory_bytes: 133528
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctype.h>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b){
        cout << c << endl;
    }
    else if(b == c){
        cout << a << endl;
    }
    else {
        cout << b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(raw_input())

R = [0 for i in range(n)]

ans = 1 - 10**9
for i in range(n):
    R[i] = int(raw_input())
    if i == 0:
        min_R = R[0]
        continue
    if R[i] - min_R > ans:
        ans = R[i] - min_R
    if R[i] < min_R:
        min_R = R[i]
        
print ans
    
    
    

Measured memory_bytes: 18876
import java.util.Scanner;

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

	int N = in.nextInt();
	int ans = 0;

	for(int cnt = 0; cnt < N; cnt++){
		int l = in.nextInt();
		int r = in.nextInt();
		ans = ans + r - l + 1;
	}
	System.out.println(ans);
}
}

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

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll n,m,i,j;
    cin>>n>>m;
    vector<vector<char>> v(n,vector<char>(m));
    vector<vector<ll>> dp(n,vector<ll>(m,0));
    
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
            cin>>v[i][j];
    }
    dp[n-1][m-1]=1;
    for(i=n-1;i>=0;i--)
    {
        for(j=m-1;j>=0;j--)
        {
            if(i>0 && v[i-1][j]!='#')
                dp[i-1][j]=(dp[i-1][j]+dp[i][j])%mod;
            if(j>0 && v[i][j-1]!='#')
                dp[i][j-1]=(dp[i][j-1]+dp[i][j])%mod;
        }
    }

    cout<<dp[0][0]<<endl;
    
    return 0;
}

Measured memory_bytes: 9088
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
l=list(mi())
for i in range(5):
  if l[i]==0:
    print(i+1)
    sys.exit()

Measured memory_bytes: 9496
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>

using namespace std;

/// 各桁の和
int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;
    }
    return sum;
}
/// 最小公倍数 
int gcd(int x, int y){
      if(x<y){
          int temp = x;
          x = y;
          y = temp;
      }
      int r = x % y;
       while(r!=0){
           x = y;
           y = r;
           r = x % y;
       }
      return y;
   }



int main(){
  int N, M;
  cin >> N >> M;
  vector<int> X(M);
  for(int i = 0; i < M; i++){
      cin >> X[i];
  }
   sort(X.begin(),X.end());
vector<int> dis(M-1);
for(int i = 0; i < M-1; i++){
    dis[i] = abs(X[i] -X[i+1]);
    
}   
sort(dis.begin() ,dis.end()) ;
int res = 0;
for(int i = 0 ;i < M-1-(N-1);i++){
    res += dis[i];
  
}
 cout << res  << endl;

   }

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x*x
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

void we_r_done(){cout<<"NO"; exit(0);}

void debug(string mssg){cout<<mssg; exit(0);}


int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    ///FastIO;
	string s;
  cin>>s;
  cout<<s[0]<<(s.size()-2)<<s.back();

    return 0;
    ///return main();
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///priority_queue< int, vector< int >, greater< int > > minHeap;
///using bs = bitset<MX>; // how many distinct number can be form?


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

int main()
{
	int n,sum=0;
	char str[128];
	while(cin >> str)
	{
		for(int i=0; str[i]; i++)
		{
			if(str[i]<'0' || '9'<str[i])
			{
				str[i] = ' ';
			}
		}
		stringstream ss;
		ss << str;
		while(ss >> n)
		{
			sum+=n;
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#define ll long long
#define ull unsigned long long
#define LLMax LLONG_MAX
#define LLMin LLONG_MIN
#define Max INT_MAX
#define Min INT_MIN
#define FOR1(i,a,b) for(int i=(a);i<(b);i++)
#define FOR2(i,a,b) for(int i=(a);i<=(b);i++)
#define DWN(j,b,a) for(int j=(b);j>=(a);j--) 
#define SET0(a) memset(a,0,sizeof(a))
#define SETN1(a) memset(a,-1,sizeof(a))
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
//#define int long long
const int INF=0x3f3f3f3f;
const int NINF=-INF-1;
const double PI=acos(-1); 
const int mod=1e9+7;
const int maxn=5e5+50;
using namespace std;
int main() {
	//IOS;
	int n;
	cin>>n;
	printf("%.5lf",PI*2*n);
	return 0;
}

Measured memory_bytes: 3748
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 distx = tx - sx;
		int disty = ty - sy;
		
		StringBuilder sb = new StringBuilder();
		
		//1回目　s -> t -> s
		for(int i = 0; i < distx; i++) {
			sb.append("R");
		}
		for(int i = 0; i < disty; i++) {
			sb.append("U");
		}
		for(int i = 0; i < distx; i++) {
			sb.append("L");
		}
		for(int i = 0; i < disty; i++) {
			sb.append("D");
		}
		//2回目
		sb.append("D");
		for(int i = 0; i < distx + 1; i++) {
			sb.append("R");
		}
		for(int i = 0; i < disty + 1; i++) {
			sb.append("U");
		}
		sb.append("L");
		sb.append("U");
		for(int i = 0; i < distx + 1; i++) {
			sb.append("L");
		}
		for(int i = 0; i < disty + 1; i++) {
			sb.append("D");
		}
		sb.append("R");
		
		System.out.println(sb.toString());
	}
}



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

int main() {
    int N; cin >> N;
    string S; cin >> S;
    for(char c : S) {
        int tmp = ((int)c - (int)'A' + N) % 26;
        cout << (char)((int)'A' + tmp);
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

int main(){
    ll n, cnt=0, r=0;
    char c[200001]={0};
    scanf("%lld",&n);
    scanf("%s",c);
    for(int i=0; i<n; i++){
        if( c[i]=='R' ){ r++; }
    }
    if( r==0 ){ printf("0\n"); return 0; }
    for(int i=0; i<r; i++){
        if( c[i]=='W' ){ cnt++; }
    }
    printf("%lld\n",cnt);
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int N; cin >> N;
    if(N%10==9 || (N/10)%10==9) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
ll n,m; cin>>n>>m;
if(2*n>m){cout<<m/2<<endl;}
else{cout<<n+(m-2*n)/4;}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int M, K;
    cin >> M >> K;
    if(K >= 1<<M){
        cout << -1 << endl;
        return 0;
    }
    if(M == 1){
        if(K == 1){
            cout << -1 << endl;
            return 0;
        }
        else{
            cout << 0 << ' ' << 1 << ' ' << 1 << ' ' << 0 << endl;
            return 0;
        }
    }
    vector<int> ans;
    rep(i, 1<<M){
        if(i != K) ans.pb(i);
    }
    ans.pb(K);
    rep3(i, (1<<M)-1, 0){
        if(i != K) ans.pb(i);
    }
    ans.pb(K);
    for(auto &e: ans) cout << e << ' ';
    cout << endl;
}

Measured memory_bytes: 2932
n = gets.chomp.to_i

if n < 2 then
    puts 0
    exit
end

puts ([*0..9].repeated_permutation(n).size - [*0..8].repeated_permutation(n).size - [*1..9].repeated_permutation(n).size + [*1..8].repeated_permutation(n).size) % (10 ** 9 + 7)


Measured memory_bytes: 23500
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int const N=2e5+5;
bool prime[N];


int main()
{
	prime[0]=prime[1]=true;
	for(int i=2;i<N;i++)
	{
		if(!prime[i])
		{
			for(int j=i*2;j<N;j+=i)
				prime[j]=true;
		}
	}
	int n;
	scanf("%d",&n);
	while(prime[n]==true) n++;
	printf("%d\n",n);
	
	return 0;
}

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

int main() {
    string N;
    cin >> N;
    reverse(N.begin(), N.end());
    vector<vector<int>> dp(N.size() + 1, vector<int>(2, 0));
    for (int i = 0; i < N.size(); i++) {
        int x = N[i] - '0';
        dp[i + 1][0] = min(dp[i][0] + x, dp[i][1] + x + 1);
        dp[i + 1][1] = i ? min(dp[i][0] + 10 - x, dp[i][1] + 9 - x) : dp[i][0] + 10 - x;
    }
    cout << min(dp[N.size()][0], dp[N.size()][1] + 1) << endl;
    return 0;
}

Measured memory_bytes: 55940
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

typedef pair< int, int > iP;

int main() {

    int n;

    while(cin >> n, n) {
        vector< iP > v;
        vector< int > t(24 * 3600, 0);
        for(int i = 0; i < n; i++) {
            int h, m, s, hh, mm, ss;
            scanf("%2d:%2d:%2d %2d:%2d:%2d", &h, &m, &s, &hh, &mm, &ss);
            v.push_back(iP(h * 3600 + m * 60 + s, hh * 3600 + mm * 60 + ss));
            t[v[v.size() - 1].first]++, t[v[v.size() - 1].second]--;
        }

        for(int i = 1; i < 24 * 3600; i++) {
            t[i] += t[i - 1];
        }
        cout << *max_element(t.begin(), t.end()) << endl;
    }
}



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

int main() {
  int N,ans=0;
  cin >> N;
  int A[N],B[N-1];
  for(int i=0;i<N-1;i++) cin >> B[i];
  
  A[0] = B[0];
  A[1] = B[0];
  for(int i=1;i<N-1;i++){
    if(B[i]<B[i-1]){
      A[i]=B[i];
      A[i+1]=B[i];
    }
    else A[i+1]=B[i];
  }
  for(int i=0;i<N;i++) ans += A[i];
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define len(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "YES" << endl
#define pyes cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "NO" << endl
#define pno cout << "No" << endl
#define PNG cout << "NG" << endl
#define ret return 0

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
ll _gcd(ll a, ll b) { return b != 0 ? _gcd(b, a % b) : a; }
ll _lcm(ll a, ll b) {return a*b/_gcd(a,b);}

signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  ll g = a[0];
  repz(i,1,n) g = _gcd(g, a[i]);
  cout << g << endl;
  ret;
}


Measured memory_bytes: 3984
#include <iostream>
#include <cmath>
#include <vector>

// namespace
using namespace std;

// O(n log log n)
void sieve(vector<bool> &is_prime) {
    int n = is_prime.size();
    for (int i = 0; i < n; ++i) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for (int i = 0; i < n; ++i) {
        if (is_prime[i]) {
            for (int j = 2 * i; j < n; j += i) is_prime[j] = false;
        }
    }

}

int main() {
    int n;
    cin >> n;
    vector<bool> is_prime((int)sqrt(n) + 10);
    sieve(is_prime);
    cout << n << ":";
    for (int i = 2, m = n; i * i <= m; ++i) {
        while (n % i == 0 && is_prime[i]) {
            n /= i;
            cout << " " << i;
        }
    }
    if (n != 1) cout << " " << n;
    cout << endl;
    return 0;
}



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

#define Task "abc"
#define All(x) (x).begin(), (x).end()
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;

const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//  freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout);
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0];
}



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

using namespace std;

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

	vector<vector<long>> a(n + 1,vector<long> (3));
	for (long long i = 1; i <=n; i++) {
		cin >> a[i][0] >> a[i][1] >> a[i][2] ;
	}

	vector<vector<long>> dp(n + 1, vector<long>(3, 0));
	for (long i = 1; i <= n; i++) {
		for (long j = 0; j <= 2; j++) {

			dp[i][j] = a[i][j]+max(dp[i - 1][(j+1)%3], dp[i - 1][(j + 2) % 3]);
		}
	}

	cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
	return 0;

}

Measured memory_bytes: 11136
import queue
n = int(input())
q = queue.Queue()
count=0
p=0
for i in range(1,10):
    q.put(i)
while count!=n:
    count+=1
    a = q.get()
    p = a
    str_a = str(a)
    if str_a[-1]=='0':
        q.put(a*10)
        q.put(a*10+1)
    elif str_a[-1]=='9':
        q.put(a*10+8)
        q.put(a*10+9)
    else:
        q.put(a*10 + int(str_a[-1])-1)
        q.put(a*10 + int(str_a[-1]))
        q.put(a*10 + int(str_a[-1])+1)
print(p)





Measured memory_bytes: 12544