akhauriyash/Code-Regression huggingface dataset:
import copy

H, W = map(int, input().split())
S = [list(map(str, list(input()))) for i in range(H)]

List = [[0] * W for i in range(H)]

for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            List[i][j] = -1


def maze(I, J):
    L_Max = 0
    Copy_List = copy.deepcopy(List)
    Copy_List[I][J] = 1

    for a in range(1, 400):
        bre_flag = True
        for m in range(H):
            for n in range(W):
                if Copy_List[m][n] == a:
                    #print(Copy_List)
                    if m - 1 >= 0:
                        if Copy_List[m - 1][n] == 0:
                            Copy_List[m - 1][n] = a + 1
                            bre_flag = False
                    if m + 1 < H:
                        if Copy_List[m + 1][n] == 0:
                            Copy_List[m + 1][n] = a + 1
                            bre_flag = False
                    if n - 1 >= 0:
                        if Copy_List[m][n - 1] == 0:
                            Copy_List[m][n - 1] = a + 1
                            bre_flag = False
                    if n + 1 < W:
                        if Copy_List[m][n + 1] == 0:
                            Copy_List[m][n + 1] = a + 1
                            bre_flag = False

        if bre_flag == True:
            L_Max = a
            #print(a)
            break

    return L_Max


Max = 0

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            Max = max(Max, maze(i, j))

print(Max-1)

Measured memory_bytes: 50524
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
 
#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.size()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>());
#define VSORT(v) sort(v.begin(),v.end());
#define VGSORT(v) sort(v.begin(),v.end(),greater<int>());
#define REV(a) reverse(begin(a),end(a));

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////
	int d,n;
	cin >> d >> n;
	d=pow(100,d)+0.5;
	//cout << d << endl;
	if(n==100) cout << 101*d << endl;
	else cout << n*d << endl;
/////////////////////////////////////////////
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline
N = int(input().strip())

ans = [0] * (N+1)
path = [[] for _ in range(N+1)]

for i in range(N-1):
    u, v, w = map(int, input().strip().split())
    path[u].append((v, w % 2))
    path[v].append((u, w % 2))

is_visit = [False] * (N+1)
search_list = [(1, 0)]

while len(search_list) > 0:
    now, color = search_list.pop()
    ans[now] = color
    is_visit[now] = True

    for node, distance in path[now]:
        if not is_visit[node]:
            search_list.append((node, (distance+color) % 2))
for color in ans[1:]:
    print(color)


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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 9223372036854775807
#define MOD 1000000007

int main(void){

    int n, m;
    cin >> n >> m;

    vector<int> L(m), R(m);
    rep(i, m) cin >> L.at(i) >> R.at(i);

    int max_L = *max_element(L.begin(), L.end());
    int min_R = *min_element(R.begin(), R.end());

    int ans = min_R - max_L+1;
    //負の時を考える
    cout << max(ans,0) << endl;
    return 0;
}

Measured memory_bytes: 1152
import sys
def input(): return sys.stdin.readline().rstrip()
import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
def main():
    n,k=map(int,input().split())
    A=list(map(int,input().split()))
    gcd_a=gcd(*A)
    if k%gcd_a==0 and max(A)>=k:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")


if __name__=='__main__':
    main()

Measured memory_bytes: 88172
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
// mp[i]: iに行く最大の位置
map<int, int> mp;

