akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAX = 510000;
const int mod = 1000000007;

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

// テーブルを作る前処理
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;
}

//mod mでの a の逆元を求める
long long modinv(long long a) {
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod; 
    if (u < 0) u += mod;
    return u;
}

// a^n を mod で割ったあまり
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


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

    ll h,w,n;
    cin>>h>>w>>n;
    ll a,b;
    map<pair<ll,ll>,ll> m;
    for(int i=0;i<n;i++){
        cin >> a >> b;
        m[make_pair(a,b)]=1;
    }
    vector<ll> ans(10);
    int dx[9] = {-1,0,1,-1,0,1,-1,0,1};
    int dy[9] = {-1,-1,-1,0,0,0,1,1,1};
    for(auto i:m){
        ll x = i.first.first, y = i.first.second;
        for(int l=0;l<9;l++){
            ll nx = x+dx[l], ny=y+dy[l];
            int cnt = 0;
            if(nx<=h-1 && nx>1 && ny>1 && ny<w){
                for(int j=-1;j<2;j++)for(int k=-1;k<2;k++){
                    cnt += m.count(make_pair(x+j+dx[l],y+k+dy[l]));
                }
                ans[cnt]++;
            }
        }
        //cerr<<x<<" "<<y<<endl;
    }
    ll t=(h-2)*(w-2);
    for(int i=1;i<10;i++){
        ans[i]/=i;
        t -= ans[i];
    }
    ans[0] = t;
    for (int i = 0; i < 10; i++)
    {
        cout << ans[i] << endl;
    }
    
    
    

}

Measured memory_bytes: 8576
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	if do(nextString()) {
		fmt.Print("Yes")
	} else {
		fmt.Print("No")
	}
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func do(s string) bool {
	return s != "AAA" && s != "BBB"
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin>>n;
  vector<int> h(n); rep(i,n) cin>>h.at(i);
  int ans=0;
  int num=0;
  bool j=true;
  rep(i,n-1){
    if(h.at(i)>=h.at(i+1)) num++;
    else{
      ans=max(ans,num);
      num=0;
      j=false;
    }
  }
  ans=max(ans,num);
  cout<<ans<<endl;
}

Measured memory_bytes: 640
N = int(input())
X = list(map(int, input().split()))
L = int(input())
from bisect import *
def get_move(X,L,left=False):
  res = [0]*N
  for i in range(N):
    if left:
      res[i] = bisect_left(X,X[i]-L)
    else:
      res[i] = bisect_right(X,X[i]+L)-1
  K = N.bit_length()
  db = [[0]*N for _ in range(K)]
  db[0] = res
  for i in range(1,K):
    for j in range(N):
      db[i][j] = db[i-1][db[i-1][j]]
  return db

def search(dbr,dbl,a,b):
  if a>b:
    db = dbl
    left = True
  else:
    db = dbr
    left = False
  K = N.bit_length()
  ans = 0
  for p in range(K-1,-1,-1):
    if left:
      if b < db[p][a]:
        a = db[p][a]
        ans += 1<<p
    else:
      if b > db[p][a]:
        a = db[p][a]
        ans += 1<<p
  ans += 1
  return ans

dbr = get_move(X,L)
dbl = get_move(X,L,left=True)
Q = int(input())
ans = [0]*Q
for i in range(Q):
  a,b = map(int, input().split())
  ans[i] = search(dbr,dbl,a-1,b-1)
print(*ans, sep='\n')


Measured memory_bytes: 113936
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	h,w = readline() |> split |> parseMap
	a = ["" for i in 1:h]
	chk = -ones(Int,h,w)
	k = 0
	b = Tuple{Int,Int}[]
	m = 0
	@inbounds for i in 1:h
		a[i] = readline() |> chomp
		for j in 1:w
			if a[i][j] == '#'
				chk[i,j] = 0
				k += 1
				push!(b,(i,j))
			end
		end
	end
	while k < h*w
		x,y = shift!(b)
		if x>1
			if chk[x-1,y] < 0
				push!(b,(x-1,y))
				chk[x-1,y] = chk[x,y]+1
				k += 1
			end
		end
		if x<h
			if chk[x+1,y] < 0
				push!(b,(x+1,y))
				chk[x+1,y] = chk[x,y]+1
				k += 1
			end
		end
		if y>1
			if chk[x,y-1] < 0
				push!(b,(x,y-1))
				chk[x,y-1] = chk[x,y]+1
				k += 1
			end
		end
		if y<w
			if chk[x,y+1] < 0
				push!(b,(x,y+1))
				chk[x,y+1] = chk[x,y]+1
				k += 1
			end
		end
		m = max(m,chk[x,y]+1)
	end
	println(m)
