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


int main(void)
{
  int n, y;
  cin >> n >> y;
  
  for(int k10=0; k10<=n; k10++){
      for(int k5=0; k5+k10<=n; k5++){
          int k=n-k10-k5;
          if(k10*10000 + k5*5000 + k*1000 == y){
              printf("%d %d %d\n", k10, k5, k);
              return 0;
          }
      }
  }
  cout << "-1 -1 -1" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, Npow, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 1LL << 60; ll ans = -INF; ll z = 0, o = 1;
vl flag, color, D; vector<vector<tuple<ll, ll, ll>>> path;
//***********//
int main() {
	cin >> N;
	for (k = 2; k <= N+1; k++) {
		if (k * (k - 1) / 2 == N) {
			cout << "Yes" << endl << k << endl;
			vll S(k);
			ll key = 1;
			for (i = 0; i < k - 1; i++) {
				for (j = i + 1; j < k; j++) {
					S[i].push_back(key);
					S[j].push_back(key);
					key++;
				}
			}
			for (i = 0; i < k; i++) {
				cout << S[i].size() << " " << S[i] << endl;
			}
			exit(0);
		}
	}
	cout << "No";
}


Measured memory_bytes: 3200
#pragma region
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define VPII vector<PII>
#define VPLL vector<PLL>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=998244353; constexpr int NIL = -1;
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
#pragma endregion
//-------------------
int n, m, k;

struct mint {
	ll x;
	mint(ll x=0):x(x%mod){}

	bool operator==(const mint a)const{return x==a.x;}
	bool operator!=(const mint a)const{return x!=a.x;}
	bool operator>=(const mint a){return (x >= a.x)? 1: 0;}
	bool operator<(const mint a){return !(*this>=a);}
	bool operator>(const mint a){return (x > a.x)? 1:0;}
	bool operator<=(const mint a){return !(*this>a);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
			return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
			return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;  //2 square
		if (t&1) a *= *this; 
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod-2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res/=a;
	}
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(200005);

int main(){
    cin.tie(0); ios::sync_with_stdio(false); //cout << fixed << setprecision(15);
    cin >> n >> m >> k;

    mint ans = mint(0);
    FOR(l, n-k, n) {
        ans += mint(m) * mint(m-1).pow(l-1) * comb(n-1, l-1);
    }

    cout << ans.x << endl;
    return 0;
}


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

#define fi                      first
#define se                      second
#define pb                      push_back
#define endl                    '\n'
#define all(x)                  x.begin(),x.end()
#define pii                     pair<int,int>
#define fast                    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define SZ(x)                   ((int)x.size())

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

void solve();

int32_t main()
{
        fast;
        int t = 1;
        // cin >> t;
        for(int i = 1; i <= t; ++i)
                solve();
        cerr << "Time taken: " << ((clock() * 1000) / CLOCKS_PER_SEC) << "ms\n";
}

void solve() {
	ull n;
	cin >> n;
	if(n%2) {
		cout << 0 << endl;
		return;
	}
	ull ans = 5;
	ull cnt = 0;
	while(n >= ans) {
		ull temp  = n/ans;
		temp /= 2;
		cnt += (temp);
		ans *= 5;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map> // pair
using namespace std;
int main(){
  vector<int> A(3);
  cin>>A.at(0)>>A.at(1)>>A.at(2);
  string ans="NO";
  sort(A.begin(),A.end());
  if(A.at(0)==5&&A.at(1)==5&&A.at(2)==7)ans="YES";
   cout<<ans<<endl;
  }


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

const int N = 3*1e3 + 10;

int dp[N][N],al,bl,r,c;
string a,b;
vector<char> ans;

int main(){
	cin>>a>>b;
	al = a.length();bl = b.length();
	
	for(int i = 1;i <= al;i++){
		for(int j = 1 ; j <= bl;j++){
			if(a[i-1] == b[j-1])	
				dp[i][j] = max(dp[i-1][j-1]+1,max(dp[i-1][j],dp[i][j-1]));
			else
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);			
		}
	}
	int f = dp[al][bl];r = al;c = bl;
	while(f!=0){
		if(a[r-1] == b[c-1]){
			ans.push_back(a[r-1]);
			r--;c--;f--;
		}

		else{
			if(dp[r-1][c] == dp[r][c-1]){
				if(r-1!=0)	
					r--;
				else
					c--;
			}
			else if(dp[r-1][c] > dp[r][c-1])
				r--;
			else
				c--;
		} 
	}
	//cout<<dp[al][bl]<<"\n";
	for(auto x = ans.crbegin() ; x!=ans.crend() ; x++)
		cout<<*x;
}

Measured memory_bytes: 35584
#include<stdio.h>
int main(){
    int a , b , c ;
    scanf( "%d%d%d" , &a , &b , &c ) ;
    if ( a == 5 && b == 5 && c == 7 ) printf( "YES\n" ) ;
    else
     if ( a == 5 && b == 7 && c == 5 ) printf( "YES\n" ) ;
     else
      if ( a == 7 && b == 5 && c == 5 ) printf( "YES\n" ) ;
      else printf( "NO\n" ) ;
    return 0 ;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int h,w;
  cin>>h>>w;
  char a;
  int ans=0;
  rep(i,h){
    rep(j,w){
      cin>>a;
      if(a=='#') ans++;
    }
  }
  if(ans==(h+w-1)) cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;
      
  

  return 0;
}


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


map<string,int> done;
map<string , vector< pair<string,int> > > graph;
bool flag;

void dfs(string p,int cost){
	if(done.find(p) != done.end()){
		if(cost != done[p]) flag = false;
		return;
	}else{
		done[p] = cost;
	}
	vector<pair<string,int> > r = graph[p];
	for(int i = 0 ; i < r.size() ; i++){
		dfs( r[i].first , cost + r[i].second );
	}
}

int main(){
	int n;
	while(cin >> n , n){
		graph.clear();
		vector<string> vertex;
		for(int i = 0 ; i < n ; i++){
			string a,b,c,d;
			cin >> d >> a >> d >> c >> b;
			c = c.substr(c.find("^")+1);
			int cost = atoi(c.c_str());
			graph[b].push_back(make_pair(a,cost));
			graph[a].push_back(make_pair(b,-cost));
			vertex.push_back(a);
			vertex.push_back(b);
		}
		sort(vertex.begin(),vertex.end());
		vertex.erase(unique(vertex.begin(),vertex.end()),vertex.end());
		bool ans = true;
		for(int i = 0 ; i < n ; i++){
			done.clear();
			flag = true;
			dfs(vertex[i] , 0);
			ans &= flag;
		}
		cout << (ans ? "Yes" : "No") << endl;
	}
}

Measured memory_bytes: 988
#include<iostream>
#include<set>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define N 100005

int h[N];
int d[N];

int main(){
    memset(d,0,sizeof(d));
    int n,i,m,ans=0,a,b;
    cin>>n>>m;
    for(i=1;i<=n;i++){
        cin>>h[i];
    }
    for(i=1;i<=m;i++){
        cin>>a>>b;
        if(h[a]<=h[b])
            d[a]=1;
        if(h[a]>=h[b])
            d[b]=1;
    }
    for(i=1;i<=n;i++)
        ans+=!d[i];
        
    cout<<ans;
    return 0;
}


Measured memory_bytes: 4368
import java.util.*;

public class Main {
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();
    char[][] map = new char[H][W];
    for (int i = 0; i < H; i++) {
      String line = sc.next();
      for (int j = 0; j < W; j++) {
        map[i][j] = line.charAt(j);
      }
    }
    
    // scan H
    int offsetH = 0;
    for(int i = 0; i < H; i++) {
      boolean allWhite = true;
      for (int j = 0; j < W; j++) {
        if (map[i][j] == '#') {
          allWhite = false;
        }
        map[i-offsetH][j] = map[i][j];
      }
      if (allWhite) {
        offsetH++;
      }
    }

    // scan W
    int offsetW = 0;
    for(int j = 0; j < W; j++) {
      boolean allWhite = true;
      for (int i = 0; i < H; i++) {
        if (map[i][j] == '#') {
          allWhite = false;
        }
        map[i][j-offsetW] = map[i][j];
      }
      if (allWhite) {
        offsetW++;
      }
    }

    for (int i = 0; i < H-offsetH; i++) {
      for (int j = 0; j < W-offsetW; j++) {
        System.out.print(map[i][j]);
      }
      System.out.println();
    }
  }
}

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

int N, a, i, x, y;
long long X, Y;

int main() {
  cin >> N;
  while (cin >> a && ++i) {
    x += a, y += a;
    if (i % 2) {
      if (x > -1) X += x + 1, x = -1;
      if (y < 1) Y += 1 - y, y = 1;
    } else {
      if (y > -1) Y += y + 1, y = -1;
      if (x < 1) X += 1 - x, x = 1;
    }
  }
  cout << min(X, Y) << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int Puzzle[3][3];
int tmp[3][3];
int da[4] = {0, 1, 0, -1};
int db[4] = {1, 0, -1, 0};
int Roop(int);
void Kara(int *, int *);



void swap(int *, int *);



int ABC(int, int, int, int, int);




int Cal(){
  int i, a;
  int sum = 0;

  for(i = 0 ; i < 9 ; i++){
    a = Puzzle[i/3][i%3];
    if(a){





      a=a-1;
      sum += abs(i/3 - a/3)  + abs(i%3 - a%3);
    }
  }

  return sum;
}







int main(){
  int i=0,j, l;
  int gya;
  int far;
  int a;

  while( i < 3){
    for(j = 0 ; j < 3 ; j++){
      scanf("%d",&Puzzle[i][j]);
    }
    i++;
  }

  Kara(&gya,&far);
  l=0;
  while(l < 100){

    
    for(i = 0 ; i < 3 ; i++){


       
      for(j = 0 ; j < 3 ; j++){
	tmp[i][j] = Puzzle[i][j];
      }
    }

    a = ABC(gya, far, -1, 0, l);
    if(a != -1){
      printf("%d\n",a);
      break;
    }
    i=0;
    while(i < 3){
      for(j = 0 ; j < 3 ; j++){
	Puzzle[i][j] = tmp[i][j];
      }
      i++;
    }
    
    a = -1;
    if(l == 99) printf("%d\n",a);
    l++;
  }

  return 0;
}

void Kara(int *gya, int *far){
  int i=0, j;

  while(i < 3){
    for(j = 0 ; j < 3 ; j++){
      if(!Puzzle[i][j]){
	*gya = j;
	*far = i;
	return;
      }
    }
    i++;
  }
}

void swap(int *a, int *b){
  int tmp;
  
  tmp = *a;
  *a = *b;
  *b = tmp;
}



int ABC(int a, int b, int p, int hukasa, int seigen){





  int i, h, na, nb, res;

  h = Cal();
  
  if(h == 0) return hukasa;





  if(hukasa + h > seigen) return -1;

for(i=0;i < 4;i++){
    na = a + da[i];
    nb = b + db[i];

    if(~p && i == (p+2)%4) continue;
    if(!(0 <= na && na < 3 && 0 <= nb && nb < 3)) continue;

    swap(&Puzzle[b][a], &Puzzle[nb][na]);








    res = ABC(na, nb, i, hukasa+1, seigen);
    if(~res) return res;

    swap(&Puzzle[b][a], &Puzzle[nb][na]);
  }

  return -1;
}
    
int Roop(int c){
c++;
return 0;
}



Measured memory_bytes: 2144
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <utility>
#include <bitset>

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

using namespace std;

int main () {
    long long n;
    cin >> n;
    for (long long i = sqrt(n); i > 0; i--) {
        if (n % i == 0) {
            cout << i + n / i - 2 << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

#define MAXN (1 << 20)

int a[MAXN];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int cur = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == cur + 1) {
			cur++;
		}
	}
	if (cur) {
		cout << n - cur;
	} else {
		cout << - 1;
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 4320
A,B,C = map(int,input().split())
K = int(input())

cnt = 0
for i in range(100):
    if A >= B:
        B *= 2
        cnt += 1

for i in range(100):
    if B >= C:
        C *= 2
        cnt += 1

if cnt > K:
    print("No")
else:
    print("Yes")

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define w(x)            int x; cin>>x; while(x--)
#define fr(i,a,b)       for(int i = a; i < b; i++)

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

void solve()
{
	int n;
	cin >> n;
	int heights[n];
	fr(i, 0, n)
	cin >> heights[i];

	int dp[n] = {};

	dp[1] = abs(heights[0] - heights[1]);
	fr(i, 2, n)
	{
		int ans1 = dp[i - 1] + abs(heights[i - 1] - heights[i]);
		int ans2 = dp[i - 2] + abs(heights[i - 2] - heights[i]);
		dp[i] = min(ans1, ans2);
	}
	cout << dp[n - 1] << endl;
}

int32_t main()
{
	c_p_c();
	solve();
	return 0;
}

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

int  main()
{
	int a,b; cin >> a>>b;
	if (a % 2 && b % 2)
		cout << "Yes\n";
	else
		cout << "No\n";
	return (0);
}

Measured memory_bytes: 256
n,m,l = (int(x) for x in input().split())


A = [[int(x) for x in input().split()] for l in range(n)]
B = [[int(x) for x in input().split()] for l in range(m)]

C = [[0]*(l) for i in range(n)]

for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k]*B[k][j]

for i in range(n):
    for j in range(l-1):
        print(str(C[i][j])+" ",end = "")
    print(str(C[i][l-1]))



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

int main() {

  int a=2, b, r, x, tmp;
  cin >> b;
  x = a * b;

  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

  cout << x/b << endl;
  return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define MAX 305

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

ll INF=1ll<<55;
int n, k;
int H[MAX];
ll dp[MAX][MAX];
/*
dp[x][y]:
*/

int main(){
  cin >> n >> k;
  rep(i,n){
    cin >> H[i+1];
  }
  H[0]=0;
  /*
  memset(dp,INF,sizeof(dp));
  */
  repo(i,n){
    repo(j,n-k){
      dp[i][j]=INF;
    }
  }
  repo(i, n){
    dp[i][0]=0;
    dp[i][1]=H[i];
  }
  for(int j=2; j<=n-k; j++){
    for(int i=j; i<=n; i++){
      repo(l,i-1){
        dp[i][j]=min(dp[l][j-1]+max(0,H[i]-H[l]),dp[i][j]);
      }
    }
  }

  ll ans=INF;
  repo(i,n){
    ans=min(ans,dp[i][n-k]);
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 1024
x, y = map(int, input().split())
val1 = [1, 3, 5, 7, 8, 10, 12]
val2 = [4, 6, 9, 11]
val3 = [2]

cnt1 = 0
for i in range(len(val1)):
    if val1[i] == x or val1[i] == y:
        cnt1 += 1

cnt2 = 0
for i in range(len(val2)):
    if val2[i] == x or val2[i] == y:
        cnt2 += 1

if cnt1 == 2 or cnt2 == 2:
    print('Yes')

else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
//#include<bits/stdc++.h>

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b)
{
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}

int main()
{
  int N;
  cin >> N;
  long long sum = 0;

  for (int i = 1; i <= N; i++)
  {
    for (int j = 1; j <= N; j++)
    {
      for (int k = 1; k <= N; k++)
      {
        int A = i;
        int B = j;
        int C = k;

        int x = GCD(A, B);
        int ans = GCD(x, C);

        sum += ans;
      }
    }
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
//INF = 1 061 109 567 ; INF + INF = 2 122 219 134 ;
//LINF = 4 557 430 888 798 830 399 ; LINF + LINF = 9 114 861 777 597 660 798 ;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = (int)1e9+7;
const int maxn = (int)1e5+7;

//浮点型运算
const db eps = 1e-6;
bool eq(const db &a, db const &b) { return fabs(a - b) < eps; }
bool ls(const db &a, db const &b) { return a + eps < b; }
bool le(const db &a, db const &b) { return eq(a, b) || ls(a, b); }

int cnt[15];

void Init() {
}

int main ()
{
    char n[10];
    scanf("%s", n);
    if (n[0] == n[1] && n[1] == n[2]) return 0 * puts("Yes");
    if (n[1] == n[2] && n[2] == n[3]) return 0 * puts("Yes");
    return 0 * puts("No");
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;	long W,sum=0;	cin>>n>>W;

	vector<int>  v(n,0);
	vector<long> w(n,0);

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

	vector<long> dp(sum+1,INT_MAX);

	dp[0]=0;

	for(int i=1;i<=n;++i)
	{
		// cout<<w[i-1]<<endl;
		for(int j=sum; j>=v[i-1]; --j){

			dp[j] =	min(dp[j], dp[j-v[i-1]] + w[i-1]);
			// if(w[i]==5) cout<<j<<" "<<dp[j]<<endl;
		}

		
	}

	for(int i=sum;i>=0;--i)
		if(dp[i] <= W){
			cout<<i<<endl;
			break;}
}

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

#define PB push_back
#define MP make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;

const int max_n = 100111;
ll inf = 1000111222LL * 1000111222LL;

vector<pair<ll, ll> > va[max_n];
vector<pair<ll, ll> > vb[max_n];

int n, m, s, t;
ll da[max_n];
ll db[max_n];
bool vis[max_n];

void dejkstra(int start, ll* d, vector<pair<ll, ll> >* v) {
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < n; ++i) {
        d[i] = inf;
    }
    d[start] = 0;
    priority_queue<pair<ll, ll> > q;
    q.push(MP(0, start));
    while (!q.empty()) {
        int cur = q.top().S;
        q.pop();
        if (vis[cur]) continue;
        vis[cur] = 1;
        for (int i = 0; i < v[cur].size(); ++i) {
            int to = v[cur][i].F;
            ll w = v[cur][i].S;
            if (!vis[to] && d[to] > d[cur] + w) {
                d[to] = d[cur] + w;
                q.push(MP(-d[to], to));
            }
        }
    }
}

int main() {
    cin >> n >> m >> s >> t;
    --s, --t;
    for (int i = 0; i < m; ++i) {
        int from, to, a, b;
        scanf("%d %d %d %d", &from, &to, &a, &b);
        --from, --to;
        va[from].PB(MP(to, a));
        va[to].PB(MP(from, a));

        vb[from].PB(MP(to, b));
        vb[to].PB(MP(from, b));
    }
    dejkstra(s, da, va);
    dejkstra(t, db, vb);
    vector<ll> vans;
    multiset<ll> ans;
    for (int i = 0; i < n; ++i) {
        ll cur_ans = da[i] + db[i];
        vans.PB(cur_ans);
        ans.insert(cur_ans);
    }
    ll have = 100000LL * 100000LL * 100000LL;
    for (int i = 0; i < n; ++i) {
        ll cur_ans = have - *ans.begin();
        cout << cur_ans << "\n";
        ans.erase(ans.find(vans[i]));
    }

    return 0;
}


Measured memory_bytes: 23676
package main

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

func main() {
	sc := NewScanner()

	d := sc.NextInt()
	n := sc.NextInt()

	if d == 0 {
		if n == 100 {
			fmt.Printf("%+v\n", 101) // output for debug
		} else {
			fmt.Printf("%+v\n", n) // output for debug
		}
		return
	}
	if d == 1 {
		if n == 100 {
			fmt.Printf("%+v\n", 101*100) // output for debug
			return

		}
		fmt.Printf("%+v\n", n*100) // output for debug
		return
	}
	if d == 2 {
		if n == 100 {
			fmt.Printf("%+v\n", 101*10000) // output for debug
			return

		}
		fmt.Printf("%+v\n", n*10000) // output for debug
		return
	}
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 200001
#define int ll
int N,M,K,A[maxn],B[maxn],ssA[maxn],ssB[maxn];

int32_t main(){
	cin>>N>>M>>K;
	
	FOR(i,1,N){cin>>A[i]; ssA[i] = ssA[i-1] + A[i];}
	FOR(i,1,M){cin>>B[i]; ssB[i] = ssB[i-1] + B[i];}
	
	
	int l = 0, r = N+M;
	
	while (l + 1 < r){
		int mid = (l+r)/2;
		int res = 1e18;
		FOR(i,0,min(mid,N)){
			if (mid - i > M) continue;
			res = min(res, ssA[i] + ssB[mid - i]);
		}
		if (res > K) r = mid;
		else l = mid;
	}
	int res = 1e18;
	FOR(i,0,min(l + 1,N)){
		if (l + 1 - i > M) continue;
		res = min(res, ssA[i] + ssB[l + 1 - i]);
	}
	if (res > K) cout<<l;
	else cout<<l+1;
		
}


Measured memory_bytes: 9840
#include<iostream>

using namespace std;

int main() {

	long A = 0, B = 0, K = 0;

	cin >> A >> B >> K;

	if (A + B <= K) {
		A = 0;
		B = 0;
	}
	else {
		if (A <= K) {
			B = B - (K - A);
			A = 0;
		}
		else {
			A = A - K;
		}
	}

	cout << A << " " << B << endl;
}

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

def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
    
def lcm(x,y):
    return x*y//gcd(x,y)
    
ans = (b-a+1) - (b//c-a//c)- (b//d-a//d) + b//lcm(d,c) - a//lcm(d,c)

if a%c == 0 and a%d != 0:
    ans -=1
elif a%c != 0 and a%d == 0:
    ans -=1
elif a%c == 0 and a%d == 0:
    ans -=1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

string s1,s2;
vector<string> f1;
vector<string> nf1;
vector<string> f2;
vector<string> nf2;

int main(){
	while(1){
		cin>>s1;
		if(s1==".")break;
		cin>>s2;
		int flag=0;//0 hutuu,1 ""
		string st;
		f1.clear();
		f2.clear();
		nf1.clear();
		nf2.clear();
		for(int i=0;i<s1.size();i++){
			if(s1[i]=='"'){
				if(flag){
					f1.push_back(st);
					st.erase(st.begin(),st.end());
					flag=0;
				}else{
					nf1.push_back(st);
					st.erase(st.begin(),st.end());
					flag=1;
				}
			}else{
				st+=s1[i];
				if(i==s1.size()-1){
					nf1.push_back(st);
					st.erase(st.begin(),st.end());
				}
			}
		}
		

		flag=0;
		for(int i=0;i<s2.size();i++){
			if(s2[i]=='"'){
				if(flag){
					f2.push_back(st);
					st.erase(st.begin(),st.end());
					flag=0;
				}else{
					nf2.push_back(st);
					st.erase(st.begin(),st.end());
					flag=1;
				}
			}else{
				st+=s2[i];
				if(i==s2.size()-1){
					nf2.push_back(st);
					st.erase(st.begin(),st.end());
				}
			}
		}
		
		/*for(int i=0;i<f1.size();i++){
			cout<<f1[i]<<" ";
		}
		cout<<endl;
		for(int i=0;i<nf1.size();i++){
			cout<<nf1[i]<<" ";
		}
		cout<<endl;
		for(int i=0;i<f2.size();i++){
			cout<<f2[i]<<" ";
		}
		cout<<endl;
		for(int i=0;i<nf2.size();i++){
			cout<<nf2[i]<<" ";
		}
		cout<<endl;*/
		
		int ans=0;
		int count=0;
		if(nf2.size()!=nf1.size()){
			cout<<"DIFFERENT"<<endl;
			goto A;
		}else{
			for(int i=0;i<nf2.size();i++){
				if(nf1[i]!=nf2[i]){
					cout<<"DIFFERENT"<<endl;
					goto A;
				}
			}
		}
		if(f1.size()!=f2.size()){
			cout<<"DIFFERENT"<<endl;
			goto A;
		}
		for(int i=0;i<f1.size();i++){
			if(f1[i]!=f2[i]){
				count++;
			}
		}
		if(count>1){
			cout<<"DIFFERENT"<<endl;
		}else if(count==1){
			cout<<"CLOSE"<<endl;
		}else{
			cout<<"IDENTICAL"<<endl;
		}
		A: 
		;
	}
	return 0;
}
				
					
					
	



Measured memory_bytes: 3180
package main

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

func out(x ...interface{}) {
	// fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

type pair struct {
	pos int
	dir byte
}

const inf = int(1e12)

func check(v []pair, s string) int {
	sort.Slice(v, func(i, j int) bool {
		return v[i].pos < v[j].pos
	})
	ans := inf
	for i := 0; i < len(v)-1; i++ {
		if v[i].dir == s[0] && v[i+1].dir == s[1] {
			ans = min(ans, v[i+1].pos-v[i].pos)
		}
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	X := make([]int, N)
	Y := make([]int, N)
	U := make([]byte, N)
	for i := 0; i < N; i++ {
		X[i] = getInt()
		Y[i] = getInt()
		U[i] = getString()[0]
	}
	out(X, Y, string(U), U)
	UD := make(map[int][]pair)
	LR := make(map[int][]pair)
	DR := make(map[int][]pair)
	DL := make(map[int][]pair)
	UR := make(map[int][]pair)
	UL := make(map[int][]pair)
	for i := 0; i < N; i++ {
		if U[i] == 'U' || U[i] == 'D' {
			UD[X[i]] = append(UD[X[i]], pair{Y[i], U[i]})
		}
		if U[i] == 'L' || U[i] == 'R' {
			LR[Y[i]] = append(LR[Y[i]], pair{X[i], U[i]})
		}
		if U[i] == 'D' || U[i] == 'R' {
			p := Y[i] - X[i]
			q := Y[i]
			DR[p] = append(DR[p], pair{q, U[i]})
		}
		if U[i] == 'D' || U[i] == 'L' {
			p := Y[i] + X[i]
			q := Y[i]
			DL[p] = append(DL[p], pair{q, U[i]})
		}
		if U[i] == 'U' || U[i] == 'R' {
			p := Y[i] + X[i]
			q := Y[i]
			UR[p] = append(UR[p], pair{q, U[i]})
		}
		if U[i] == 'U' || U[i] == 'L' {
			p := Y[i] - X[i]
			q := Y[i]
			UL[p] = append(UL[p], pair{q, U[i]})
		}
	}
	out(UD)
	out(LR)
	out(DR)
	out(DL)
	out(UR)
	out(UL)

	ans := inf
	for _, e := range UD {
		ret := check(e, "UD")
		if ret != inf {
			ans = min(ans, ret*5)
		}
	}
	out(ans)
	for _, e := range LR {
		ret := check(e, "RL")
		if ret != inf {
			ans = min(ans, ret*5)
		}
	}
	out(ans)
	for _, e := range DR {
		ret := check(e, "RD")
		if ret != inf {
			ans = min(ans, ret*10)
		}
	}
	out(ans)
	for _, e := range DL {
		ret := check(e, "LD")
		if ret != inf {
			ans = min(ans, ret*10)
		}
	}
	out(ans)
	for _, e := range UR {
		ret := check(e, "UR")
		if ret != inf {
			ans = min(ans, ret*10)
		}
	}
	out(ans)
	for _, e := range UL {
		ret := check(e, "UL")
		if ret != inf {
			ans = min(ans, ret*10)
		}
	}
	out(ans)

	if ans == inf {
		fmt.Println("SAFE")
		return
	}
	fmt.Println(ans)
}


Measured memory_bytes: 84980
#include <iostream>

using namespace std;

int main(void) {
    int X, A, B;
    cin >> X >> A >> B;
    if(B <= A) {
        cout << "delicious" << endl;
    } else if(B <= A+X) {
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int flag = 0;
    for(int i = 0; i < s.length(); i++){
      if(i % 2 == 0){
        if(s.charAt(i) == 'L'){
          flag = 1;
          break;
        }
      }else{
        if(s.charAt(i) == 'R'){
          flag = 1;
          break;
        }
      }
    }
    if(flag == 0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 23252
def L(cake1,cake2):
	return ((cake1+cake2)**2-abs(cake1-cake2)**2)**0.5
 
while 1:
	try:
		Cakes=map(int,raw_input().split())
		size_max=Cakes.pop(0)
		size_min=999
		for j in range(len(Cakes)):
			cakes=Cakes[:]
			box=[cakes.pop(j)]
			while cakes:
			    cos=[L(box[-1],i)/(box[-1]+i) for i in cakes]
			    box.append(cakes.pop(cos.index(min(cos))))
			size=box[0]+box[-1]
			for i in range(len(box)-1):
				size+=L(box[i],box[i+1])
			size_min=min(size,size_min)
		print "OK" if size_min<=size_max else "NA"
	except:
		break

Measured memory_bytes: 4332
#include<bits/stdc++.h>
		#include <bitset>
		using namespace std;
		#define ll long long 
		#define mod7 1000000007
		#define mod9 1000000009
		#define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
		#define mp make_pair
		#define pb push_back
		#define ct ll t;cin>>t;while(t--)
		#define bi begin()
		#define ei end()
		#define fi first 
		#define se second
		#define foe(i,a,b) for(ll i=a;i<b;i++)
		#define sz(s) s.size()
        #define mem(a,s) memset(a,s,sizeof(a))    

		ll n,m,k;

		// map<pair<ll,ll>,ll>m;
		vector<ll>v[200005];
		// vector<pair<ll,ll>>p1,p2;
		// ll v[505][505]={0};
// 		vector<ll>v1(200005,0),v2(200005,0),v3;
// 		set<ll>s1,s2;
		// int flag=0;
		// bool visited[505][505]={false};
		bool visited[200005]={false};
		ll rr[8]={1,0,-1,0,1,1,-1,-1};
		ll cc[8]={0,-1,0,1,1,-1,1,-1};
// 		set<ll>ch;
// 		ll cnt0=0,cnt1=0,c=0,t=0;
		// vector<ll>v1,v2;
		// ll col[100005]={0};
// 		ll a[100005];
// 		set<ll>s5[100005];
// 		char s[505][505];
	// string s;
// 	 ll j=1;
		// bool ans=false;
//   ll fact[1000007]={0};
//   ll expo(ll x, ll y) {ll res=1;x=x%mod7;while(y>0){if(y&1)res=(1ll*res*x)%mod7;
//     y=y>>1;x=(1ll*x*x)%mod7;} return res;}
// void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod7;}
//   ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],mod7-2)))%mod7; return res; }
	
		// vector<ll>ans[100005];
		// char s[12];
		ll dp[100005];
	ll ans=0;
		void dfs(ll i)
		{
			if(!visited[i])
			{
				visited[i]=true;
				for(auto x:v[i])
				{
					if(!visited[x])
					{
						dfs(x);
					}
					dp[i]=max(dp[i],dp[x]+1);
				}
			}
		}
	 
		 int main()
		 {
			 fast
// 			   freopen("std.in", "r", stdin);
//  			 freopen("std.out", "w", stdout);
//  		 	freopen("input.txt", "r", stdin);
//			   freopen("output.txt", "w", stdout);
			cin>>n>>m;
			ll u,w;
			foe(i,0,m)
			{
				cin>>u>>w;
				v[u].pb(w);
			}
			mem(visited,false);
			mem(dp,0);
			foe(i,1,n+1)
			{
				if(!visited[i])
				{
					dfs(i);
				}
			}
			ll ans=0;
			foe(i,1,n+1)
			{
				ans=max(ans,dp[i]);
			}
			cout<<ans<<"\n";
			
	}	

Measured memory_bytes: 11136
S=input()
right=[0]*(len(S)+1)
for i in range(len(S)):
    if S[i]=="<":
        right[i+1]=right[i]+1
left=[0]*(len(S)+1)
for i in range(len(S)-1,-1,-1):
    if S[i]==">":
        left[i]=left[i+1]+1
total=0
for i in range(len(S)+1):
    total+=max(right[i],left[i])
print(total)

Measured memory_bytes: 33072
#include<stdio.h>
int main()
{
    int n,m,i,j=0,h[200001]={0};
    scanf("%d %d",&n,&m);
    int a[m],b[m],d[m];
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&a[i],&b[i]);
        if(a[i]==1)
        {
            h[b[i]]=1;
        }
       if(b[i]==n)
       {
           d[j]=a[i];
           j++;
       }
    }
    for(i=0;i<j;i++)
    {
        if(h[d[i]])
        {
            printf("POSSIBLE\n");
            return 0;
        }
    }
    printf("IMPOSSIBLE\n");
 return 0;
}


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

signed main () {
    int n, t;
    cin >> n >> t;
    vector < int > a(n + 1, 0);
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    vector < int > mx(n + 2, 0);
    for (int i = n; i; --i)
        mx[i] = max(a[i], mx[i + 1]);
    map < int, int > frank_ocean;
    for (int i = 1; i <= n; ++i)
        ++frank_ocean[mx[i + 1] - a[i]];
    cout << prev(frank_ocean.end()) -> second << '\n';
}


Measured memory_bytes: 5760
N = int(input())
A = list(map(int, input().split()))

mx = max(A)
mn = min(A)

ans = []
if abs(mx) > abs(mn):
    for i in range(1, N+1):
        ans += [[A.index(mx)+1, i]]
    for i in range(1, N):
        ans += [[i, i+1]]
else:
    for i in range(1, N+1):
        ans += [[A.index(mn)+1, i]]
    for i in range(N, 1, -1):
        ans += [[i, i-1]]

print(len(ans))
for x, y in ans:
    print(x, y)

Measured memory_bytes: 62608
n,a,b,c,d=gets.chomp.split(" ").map(&:to_i)
arr=gets.chomp
a-=1
b-=1
c-=1
d-=1

if c < d
  if not arr[(b+1)..(d-1)].include?("##") and not arr[(a+1)..(c-1)].include?("##")
    puts("Yes")
  else
    puts("No")
  end
else
  tmp=arr[(a+1)..(c-1)]

  if not tmp.include?("##") and arr[(b-1)..(d+1)].include?("...") and not arr[(b+1)..(d-1)].include?("##")
    puts("Yes")
  else
    puts("No")
  end
end


Measured memory_bytes: 2428
import java.util.*;

public class Main {
	
	private void doit(){
		
		Scanner sc = new Scanner(System.in);
		long mod = 1000000007;
		while(sc.hasNext()){
			
			int sx = sc.nextInt();
			int sy = sc.nextInt();
			int tx = sc.nextInt();
			int ty = sc.nextInt();
			
			StringBuilder sb = new StringBuilder();
			
			for(int i = 0; i < ty - sy; i++){
				sb.append("U");
			}
			
			for(int i = 0; i < tx - sx; i++){
				sb.append("R");
			}
			
			for(int i = 0; i < ty - sy; i++){
				sb.append("D");
			}
			
			for(int i = 0; i < tx - sx; i++){
				sb.append("L");
			}
			sb.append("L");
			
			
			for(int i = 0; i < ty - sy + 1; i++){
				sb.append("U");
			}
			
			for(int i = 0; i < tx - sx + 1; i++){
				sb.append("R");
			}
			sb.append("D");
			sb.append("R");
			for(int i = 0; i < ty - sy + 1; i++){
				sb.append("D");
			}
			
			for(int i = 0; i < tx - sx + 1; i++){
				sb.append("L");
			}
			sb.append("U");
			System.out.println(sb.toString());
		}

	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

}


Measured memory_bytes: 10192
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n],b[n],c[n];
	for(int i=0;i<n;i++)
		cin>>a[i]>>b[i]>>c[i];
	int dpa[n],dpb[n],dpc[n];
	dpa[0]=a[0];
	dpb[0]=b[0];
	dpc[0]=c[0];

	for(int i=1;i<n;i++)
		{
           dpa[i]=max(dpc[i-1],dpb[i-1])+a[i];
           dpb[i]=max(dpa[i-1],dpc[i-1])+b[i];
           dpc[i]=max(dpa[i-1],dpb[i-1])+c[i]; 
		} 
	cout<<max(dpa[n-1],max(dpb[n-1],dpc[n-1]));	
}

Measured memory_bytes: 2688
#include <stdio.h>

int is_uruu(int y)
{
	return (y % 400 == 0 || (y % 100 != 0 && y % 4 == 0));
}

int main(void)
{
	int a, b;
	int done_first;
	int found;
	int i;
	
	done_first = 0;
	while (scanf("%d %d", &a, &b), a != 0 || b != 0){
		if (done_first){
			printf("\n");
		}
		
		found = 0;
		for (i = a; i <= b; i++){
			if (is_uruu(i)){
				printf("%d\n", i);
				found = 1;
			}
		}
		
		if (!found){
			printf("NA\n");
		}
		
		done_first = 1;
	}
	
	return (0);
}

Measured memory_bytes: 616
N,*vs=$<.read.split.map(&:to_i)

es,os = vs.zip((1..N)).partition {|v,i| i%2 == 0}

def f(xs)
  xs.group_by {|v,i|v}.map{|k,v|[k,v.length]}.sort_by {|k,v|-v}
end

es = f(es)
os = f(os)

if es[0][0] != os[0][0]
    puts vs.length - es[0][1] - os[0][1]
elsif es[0][0] == os[0][0] && es.length == 1 && os.length == 1
    puts vs.length / 2
elsif es[0][1]-es[1][1] < os[0][1]-os[1][1]
    puts vs.length - es[1][1] - os[0][1]
else
    puts vs.length - es[0][1] - os[1][1]
end

Measured memory_bytes: 33048
N = int(input())
al = map(int, input().strip().split(" "))

additional = 0
dic = {}
for a in al:
    if 1 <= a <= 399:
        dic['0'] = 0
    if 400 <= a <= 799:
        dic['1'] = 0
    if 800 <= a <= 1199:
        dic['2'] = 0
    if 1200 <= a <= 1599:
        dic['3'] = 0
    if 1600 <= a <= 1999:
        dic['4'] = 0
    if 2000 <= a <= 2399:
        dic['5'] = 0
    if 2400 <= a <= 2799:
        dic['6'] = 0
    if 2800 <= a <= 3199:
        dic['7'] = 0
    if 3200 <= a:
        additional += 1

leng = len(dic.keys())
print(max(leng, 1), leng + additional)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
typedef pair<ll, string> PLS;

int n;
int a[100100];
bool f[100100];

int main(){
	int ans = 0;
	cin >> n;
	fill(f, f + n, 1);
	REP(i, n){
		cin >> a[i];
		a[i]--;
	}
	REP(i, n){
		if (f[i]){
			if (a[a[i]] == i){
				ans++;
				f[i] = 0;
				f[a[i]] = 0;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> a[200500];
int used[200500];
int n, m;
int c = 0;
void dfs(int i) {
	used[i] = 1;
	c++;
	for (auto f : a[i]) {
		if (used[f] == 0) dfs(f);
	}
}

void solve() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		a[u].push_back(v);
		a[v].push_back(u);
	}
	int k = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i].empty()) k++;
	}
	int mx = 0;
	for (int i = 1; i <= n; i++) {
		if (used[i] == 0) {
			c = 0;
			dfs(i);
			mx = max(mx, c);
		}
	}
	cout << mx;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	for (int i = 1; i <= t; i++) {
		solve();
	}
}

Measured memory_bytes: 21548
package main

import (
	"fmt"
	"math"
	"os"
)

func main() {
	var a int
	var b int
	var c int
	var d int
	fmt.Scan(&a, &b, &c, &d)
	ab := math.Abs(float64(a - b))
	bc := math.Abs(float64(b - c))
	ac := math.Abs(float64(a - c))
	if int(ac) <= d {
		fmt.Println("Yes")
		os.Exit(0)
	}
	if int(ab) <= d && int(bc) <= d {
		fmt.Println("Yes")
		os.Exit(0)
	}
	fmt.Println("No")
}

Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>
int main() {
  double n;
  double a, b;
  int i;
  int flag = 0;
  scanf ("%lf", &n);

  a = n / 1.08;
  a = floor(a);

  for (i = 0; i < 2; i++) {
    b = a * 1.08;
    b = floor(b);
    if (b == n) {
      printf ("%.0lf", a);
      flag = 1;
    }
    a++;
  }

  if (flag == 0) printf (":(");

  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(void){
    int numflower;
    int *goal_height,*now_height;

    scanf("%d",&numflower);
    goal_height=(int *)malloc(sizeof(int)*numflower);
    now_height=(int *)malloc(sizeof(int)*numflower);
    int i,j;
    for(i=0;i<numflower;i++){
        scanf("%d",&goal_height[i]);
        now_height[i]=0;
    }
    int count=0;
    int flag=0;

    //printf("\n");

    for(i=0;i<numflower;i++){
        while(now_height[i]!=goal_height[i]){
            now_height[i]++;
            if(i==numflower-1){
                count++;
            }
            for(j=i+1;j<numflower;j++){
                if(now_height[j]>=goal_height[j]){
                    count++;
                    break;
                }
                else if(j==numflower-1){
                    now_height[j]++;
                    count++;
                }
                else{
                    now_height[j]++;
                }
            }
             
            for(int k=0;k<numflower;k++){
                //printf("%d ",now_height[k]);
            }
            //printf(":%d\n",count);
        }
    }
       
    
    printf("%d",count);
    free(goal_height);
    free(now_height);
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int A,B,C;
        A=s.nextInt();
        B=s.nextInt();
        C=s.nextInt();
        
        System.out.println(Math.min(B/A,C));

    }  
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<string> vecs;
template<class T,class U> using Hash=unordered_map<T,U>;

#define REP(i, a, n) for(ll i = a; i < (ll)n; i++)
#define RREP(i, a, n) for(ll i = n-1; i >= a; i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, 0, n)
#define MD 1000000007

template<class T> T read(){T a;cin >> a;return a;}
template<class T> void read(T& a){cin >> a;}
template<class T> void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}}
template<class T> void write(T a){cout << a << endl;}
template<class T> void writes(vector<T> a, const char* c = " "){cout << a[0];for(int i = 1; i < (int)a.size(); i++)cout << c << a[i];cout << endl;;}
void write(double a){cout << fixed << setprecision(12) << a << endl;}
void write(long double a){cout << fixed << setprecision(12) << a << endl;}
template<class T> void warr(T a, int n, const char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;}
void split(string s, string delim, veci& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(atoi(s.substr(pos).data()));break;}else {result.push_back(atoi(s.substr(pos, p - pos).data()));}pos = p + delim.size();}}
void split(string s, string delim, vecs& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(s.substr(pos));break;}else {result.push_back(s.substr(pos, p - pos));}pos = p + delim.size();}}
ll gcd(ll a, ll b){while(true){ll k = a % b;if(k == 0)return b;a = b;b = k;}}
ll comb(ll n, ll m){ll p=1;m=min(m,n-m);for(ll i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;}

int main(void)
{
	int a[3];
    rep(i,3)cin>>a[i];
    sort(a,a+3);
    if(a[0]==5&&a[1]==5&&a[2]==7)
        write("YES");
    else 
        write("NO");
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H==0 && W==0){
                break;
            }
            for(int i=1; i<=H; i++){
                for(int j=1; j<=W; j++){
                    System.out.printf("#");
                }
                System.out.println();
            }
            System.out.println();
        }
        sc.close();
    }
}


Measured memory_bytes: 60736
import math
a,b,c = map(int,input().split())
th = (math.pi/180)*c

s = 1/2 * a * b * math.sin(th)
c2 = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(th))
l = a + b + c2
h = 2 * s / a

print('{:.8f}'.format(s))
print('{:.8f}'.format(l))
print('{:.8f}'.format(h))


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

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

using namespace std;
using lint=long long;

int main(){
	int h,w,n; scanf("%d%d%d",&h,&w,&n);
	set<pair<int,int>> S;
	rep(i,n){
		int y,x; scanf("%d%d",&y,&x); y--; x--;
		S.emplace(y,x);
	}

	set<pair<int,int>> Cand;
	for(auto p:S) rep(i,3) rep(j,3) {
		int y=p.first+i-1;
		int x=p.second+j-1;
		if(0<y && y<h-1 && 0<x && x<w-1) Cand.emplace(y,x);
	}

	lint ans[10]={};
	for(auto p:Cand){
		int cnt=0;
		rep(i,3) rep(j,3) if(S.count({p.first+i-1,p.second+j-1})>0) cnt++;
		ans[cnt]++;
	}
	ans[0]=1LL*(h-2)*(w-2);
	rep(i,9) ans[0]-=ans[i+1];

	rep(i,10) printf("%lld\n",ans[i]);

	return 0;
}


Measured memory_bytes: 47104