const int INF = 1e9;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    multiset<int> st;
    int H, W;
    cin >> H >> W;
    mp[-INF] = -INF;
    mp[INF] = INF;
    for(int i = 0; i < W; i++){
        mp[i] = i;
        st.insert(0);
    }
    for(int i = 0; i < H; i++){
        int a, b; cin >> a >> b; a--; b--;
        auto l = mp.lower_bound(a);
        auto r = mp.upper_bound(b);
        vector<int> to_erase;
        for(auto it = l; it != r; it++){
            int to = it->first;
            int pos = it->second;
            to_erase.push_back(to);
            st.erase(st.find(to-pos));
        }
        int pos;
        if(to_erase.size() > 0){
            pos = mp[to_erase[(int)to_erase.size()-1]];
        }
        for(int pos : to_erase) mp.erase(pos);
        if(to_erase.size() > 0){
            int to = b+1;
            if(mp.count(to) > 0){
                // 何もしなくていい？
            }else{
                mp[to] = pos;
                if(to == W){
                    st.insert(INF);
                }else{
                    st.insert(to-pos);
                }
            }
        }
        // for(auto it : mp){
        //     cout << it.first << ':' << it.second << ' ';
        // }
        // cout << endl;
        if(*st.begin() == INF){
            cout << -1 << endl;
        }else{
            cout << *st.begin()+i+1 << endl;
        }
    }
}

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

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

  vector<int> x(n);
  rep (i, n) cin >> x[i];

  int ans = 0;

  rep (i, n) {
    ans += 2 * min(x[i], abs(k-x[i]));
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int H, W, K;
char C[310][310];
int ans[310][310];

void solve() {
	cin >> H >> W >> K;
	rep(i, 0, H) {
		rep(j, 0, W) {
			cin >> C[i][j];
		}
	}
	memset(ans, -1, sizeof(ans));
	int k = 0;
	rep(j, 0, W) {
		bool found = false;
		rep(i, 0, H) {
			if(C[i][j] == '#') found = true;
		}
		if(!found) continue;

		rep(i, 0, H) {
			ans[i][j] = k;
			if(C[i][j] == '#') k++;
		}
		rer(i, H, 0) {
			if(C[i][j] == '#') break;
			else ans[i][j]--;
		}
	}
	rep(j, 1, W) {
		rep(i, 0, H) {
			if(ans[i][j] == -1) {
				ans[i][j] = ans[i][j - 1];
			}
		}
	}
	rer(j, W - 1, 0) {
		rep(i, 0, H) {
			if(ans[i][j] == -1) {
				ans[i][j] = ans[i][j + 1];
			}
		}
	}
	rep(i, 0, H) {
		rep(j, 0, W) {
			cout << ans[i][j] + 1 << " ";
		}
		cout << "\n";
	}
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 1280
/*  -*- coding: utf-8 -*-
 *
 * 3111.cc: Cutting Subarray
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int MAX_E2 = 1 << 18; // = 262144
const int INF = 1 << 30;

/* typedef */

typedef long long ll;

struct Elm {
  ll s, l, r, m;
  Elm() {}
  Elm(ll _s, ll _l, ll _r, ll _m): s(_s), l(_l), r(_r), m(_m) {}
  Elm(ll _s): s(_s), l(_s), r(_s), m(_s) {}

  Elm operator+(const Elm &e) const {
    Elm t;
    t.s = s + e.s;
    t.l = max(l, s + e.l);
    t.r = max(e.r, e.s + r);
    t.m = max(m, max(e.m, max(t.s, max(t.l, max(t.r, r + e.l)))));
    return t;
  }

  ll getmax() { return max<ll>(0, m); }
};

template <typename T, const int MAX_E2>
struct SegTree {
  int n, e2;
  T nodes[MAX_E2], def;
  SegTree() {}

  void init(int _n, T _def) {
    n = _n; def = _def;
    for (e2 = 1; e2 < n; e2 <<= 1);
    fill(nodes + e2 - 1, nodes + MAX_E2, def);
    for (int j = e2 - 2; j >= 0; j--)
      nodes[j] = nodes[j * 2 + 1] + nodes[j * 2 + 2];
  }

  T &get(int i) { return nodes[e2 - 1 + i]; }
  T &root() { return nodes[0]; }

  void setall() {
    for (int j = e2 - 2; j >= 0; j--)
      nodes[j] = nodes[j * 2 + 1] + nodes[j * 2 + 2];
  }

  void set(int i, T v) {
    int j = e2 - 1 + i;
    nodes[j] = v;
    while (j > 0) {
      j = (j - 1) / 2;
      nodes[j] = nodes[j * 2 + 1] + nodes[j * 2 + 2];
    }
  }
};

/* global variables */

SegTree<Elm,MAX_E2> st;

/* subroutines */

/* main */

int main() {
  int n, qn;
  scanf("%d%d", &n, &qn);

  st.init(n, Elm(0));

  for (int i = 0; i < n; i++) {
    int ai;
    scanf("%d", &ai);
    st.get(i) = ai;
  }
  st.setall();

  printf("%lld\n", st.root().getmax());

  while (qn--) {
    int ki, xi;
    scanf("%d%d", &ki, &xi);
    ki--;

    st.set(ki, Elm(xi));
    printf("%lld\n", st.root().getmax());
  }
  return 0;
}



Measured memory_bytes: 11420
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 3300030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7;
using namespace std;

int main(){
int p,q,r;
cin>>p>>q>>r;
cout<<min(p+q,min(q+r,p+r));
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int W,H,A,B,AB;
main()
{
	while(cin>>W>>H>>A>>B>>AB,W)
	{
		double RA=sqrt(A/M_PI);
		double RB=sqrt(B/M_PI);
		double DL=abs(RA-RB),DR=RA+RB;
		for(int tm=0;tm<100;tm++)
		{
			double D=(DL+DR)/2;
			double ta=acos((RA*RA+D*D-RB*RB)/2/RA/D)*2;
			double tb=acos((RB*RB+D*D-RA*RA)/2/RB/D)*2;
			double area=RA*RA*(ta-sin(ta))/2+RB*RB*(tb-sin(tb))/2;
			if(area<AB)DR=D;
			else DL=D;
		}
		double D=DL;
		if(max(RA,RB)*2>min(H,W)||hypot(H-RA-RB,W-RA-RB)<D)
		{
			cout<<"impossible"<<endl;
			continue;
		}
		double theta=atan2(H-RA-RB,W-RA-RB);
		double dh=D*sin(theta);
		double dw=D*cos(theta);
		double XA=RA,YA=RA,XB=RA+dw,YB=RA+dh;
		if(XB<RB)
		{
			double d=RB-XB;
			XA+=d;
			XB+=d;
		}
		if(YB<RB)
		{
			double d=RB-YB;
			YA+=d;
			YB+=d;
		}
		if(XA+RA>W||XB+RB>W||YA+RA>H||YB+RB>H)
		{
			cout<<"impossible"<<endl;
		}
		else
		{
			cout<<fixed<<setprecision(16)<<XA<<" "<<YA<<" "<<RA<<" "<<XB<<" "<<YB<<" "<<RB<<endl;
		}
	}
}



Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
double a,b,h,m;
double pi=acos(-1);
int main(){
	cout<<fixed<<setprecision(15)<<endl;
	cin>>a>>b>>h>>m;
	double ans=sqrt(a*a+b*b-2*a*b*cos((h*30-m*5.5)*pi/180));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 112345
ll a[N], b[N];

int main(){
	int n; scanf("%d", &n);
	REP(i, n+1) scanf("%lld", a+i);
	REP(i, n) scanf("%lld", b+i);
	ll ans = 0;
	REP(i, n) {
		ll p = min(a[i], b[i]);
		ans += p;
		a[i] -= p; b[i] -= p;
		p = min(a[i+1], b[i]);
		ans += p;
		a[i+1] -= p; b[i] -= p;
	}
	printf("%lld\n", ans);
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  string s;
  cin >> s;
  string t[] = {"AKIHABARA", "AKIHABAR", "AKIHABRA", "AKIHABR", "AKIHBARA", "AKIHBAR", "AKIHBRA", "AKIHBR", "KIHABARA", "KIHABAR", "KIHABRA", "KIHABR", "KIHBR", "KIHHBARA", "KIHBRA", "KIHBAR"};
  bool OK = false;
  rep(i,16){
    if(s==t[i]){
      OK = true;
    }
  }
  if(OK){
    print("YES");
  }
  else{
    print("NO");
  }
}

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

int n;
map<int,bool>vis;
int main() {
	scanf("%d",&n);
	bool flag=true;
	for(int i=1,a;i<=n;i++) {
		scanf("%d",&a);
		if(!vis.count(a))
			vis[a]=true;
		else flag=false;
	}
	if(flag) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 9600
fun main(args: Array<String>) {
  val S = readString()
  repeat(S.length) {
    print("x")
  }
  println()
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }
fun readLong() = readString().toLong()
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 31920
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[32];
        for (int i = 0; i < 32; i++) {
            if (n % 2 != 0) {
                a[i] = 1;
                n = (n - 1) / (-2);
            } else {
                n /= (-2);
            }
        }
        int index = 0;
        for (int i = 0; i < 32; i++) {
            if (a[31 - i] != 0) {
                index = 31 - i;
                break;
            }
        }
        for (int i = 0; i <= index; i++) {
            System.out.print(a[index - i]);
        }
        System.out.println();
    }
}

Measured memory_bytes: 24148
#include <iostream>
#include <cmath>
#include <limits>
#include <utility>
#include <vector>
#include <string>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cfenv>
#include <iomanip>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
typedef long double ld;
int t=1000000000000000000;
signed main(){
ld a=0,b=0;
cin >>a>>b;
  cout <<std::setprecision(18)<<floor(a*b);
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  #define int long long
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  int ans=A*X+B*Y;
  if(A+B>2*C){
    int r=min(X,Y);
    ans-=A*r+B*r;
    ans+=2*C*r;
  }
  ans=min(ans,max(X,Y)*2*C);
  cout<<ans<<endl;
}

Measured memory_bytes: 3544
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <algorithm>
#include <iomanip>
#include <functional>
#include <numeric>

#define REP(i, n) for(int i = 0;i < (n); i++)
#define REP2(i, x, n) for(int i = (x); i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

using namespace std;

//================================================

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string S; cin >> S; reverse(ALL(S)); cout << S << "\n";
	return 0;
}

Measured memory_bytes: 3128
#include <iostream>
#include <algorithm>

const int N = 1000000 + 7;

int n;
char s[N];
int a[N], c[3];
int f[3];

void resort() {
	int x = 0, y = 0;
	for (int i = 0; i < 3; ++i) {
		if (c[i] > c[x]) x = i;
		if (c[i] < c[y]) y = i;
	}
	if (x == y) x = 0, y = 1;
	f[0] = x, f[1] = 3 - x - y, f[2] = y;
	for (int i = 1; i <= n; ++i)
		a[i] = a[i] == y ? 2 : a[i] != x;
	std::sort(c, c + 3), std::swap(c[0], c[2]);
}

void erase(void (*is_del)(int& i, int b[], int& m)) {
	static int b[N], m;
	m = 0;
	for (int i = 1; i <= n; is_del(i, b, m));
	n = m;
	std::copy(b + 1, b + m + 1, a + 1);
}

int main() {
//	freopen("code.in", "r", stdin);
//	freopen("code.out", "w", stdout);

	scanf("%s", s + 1);
	for (int i = 1; s[i]; ++i)
		if (s[i] != s[i - 1]) ++c[a[++n] = s[i] - 'A'];
	resort();
	erase([](int& i, int b[], int& m) {
		int f = 0;
		if (c[0] > c[1]) f = !a[i] && (i == 1 || i == n || b[m] != a[i + 1]);
		f ? --c[0] : (b[++m] = a[i]);
		++i;
	});
	erase([](int& i, int b[], int& m) {
		int f = 0;
		if (c[0] > c[1] && i < n) f = a[i] + a[i + 1] == 2 && (!m || i == n - 1 || b[m] != a[i + 2]);
		f ? (--c[0], --c[2], ++i) : (b[++m] = a[i]);
		++i;
	});
	erase([](int& i, int b[], int& m) {
		int f = 0;
		if (c[0] > c[2] && i < n) f = a[i] + a[i + 1] == 1 && (!m || i == n - 1 || b[m] != a[i + 2]);
		f ? (--c[0], --c[1], ++i) : (b[++m] = a[i]);
		++i;
	});
	for (int i = 1; i <= n; ++i)
		printf("%c", f[a[i]] + 'A');
	return 0;
}


Measured memory_bytes: 12444
#include<iostream>
#include<cmath>
#include<string>


using namespace std;







int main(){


    int A=0;
    int B=0;
   // int S=0;
    string S;
    int hihun =0;

    cin >> A >> B;
    cin >> S;

    

    
    for(int i=0;i<A+B+1;i++){
        if(S[i]=='-')++hihun;
    }
    //cout << hihun;
    if(hihun!=1)cout << "No";
    else{
    
       if(S[A]=='-')cout << "Yes";
       else cout << "No";
    }
 
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<set>
#include<map>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string *s = new string[n];
    map<string, int> m;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        if (m.find(s[i]) == m.end()) {
            m[s[i]] = 1;
        } else {
            m[s[i]]++;
        }
    }
    int max = -1;
    set<string> maxset;
    for (auto i = m.begin(); i != m.end(); i++) {
        if (i->second > max) {
            max = i->second;
            maxset.clear();
            maxset.insert(i->first);
        } else if (i->second == max) {
            maxset.insert(i->first);
        }
    }
    for (auto i = maxset.begin(); i != maxset.end(); i++) {
        cout << *i << endl;
    }
    return 0;
}


Measured memory_bytes: 36096
#include <iostream>
#include <string>
#include <vector>

int main()
{
	std::string S, ans;
	std::cin >> S;
	
	ans = "Yes";

	for (int i = 0; i < S.std::string::length(); i++)
	{
		if ( (S[i] != 'U') && (S[i] != 'D'))
		{
			ans = "No";
			if ((i % 2 != 0) && (S[i] == 'L'))
			{
				ans = "Yes";
			}
			else if ((i % 2 == 0) && (S[i] == 'R'))
			{
				ans = "Yes";
			}
			if (ans == "No") break;
		}
	}
  
	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
n, k, q = map(int, input().split())
A = [int(input()) for i in range(q)]
motiten = [k-q for i in range(n)]#まず全員の点数をn点減点
for j in A:
    motiten[j-1] += 1
for x in motiten:
    if x<= 0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 11792
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    REP(i,n) {
        cin >> a[i];
        a[i]--;
    }
    REP(i,n) cin >> b[i];
    REP(i,n-1) cin >> c[i];

    int ans = 0;
    int prev = -1;
    REP(i,n) {
        ans += b[a[i]];
        if (i != 0) {
            if (prev +1 == a[i]) ans += c[prev];
        }
        prev = a[i];
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
a = list(map(int,input().split()))
b = sorted(a)
c = b[2]-b[1]
b[0] +=c
b[1] +=c
d = b[1]-b[0]
if d%2 == 0:
    print(int(c+d/2))
else:
    print(int(c+(d+3)//2))

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
typedef long long int LLI;
int main()
{
	int n, k, x, ans = 0;
	cin >> n >> k;
	for(int i = 0; i < n; i++)
	{
		cin >> x;
		if( x > k - x )
			ans += k - x;
		else
			ans += x;
	}
	cout << 2 * ans;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using Int = long long;

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b){
    if(a > b) a = b;
}

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b){
    if(a < b) a = b;
}

int main(){
    Int n;
    cin >> n;
    vector<Int> xs(n), ys(n);
    for(Int i=0;i<n;i++) cin >> xs[i] >> ys[i];

    using D = double;
    D ans = 0;
    for(Int i=0;i<n;i++){
        Int gx = xs[i], gy = ys[i];
        for(Int k=0;k<4;k++){
            {
                //90度回転
                Int nx = -gy, ny = gx;
                gx = nx;
                gy = ny;
            }
            Int sx = 0, sy = 0;
            Int px = 0, py = 0;
            Int qx = 0, qy = 0;

            auto dot=[&](Int x1, Int y1, Int x2, Int y2){return x1*x2 + y1*y2;};
            auto cross=[&](Int x1, Int y1, Int x2, Int y2){return x1*y2-x2*y1;};
            for(Int j=0;j<n;j++){
                Int res = dot(xs[j], ys[j], gx, gy);
                if(res < 0) continue;
                if(res > 0){
                    sx += xs[j];
                    sy += ys[j];
                    continue;
                }
                if(cross(xs[j], ys[j], gx, gy)>0){
                    px += xs[j];
                    py += ys[j];
                }else{
                    qx += xs[j];
                    qy += ys[j];
                }
            }
            for(Int t=0;t<4;t++){
                D bx = sx, by = sy;
                if(t&1) bx += px, by += py;
                if(t&2) bx += qx, by += qy;
                chmax(ans, bx*bx+by*by);
            }
        }
    }
    cout << fixed << setprecision(12) << sqrt(ans) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 typedef long long ll;
 
int main() {
int h,w;
cin>>h>>w;
char m[110][110];
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
cin>>m[i][j];
}
}

for(int i=1;i<=h;i++){
    bool c=1;
for(int j=1;j<=w;j++){
if(m[i][j]=='#')c=0;
}
if(c)m[i][0]='n';
}
for(int j=1;j<=w;j++){
    bool c=1;
for(int i=1;i<=h;i++){
if(m[i][j]=='#')c=0;
}
if(c)m[0][j]='n';
}
for(int i=1;i<=h;i++){
if(m[i][0]!='n'){
for(int j=1;j<=w;j++){
if(m[0][j]!='n')cout<<m[i][j];
}
}
if(m[i][0]!='n')cout<<endl;
}
 
 
}

Measured memory_bytes: 256
def make_harf(H, W):
    h = H // 2
    small = W * h
    large = W * (H - h)
    w = W // 2
    small2 = w * H
    large2 = (W - w) * H
    if large - small <= large2 - small2:
        return large, small
    else:
        return large2, small2


H, W = map(int, input().split())
ans = float('inf')
for h in range(1, H):
    tmp = [h * W]
    for item in make_harf(H - h, W):
        tmp.append(item)
    ans = min(max(tmp) - min(tmp), ans)
for w in range(1, W):
    tmp = [H * w]
    for item in make_harf(H, W - w):
        tmp.append(item)
    ans = min(max(tmp) - min(tmp), ans)
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n,m;
  cin>>n>>m;
  vector<int> a(m);
  vector<int> b(m);
  rep(i,m)cin>>a[i]>>b[i];
  vector<int> acc(n+1);
  rep(i,m) {
    acc[a[i]]++;
    acc[b[i]]--;
  }
  repeat(i,1,n+1) {
    acc[i]+=acc[i-1];
    if(acc[i]%2==1) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<" --- "<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
map<string,int> mp;
int n;

int main(){
	io;
	cin>>n;
	while(n--){
		string s;cin>>s;
		mp[s]++;
	}
	cout<<"AC x "<<mp["AC"]<<endl;
	cout<<"WA x "<<mp["WA"]<<endl;
	cout<<"TLE x "<<mp["TLE"]<<endl;
	cout<<"RE x "<<mp["RE"]<<endl;
	return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <string.h>

int point(void)
{
	int run, out, res;
	run = out = res = 0;
	char event[8];
	for (;;) {
		scanf("%s", event);
		if (strcmp(event, "OUT") == 0) {
			out++;
			if (out == 3)
				return res;
		}
		else if (strcmp(event, "HIT") == 0) {
			if (run == 3)
				res++;
			else
				run++;
		}
		else {
			res += ++run;
			run = 0;
		}
	}
}


int main(void)
{
	int inning, i;
	scanf("%d", &inning);
	for (i = 0; i < inning; i++) {
		printf("%d\n", point());
	}
	return 0;
}

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

typedef long long ll;
typedef vector<ll> v1;
typedef vector<vector<ll>> graph;

const ll INF = 1ll << 50;
ll n,m,p;
v1 a,b,c;
graph g;
graph rg;
graph cost;
v1 dist;
bool is_update;
v1 vis;
v1 mem;

void rdfs(ll x){
    vis[x] = 1;
    ll siz = rg[x].size();
    for(ll y : rg[x]){
        if(vis[y] == 0) rdfs(y);
    }
}

void dfs(ll x){
    // if(vis[x]) return;
    vis[x] = 1;
    ll siz = g[x].size();
    for(ll i = 0;i < siz;i++){
        if(mem[g[x][i]]){
            if(vis[g[x][i]] == 0) dfs(g[x][i]);
            a.push_back(x);
            b.push_back(g[x][i]);
            c.push_back(cost[x][i]);
        }
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m >> p;
    dist = v1(n+1, -INF);
    // a=b=c=v1(m);
    g = graph(n+1);
    rg = graph(n+1);
    cost = graph(n+1);
    for(ll i = 0;i < m;i++){
        ll a,b,c;
        cin >> a >> b >> c;
        rg[b].push_back(a);
        g[a].push_back(b);
        cost[a].push_back(c-p);
    }
    vis = v1(n+1,0ll);
    rdfs(n);
    mem = vis;
    vis = v1(n+1,0ll);
    dfs(1);
    // for(ll i = 0;i < a.size();i++){
    //     cerr << a[i] << " " << b[i] << " " << c[i] << endl;
    // }
    dist[1] = 0;
    ll siz = a.size();
    for(ll i = 0;i < n+1;i++){
        is_update = false;
        for(ll j = 0;j < siz;j++){
            if(dist[b[j]] < dist[a[j]]+c[j]){
                dist[b[j]] = dist[a[j]]+c[j];
                is_update = true;
            }
        }
        if(is_update == false) break;
    }
    if(is_update) cout << -1 << endl;
    else cout << max(dist[n],0ll) << endl;
    // if(bellman_ford()){
    //     cout << max(dist[n],0ll) << endl;
    // }else{
    //
    // }
    // bellman_ford();
    // ll tmp = dist[n];
    // bellman_ford();
    // if(tmp == dist[n]) cout << max(dist[n],0ll) << endl;
    // else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm> 
#include <queue>
#include <functional>
#include <map>
#include <string>
using namespace std;
typedef long long ll;



int main(void){

    ll n;

    ll a[300005];
    ll maxscore[100005];
    ll minscore[100005];

    priority_queue<ll, vector<ll>, greater<ll>> que1;
    priority_queue<ll> que2;


    maxscore[0] = minscore[n] = 0;

    cin >> n;

    for (ll i = 0; i < 3 * n; i++){
        cin >> a[i];

        if (i <= n - 1){
            que1.push(a[i]);
            maxscore[0] += a[i];
        }

        if (i >= 2 * n){
            que2.push(a[i]);
            minscore[n] += a[i];
        }

    }


    for (ll k = n; k < 2 * n; k++){
        que1.push(a[k]);
        maxscore[k - n + 1] = maxscore[k - n] + a[k] - que1.top();
        que1.pop();
    }

    for (ll k = 2 * n - 1; k >= n; k--){
        que2.push(a[k]);
        minscore[k - n] = minscore[k - n + 1] + a[k] - que2.top();
        que2.pop();
    }

    ll ans = -10000000000000000;

    for (ll i = 0; i <= n; i++){
        ans = max(ans, maxscore[i] - minscore[i]);
    }

    cout << ans << endl;


}

Measured memory_bytes: 6004
a = input()
a= int(a)

if 1<= a < 1000:
    print(1000 - a)
if 1000 < a < 2000:
    print(2000 - a)
if 2000 < a < 3000:
    print(3000 - a)
if 3000 < a < 4000:
    print(4000 - a)
if 4000< a < 5000:
    print(5000 - a)
if 5000< a < 6000:
    print(6000 - a)
if 6000< a < 7000:
    print(7000 - a)
if 7000 < a < 8000:
    print(8000 - a)
if 8000 < a < 9000:
    print(9000 - a)
if 9000 < a <10000:
    print(10000 - a)
if a == 1000:
    print(0)
if a == 2000:
    print(0)
if a == 3000:
    print(0)
if a == 4000:
    print(0)
if a == 5000:
    print(0)
if a == 6000:
    print(0)
if a == 7000:
    print(0)
if a == 8000:
    print(0)
if a == 9000:
    print(0)
if a == 10000:
    print(0)

# (物の値段/入力)a + （おつり）N = 1000?
#Nは整数だから　print(おつり)
#　N　＝　1000? - a

#input 1900  print 100 (2000)
# input 1525 print 475 (2000)
# input 2500 print 500 (3000)



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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    int k,n;cin >> k >> n;
    vector<int> a(2*n);
    rep(i,n)
    {
        cin >> a[i];
    }
    int ans = INF;
    rep(i,n)
    {
        if(i==0)
        {
            chmin(ans, k-(k+a[0]-a[n-1]));
            continue;
        }
        chmin(ans, k-(a[i]-a[i-1]));
    }
    
    cout << ans << endl;
}

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

using namespace std;

int main() {
    string A;
    string B;
    cin >> A >> B;

    if (A.size() < B.size()) {
        cout << "LESS" << endl;
        return 0;
    }
    else if (A.size() > B.size()) {
        cout << "GREATER" << endl;
        return 0;
    }

    for (int i = 0; i < A.size(); i++) {
        if (A[i] < B[i]) {
            cout << "LESS" << endl;
            return 0;
        }
        else if (A[i] > B[i]) {
            cout << "GREATER" << endl;
            return 0;
        }
    }
    cout << "EQUAL" << endl;
}

Measured memory_bytes: 256
#たてH cm よこ W cm の枠を描くプログラム
#各データセットの後に、１つの空行
while True:
    H, W = map(int, input().split())
    if (H, W) == (0, 0):
        break
    print('#' * W)
    for i in range(H - 2):
        print('#' + '.' * (W - 2) + '#')
    print('#' * W)
    print('')


Measured memory_bytes: 5620
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________


	int n;
	cin >> n;
	int a[n]; zip(i, 0, n) cin >> a[i];

	int x = a[0];
	zip(i, 1, n)
	{
		x = __gcd(a[i], x);
	}
	cout << x << en;



	return 0;
}



Measured memory_bytes: 1024
// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    // var... 変数の識別子, $t...型を一つよむ
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        //ここで繰り返し
        input_inner!{$iter $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    //
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    // 配列の最後のNestではここで型が指定されてparseされる
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
// =========

fn main() {
    input! {
        s: String,
    }
    let s: Vec<char> = s.chars().collect();
    for c in s {
        print!("x");
    }
    println!("");
}


Measured memory_bytes: 4352
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using INT=mp::cpp_int;
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
INT LCM(INT x,INT y){
  INT z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
INT modinv(INT a, INT m) {
    INT b = m, u = 1, v = 0;
    while (b) {
        INT t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main() {
  cout << fixed << setprecision(30);
  vec a(3);
  loop(i,3)cin>>a[i];
  sort(all(a));
  bool check=false;
  if(a[0]==a[1]&&a[1]!=a[2])check=true;
  if(a[0]!=a[1]&&a[1]==a[2])check=true;
  if(check)putout("Yes");
  else putout("No");
}

Measured memory_bytes: 256
sx,sy,ex,ey = gets.chomp.split(" ").map(&:to_i)
(x = sx - ex).abs.times do
  print (x > 0)? "L" : "R"
end
(y = sy - ey).abs.times do
  print (y > 0)? "D" : "U"
end
(x).abs.times do
  print (x > 0)? "R" : "L"
end
(y).abs.times do
  print (y > 0)? "U" : "D"
end
print (y > 0)? "U" : "D"
((x).abs+1).times do
  print (x > 0)? "L" : "R"
end
((y).abs+1).times do
  print (y > 0)? "D" : "U"
end
print (x > 0)? "R" : "L"
print (y > 0)? "D" : "U"
((x).abs+1).times do
  print (x > 0)? "R" : "L"
end
((y).abs+1).times do
  print (y > 0)? "U" : "D"
end
print (x > 0)? "L" : "R"

Measured memory_bytes: 1788
//#pragma GCC optimize("Ofast")

#pragma GCC optimize("O3")
//#pragma GCC target("avx,avx2,fma")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007// prime modulo value 
#define C 1000000001
#define M 998244353
#define all(x) x.begin(),x.end()
using namespace std;
// From Geeksforgeeks
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
// Power function took from geeksforgeeks
ll power(ll x, ll y)
{
	ll res = 1;

	x = x;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x);
		y = y >> 1;
		x = (x * x);
	}
	return res;
}
double dist(ll x1,ll y1, ll x2,ll y2)
{
	double ans = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll a, b;
	cin >> a >> b;
	ll ans = max(a + b, a - b);
	ans = max(ans, a * b);
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
# MInt(ModInt)
class Integer

  attr_accessor :mod
  @@mod = 10 ** 9 + 7
  @@h = Hash.new

  def +@(other)
    super(other) % @@mod
  end

  def -@(other)
    super(other) % @@mod
  end

  alias_method :primitive_times, :*
  def *(other)
    self.primitive_times(other) % @@mod
  end

  def /(other)
    @@h[other] ||= other.pow(@@mod-2, @@mod)
    self * @@h[other]
  end
  
  alias_method :primitive_equal, :==
  def ==(other)
    ( self % @@mod ).primitive_equal( other % @@mod )
  end
  
  def abs
    self % @@mod
  end
  
  def <<(value)
    self * 2.pow(value, @@mod)
  end
  
  def >>(value)
    t = 2.pow(value, @@mod)
    @@h[t] ||= t.pow(@@mod-2, @@mod)
    self * @@h[t]
  end
  
  alias_method :primitive_inspect, :inspect
  def inspect
    (self % @@mod).primitive_inspect
  end

  alias_method :primitive_to_s, :to_s
  def to_s
    (self % @@mod).primitive_to_s
  end
end

# ABC163
n, k = gets.to_s.split.map{|e|e.to_i}

ans = (k..n+1).map{|i| i * (n + n - i + 1) / 2 - i * ( i - 1 ) / 2 + 1 }.sum

puts ans

Measured memory_bytes: 15976
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String str = sc.next();
        int max = 0;
        for(int i = 1; i<N; i++) {
            String a = str.substring(0,i);
            String b = str.substring(i,N);
            int cnt = 0;
            HashSet<Character> set = new HashSet<Character>();
            for(int j = 0; j<a.length(); j++) {
                for(int k = 0; k<b.length(); k++) {
                    if((a.charAt(j) == b.charAt(k)) && !set.contains(b.charAt(k))) {
                        cnt++;
                        set.add(b.charAt(k));
                    }
                }
            }
            max = Math.max(max, cnt);
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 24148
n, m = map(int, input().split())
edges = [[] for i in range(n)]
check = [[]]
for _ in range(m):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
    check.append([[a-1, b-1], [b-1, a-1]])



def dfs(start, edges, exception):
    seen = [False] * n
    seen[start] = True
    todo = []
    for to in edges[start]:
        if [start, to] in exception:
            continue
        todo.append(to)

    while todo:
        node = todo.pop()
        if seen[node]:
            continue

        seen[node] = True
        for to in edges[node]:
            if [node, to] in exception:
                continue
            todo.append(to)

    if sum(seen) == n:
        return False
    else:
        return True


ans = 0
for exception in check:
    ans += dfs(0, edges, exception)

print(ans)

Measured memory_bytes: 3192
/*
 * Click `Run` to execute the snippet below!
 */

import java.io.*;
import java.util.*;

/*
 * To execute Java, please define "static void main" on a class
 * named Solution.
 *
 * If you need more classes, simply define them inline.
 */

public class Main {
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int A = sc.nextInt();
    System.out.println((int) (Math.ceil(1.0 * H / A)));
  }
}


Measured memory_bytes: 27128
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

string s;

int main() {
	cin >> s;
	
	bool ans = true;
	inc(i, SI(s)) {
		if(i % 2 == 0) {
			ans &= (s[i] == 'R' || s[i] == 'U' || s[i] == 'D');
		} else {
			ans &= (s[i] == 'L' || s[i] == 'U' || s[i] == 'D');
		}
	}
	
	cout << (ans ? "Yes" : "No") << endl;
	
	return 0;
}


Measured memory_bytes: 256