end

main()

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

class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		long N=sc.nextLong();
		long max=0;
		for(long i=0; i*i<=N; i++) {
			max++;
		}
		long ans=0;
		for(long i=max; i>=1; i--) {
			if(N-i>0) {
				if((N-i)%i==0 && N%((N-i)/i)!=0 && (N/((N-i)/i)==N%((N-i)/i))) {
					ans+=((N-i)/i);
					//pl((N-i)/i);
				}
			}
		}
		//pl("");
		pl(ans);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
}

Measured memory_bytes: 22484
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


a = int(input())

print(a//3)


Measured memory_bytes: 2940
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vint a(3);
    REP(i,3) cin >> a[i];
    sort(ALL(a));
    if(a[0]+a[1]==a[2]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP()(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(a * n, b) << endl;
  return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

class CRectangle {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int h,w,x,y;
        in>>h>>w>>x>>y;
        int a=-1e9,b=1e9-x*y+1;
        if(h%x==0&&w%y==0){
            out<<"No"<<endl;
            return;
        }
        out<<"Yes"<<endl;
        fr(i,h){
            fr(j,w){
                if(i%x==0&&j%y==0) out<<b<<" ";
                else if(i%x==x-1&&j%y==y-1) out<<a<<" ";
                else out<<1<<" ";
            }
            out<<endl;
        }
    }
};

int main() {
    CRectangle solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 2944
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		long Inf = (long) 1e18;
		long[][] ma = new long[3 * N + 1][];
		for(int i=0;i<3 * N + 1; i++){
			ma[i] = new long[N];
			for(int j=0;j<N; j++){
				ma[i][j] = -Inf;
			}
		}
		for(int i=0;i<M;i++) C[i] -= P;
		ma[0][0] = 0;
		for(int i=0;i<3*N;i++){
			for(int j=0;j<M;j++){
				int a = A[j];
				int b = B[j];
				long c = C[j];
//Console.WriteLine(String.Join(",", a, b, c));
				if(ma[i][a] == -Inf) continue;
				ma[i + 1][b] = Math.Max(ma[i + 1][b], ma[i][a] + c);
			}
		}
//Console.WriteLine("ok");
		
		long ma0 = -Inf;
		for(int i=0;i<=N;i++){
			ma0 = Math.Max(ma0, ma[i][N-1]);
		}
		long ma1 = -Inf;
		for(int i=N+1;i<=2*N;i++){
			ma1 = Math.Max(ma1, ma[i][N-1]);
		}
		long ma2 = -Inf;
		for(int i=2*N+1;i<=3*N;i++){
			ma2 = Math.Max(ma2, ma[i][N-1]);
		}
		
		if(ma2 > ma1){
			Console.WriteLine(-1);
			return;
		} else {
			Console.WriteLine(Math.Max(ma0, 0));
		}
		
		
		
	}
	int N,M;
	long P;
	int[] A,B;
	long[] C;
	public Sol(){
		var d = ria();
		N = d[0]; M = d[1]; P = d[2];
		A = new int[M];
		B = new int[M];
		C = new long[M];
		for(int i=0;i<M;i++){
			d = ria();
			A[i] = d[0] - 1;
			B[i] = d[1] - 1;
			C[i] = d[2];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 163760
#include <cstdio>
#include <utility>
using namespace std;
int selection_sort(int a[], int n) {
    int count = 0;
    for(int i = 0; i < n; i++) {
        int minj = i;
        for(int j = i; j < n; j++) {
            if(a[j] < a[minj]) minj = j;
        }
        swap(a[i], a[minj]);
        if(i != minj) count++;
    }
    return count;
}
int main() {
    int n;
    scanf("%d", &n);
    int a[n];
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);
    int count = selection_sort(a, n);
    for(int i = 0; i < n; i++) {
        if(i != 0) printf(" ");
        printf("%d", a[i]);
    }
    printf("\n%d\n", count);
}


Measured memory_bytes: 2728
S = input()
r = "Yes"
if len(S) % 2 != 0:
  r = "No"
else:
  for i in range(len(S)):
    if (i % 2 == 0 and S[i] != "h") or (i % 2 == 1 and S[i] != "i"):
      r = "No"
      break
print(r)

Measured memory_bytes: 2940
/*
ID: hursh171
LANG: C++
TASK: test
*/
// Sat Sep 19 20:03:13 IST 2020   
#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)       for(int64 ii = (int64)a ; ii < (int64)b  ; ii++ )
#define scan(any)          for(auto &i:any) cin>>i;
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long   
#define all(x)             (x).begin(),(x).end() 
#define ff                 first
#define ss                 second
#define pppp               pair <int,int> 
#define flushOff           fflush(stdout) 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
using namespace std ;    
// policy based   
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
 
const int MOD1 = 1e9+7;
const int MOD2 = 1e9+9;
const int weird_mod = 998244353;
const double pi = 3.141592653589793238;
const int INF = 2e9+7;
const int64 big = 1e18;

const int N = 2e5+7;
struct compare{
    bool operator()(pair <int,int> A, pair <int,int> B){
        if(A.first == B.first)
            return A.second > B.second;
        return A.first > B.first;
    }
}; 
void print(vector <int>v){
    for(int t : v) 
        cout << t << ' ';
    cout << '\n';
    return;
}     
int tests(){
    string s = "ACL";
    int K;
    cin >> K;
    while(K--) 
        cout << s;

    return 0;
}    
int main(){
    I__O ;     
    int cases = 1;
    // cin >> cases; 
    while(cases--)
        tests(); 
    return 0 ; 
}
 


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

int main() {
	// your code goes here
	int N = 0;
	cin>>N;
	vector <long long> vect(N);
	int j = 0;
	for(int i = 0; i < N; i++)
	{
	    cin>>vect[i];
	    if(vect[i] % 2 == 1)
	    {
	        j++;
	    }
	}
	if(j % 2 == 0)
	{
	    cout<<"YES";
	}
	else
	{
	    cout<<"NO";
	}
	return 0;
	
}


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

int main()
{
  int n;
  cin >> n;
  int a[n][3];

  for (auto i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1] >> a[i][2];
  }
  for (auto i = 0; i < n - 1; i++) {
    for (auto j = 0; j < 3; j++) {
      a[i + 1][j] += max(a[i][(j + 1) % 3], a[i][(j + 2) % 3]);
    }
  }
  cout << max(a[n - 1][0], max(a[n - 1][1], a[n - 1][2])) << endl;
}


Measured memory_bytes: 1408
n = int(input())
h = [0] + list(map(int, input().split()))
inf = 10**5
dp = [inf]*(n+1)
dp[1] = 0
dp[2] = abs(h[1] - h[2])
for i in range(3, n+1):
    dp[i] = min(
        dp[i-1] + abs(h[i-1] - h[i]),
        dp[i-2] + abs(h[i-2] - h[i])
    )

print(dp[n])

Measured memory_bytes: 13924
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
lli v[105], w[105];
lli dp[105][100005] = {};
// i まででjを達成するのに必要なWの最小値
int main() {
  lli n, W;
  cin >> n >> W;

  rep(i, n) cin >> w[i] >> v[i];
  rep(i, 105) rep(j, 100005) dp[i][j] = i == 0 && j == 0? 0:1e18;
  rep(i, n) {
    rep(j, 100005) {
      dp[i+1][j] = min(dp[i][j],dp[i+1][j]);
      if (j + v[i] < 100005)
        dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i]);
    }
  }
  rrep(j,100005){
      //cout << dp[n][j] << " "; 
      if(dp[n][j]<=W){
          cout << j << endl;
          return 0;
      }
  }
}


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

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int[] I =new int[3];
		for(int i=0;i<3;i++){
			I[i] = s.nextInt();
		}
		int sum = 0;
		
		Arrays.sort(I);
		sum = I[0] + I[1];
		
		System.out.println(sum);
		
	}
}


