akhauriyash/Code-Regression huggingface dataset:
n=int(input())
 
def rot(d, r):
    if r == 'N':
        return (d[1], d[5], d[2], d[3], d[0], d[4])
    if r == 'E':
        return (d[3], d[1], d[0], d[5], d[4], d[2])
    if r == 'W':
        return (d[2], d[1], d[5], d[0], d[4], d[3])
    if r == 'S':
        return (d[4], d[0], d[2], d[3], d[5], d[1])
    return d
 
def gen_all( d1 ):
    ds = { d1 }
    while 1:
        ds2 = { rot(d, r) for d in ds for r in list('NEWS') }.union(ds)
        if ds == ds2: break
        ds = ds2
    return ds
 
ds = {}
 
for i in range(n):
    d=tuple(map(int,input().split()))
    ds[i] = (d, gen_all(d))
 
dep=any ([ ds[i][0] in ds[j][1] for i in range(n) for j in range(i+1,n) ])
     
print('No' if dep else 'Yes')

Measured memory_bytes: 8252
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String[] arr = sc.nextLine().split("");

		int count = 0;
		int max = 0;
		for(String str : arr){

			if(str.equals("R")){
				count++;
			}else{
				if(count > max){
					max = count;
				}
				count=0;
			}
		}


		if(count > max){
			max = count;
		}

		System.out.println(max);


	}
}

Measured memory_bytes: 35628
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