Measured memory_bytes: 21716
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
string s;
int K;






//サブ関数
//入力
void input()
{
	cin >> s >> K;
}


//計算
void calc()
{
	set<string> ss;
	FOR(len, 1, K + 1) {
		REP(start, s.size() +1 - len) {
			ss.insert(s.substr(start, len));
		}
	}
	vector<string>vs;
	for (auto num : ss) {
		vs.push_back(num);
	}
	sort(vs.begin(), vs.end());
	cout << vs[K - 1] << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef pair<ul, ul> P;




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

	vector<int> A;
	
	REP(i, N)
	{
		int r;
		cin >> r;
		A.push_back(r);
	}
	int max = 0;
	REP(i, N)
	{
		REP(j, N){
			if(abs(A[i]-A[j])>max){
				max = abs(A[i] - A[j]);
			}
		}
	}
	cout << max << endl;

	return 0;
}

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

int main() {
    string S;
    cin >> S;
    int N = S.size();
    int ans = 0;
    //1つめのチェック
    for (int i=0; i<(N-1)/2; i++){
        if (S.at(i) != S.at(N-1-i)){
            ans ++;
        }
        }
    //2つめのチェック    
    for (int i=0; i<((N-1)/2)/2; i++){
        if (S.at(i) != S.at((N-1)/2-1-i) ){
            ans ++;
        }
        }
    //3つめのチェック
    for (int i=0; i<((N-1)/2)/2; i++){
        if (S.at((N+1)/2 +i) != S.at(N-1-i)){
            ans ++;
        }
        }
    if(ans == 0){
        cout << "Yes" << endl;
    }    
    else {
        cout << "No" << endl;
    }

      
    
    
}

Measured memory_bytes: 256
function Main(input) {
  var current = parseInt(input)

  for (var i = current; i < 1000; i++) {
    var s = i.toString()
    if (s[0] === s[1] && s[1] === s[2]) {
      console.log(s);
      break;
    }
  }

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

Measured memory_bytes: 21064
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <queue>

using namespace std;
typedef long long ll;
ll l;
int dx[4]={0,1,0,-1};
int dy[4]={-1,0,1,0};
const char *DIR="NESW";
int h,w;
int fie[101][101];
int sx,sy,sdir;
ll dp[101][101][4];
void dfs(int x,int y,int dir,ll dist){
	if(dp[x][y][dir]!=-1){
		ll loop=dist-dp[x][y][dir];
		ll cnt=(l-dist)/loop;
		if(cnt>0)dist+=loop*(cnt-1);
	}
	//printf("%d %d %d %lld\n",x,y,dir,dist);
	dp[x][y][dir]=dist;
	if(dist==l){
		printf("%d %d %c\n",y+1,x+1,DIR[dir]);
		return;
	}
	int nx=x+dx[dir],ny=y+dy[dir];
	if(nx<0 || nx>=w || ny<0 || ny>=h){
		dfs(x,y,(dir+1)%4,dist);
		return;
	}
	if(fie[nx][ny]==-1){
		dfs(x,y,(dir+1)%4,dist);
		return;
	}
	dfs(nx,ny,dir,dist+1);
}

int main(void){
	while(1){
		scanf("%d %d %lld",&h,&w,&l);
		if(h+w+l==0)break;
		memset(fie,-1,sizeof(fie));
		memset(dp,-1,sizeof(dp));
		for(int i=0;i<h;i++){
			string str;
			cin >> str;
			for(int j=0;j<w;j++){
				if(str[j]=='.')fie[j][i]=0;
				for(int k=0;k<4;k++){
					if(str[j]==DIR[k]){
						fie[j][i]=0;
						sx=j;
						sy=i;
						sdir=k;
					}
				}
			}
		}
		dfs(sx,sy,sdir,0);
	}
	return 0;
}

Measured memory_bytes: 1592
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X, Y = map(int, input().split())

ans = -1
for i in range(X + 1):
    if i * 2 + (X - i) * 4 == Y:
        ans = i

if ans == -1:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 9184
s = gets.chomp
t = gets.chomp

start_i = t[0]
offset= 0
hit = false
while (i = s.index(start_i, offset))
  if i != 0
    tmp = s[i..-1] + s[0..i-1]
  else
    tmp = s
  end
  if tmp == t
    hit = true
    break
  end
  offset = i+1
end

puts hit ? 'Yes' : 'No'


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

using namespace std;

int main() {
    string s;
    cin >> s;
    int count = 0;
    for (int i = 0; i < s.size(); i++)
        if (s[i] == 'x')count++;
    cout << (count < 8 ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pll pair<ll,ll>
#define vi vector < int >
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define s(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define pf(x) printf("%d\n",x)
#define pfl(x) printf("%lld\n",x)
#define flash ios_base::sync_with_stdio(false);cin.tie(0)
#define goog(x) cout << "Case #" << x << ": "
#define MAX5 200005
#define MAX6 2000005
#define MLOG 18
#define limit 1e18
#define mod 1000000007   
void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


int power(int x, int y, int p){
    int res = 1;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

void solve(){
    int n;
    cin >> n;
    vi v(n), a(n+1, 0);
    int cnt = 1;
    for(int i = 0; i < n; i++){
        cin >> v[i];
        if(v[i] == cnt){
            cnt++;
        }
    }
    cnt--;
    if(cnt == 0) cout << -1 << endl;
    else cout << n-cnt << endl;
} 
signed main(){  
//  freopen("ii.txt", "w", stdin);
    flash;
    int t = 1;
    //  cin >> t;  
    for(int tc = 1; tc <= t; tc++){
    //goog(tc);
        solve();
    }
}

Measured memory_bytes: 3456
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		
		int inH = s.nextInt();
		int inW = s.nextInt();
		int inh = s.nextInt();
		int inw = s.nextInt();
		
		int result = (inH-inh) * (inW -inw);
		
		System.out.println(result);
		s.close();
		
	}

}

Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <list>
#include <stack>

using namespace std;

/* constant */

const int INF = 1 << 30;
const int mod = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */

/* function */

/* main */
int main() {

    int a, b, c; cin >> a >> b >> c;
    if ( a < b && b < c ) {
        cout << "Yes" << '\n';
    }
    else {
        cout << "No"<< '\n';
    }

}



Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
#include <cmath>
#define ll long long

using namespace std;

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

 ll ans=0;
 for(ll r=1;r<=sqrt(n);++r){
   if(n%r==0){
       ll m;
       m=n/r-1; 
       if(r<m) ans+=m;
   }
 }
 
 cout<<ans<<endl;

 return 0;
}


Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n=1):
        self.parent = [i for i in range(n)]
        self.rank = [0] * n
    
    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.parent[y] = x
    
    def is_same(self, x, y):
        return self.find(x) == self.find(y)

N = int(input())
uf = UnionFind(N)
X = []; Y = []
for i in range(N):
  x, y = map(int, input().split())
  X.append((x, i)); Y.append((y, i))

X.sort()
Y.sort()
road = []

def add_cand(Z):
  global road
  z1, i1 = Z[0]
  for j in range(1, N):
    z2, i2 = Z[j]
    road.append((z2-z1, i1, i2))
    z1, i1 = z2, i2

add_cand(X); add_cand(Y)

road.sort()
ans = 0
for cost, i, j in road:
  if uf.is_same(i, j):
    continue
  uf.union(i, j)
  ans += cost

print(ans)

Measured memory_bytes: 54992
#include <iostream>
//#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
void mysort(vll &a){sort(a.begin(),a.end()) ;}
void myrev(vll &a){reverse(a.begin(),a.end()) ;}

int main(){
	string s,t ;
	cin >> s >> t ;
	int n = s.size() ;
	vll a(26,0),b(26,0) ;
	for(int i=0;i<n;i++) a.at(s.at(i)-'a')++ ;
	for(int i=0;i<n;i++) b.at(t.at(i)-'a')++ ;
	mysort(a) ; mysort(b) ;
	yorn(a==b) ;
}


Measured memory_bytes: 776
from itertools import accumulate

n = int(input())
a = list(map(int, input().split()))
acc = list(accumulate(a))
# print(acc)

ans = float('INF')
for i in range(n-1):
    if abs(acc[-1] - acc[i] * 2) < ans:
        ans = abs(acc[-1] - acc[i] * 2)
print(ans)

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

ll INF = 1e+18;

struct UnionFind {
    vector<int> par, rank, sz;
    
    UnionFind(int n) : par(n), rank(n, 0), sz(n, 1) {
        for (int i = 0; i < n; ++i) par[i] = i;
    }
    void init(int n) {
        par.resize(n); rank.resize(n); sz.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, sz[i] = 1;
    }

    int root(int n)
    {
      if(par[n] == n) return n;
      else {
        return par[n] = root(par[n]);
      }
    }

    bool is_same(int a, int b)
    {
      return root(a) == root (b); 
    }

    int size(int n)
    {
      return sz[root(n)];
    }

    bool merge(int a, int b)
    {
      int rt_a = root(a);
      int rt_b = root(b);
      if(rt_a == rt_b) return false;
      if (rank[rt_a] < rank[rt_b]) swap(rt_a, rt_b);
      if (rank[rt_a] == rank[rt_b]) ++rank[rt_a];
      par[rt_b] = rt_a;
      sz[rt_a] += sz[rt_b];
      return true;
    }

};

int 
main()
{
  int N, M, K; cin >> N >> M >> K;
  UnionFind uf(N);
  vector<vector<int>> friends(N);
  rep(i, 0, M){
    int a, b; cin >> a >> b;
    --a, --b;
    uf.merge(a, b);
    friends[a].push_back(b);
    friends[b].push_back(a);
  }

  vector<vector<int>> blocks(N);
  rep(i, 0, K){
    int c, d; cin >> c >> d;
    --c, --d;
    blocks[c].push_back(d);
    blocks[d].push_back(c);
  }

  rep(i, 0, N){
    int cnt = 0;
    for(auto x: blocks[i]){
      if(uf.is_same(i, x)) ++cnt;
    }
    int ans = uf.size(i) - friends[i].size() - cnt - 1;
    if(i == N - 1) cout << ans;
    else cout << ans << " ";
  }
  cout << endl;


}

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

int main()
{
    // input
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];

    // count
    vector<ll> cnt(N + 1, 0);
    for (ll v : A)
        cnt[v] += 1;
    sort(cnt.begin(), cnt.end());

    vector<ll> cumsum(N + 1);
    cumsum[0] = 0;
    for (int i = 1; i <= N; i++)
        cumsum[i] = cumsum[i - 1] + cnt[i];

    vector<ll> times(N + 1);
    for (int i = 1; i <= N; i++)
    {
        int ng = upper_bound(cnt.begin(), cnt.end(), i) - cnt.begin();
        times[i] = (cumsum[ng - 1] + (N - ng + 1) * i) / i;
    }

    for (int k = 1; k <= N; k++)
    {
        int ok = 0, ng = N + 1, mid;
        while (ng - ok > 1)
        {
            mid = (ok + ng) / 2;
            if (times[mid] >= k)
                ok = mid;
            else
                ng = mid;
        }
        cout << ok << endl;
    }

    return 0;
}