int main() {
    int n; cin >> n;
    vector<pair<int, int>> V(n);
    for (int i = 0; i < n; i++) {
        int a, b; cin >> a >> b;
        V[i] = pair<int, int>(b, a);
    }

    sort(V.begin(), V.end());
    long long sum = 0;
    for (auto v : V) {
        sum += v.second;
        if (sum > v.first) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


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

#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define ms memset
//#define MAXN 10005
//#define MAXM 100005
#define pi 3.14159265359

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpii;
typedef long long ll;
typedef priority_queue<int> pqi;
typedef priority_queue<pii, vpii, greater<pii> > dij;

int N;
int H[100005];
int memo[100005];

int solve(int x){

	if(x == N - 1) return 0;

	if(x >= N) return INF;

	int &state = memo[x];
	if(state != -1) return state;

	return state = min( abs( H[x] - H[x+1] ) + solve(x+1), abs( H[x] - H[x+2] ) + solve(x+2) );

}


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

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

	ms(memo, -1, sizeof memo);

	cout << solve(0) << "\n";

	return 0;	
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
bool bbo[100];
#define ll long long 
#define mod 1000000007
bool bo[100][100];
int a[100];
int main()
{
	ll n,k;
	cin>>n>>k;
	for(int i=1;i<=k;i++)
	{
		ll q,w;
		cin>>q>>w;
		//if(bo[q][w]==0)
		{
			a[q]++;
			a[w]++;
		//	bo[q][w]=1;
		}
	}
	for(int i=1;i<=n;i++)
	{
		cout<<a[i]<<endl;
	}
}

Measured memory_bytes: 256
n, m = list(map(int, input().split()))
an = []
cm = []
for i in range(n):
    an.append(list(map(int, input().split())))
for i in range(m):
    cm.append(list(map(int, input().split())))

def length(x, y, x2, y2):
    return abs(x - x2) + abs(y - y2)

for i in range(n):
    num = -1
    min_ = float("inf")
    for j in range(m):
       tmp = length(an[i][0], an[i][1], cm[j][0], cm[j][1])
       if(tmp < min_):
           min_ = tmp
           num = j + 1
    print(num)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <regex>
typedef long long ll;
using namespace std;


int main(void){
  ll n;
  cin >> n;
  vector<ll> a(n),b(n),c(n);
  for(ll i = 0;i < n;i++){
    cin >> a[i];
  }
  for(ll i = 0;i < n;i++){
    cin >> b[i];
  }
  for(ll i = 0;i < n;i++){
    cin >> c[i];
  }
  sort(a.begin(),a.end());
  
  sort(c.begin(),c.end());

  ll ans = 0;
  for(ll i = 0;i < n;i++){
    auto a_comb_l = lower_bound(a.begin(),a.end(),b[i]) - a.begin();
    auto c_comb_r = c.end() - upper_bound(c.begin(),c.end(),b[i]);
    ans += a_comb_l * c_comb_r;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"a=0\n"
"for i,s in enumerate(input()):a+=i%2^int(s)\n"
"print(min(a,i-a+1))\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 7236
#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
int main()
{
    int n;
    cin >> n;
    string str;
    cin >> str;
    if (str.size() > n)
    {
        cout << str.substr(0, n) << "..." << endl;
    }
    else
        cout << str << endl;
    return 0;
}

Measured memory_bytes: 3632
A = int(input())
B = int(input())
C = int(input())
X = int(input())

I = []
J = []
K = []
for i in range(A+1):
  if 500*i <= X:
    I.append(i)
for i in I:
  for j in range(B+1):
    if 100*j <= X-500*i:
      J.append([i,j])
for [i,j] in J:
  for k in range(C+1):
    if 50*k == X-500*i-100*j:
      K.append([i,j,k])

print(len(K))

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <queue>
#include <list>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

const int mx=1e5+123;
#define mem(a,b) memset(a,b,sizeof(a));


int w[120],v[120],W,n;  long long dp[120][mx];

long long solve(int i,int j){

       if(i>n)
           return 0;
       if(dp[i][j]!=-1)
           return dp[i][j];

       long long left=0,right=0;

       if(j+w[i]<=W)
            left=v[i]+solve(i+1,j+w[i]);
        right=solve(i+1,j);

      return dp[i][j] = max(left, right);

}

int main() {

     cin>>n>>W;

    for(int i=1;i<=n;i++)
        cin>>w[i]>>v[i];

     mem(dp,-1);
       cout<<solve(1,0)<<endl;

    return 0;
}

Measured memory_bytes: 97484
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int m = 1e9 +7, con = 1005;
char s[con][con];
void self(int& a, int b){
    a +=b;
    if(a>=m){a -=m;}
}

int main(){
    int h, w;
    char c;
    scanf("%d%d", &h, &w);
    vector<vector<int>>dp(h, vector<int>(w, 0));
    dp[0][0]=1;
    for(int i=0; i<h; i++){
        scanf("%s", &s[i]);
    }
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            for(int r: {i, i+1}){
                int c = j;
                if(r == i){c = j+1;}
                if(s[r][c] == '.' && r<h && c<w){
                    self(dp[r][c], dp[i][j]);
                }
            }
        }
    }
    printf("%d", dp[h-1][w-1]);
}

Measured memory_bytes: 5120
import java.util.Scanner;

public class Main {

  static int[] sort(int[] progression) {

    int min, temp;
    min = temp = 0;

    for (int i = 0; i < progression.length - 1 ; i++ ) {
      min = i;
      for (int j = i + 1; j < progression.length ; j++ ) {
        if ( progression[min] > progression[j] ) {
          min = j;
        }
      }
      temp = progression[i];
      progression[i] = progression[min];
      progression[min] = temp;
    }
    return progression;
  }

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int progression[] = new int[3];
    for (int i = 0;i < 3 ;i++) {
      progression[i] = stdIn.nextInt();
    }

    progression = sort(progression);

    System.out.println(progression[0]+" "+progression[1]+" "+progression[2]);
  }
}

Measured memory_bytes: 26176
#include <bits/stdc++.h>
using namespace std;
  
int main() {
    int N;
    cin >> N;
    
    vector<tuple <string,int,int>> t(N);
    for (int i=0;i<N;i++) {
        string a;
        int b;
        cin >> a >> b;
        t.at(i) = make_tuple(a,-b,i+1);
    }
    sort(t.begin(),t.end());
    
    for (int j=0;j<N;j++) {
        string a;
        int b,i;
        tie(a,b,i) = t.at(j);
        cout << i << endl;
    }
   }

 

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

bool check(int x){
    for(int b=1; b<=x; b++) for(int p=2; p<=10; p++){
        ll temp = pow(b, p);
        if(temp == x){
            return true;
        }
    }
    return false;
}

int main(){
    int X;  cin >> X;
    for(int x=X; x>=1; x--){
        if(check(x)){
            cout << x << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
b = input()
if b == 'A':
    b = b.replace('A', 'T')
elif b == 'T':
    b = b.replace('T', 'A')
elif b == 'C':
    b = b.replace('C', 'G')
else:
    b = b.replace('G', 'C')

print(b)

Measured memory_bytes: 2940
#include<iostream>
using namespace std;
int main(){
	for (int i = 0; true; i++){
		int a, b;
		char op;
		cin >> a >> op >> b;
		if (op == '?'){ break; }
		else if (op == '+'){
			cout << a + b << endl;
		}
		else if (op == '-'){
			cout << a - b << endl;
		}
		else if (op == '/'){
			cout << a / b << endl;
		}
		else cout << a*b << endl;
	}
}

Measured memory_bytes: 3048
//Comentary AC
#include <iostream>
#include <vector>
using namespace::std;
const int INF = 999999999;
int main() {
    int N;  cin >> N;
    string S;   cin >> S;
    vector<int> vW(N+1, 0), vE(N+1, 0);
    for(int i=0; i<N; i++){
        vW[i+1] += vW[i];
        if(S[i] == 'W') vW[i+1]++;
        vE[i+1] += vE[i];
        if(S[i] == 'E') vE[i+1]++;
    }
    int ans = INF;
    for(int i=0; i<N; i++){
        int now = vW[i] + (vE[N]-vE[i+1]);
        if(ans > now) ans = now;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3076
/*
                                                                           __                _________
                                                                          /  \              /  ______/
                                                                         /    \            /  /
                                                                        /  __  \          /  /
                                                                       /  /  \  \         |  |
                                                                      /  /____\  \        \  \
                                                                     /  ________  \        \  \______
                                                                    /__/        \__\        \________\
	
	I_love_Hacked;
	I_hate_pretest past;
	
    coder:xxjAc
    date:2018/3/4 
    
    I_love_Ac;
    I_hate_WA;
    I_hate_Tle;
    I_hate_RE;
    I_hate_CE;
    I_hate_Mle;
    
    I love Accepts very much;
*/
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
const int inf=1000000007;
int main(){
	int n;
	cin>>n;
	char c;
	for (int i=0;i<n;i++){
		cin>>c;
		if (c=='Y'){
			cout<<"Four"<<endl;
			return 0;
		}
	}
	cout<<"Three"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <complex>

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

constexpr int MAXN = 102;
int n;
ll x[MAXN], y[MAXN], h[MAXN];

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

    cin >> n;
    int start = 0;
    for (int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i] >> h[i];
        if (h[i] >= 1)
            start = i;
    }

    for (ll cx = 0; cx <= 100; ++cx) {
        for (ll cy = 0; cy <= 100; ++cy) {
            ll hh = max(0LL, abs(x[start] - cx) + abs(y[start] - cy) + h[start]);
            bool all_pass = true;
            for (int i = 0; i < n; ++i) {
                ll dx = abs(x[i] - cx);
                ll dy = abs(y[i] - cy);
                if (max(hh - dx - dy, 0LL) != h[i]) {
                    all_pass = false;
                    break;
                }
            }

            if (all_pass) {
                cout << cx << " " << cy << " " << hh << '\n';
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
module Main where

import Control.Applicative
import Text.Printf
import Numeric

main :: IO ()
main = do
  { [r] <- getDoubles
  ; let area = pi * r ^ 2
  ; let peri = 2 * pi * r
  ; putDoubles [area, peri] 
  }

--

getInts :: IO[Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble x = showFFloat Nothing x ""




Measured memory_bytes: 4052
import static java.lang.Math.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			int[] a = in.nextIntArray(n);

			long cost = INF;
			for (int k = -100; k <= 100; k++) {
				long tmp = 0;
				for (int i = 0; i < n; i++) {
					tmp += pow((k-a[i]), 2);
				}
				cost = min(cost, tmp);
			}

			out.println(cost);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define ld double
#define ll long long
#define pb emplace_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(),x.end()
ll power(ll a, ll b) {ll res = 1; a = a % mod; while (b) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b /= 2;} return res;}
ll invmod(ll a) {return power(a, mod - 2);}
int main(void)
{
	FIO
	int t = 1;
	// cin >> t;
	while (t--)
	{
		ll n, j = 2;
		int cnt = 0, ans = 0;
		vector<int> arr;
		cin >> n;
		while (j * j <= n) {
			cnt = 0;
			while (n % j == 0) {
				n /= j;
				cnt++;
			}
			// cout << j << " " << cnt << '\n';
			j++;
			if (cnt)arr.pb(cnt);
		}
		if (n > 1) arr.pb(1);
		for (auto i : arr) {
			ans += (sqrt(1 + 8 * i) - 1) / 2;
		}
		cout << ans << '\n';
	}
	return 0;
}

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

#define G_SIZE 100100
#define BLACK 1
#define WHITE 2
#define UNC 0

vector<int> g[G_SIZE];
int parent[G_SIZE];
int color[G_SIZE];

int dfs(int node, int c, int p){
    if(color[node] != UNC && color[node] != c){
        return 0;
    }
    //cout<< node <<" "<< color[node] << " " << c << " " << p << endl;

    color[node] = c;
    int ans = 1; //this node
    for(auto nei : g[node]){
        if(nei != p){
            ans += dfs(nei, c, node);
        }
    }
    return ans;
}

int main(){
    #ifdef magUNbos
    freopen("a.in.c","r",stdin);
    #endif // magUNbos

    int n;
    cin >> n ;

    for(int i = 0 ; i < n - 1; i++){
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    queue< pair<int,int> >q;
    q.push(make_pair(1, -1));
    while(!q.empty()){
        auto p = q.front();
        q.pop();

        int node = p.first;
        int par = p.second;
        parent[node] = par;

        if(node == n){
            break;
        }

        for(auto nei : g[node]){
            if(nei != par)
                q.push(make_pair(nei, node));
        }
    }

    vector<int> path;
    int node = n;
    int par = parent[n];

    while(node != -1){
        path.push_back(node);
        node = par;
        par = parent[node];
    }
    reverse(path.begin(), path.end());

    for(int i = 0 ; i < path.size() / 2 ; i++){
        color[path[i]] = BLACK;
        color[path[path.size() - i - 1]] = WHITE;
    }
    if(path.size() % 2 == 1){
        color[path[path.size()/2]] = BLACK;
    }

    /*for(auto node: path){
        cout << node << " ";
    }cout << endl;*/

    int B = dfs(1, BLACK, -1);
    int W = dfs(n, WHITE, -1);

    //cout << B << " " << W << " " << n << endl;
    assert(B + W == n);
    if(B > W){
        cout << "Fennec" << endl;
    }else{
        cout << "Snuke" << endl;
    }


}


Measured memory_bytes: 10104
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,q,x;
  cin >> a >> b >> q;
  vector<long long> s(a),t(b);
  for(int i=0;i<a;i++){
    cin >> s[i];
  }
  for(int i=0;i<b;i++){
    cin >> t[i];
  }
  for(int i=0;i<q;i++){
    cin >> x;
    long long r=a-1, l=0,ar,al,br,bl,ans=1e18;
    while(abs(r-l)>1){//A
      long long mid=(r+l)/2;
      if(s[mid]>=x){
        r=mid;
      }else{
        l=mid;
      }
    }
    ar=r; al=r-1;
    if(s[0]>x){
      ar=0;
      al=-1;
    }
    if(s[a-1]<x){
      ar=-1;
      al=a-1;
    }

    r=b-1; l=0;
    while(abs(r-l)>1){//B
      long long mid=(r+l)/2;
      if(t[mid]>=x){
        r=mid;
      }else{
        l=mid;
      }
    }
    br=r; bl=r-1;
    if(t[0]>x){
      br=0;
      bl=-1;
    }
    if(t[b-1]<x){
      br=-1;
      bl=b-1;
    }
    if(al>=0 and bl>=0) ans=min(ans, max(abs(x-s[al]), abs(x-t[bl])));
    if(ar>=0 and br>=0) ans=min(ans, max(abs(s[ar]-x), abs(t[br]-x)));
    if(al>=0 and br>=0) ans=min(ans, 2*abs(x-s[al])+abs(t[br]-x));
    if(ar>=0 and bl>=0) ans=min(ans, 2*abs(x-s[ar])+abs(t[bl]-x));
    if(ar>=0 and bl>=0) ans=min(ans, 2*abs(x-t[bl])+abs(s[ar]-x));
    if(al>=0 and br>=0) ans=min(ans, 2*abs(x-t[br])+abs(s[al]-x));
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 2944
object Main extends App {
  val n = new java.util.Scanner(System.in).nextInt
  n % 10 match {
    case 2 | 4 | 5 | 7 | 9 => println("hon")
    case 0 | 1 | 6 | 8 => println("pon")
    case 3 => println("bon")
  }
}

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

int main()
{
	int n, i = 2;
	cin >> n;
	cout << n << ':';

	while (i * i <= n)
	{
		if (n % i != 0)
		{
			i++;
			continue;
		}
		cout << ' ' << i;
		n /= i;
	}
	cout << ' ' <<n << endl;

	return 0;
}

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

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

	int N;
	int i,k;
	int ans=1e9;
	int ctr=0;
	string S,T;

	cin >> S >> T;

	for(i=0;i<=(S.size()-T.size());i++){
		ctr=0;
		for(k=0;k<T.size();k++){
			if(S[i+k]!=T[k]) ctr++;
		}

		if(ctr<ans) ans=ctr;
	}
	
	cout << ans << endl;

	return 0;
}



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

using namespace std;

int h,w;
bool visited[50][50];
char board[50][50];
int dx[4]={0,1,0,-1};
int dy[4]={-1,0,1,0};
bool ok = true;

void bfs(int sy,int sx)
{
	bool check = false;
	queue <pair<int,int>> que;
	que.push(make_pair(sy,sx));

	while(!que.empty())
	{
		int y = que.front().first;
		int x = que.front().second;
		que.pop();

		if(visited[y][x]==true)
		{
			continue;
		}

		visited[y][x]=true;

		for(int i=0;i<4;i++)
		{
			int ny = y + dy[i];
			int nx = x + dx[i];

			if(ny<0 || ny>=h || nx<0 || nx>=w)
			{
				continue;
			}

			if(board[ny][nx]=='#' && visited[ny][nx]==false)
			{
				if(check==false)
				{
					check=true;
				}
				que.push(make_pair(ny,nx));
			}
		}
	}

	if(check==false)
	{
		ok=false;
	}
}
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> h >> w;

	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin >> board[i][j];
		}
		memset(visited[i],false,sizeof(visited[i]));
	}

	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(board[i][j]=='#' && visited[i][j]==false)
			{
				bfs(i,j);

				if(ok==false)
				{
					cout << "No" << '\n';

					return 0;
				}
			}
		}
	}

	cout << "Yes" << '\n';

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include<set>
using namespace std;
long long int mpown(long long int m, int n);
long long int bign=1000000007;
int bitCount(int bits);
int main()
{
    int a,b;
    cin >> a >>b;
    if(a>=13)cout << b << endl;
    else if(6<=a)cout << b/2 << endl;
    else cout << 0 << endl;
    return 0;
}

int bitCount(int bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); //  2bitごとに計算
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); //  4bitごとに計算
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f); //  8bitごとに計算
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff); //  16ビットごとに計算
    return (bits & 0x0000ffff) + (bits >> 16);             //  32ビット分を計算
}
long long int mpown(long long int m, int n)
{
    if (n == 0)
        return 1;
    else if (n == 1)
        return m;
    else
    {
        long long int temp = mpown(m, n / 2);
        return temp * temp * (n & 1 ? m : 1);
    }
}

Measured memory_bytes: 3152
n = gets.to_i
srray = gets.split("").map(&:to_s)
# answer.push(srray.count("."))
i=0
brray = []
crray = srray
subanswer = brray.count("#")+crray.count(".")
answer = subanswer
while i<n
  tmp = crray.shift
  if tmp == '#' then
    subanswer += 1
  elsif tmp == '.' then
    subanswer -= 1
    answer = [answer,subanswer].min
  end
  # j=0
  # while j<i+1
  #   brray.push(srray[j])
  #   j+=1
  # end
  # while j>i && j<n
  #   crray.push(srray[j])
  #   j+=1
  # end
  # answer.push(brray.count("#")+crray.count("."))
  i+=1
end
puts answer


Measured memory_bytes: 20244
package main

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

type node struct { // 左子右兄弟表現(left-child, right-sibling representation)
	parent, left, right int
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var n int
	fmt.Scan(&n)
	nodes = make([]node, n)
	for i := 0; i < n; i++ {
		nodes[i].parent = -1
		nodes[i].left = -1  // 一番左の子ども
		nodes[i].right = -1 // すぐ隣の兄弟
	}
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		me := nextInt(sc)
		numc := nextInt(sc)
		var left int
		for j := 0; j < numc; j++ { // 子どもをスキャンする
			c := nextInt(sc)
			if j == 0 {
				nodes[me].left = c // 最初の子どもをleftにセットする
			} else {
				nodes[left].right = c // 二番目以降の子どもは、leftのrightにセットする
			}
			left = c
			nodes[c].parent = me
		}
	}
	var root int
	for i := 0; i < n; i++ {
		if nodes[i].parent == -1 {
			root = i
		}
	}
	depth = make([]int, n)
	getDepth(root, 0)
	for i := 0; i < n; i++ {
		printNode(i)
	}
}

var depth []int
var nodes []node

func getDepth(u, p int) {
	// fmt.Printf("getDepth() en: u %d, p %d\n", u, p)
	depth[u] = p
	if nodes[u].right != -1 {
		getDepth(nodes[u].right, p)
	}
	if nodes[u].left != -1 {
		getDepth(nodes[u].left, p+1)
	}
}

func printNode(id int) {
	wtr := bufio.NewWriter(os.Stdout)
	fmt.Fprintf(wtr, "node %d: parent = %d, depth = %d, ", id, nodes[id].parent, depth[id])
	if nodes[id].parent == -1 {
		fmt.Fprintf(wtr, "root, ")
	} else if nodes[id].left == -1 {
		fmt.Fprintf(wtr, "leaf, ")
	} else {
		fmt.Fprintf(wtr, "internal node, ")
	}
	fmt.Fprintf(wtr, "[")
	n := nodes[id].left
	var cnt int
	for n != -1 {
		if cnt == 0 {
			fmt.Fprintf(wtr, "%d", n)
		} else {
			fmt.Fprintf(wtr, ", %d", n)
		}
		cnt++
		n = nodes[n].right
	}
	fmt.Fprintf(wtr, "]\n")
	wtr.Flush()
}



Measured memory_bytes: 13776
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
const int w=5e5+5;
const ll mod=998244353;
ll a[w],b[w];
int main()
{
    int i,j;
    ll n,m;
    scanf("%lld %lld",&n,&m);
    for(i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    sort(a+1,a+1+n);
    a[n+1]=1e18;
    ll ans=0;
    ll l=0,r=a[n]*2+1;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        ll num=0;
        for(i=1;i<=n;i++)
        {
            if(a[i]>=mid)
                num+=n;
            else
            {
                ll x=mid-a[i];
                int u=lower_bound(a+1,a+2+n,x)-a;
                num+=n-u+1;
            }
        }
        if(num<m)
            r=mid-1;
        else
            l=mid+1;
    }
    //cout<<l<<" "<<r<<" "<<endl;
    for(i=1;i<=n;i++)
        b[i]=b[i-1]+a[i];
    ll num=0;
    for(i=1;i<=n;i++)
    {
        ll x=r-a[i];
        int pos=upper_bound(a+1,a+2+n,x)-a;
        ans+=a[i]*(n-pos+1)+b[n]-b[pos-1];
        num+=(n-pos+1);
    }
    cout<<ans+(m-num)*r<<endl;
    return 0;
}
/*
9 2
1 3 5 110 24 21 34 5 3
*/


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

int main() {
	int n, m;

	while(cin >> m, m) {
		cin >> n;
		int ans = 0;

		for(; m <= n; m++) {
			int tmp = m;
			while(!(tmp % 2)) tmp /= 2;
			while(!(tmp % 3)) tmp /= 3;
			while(!(tmp % 5)) tmp /= 5;
			if(tmp == 1)
				ans++;
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
def north(d):
    return [d[1], d[5], d[2], d[3], d[0], d[4]]

def east(d):
    return [d[3], d[1], d[0], d[5], d[4], d[2]]

def south(d):
    return [d[4], d[0], d[2], d[3], d[5], d[1]]

def west(d):
    return [d[2], d[1], d[5], d[0], d[4], d[3]]

numbers = list(map(int, input().split()))
directions = list(input())

for d in directions:
    if d == "N":
        numbers = north(numbers)
    elif d == "E":
        numbers = east(numbers)
    elif d == "S":
        numbers = south(numbers)
    elif d == "W":
        numbers = west(numbers)

print(numbers[0])

Measured memory_bytes: 6748
#define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>

using namespace std;

int main(int argc, char **argv){
	int a, b;
	while (std::cin >> a >> b) {
		int tmp_a = a, tmp_b = b;
		while (a % b != 0) {
			int tmp = a % b;
			a = b;
			b = tmp;
		}
		cout << b << " " << (tmp_a / b) * (tmp_b / b) * b << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#pragma GCC optimize("Ofast,fast-math,unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (int)v.size()
#define fi first
#define se second
#define sqrt(x) sqrt(abs(x))
#define sqr(x) ((x) * (x))
#define unq(x) (x.resize(unique(all(x)) - x.begin()))
#define fill(x, y) memset(x, y, sizeof(x))
#define mp make_pair
#define pb emplace_back
#define popcnt __builtin_popcount
#define ctz __builtin_ctz

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;

template <class T> using indexed_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T, class U>
istream& operator >> (istream &in, pair <T, U> &p) {
    in >> p.first >> p.second;
    return in;
}

template <class T, class U>
ostream& operator << (ostream &out, pair <T, U> &p) {
    out << p.first << ' ' << p.second;
    return out;
}

template <class T>
istream& operator >> (istream &in, vector <T> &a) {
    for (T &i: a) in >> i;
    return in;
}

template <class T>
ostream& operator << (ostream &out, vector <T> &a) {
    for (T i: a) out << i << ' ';
    out << '\n';
    return out;
}

template <class T>
ostream& operator << (ostream &out, set <T> &a) {
    for (T i: a) out << i << ' ';
    out << '\n';
    return out;
}

void fastIO() {
    ios_base:: sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
}

int k, s;

signed main() {
    fastIO();

    cin >> k;
    for (int i = 1; i <= k; ++i) {
        for (int j = 1; j <= k; ++j) {
            for (int w = 1; w <= k; ++w) {
                s += __gcd(__gcd(i, j), w);
            }
        }
    }

    cout << s;

    return 0;
}

/// ЗАПУСКАЕМ ГУСЯ:
/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */


Measured memory_bytes: 3652
#include <stdio.h>

int main(void) {
	int n,p,a;
	int x = 0;

	scanf("%d %d",&n,&p);

	for (int i = 0;i < n;i++) {
		scanf("%d",&a);
		if (a % 2 == 1) {
			x++;
		}
	}
	
	printf("%ld\n",(p == 1 && x == 0) ? 0L : x == 0 ? 1L << n : 1L << (n-1));
	
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    ll N,K;
    cin>>N>>K;
    ll cnt=1;
    rep(i,N){
        if(cnt<K){
            cnt*=2;
        }
        else{
            cnt+=K;
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3604
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<numeric>
#include<math.h>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
double dist ( int i, int j, vector<pair<int, int>>& xy ) {
    double dx = xy[i].first - xy[j].first;
    double dy = xy[i].second - xy[j].second;
    return sqrtl(dx * dx + dy * dy);
}
int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> xy(n);
    rep(i, n) {
        int x, y;
        cin >> x >> y;
        xy[i] = make_pair(x, y);
    }
    double sum = 0.0;
    vector<int> v(n);
    rep(i, n) v[i] = i;
    do {
        rep(i, n-1) sum += dist(v[i], v[i+1], xy);
    } while( next_permutation(v.begin(), v.end()));
    int num = 1;
    rep(i, n) num *= ( i + 1);
    printf("%.6lf\n", sum / num);
    return 0;
}


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

int main(){

  int n, m, i, j;
  int f[100]={ }, t[100], x[100][100];

  cin >> n >> m;

  for (i=0; i<m; i++){
    cin >> t[i];
  }

  for (i=0; i<m; i++){
    for (j=0; j<n; j++){
      cin >> x[i][j];
      if (x[i][j] == t[i]){
	f[j]++;
      } else {
	f[t[i]-1]++;
      }
      // cout << x[i][j] << " " << f[j] << " " << t[i] << " " << f[t[i]] << endl;

    }
  }

  for (i=0; i<n; i++){
    cout << f[i] << endl;
  }

}
  

Measured memory_bytes: 3104
#include <iostream>
  #include <vector>
  #include <algorithm>
  #include <ctime>
  #include <cmath>
  #include <string>
  #include <stdlib.h>
  #include <fstream>
  #include <set>
  #include <map>
  #include <stack>
  #include <deque>
  #include <iterator>
  using namespace std;

  
  int main(){
      long long n, p;
      cin >> n >> p;
      cout << (n >= 10? p:p + 100 * (10 - n));
  }

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.cl", "r", stdin);
	string str = "";

	int i;
	while (getline (cin, str ) ){
		if ( isupper(str[0]) ){
			cout << "The converted text." << endl;
		}else{
			for (i = 0; i < str.length(); ++i){
				if ( isalpha(str[i]) ){
					str[i] = toupper(str[i]);
				} // end if
			} // end for
			cout << str << endl;
		} // end if
	} // end while
		
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

multiset<pair<long long int, pair<long long int ,long long int>>> P, M;

int N;
long long int x[200005], y[200005];

long long int INF = 999999999999999;

int main(void) {

	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> x[i] >> y[i];
		P.insert(make_pair(x[i] + y[i],make_pair(x[i],y[i])));
		M.insert(make_pair(x[i] - y[i],make_pair(x[i],y[i])));
	}

	long long int ans = 0;
	long long int tmp_x,tmp_y, tmp_p, tmp_m;

	pair<long long int, pair<long long int, long long int>> q, r;

	for (int i = 1; i <= N; i++) {
		q.first = x[i] + y[i]; q.second.first = x[i]; q.second.second = y[i];
		auto it = P.find(q); P.erase(it);

	//cout << q.first << " " << q.second.first << " " << q.second.second << endl;

		r.first = x[i] - y[i]; r.second.first = x[i]; r.second.second = y[i];
		auto itr = M.find(r); M.erase(itr);


		//-----
		it = P.end(); it--;
		tmp_p = (*it).first;  tmp_x = (*it).second.first; tmp_y = (*it).second.second;
		ans = max(ans, abs(tmp_x - x[i]) + abs(tmp_y - y[i]));
        //----
		it = P.upper_bound(make_pair(tmp_p, make_pair(INF, INF)));
		it--;
		tmp_p = (*it).first;  tmp_x = (*it).second.first; tmp_y = (*it).second.second;
		ans = max(ans, abs(tmp_x - x[i]) + abs(tmp_y - y[i]));
		//-----

		itr = M.end(); itr--;
		tmp_m = (*itr).first; tmp_x = (*itr).second.first; tmp_y = (*itr).second.second;
		ans = max(ans, abs(tmp_x - x[i]) + abs(tmp_y - y[i]));

		//cout << tmp_m << " " << tmp_x << " " << tmp_y << endl;
		
		//-----
		itr = M.upper_bound(make_pair(tmp_m, make_pair(INF, INF))); itr--;
		tmp_m = (*itr).first; tmp_x = (*itr).second.first; tmp_y = (*itr).second.second;
		ans = max(ans, abs(tmp_x - x[i]) + abs(tmp_y - y[i]));
		

		P.insert(q);
		M.insert(r);
		
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 31652
#include<iostream>
#include<cstdio>
using namespace std;
int a[100001];
int main()
{
	long long n,t=0,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		while(a[i]%2==0) a[i]/=2,ans++;
	cout<<ans;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int a = sc.nextInt();
        int v = sc.nextInt();
        int b = sc.nextInt();
        int w = sc.nextInt();
        int t = sc.nextInt();

        if (v<=w) {
            System.out.println("NO");
            return;
        }

        int dis = Math.abs(a-b);
        int diff = Math.abs(v-w);

        if (dis<=(long)diff*(long)t) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 35664
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(13)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> Q;
//ll longinf=1ll<<60;
int inf=1<<29;
int dn[4]={-1,1,0,0};
int dm[4]={0,0,-1,1};
ll longinf=(1ll<<60);

const ll MOD = 1e9+7;

class unionFind{
      private:
      vector<int> parent;
      vector<int> rank;
      vector<int> sizes;

      public:
      unionFind(int n){
            rep0(i,n){
                  parent.push_back(i);
                  rank.push_back(0);
                  sizes.push_back(1);
            }
      }
      int root(int x){
            if(parent[x]==x){
                  return x;
            }
            else{
                  parent[x] = root(parent[x]);
                  return parent[x];
            }
      }
      void merge(int x,int y){
            x=root(x);
            y=root(y);
            if(x==y) return;
            if(rank[x]<rank[y]) swap(x,y);
            if(rank[x]==rank[y]) rank[x]++;
            parent[y]=x;
            sizes[x]+=sizes[y];
      }
      bool same(int x,int y){
            return root(x)==root(y);
      }
      int size(int x){
            return sizes[root(x)];
      }
};
int main(){
      int N,K,L;
      cin>>N>>K>>L;
      unionFind road(N);
      unionFind train(N);
      int p[K],q[K];
      rep0(i,K){
            cin>>p[i]>>q[i];
            p[i]--,q[i]--;
            road.merge(p[i],q[i]);
      }
      int r[L],s[L];
      rep0(i,L){
            cin>>r[i]>>s[i];
            r[i]--,s[i]--;
            train.merge(r[i],s[i]);
      }
      Q pa[N];
      rep0(i,N){
            pa[i].first=road.root(i);
            pa[i].second.first=train.root(i);
            pa[i].second.second=i;
      }
      sort(pa,pa+N);
      ll ans[N];
      rep0(i,N){
            ll aa=pa[i].first;
            ll bb=pa[i].second.first;
            Q qq={aa,{bb,longinf}};
            Q qs={aa,{bb,-1}};
            ans[pa[i].second.second]= upper_bound(pa,pa+N,qq) - lower_bound(pa,pa+N,qs);
      }
      rep0(i,N){
            cout<<ans[i]<<" ";
      }
      cout<<endl;
      
}

Measured memory_bytes: 13152
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    a, b = Input()
    if a % 2 !=  b % 2:
        print("IMPOSSIBLE")
    else:
        print((a+b)//2)

main()

Measured memory_bytes: 9120
A,B = map(int, input().split())
def f(n):
    if n % 4 == 0:
        return n
    elif n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return n ^ (n-1) ^ (n-2)
    elif n % 4 == 3:
        return 0
print(f(A-1) ^ f(B))


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

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

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

const int inf=100000000;

llong pownew(llong m, llong n) {
        if (n == 0) { return 1; }
        if (n % 2 == 0) { return pow(m*m, n/2); }
        return pow(m, n-1) * m;
    }

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    llong X; cin>>X;
    llong cnt=0;
    for(int i=1; ; i++)
    {
     cnt+=i;
     if(cnt>=X) {
         cout<<i<<endl;
         break;
     }
    }
    return 0;
}


Measured memory_bytes: 256
import itertools

n = int(input())
l = list(map(int, input().split()))
p_list = list(itertools.permutations(l, 3))
results = [x for x in p_list if max(x) < (sum(x) - max(x)) and len(x) == len(set(x))]
print(int(len(results) / 6))

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, k, d, a,c=0;
	int snk[105]{0};
	cin >> n >> k;

	for (int i = 1; i <= k; i++) {
		cin >> d;
		for (int j = 0; j < d; j++) {
			cin >> a;
			snk[a]++;
		}
	}

	for (int i = 1; i <= n; i++) {
		if (!snk[i]) c++;
	}

	cout << c << "\n";
}

Measured memory_bytes: 3648
import java.util.*;

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 i;
		for(i=0;i<ty-sy;i++) System.out.print("U");
		for(i=0;i<tx-sx;i++) System.out.print("R");
		for(i=0;i<ty-sy;i++) System.out.print("D");
		for(i=0;i<tx-sx;i++) System.out.print("L");
		
		System.out.print("L");
		for(i=0;i<=ty-sy;i++) System.out.print("U");
		for(i=0;i<=tx-sx;i++) System.out.print("R");
		System.out.print("D");
		
		System.out.print("R");
		for(i=0;i<=ty-sy;i++) System.out.print("D");
		for(i=0;i<=tx-sx;i++) System.out.print("L");
		System.out.print("U");

		
		
	}

}


Measured memory_bytes: 40152
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
		int q=sc.nextInt();
  	   	int[] a=new int[q];
  		int[] b=new int[n];
		for(int c=0;c<q;c++){
    		a[c]=sc.nextInt();
          	b[a[c]-1]++;
    	}
  		
          
    	for(int f=0;f<n;f++){
 		if((k-q+b[f])<=0){
    		System.out.println("No");
    	}else{
     		System.out.println("Yes");
   	 }

        }
    }
}


Measured memory_bytes: 55796
using System;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Collections.Generic;

//

namespace Kyoupro
{
    class Program
    {
        
        static void Main(string[] args)
        {    

            //整数の数を取得
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int N = input[0];//.ElementAt(0);//ボール個数
            int K = input[1];//.ElementAt(1);//あるべき種類 

            //空白区切り一行
            var balls = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            balls = balls.GroupBy(x => x).Select(x =>x.Count()).ToArray();
            
            Array.Sort(balls);
            Array.Reverse(balls);
            

            //リスト化
            //var qlist = numcounts.ToList();

            int count = 0;

            if(balls.Count()>K){
                
                for(int k=0;k<K;k++)
                {       
                count +=balls.ElementAt(k);
                }
                count = N-count;
            }
            
            Console.WriteLine(count);
                       


        }
    }
}

Measured memory_bytes: 46860
from collections import Counter
s = input()[::-1]
mod = 2019

x = [0]

for i, j in enumerate(s):
    x.append((x[-1] + int(j) * pow(10,i, mod))%mod)

C = Counter(x)
ans = 0

for v in C.values():
    ans += v*(v-1)//2
print(ans)

Measured memory_bytes: 16748
N = int(input()) 
n = int(N**.5)
res = len(str(N))
for i in range(2,n+1):
    if N % i == 0:
        #print(len(str(i)),len(str(N/i)))
        f = max(len(str(i)),len(str(N//i)))
        res = min(res, f)
#        print(i, len(str(i)),len(str(N/i)),res, f)
print(res)


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

using namespace std;

int main(){
  int n;
  vector<long long> v,acc, result;
  long long oddsum = 0;
  cin >> n;

  for (int i=0;i<n;i++) {
    long long tmp;
    cin >> tmp;
    v.push_back(tmp);
    oddsum += i%2==0?tmp:-tmp;
    acc.push_back(oddsum);
  }
  for (int i=0;i<n;i++) {
    long long leftsum, rightsum;
    if (i%2==0) {
      if (i>0)
	leftsum = acc[i-1];
      else
	leftsum = 0;
      if (i<n-1)
	rightsum = -(acc[n-1] - acc[i+1]);
      else
	rightsum = 0;
    } else {
      if (i>0)
	leftsum = -acc[i-1];
      else
	leftsum = 0;
      if (i<n-1)
	rightsum = acc[n-1] - acc[i+1];
      else
	rightsum = 0;
    }
    result.push_back(v[i] + v[(i+1)] + leftsum + rightsum);
  }

  cout << result[n-1] << " ";
  for (int i=0;i<n-1;i++) {
    cout << result[i] << " ";
  }
  cout << endl;
  return(0);
  
  
}



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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define INF INT_MAX/3

int rr[8];
int d[200][200];

int main(){
    cin.sync_with_stdio(false);
    int n, m, r;
    cin >> n >> m >> r;
    rep(i, r) {
        cin >> rr[i];
        rr[i]--;
    }
    rep(i, n)rep(j, n) if(i != j) d[i][j] = INF;
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        d[a][b] = d[b][a] = c;
    }
    rep(k, n)rep(i, n)rep(j, n) minch(d[i][j], d[i][k] + d[k][j]);
    int ans = INF;
    sort(rr, rr + r);
    do {
        int c = 0;
        rep(i, r - 1) {
            c += d[rr[i]][rr[i + 1]];
        }
        minch(ans, c);
    } while(next_permutation(rr, rr + r));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1020
#include <stdio.h>

int main() {
  int i,j,k,a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  while((1>a)&&(a>100)&&(1>b)&&(b>100)&&(1>c)&&(c>100)&&(1>d)&&(d>100)){
    scanf("%d %d %d %d",&a,&b,&c,&d);
  }
  i=a-b;
  if(i<0)i=i*(-1);
  j=b-c;
  if(j<0)j=j*(-1);
  k=c-a;
  if(k<0)k=k*(-1);
  if(((i<=d)&&(j<=d))||(k<=d)){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1728
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

const ll INF = 1LL << 40;

vector<vector<ll>> sushis;

int main(void) {
    int N, K;
    cin >> N >> K;

    sushis.resize(N);
    for (int i = 0; i < N; i++) {
        int t, d;
        cin >> t >> d;
        t--;
        sushis[t].push_back(d);
    }

    priority_queue<ll> q;

    for (int i = 0; i < N; i++) {
        if (sushis[i].empty()) {
            sushis[i].push_back(-INF);
        }
        sort(sushis[i].begin(), sushis[i].end());
        reverse(sushis[i].begin(), sushis[i].end());
    }

    sort(sushis.begin(), sushis.end(), [](const vector<ll> &a, const vector<ll> &b) {
            return a[0] > b[0];
            });

    ll delicious = 0;
    ll kind = 0;
    ll cand = 0;

    for (int i = 0; i < K; i++) {
        delicious += sushis[i][0];
        kind++;
        for (int j = 1; j < (int) sushis[i].size(); j++) {
            q.push(sushis[i][j]);
        }
    }

    for (int i = K; i < N; i++) {
        for (int j = 0; j < (int) sushis[i].size(); j++) {
            q.push(sushis[i][j]);
        }
    }

    cand = delicious + kind * kind;
    // printf("delicious: %lld, kind: %lld, cand: %lld\n", delicious, kind, cand);

    while (kind > 0) {
        auto remove = sushis[kind - 1][0];
        delicious -= remove;
        q.push(remove);
        auto v = q.top();
        q.pop();
        delicious += v;

        kind--;
        chmax(cand, delicious + kind * kind);
        // printf("delicious: %lld, kind: %lld, cand: %lld\n", delicious, kind, cand);
    }

    cout << cand << endl;

    return 0;
}


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

string S,T;

void input(){
  cin >> S >> T;
}

void solve(){
  T.pop_back();
  if(S == T) cout << "Yes" << endl;
  else cout << "No" << endl;
}

int main(){
  input();
  solve();
  return 0;
}


Measured memory_bytes: 3592