Measured memory_bytes: 10240
from collections import deque

n, q = map(int, input().split())
listA = []
t=1
while t <=n:  # 変な書き方をしていると思います、、、
    try:
        listA.append(input().split())
        t +=1
    except:
        break

result=[]
qu = deque()
for i in range(n):
    qu.append(listA[i]) # プロセスを順番にキューに入れる

time = 0    # 処理を開始してからの経過時間を入れる
while True:
    try:
        task = qu.popleft()     # 今処理するプロセスを取り出す
        if int(task[1]) <= q:   # クオンタム内で処理が完了するかを判断
            time += int(task[1]) # 処理時間を加える
            result.append([task[0], time]) 
        else:
            time += q # クオンタム目一杯処理を行ったのでクオンタム分を加える
            task[1] = int(task[1]) - q # 残りの処理時間
            qu.append(task) # 待ち行列の最後尾に追加
    except:
        break

for i in range(n):
    print(*result[i])


Measured memory_bytes: 23480
n = int(input())
d = {}
for i in range(1, n+1):
    c = str(i)
    cr = c[0]
    cl = c[-1]
    key = cr + cl
    if key in d:
        d[key] += 1
    else:
        d[key] = 1
ans = 0
for key in d:
    key_r = key[-1] + key[0]
    if key_r in d:
        ans += d[key] * d[key_r]
print(ans)


Measured memory_bytes: 40428
/*

A：1...n
B：1...n

dp[i][j][k]：考虑完前i个，还有j个留着没配，已经confirm了k分的方案

*/
#include<bits/stdc++.h>
#define ll long long
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
const ll MAXN=5e5+5;
const ll INF=1e18;
const ll MOD=1e9+7;
ll n,k,dp[105][MAXN],sum[MAXN],represent[MAXN],cnt,x[MAXN];
set<ll>s;
ll add(ll x,ll y)
{
    ll ret=x+y;
    if(ret>=MOD)
    {
        return ret-MOD;
    }
    return ret;
}
ll mul(ll x,ll y)
{
    return x*y%MOD;
}
void init()
{
    for(ll i=1;;)
    {
        ll sh=n/i;
        s.insert(sh);
        if(sh==1)
        {
            break;
        }
        ll nex=n/sh+1;
        i=nex;
    }
    ll pre=0;
    for(auto it=s.begin();it!=s.end();it++)
    {

        //3代表3和2 因为他们都是由1更新来
        represent[++cnt]=*it-pre;
        x[cnt]=*it;
        pre=*it;
     //   printf("%lld %lld\n",*it,represent[cnt]);
    }
}
void solve()
{
    s.clear();
    cnt=0;
    init();
    for(ll i=1;i<=cnt;i++)
    {
        dp[1][i]=represent[i];
    }

    for(ll i=2;i<=k;i++)
    {
        for(ll j=1;j<=cnt;j++)
        {
            sum[j]=add(sum[j-1],dp[i-1][j]);
        }
        for(ll j=1;j<=cnt;j++)
        {
            dp[i][j]=mul(sum[cnt-j+1],represent[j]);
        }
    }
    ll ans=0;
    for(ll i=1;i<=cnt;i++)
    {
        ans=add(ans,dp[k][i]);
    }
    printf("%lld\n",ans);


}
int main()
{

//    freopen("c://duipai//data.txt","r",stdin);
//    freopen("c://duipai//wa.txt","w",stdout);
//    ll cc=0;
//    for(ll i=1;i<=9;i++)
//    {
//        for(ll j=1;j<=9;j++)
//        {
////            for(ll k=1;k<=10;k++)
////            {
//                if(i*j<=9)
//                {
//                    printf("%lld %lld %lld %lld\n",++cc,i,j,k);
//                }
//        }
//    }
    while(~scanf("%lld %lld",&n,&k))
    {
//        string str;
//        cin>>str;
//        cout<<str<<endl;
        solve();
    }
}


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

int dx[] = {1,-1,0,0,1,1,-1,-1};
int dy[] = {0,0,1,-1,1,-1,1,-1};

int main(){
  long n,m;
  cin >> n >> m;  
  if(n >= 3 && m >= 3) cout << n*m - 2*n - 2*m + 4 << endl;
  else if(n == 2 || m == 2) cout << 0 << endl;
  else if(n == 1){
    if(m == 1) {
      cout << 1 << endl;
      return 0;
    }
    int a = m-2;
    cout << max(0,a) << endl;
  }
  else if(m == 1){
    int a = n - 2;
    cout << max(0,a) << endl;
  }

}

Measured memory_bytes: 256
a,b,c,d =map(int,input().split())
flag = 0
while True:
  if flag ==0:
    c -= b
    if c <= 0:
      print('Yes')
      break
    flag = 1
  else:
    a -= d
    if a <= 0:
      print('No')
      break
    flag = 0

Measured memory_bytes: 9184
#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 repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

lli to_lli( char c ){
    return c - '0';
}

int main() {
    string s;   cin >> s;
    int n = s.size();

    lli ans = 0;
    rep( i,pow(2,n-1) ){
        lli tmp = to_lli(s[0]);
        rep( j,n-1 ){
            if( (i >> j) & 1 ){
                ans += tmp;
                tmp = to_lli(s[j+1]);
            }
            else{
                tmp *= 10;
                tmp += to_lli(s[j+1]);
            }
        }
        ans += tmp;
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<cstdlib>
#include<list>
#include<set>
#include<numeric>

#define MOD 1000000007

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

int main()
{
	ll N; cin >> N;
	
	string s = to_string(N);
	ll si = s.size();
	int sq = sqrt(N);
	ll ans = 1000000000000000;

	if (sq*sq == N) {
		s = to_string(sq);
		si = s.size();
		cout << si << endl;
	}
	else {
		for (int i = 1; i <= sqrt(N); i++) {
			if (N % i == 0) {
				s = to_string(N/i);
				ll si = s.size();
				ans = min(ans, si);
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
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;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main(void) {
   ll N;
   string S;
   cin >> N >> S;
   ll ans =0;
   rep(i,10){
       rep(j,10){
           rep(k,10){
               bool fi = false,se =false;//フラグリセット
               //例えば今の暗証番号が112として,Sのどこかに連続する112があればいい
               rep(s,N){
                   if(!fi&&S[s] == i + '0'){
                       fi = true;//最初の数字を発見
                       continue;
                   }
                   //最初の数字が発見されて、かつ二番目が未発見、で一致
                   if(fi && !se && S[s] == j + '0'){
                       se = true;
                       continue;
                   }
                   //最初と二番目を発見、で三番目が一致
                   if(fi && se && S[s] == k+'0'){
                       ans++;
                       break;
                   }
               }
           }
       }
   }
   fin(ans);
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	c-=a,d-=b;
	rep(i,d){
		cout<<'U';
	}
	rep(i,c){
		cout<<'R';
	}
	rep(i,d){
		cout<<'D';
	}
	rep(i,c){
		cout<<'L';
	}
	cout<<'L';
	rep(i,d+1){
		cout<<'U';
	}
	rep(i,c+1){
		cout<<'R';
	}
	cout<<'D'<<'R';
	rep(i,d+1){
		cout<<'D';
	}
	rep(i,c+1){
		cout<<'L';
	}
	cout<<'U'<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		int pchk = 0, gchk = 0, win = 0, lose = 0;
		for (int i = 0; i < str.length(); i++) {
			if (pchk < gchk) {
				if (String.valueOf(str.charAt(i)).equals("g")) {
					pchk += 1;
					win += 1;
				} else {
					pchk += 1;
				}
			} else {
				if (String.valueOf(str.charAt(i)).equals("p")) {
					gchk += 1;
					lose += 1;
				} else {
					gchk += 1;
				}
			}
		}
		System.out.println(win - lose);
		scan.close();
	}
}


Measured memory_bytes: 18660
#include <iostream>

using namespace std;

int main(void)
{
    int N, T, i, c[101], t[101], min=10000;

    cin >> N >> T;

    for(i=1; i<=N; i++){
        cin >> c[i] >> t[i];

        if(t[i]<=T && c[i]<min){
            min = c[i];
        }
    }

    if(min == 10000){
        cout << "TLE" << endl;
    }

    else{
        cout << min << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define tr(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
//#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/

int32_t main()
{
	fastio();
	string s,t;
	cin>>s>>t;
	int sl=s.length();
	int tl=t.length();
	if(sl+1!=tl)
	{
		cout<<"No\n";return 0;
	}
	for(int i=0;i<sl;i++)
	{
		if(s[i]!=t[i])
		{
			cout<<"No\n";
			return 0;
		}
	}
	cout<<"Yes\n";
}


Measured memory_bytes: 3648
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second

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

string s, t;
int n;

void read_input()
{
    cin >> s >> t;
    n = sz(s);
}

void solve()
{
    int ans = 0;
    for(int i = 0; i < n; ++i)
        if(s[i] != t[i]) ++ans;
    cout << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}



Measured memory_bytes: 3860
import sys

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]
MOD = 10**9+7

N = INT()
A = MAP()

B = [0] * N
C = [0, 0, 0]
for i, a in enumerate(A):
	flg = False
	for j, c in enumerate(C):
		#print(a, c)
		if a==c:
			B[i] += 1
			if not flg:
				C[j] += 1
				flg += 1

#print(B)
#print(C)

ans = 1
for b in B:
	ans *= b
	ans %= MOD

print(ans%MOD)

Measured memory_bytes: 14248
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    lli N, K;
    cin >> N >> K;
    vector<pair<lli, lli>> tasks;
    lli a, b;
    for (int i = 0; i < N; i++)
    {
        cin >> a >> b;
        tasks.emplace_back(a, b);
    }
    sort(tasks.begin(), tasks.end());
    lli sum = 0;
    for (auto i : tasks)
    {
        sum += i.second;
        if (sum >= K)
        {
            cout << i.first << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 5300
//-------All power is within you,you can do Anything and Everything.---------//
 
    #include <bits/stdc++.h>
    using namespace std;
  
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
 
    #define pb push_back
    #define MP make_pair
    #define F first
    #define S second
    #define int long long
    #define fo(i,a,b) for(int i=a;i<b;i++)
    #define rfo(i,b,a) for(int i=b;i>=a;i--)
    #define deb(x) cout<<#x<<" "<<x<<endl;
    #define mem( a, val ) memset(a, val, sizeof( a ) )
    #define deci( x ) cout<<fixed<<setprecision( x );
    #define bitcount( x ) __builtin_popcountll( x )
    #define endl "\n" 
 
    
    typedef vector<int> vi;
    typedef pair<int,int> pi; 
    
    const int MOD =  1000000007 ;
    const int MAX = 2e6 + 7;
    const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ V $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//  
    
    int i,j,k,t,n,q,l,r,mid;
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ F $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
    
    void solve()
    {
        int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        cin>>k;
        k--;
        cout<<a[k]<<endl;
 
    }
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
//                          GAME STARTS FROM HERE                            //
 
    int32_t main() 
      {
        
        // int start,stop=clock();
        // cout<<"time:"<<(stop-start)/double(CLOCKS_PER_SEC)*1000<<endl;
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        
        // cin>>t;while(t--)
        solve();
        
      return 0;
      }

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    var S = scn.next()

    var str = ""
    for(i in 1..5){
        str += "hi"
        if(S == str){
            println("Yes")
            return
        }
    }

    println("No")
}


Measured memory_bytes: 31272
import sys,os,math
from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat


# sys.stdin = open('input')
# n, k = map(int, raw_input().split())
# da = map(int, raw_input().split())
# db = map(int, raw_input().split())


def solve():

    pass

def main():
    n, k = map(int, raw_input().split())
    da = map(int, raw_input().split())
    print len(filter(lambda x:x>=k, da))



main()


Measured memory_bytes: 42092
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int N;
  bool res=false;

  cin >> N;
  
  for(int a=1;a<=9;a++){
    for(int b=1;b<=9;b++){
    	if(N==a*b)res=true;
    }
  }
  if(res){
    cout << "Yes";
  }else{
    cout << "No";
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
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;}
int cnt[35];
int main(){
	string s;
	cin >> s;
	for(int i=0;i<s.size();i++){
		cnt[s[i]-'A']++;
	}
	for(int i=0;i<30;i++){
		if(!(cnt[i]==0||cnt[i]==2)){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256