akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	ll N;
	scanf("%lld",&N);

	printf("%lld\n",(N*(N-1))/2);

	return 0;
}


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

using namespace std;
struct node
{
    int t;
    int x,y;
};
const int maxn = 100000;
const int INF = 1e5+10;

int N;
int main()
{
    node T0 = {0,0,0},T1;
    scanf("%d",&N);
    int flag = 0;
    for(int i = 0; i < N; i++)
    {
        scanf("%d%d%d",&T1.t,&T1.x,&T1.y);
        if(flag == 1) continue;
        int t0 = T0.t+abs(T1.x-T0.x)+abs(T1.y-T0.y);
        if(t0>T1.t || (T1.t-t0)%2 != 0)
        {
            flag = 1;
            continue;
        }
        T0.t = T1.t;
        T0.x = T1.x;
        T0.y = T1.y;
    }
    if(flag == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
import heapq
from math import sqrt
# -*- coding: utf-8 -*-
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def calc(b1, b2):
    x1, y1, r1 = b1
    x2, y2, r2 = b2
    d = sqrt((x1-x2)**2+(y1-y2)**2)
    return max(d-(r1+r2), 0)


sx, sy, gx, gy = map(int, input().split())
N = int(input())
barriers = [[sx, sy, 0]] + [list(map(int, input().split()))
                            for _ in range(N)]+[[gx, gy, 0]]

mat = [[0]*(N+2) for _ in range(N+2)]

for row in range(N+2):
    for col in range(row+1, N+2):
        d = calc(barriers[row], barriers[col])
        mat[row][col] = d
        mat[col][row] = d

# 視点からの距離
dist = [float('inf')]*(N+2)
dist[0] = 0

# 最短経路での一つ前のノード
prev = defaultdict(lambda: None)

Q = []
# Q->[dist from　start,node])
heapq.heappush(Q, (0, 0))

while Q:
    dist_to_node, node = heapq.heappop(Q)
    if dist[node] < dist_to_node:
        continue
    else:
        for v in range(N+2):
            weight = mat[node][v]
            alt = dist_to_node+weight
            if dist[v] > alt:
                dist[v] = alt
                prev[v] = node
                heapq.heappush(Q, (alt, v))
print(dist[-1])


Measured memory_bytes: 123612
#include <iostream>

using namespace std;

long long wy;

void algo( string & s, int pocz, long long sum ) {
    if( pocz>=s.size() )
        return;
    long long n=0, x=0;
    for( int i=pocz; i<s.size(); i++ ) {
        n=n*10+s[i]-'0';
        algo( s, i+1, sum+n );
    }
    wy+=sum+n;
}

int main()
{
    string s;
    cin >> s;
    algo( s, 0, 0 );
    cout << wy;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll mod = 10e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prtd(n, var)  cout << fixed << setprecision(n) << var << endl
#define prt2(var1, var2) cout << var1 << " " << var2 << endl

//----------------------------------------------------------------

int main(void) {
  ll n, m;
  cin >> n >> m;

  vecll a(n);
  rep(i,n){
    cin >> a[i];
  }
  sort(all(a));

  vpairll proc(m);
  rep(i,m){
    ll b, c;
    cin >> b >> c;
    proc[i] = make_pair(c, b);
  }
  sort(all(proc));

  vec d(n);
  d.assign(n, 0);
  ll k=m-1;
  rep(i,n){
    while(proc[k].second<1){
      k--;
    }
    if(k<0){
      break;
    }
    d[i] = proc[k].first;
    proc[k].second--;
  }

  sort(all(proc));

  rep(i,n){
    if(d[i]-a[i]>0){
      a[i] = d[i];
    } else {
      break;
    }
  }

  ll ans=0;
  rep(i,n){
    ans += a[i];
  }

  prt(ans);
}


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

int main() {
int A1=10;
int A2=7;
int A3=9;
cin >> A1;
cin >> A2;
cin >> A3;
if(A1+A2+A3>=22){
  cout << "bust";
}else{
  cout << "win";
}
	return 0;
}


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

int main() {
    int n, m;
    int p[100000], y[100000];
    vector<int> yd[100001];
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> p[i] >> y[i];
        yd[p[i]].push_back(y[i]);
    }
    for (int i = 0; i < n; i++) {
        sort(yd[i + 1].begin(), yd[i + 1].end());
    }
    for (int i = 0; i < m; i++) {
        auto itr = lower_bound(yd[p[i]].begin(), yd[p[i]].end(), y[i]);
        string s1 = to_string(p[i]);
        string s2 = to_string(itr - yd[p[i]].begin() + 1);
        string t1(6 - s1.length(), '0');
        string t2(6 - s2.length(), '0');
        string ans = t1 + s1 + t2 + s2;
        cout << ans << endl;
    }
    return 0;
}

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

#define int long long 
#define MOD 1000000007


using namespace std;

typedef unordered_map<int,int>::const_iterator map_itr;

bool compare( const map_itr& a, const map_itr& b ){ // ファンクタというらしい
  return ( a->second > b->second );
}

signed main(){

	int n;
	cin >> n;
	int v[n];
	unordered_map<int,int> count;
	unordered_map<int,int> count2;
	set<int> kind;
	
	for(int i=0;i<n;i++){
		cin >> v[i];
		kind.insert(v[i]);		
		if(i%2==0){
			count[v[i]]++;
		}
		else{
			count2[v[i]]++;
		}
	}
	
	
	bool if1 = (count.size()==1&&count2.size()==1);
	bool if2 = (kind.size()==1);
	bool if3 = (kind.size()==2);
	
	if(if1&&if3){
		cout << "0" <<endl;
		return 0;
	}
	
	if(if2){
		cout << n/2 <<endl;
		return 0;
	}


	vector<map_itr> c;
	for(auto itr=count.begin();itr!=count.end();itr++){
		c.push_back(itr);
	}
	sort(c.begin(),c.end(),compare);
	
	vector<map_itr> c2;
	for(auto itr=count2.begin();itr!=count2.end();itr++){
		c2.push_back(itr);
	}
	sort(c2.begin(),c2.end(),compare);
	
	auto a = c.begin();
	auto b = c2.begin();
	
	if((*a)->first!=(*b)->first){
		cout<< n-(*a)->second-(*b)->second <<endl;
		return 0;
	}
	
	else{
		auto a2 = c.begin();
		a2++;	
		auto b2 = c2.begin();
		b2++;
	
		int t1 = n-(*a)->second-(*b2)->second;
		int t2 = n-(*a2)->second-(*b)->second;
	
		if(t1<=t2){
			cout <<t1 <<endl;
			return 0;
		}
	
		else{
			cout << t2 <<endl;
			return 0;
		}
	
	}

 	
 	return 0;
	

}

Measured memory_bytes: 11028
N = int(input())
l = []
for i in range(N-1):
  s = [int(x) for x in input().split()]
  l.append(s)
for i in range(N-1):
  t = 0
  for j in range(i,N-1):
      t = max(t,l[j][1]) 
      if t % l[j][2] == 0:
        t += l[j][0]
      else:
        t += l[j][2]- t % l[j][2] +l[j][0]
  print(t)
print(0)

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define N 200001
using namespace std;

int main(){
  int n;
  int a[N]={0};
  cin >> n;
  rep(i,n){
    scanf("%d",&a[i]);
  }
  vector<int> b;
  for (int i = n - 1; i >= 0; i -= 2) {
    b.push_back(a[i]);
  }
  for (int i = n % 2; i < n; i += 2) {
    b.push_back(a[i]);
  }
  for (int i = 0; i < n - 1; i++) {
    printf("%d ", b[i]);
  }
  printf("%d\n", b[n - 1]);

  return 0;
}


Measured memory_bytes: 3828
#include<iostream>

using namespace std;

int main() {
  int H, W, k = 1;
  while(k > 0) {
    cin >> H >> W;
    if(H == 0 && W == 0){
      break;
    }
    for (int i = 0; i < H; i++){
      for(int x = 0; x < W; x++){
	cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  
  return 0;
}



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

  const int MOD = 1000000007;
  const double PI = acos(-1); 

  //long long
  using ll = long long;

  //出力系
  #define print(x) cout << x << endl
  #define yes cout << "Yes" << endl
  #define YES cout << "YES" << endl
  #define no cout << "No" << endl
  #define NO cout << "NO" << endl
  
  // begin() end()
  #define all(x) (x).begin(),(x).end()

  //for
  #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

  //最大公約数（ll）
  ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

  //素因数分解
  vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
      if(n % i) continue;
      res.emplace_back(i, 0);
      while(n % i == 0){
        n /= i;
        res.back().second++;
      }
    }
  if(n != 1) res.emplace_back(n, 1);
  return res;
  }



  //二分探索(最小値を出す問題は疑う)


// bool C(ll x){
//     ll res = 0;
//     for(int i = 0; i < N; ++i){
// 		res += max(0ll, A[i]-x/F[i]);
//     }
//     return res <= K;
// }

//   ll binary_search(ll ok, ll ng){
//     while(abs(ok - ng) > 1){
//       ll mid = (ok + ng) / 2;
//       if(C(mid)) ok = mid;
//       else ng = mid;
//     }
//     return ok;
//   }

int main(){
int N;
cin >> N;
int x;
cin >> x;
vector<int> A(N);
REP(i, N) cin >> A[i];
sort(all(A));
int ans = 0;
REP(i, N){
  if(i < N - 1 && x >= A.at(i)){
    x -=A.at(i);
    ans++;
  }
  if(i == N - 1 && x == A.at(i)){
    ans++;
  }
}
print(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<typename T>
inline void read(T &x){
	char ch=0; x=0;
	bool sign=false;
	while(ch<'0'||'9'<ch) sign|=ch=='-',ch=getchar();
	while('0'<=ch&&ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	x=sign?-x:x;
}
int n,k;
int a[105];
short dp[2][(int)1e5+10];
inline void dfs(int r,int l){
	if(dp[r][l]) return;
	if(r==0){
		dp[r][l]=-1;
		for(int i=0;i<n&&a[i]<=l;++i){
			dfs(1,l-a[i]);
			dp[r][l]=max(dp[r][l],dp[1][l-a[i]]);
		}
	} else {
		dp[r][l]=1;
		for(int i=0;i<n&&a[i]<=l;++i){
			dfs(0,l-a[i]);
			dp[r][l]=min(dp[r][l],dp[0][l-a[i]]);
		}
	}
}
int main(){
	read(n),read(k);
	for(int i=0;i<n;++i){
		read(a[i]);
	}
	dfs(0,k);
	puts(dp[0][k]==1?"First":"Second");
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  if (s[1] == s[2] && (s[0] == s[1] || s[2] == s[3])) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
      return 0;
}

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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    vector<pair<int, int>> XY; XY.reserve(N);
    map<pair<int, int>, int> count_map;
    REP(n, N){
        scanInt(xn);
        scanInt(yn);
        for (auto& e : XY){
            auto& xe = e.first;
            auto& ye = e.second;
            const auto xd = xe - xn;
            const auto yd = ye - yn;
            count_map[make_pair(xd, yd)]++;
            count_map[make_pair(-xd, -yd)]++;
        }
        XY.emplace_back(xn, yn);
    }
    int count_max = 0;
    for (auto& e : count_map){
        auto& xd = e.first.first;
        auto& yd = e.first.second;
        auto& count = e.second;
        // cout << xd << ", " << yd << " : " << count << endl;
        count_max = max(count_max, count);
    }
    cout << (N - count_max) << endl;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
int n,a[100001];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i){scanf("%d",&a[i]);if(!(a[i]&1)&&a[i]%3&&a[i]%5){printf("DENIED\n");return 0;}}printf("APPROVED\n");return 0;
}

Measured memory_bytes: 128
/* be name khoda */

// #define stream_enable
#define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;

#ifdef stream_enable
#define cin sss
#endif
#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

const ll MOD = 1000000007;
const long long BIG = 1446803456761533460;
const int Big = 336860180;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debugp(x) cout << #x << " -> " << "(" << (x).F << ", " << (x).S << ")" << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].F << ", " << (x)[i1_dap].S << ")\n"; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_dav].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl

#define forifrom(i, s, n) for(ll i = (s); i < (n); ++i)
#define forirto(i, n, e) for(ll i = (n) - 1; i >= (e); --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define Add(a, b) a = (a + (b)) % MOD
#define Mul(a, b) a = (a * (b)) % MOD

stringstream sss;

// -----------------------------------------------------------------------

const ll maxn = 200010;

ll n;
ll ar[maxn];
ll lt[maxn], rt[maxn];

void MAIN() {

    cin >> n;
    fori (i, n) cin >> ar[i];
    lt[0] = -1;
    forifrom (i, 1, n) {
        lt[i] = i - 1;
        while (lt[i] >= 0 && ar[lt[i]] > ar[i]) lt[i] = lt[lt[i]];
    }
    rt[n - 1] = n;
    forir (i, n - 1) {
        rt[i] = i + 1;
        while (rt[i] <  n && ar[rt[i]] > ar[i]) rt[i] = rt[rt[i]];
    }
    ll ans = 0;
    fori (i, n) {
        ans += ar[i] * (rt[i] - i) * (i - lt[i]);
    }
    cout << ans << '\n';

}

// -----------------------------------------------------------------------

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(10);
    sss << R"(
8
5 4 8 1 2 6 7 3
    )";
    MAIN();
    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int n, h[110], tot;
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> h[i];
	}
	int m = h[1];
	for (int i = 1; i <= n; i++) {
		if (h[i] >= m) {
			m = h[i];
			tot++;
		}
	}
	cout << tot << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>

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

	bool rule = true;
	std::map<std::string, int> m;
	char cBack = 0;

	std::string tmp;
	std::cin >> tmp;
	m[tmp]++;
	cBack = tmp.back();

	for ( int i = 1; i < N; i++ )
	{
		std::cin >> tmp;

		if ( ( m[tmp]++ != 0 ) || ( tmp[0] != cBack ) )
		{
			rule = false;
			break;
		}
		else
		{
			cBack = tmp.back();
		}
	}

	if ( rule )
	{
		std::cout << "Yes" << std::endl;
	}
	else
	{
		std::cout << "No" << std::endl;
	}

	return ( 0 );
}


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

bool is_square(int x){int y=std::sqrt(x);return y*y==x;}

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    std::string s,t;std::cin>>s>>t;
    std::cout<<(is_square(std::stoi(s+t))?"Yes":"No")<<std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){
  int a, b, t;
  cin >> a >> b >> t;

  int num = t/a;
  int ans = num * b;
  cout << ans << endl;

}

Measured memory_bytes: 3616
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>
#include<stack>

const long long MOD = 1000000007;
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

int main(){
    string S;
    string T;
    vector<string> ans;
    string temp;
    cin >> S >> T;
    char flg;
    for(int i=0; i<S.size()-1+T.size(); i++){
        flg = 1;
        for(int j=0; j<T.size(); j++){
            if(S[i+j]!='?' && S[i+j]!=T[j]){
                flg = 0;
            }
        }
        if(flg){
            temp = S;
            for(int j=0; j<T.size(); j++){
                temp[i+j] = T[j];
            }
            for(int j=0; j<S.size(); j++){
                if(temp[j]=='?'){
                    temp[j] = 'a';
                }
            }
            ans.push_back(temp);
        }
    }
    if(ans.size()==0){
        cout << "UNRESTORABLE" << endl;
        exit(0);
    }
    sort(ans.begin(), ans.end());
    cout << ans[0] << endl;
    return 0;
}


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

#define INF 100100100
#define MOD 1000000007

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

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);
   ll A,B,K;
   cin>>A>>B>>K;
   for(int i=0;i<K;i++){
      if(i%2==0){
         if(A%2)A--;
         B+=A/2;
         A-=A/2;
      }
      else{
         if(B%2)B--;
         A+=B/2;
         B-=B/2;
      }
   }
   cout << A << " "<< B;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  long total = 0;
  for(int i = 1; i <= N; i++) {
    if(i % 3 != 0 && i % 5 != 0) {
      total += i;
    }
  }
  cout << total;

  return 0;
}



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


using namespace std;

int main(void){

    vector<int> vec;
    int i=0,a,b;
    while(true){

        cin>>a>>b;
        if((a==0)&&(b==0)) break;
        i++;
        vec.push_back(a);
        vec.push_back(b);
    }

    for(int j=0;j<i;j++){
        for(int u=0;u<vec.at(j*2);u++){
            for(int v=0;v<vec.at(j*2+1);v++){
              if(u==0||u==vec.at(j*2)-1) cout<<"#";
              else if(v==0||v==vec.at(j*2+1)-1) cout<<"#";
              else cout<<".";
            }
            cout<<endl;
        }
        cout<<endl;
    }

    return 0;
}



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

int main(){
    int a,b;
    cin >> a >> b;
    if(a == 1)a = 14;
    if(b == 1)b = 14;
    if(a < b)cout << "Bob" << endl;
    if(a == b)cout << "Draw" << endl;
    if(a > b)cout << "Alice" << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int[] A = new int[N];
        for(int i = 0; i < N; i++) {
            A[i] = in.nextInt();
        }

        int[] B = new int[100010];
        for(int i = 0; i < N; i++) {
            ++B[Math.max(A[i]-1, 0)];
            --B[A[i]+2];
        }

        int maxi = Integer.MIN_VALUE;
        for(int i = 0, cur = 0; i < 100010; i++) {
            cur += B[i];
            maxi = Math.max(cur, maxi);
        }

        System.out.println(maxi);
    }
}

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


int main() {
    char a, b;
    cin >> a >> b;
    if(a == 'H') cout << b << endl;
    else {
        if(b == 'D') cout << 'H' << endl;
        else cout << 'D' << endl;
    }
}

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




int main()
{
 int n;
 cin>>n;
 int p=n;
 int c=0;
 while(p>0){
    p/=10;
    c++;
 }
 if(c==1)
 cout<<n<<endl;
 else if(c==2)
 {
 cout<<9<<endl;
 }
 else if(c==3)
 {
 cout<<(n-100+10)<<endl;
 }
 else if(c==4)
 {
 cout<<909<<endl;
 }
 else if(c==5)
 {
 cout<<(n-10000+900+9+1)<<endl;
 }
 else
 {
 cout<<90909<<endl;
 }

return 0;
}


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

typedef long long ll;

const int N = 200010;
int n, k, Q;
ll a[N];

int main() {
	scanf("%d%d%d", &n, &k, &Q);
	for(int i = 1, x; i <= Q; ++i) {
		a[1]--; a[n + 1]++;
		scanf("%d", &x);
		a[x]++; a[x + 1]--;
	}
	for(int i = 1; i <= n; ++i) a[i] += a[i - 1];
	for(int i = 1; i <= n; ++i) a[i] += k;
	for(int i = 1; i <= n; ++i) {
		if(a[i] > 0) puts("Yes");
		else puts("No");
	}
}

Measured memory_bytes: 1408
n=int(input())
a=list(map(int,input().split( )))
q=int(input())
for i in range(q):
    b,e=map(int,input().split( ))
    tmp=[]
    for j in range((e-b)//2):
        a[b+j],a[e-j-1]=a[e-j-1],a[b+j]
print(*a)



Measured memory_bytes: 5832
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    string A, B;
    cin >> A >> B;
    if (A.size() > B.size()) cout << "GREATER" << endl;
    else if (A.size() < B.size()) cout << "LESS" << endl;
    else {
        REP(i, A.size()) {
            if (A[i] > B[i]) {
                cout << "GREATER" << endl;
                return 0;
            }
            else if (A[i] < B[i]) {
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }
    return 0;
}

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

using namespace std;

#define FaSt ios::sync_with_stdio(0),cin.tie(0);
#define random uniform_int_distribution<long long>(1, 2000000000000000LL)(rng)
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count() * ((uint64_t) new char | 1));

const int N = 200005, M = 1e9 + 7;
int n, a[N], dp[N], last[N];
long long ans;

int main() 
{
    FaSt
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    
    for (int i = n - 1; i >= 0; i--)
    {
        if (i && a[i - 1] == a[i])
        {
            dp[i] = dp[i + 1];
            continue;
        }
        
        if (last[a[i]] == 0)
        {
            dp[i] = dp[i + 1];
        }
        else
        {
            dp[i] = (dp[i + 1] + dp[last[a[i]]]) % M;
        }
        
        dp[i] = max(dp[i], 1);
        last[a[i]] = i;
    }
    
    cout << dp[0];
}

Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include<stdio.h>
using namespace std;

double Minkowski(int n, double p, double *x, double *y);


int main(){
    int n;
    double x[100];
    double y[100];
    cin >> n;
    for(int i=0; i<n ; i++){
        cin >> x[i];
    }
      for(int i=0; i<n ; i++){
        cin >> y[i];
    }
    double p=1.0;
    printf("%lf\n", Minkowski(n, p, x, y));
    p=2.0;
    printf("%lf\n", Minkowski(n, p, x, y));
    p=3.0;
    printf("%lf\n", Minkowski(n, p, x, y));
    double mx=0;
    for(int i=0;i<n;i++){
        mx=max(mx, abs(x[i]-y[i]) );
    }
    printf("%lf\n", mx);    
  return 0;
}


double Minkowski(int n, double p, double *x, double *y){
    double sum=0;
     for (int i=0; i<n; i++){
         double a =abs(x[i]-y[i]);
         sum += pow(a, p);
     }
     return pow(sum, 1.0/p);

}


Measured memory_bytes: 3400
// Mujhe jod mat kisi aur ke usool se .. Hype Game
// Baat karun sirf apne liye, Aur mujhe maharani se nafrat hai
// If you are thinking bout world tour for free go for as much problem as you can ..
#include<bits/stdc++.h>
using namespace std;
// type dijkstra mst kruskal graph aasaanhai devil expert
const int X = 100100, N = X, M = 1e9 + 7ll, inf = M ;
#define vi      vector<int>
#define pb      push_back
#define fi      first
#define se      second

vi g[X];
int d[N], du[N] , p[N] ;
bitset<N> lit;
int n;
void dfs(int s,int k)
{ 
   lit[s]=true ;
   for(int c : g[s])
   {
      if(!lit[c] ) 
      {
         d[c] = k;
         p[c] = s;
         dfs(c, k + 1) ;
      }
   }
}

int main()
{
    int u, v;
    cin >> n >> u >> v ;
    for(int i = 1; i < n; ++i)
    {
        int l, r;
        cin >> l >> r;
        g[l].push_back(r);
        g[r].push_back(l);
    }    
    lit.reset();
    dfs(u, 1);
    for(int i = 0; i <= n; ++i ) du[i] = d[i];
    lit.reset();
    memset(d, 0, sizeof(d));
    memset(p, 0, sizeof(p));
    dfs(v, 1);
    // for(int i = 0; i <= n; ++i )  cout << d[i] << ' '; cout << endl;
    // for(int i = 0; i <= n; ++i )  cout << du[i] << ' ';
    int ans = 0;
    for(int i = 1; i <= n; ++i) {
        if(du[i] < d[i]) 
            ans = max(ans, d[i] - 1);
    }
    cout << ans;
}


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

int main() {
	int m1, d1;
	cin >> m1 >> d1;
	int m2, d2;
	cin >> m2 >> d2;
	if (m1 != m2) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>

int l0[7], l[7], l1[7], s=1, c=0;

void dice(int num){
    l[0] = l[1];
    l[1] = l[num];
    l[num] = l[6];
    l[6] = l[7-num];
    l[7-num] = l[0];
}

int same(void){
    s = (l0[1]==l[1]&&l0[3]==l[3]&&l0[4]==l[4]&&l0[5]==l[5]&&l0[6]==l[6])?0:1;
    return s;
}

void reset(void){
    for(int i=0; i<6; i++) l[i+1] = l1[i+1];
    c = 0;
}

int main(void){
    for(int i=0; i<6; i++) scanf("%d", &l0[i+1]);
    for(int i=0; i<6; i++) scanf("%d", &l[i+1]);
    for(int i=0; i<6; i++) l1[i+1] = l[i+1];
    if(s){
        dice(5);
        if(l0[2]==l[2]) while(same() && c++<4) dice(4);
    } // 1
    if(s){
        reset();
        if(l0[2]==l[2]) while(same() && c++<4) dice(4);
    } // 2
    if(s){
        reset();
        dice(3);
        dice(5);
        if(l0[2]==l[2]) while(same() && c++<4) dice(4);
    } // 3
    if(s){
        reset();
        dice(4);
        dice(5);
        if(l0[2]==l[2]) while(same() && c++<4) dice(4);
    } // 4
    if(s){
        reset();
        dice(5);
        dice(5);
        if(l0[2]==l[2]) while(same() && c++<4) dice(4);
    } // 5
    if(s){
        reset();
        dice(2);
        if(l0[2]==l[2]) while(same() && c++<4) dice(4);
    } // 6
    if(s) printf("No\n");
    else printf("Yes\n");
    return 0;
}


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

int main (){
  int N,A;
  cin >> N >> A;
  if (N % 500 == 0){
    cout << "Yes" << endl;
  }
  else if (N % 500 <= A){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

    


Measured memory_bytes: 3604
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int g[400][400];

int main() {
  int n;
  scanf("%d", &n);
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      scanf("%d", &g[i][j]);
    }
  }
  ll ret = 0;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      bool needed = true;
      for(int k = 0; k < n; k++) {
        if(g[i][k] + g[k][j] < g[i][j]) {
          printf("-1\n");
          return 0;
        }
        if(k != i && k != j && g[i][k] + g[k][j] == g[i][j]) {
          needed = false;
        }
      }
      if(needed) {
        ret += g[i][j];
      }
    }
  }
  printf("%lld\n", ret/2);
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main() {
int x,y,z;
cin>>x>>y>>z;
int ans;
ans=(x-z)/(y+z);
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define per(i,a,b) for(int i=(b);i>=(a);i--)
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Forenska(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
using namespace std;
typedef long long LL;
typedef pair<int,int> Pair;
typedef vector<int> vec;
const long double PI=3.14159265358979323846264338327950288;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const int N=105;
int x[N],y[N],h[N];
int n;
signed main()
{
	cin>>n;
	rep(i,0,n)
	{
		cin>>x[i]>>y[i]>>h[i];
	}
	For(Cx,0,100)
	{
		For(Cy,0,100)
		{
			vector <int> Hh;
			rep(i,0,n)
			{
				if(h[i]<=0)continue;
				int H=h[i]+abs(Cx-x[i])+abs(Cy-y[i]);
				Hh.pb(H);
			}
			sort(all(Hh));
			if(unique(all(Hh))-Hh.begin()==1)
			{
				bool right=true;
				rep(i,0,n)
				{
					if(h[i]!=max((Hh[0]-abs(x[i]-Cx)-abs(y[i]-Cy)),0ll))right=false;
				}
				if(right)
				{
					cout<<Cx<<" "<<Cy<<" "<<Hh[0]<<endl;
					return 0;
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin>>n;
  long long a[n];
  bool zero=0;
  int nega=0;
  long long ans=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]==0) zero=1;
    else if(a[i]<0) nega++;
    a[i]=abs(a[i]);
    ans+=a[i];
  }
  
  sort(a,a+n);
  if(zero) cout<<ans<<endl;
  else{
    if(nega%2==0) cout<<ans<<endl;
    else cout<<ans-2*a[0]<<endl;
  }
  
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 N, M; cin >> N >> M;

    i64 maxd = 0;
    for (i64 i = 1; i * i <= M; i++) {
        if (M % i != 0) continue;
        if (i <= M / N) chmax(maxd, i);
        if (M / i <= M / N) chmax(maxd, M / i);
    }
    cout << maxd << endl;

    return 0;
}

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

int main(){
  int n, m;
  cin >> n >> m;
  for(int i = 0; i < m; ++i){
    int a;
    cin >> a;
    n -= a;
    if(n < 0){
      n = -1;
      break;
    }
  }
  
  cout << n << endl;
}

Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        int[] O = new int[n + 1];
        for(int i = 1; i <= n; i++) O[Integer.parseInt(sc.next())] = i;
        for(int i = 1; i < n; i++) {
            sb.append(O[i]).append(" ");
        }
        System.out.println(sb.append(O[n]));
    }
}


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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

    //    freopen("input.txt","r",stdin);
    //    freopen("input.txt","w",stdout);

    int i,n,k,ans=0,cnt=1;
    string s;
    char mark='a';
    cin >> n >> k >> s;
    for(i=0; i<n; i++)
    {
        if(s[i] == mark)
        {
            cnt++;
        }
        else
        {
            mark=s[i];
            ans+=(cnt-1);
            cnt=1;
        }
    }
    ans+=(cnt-1);
    cout << min(n-1,ans+2*k);
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;
const int mod = 1e9 + 7;
const int MAX = 200002;
ll fact[MAX], invfact[MAX];

#define MAX_V 1000000

ll mod_pow(ll a, ll n, ll mod) {
	ll res = 1;
	while(n > 0) {
		if(n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}

	return res;
}

ll mod_inverse(ll a, ll m) {
	return mod_pow(a, m - 2, m);
}

ll nCr(ll n, ll r) {
	return fact[n] * invfact[r] % mod * invfact[n - r] % mod;
}

void init() {
	fact[0] = invfact[0] = 1;
	rep(i, 1, MAX) {
		fact[i] = (fact[i - 1] * i) % mod;
		invfact[i] = mod_inverse(fact[i], mod);
	}
}
	
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	init();
	int N;
	cin >> N;
	int a[N];
	rep(i, 0, N) cin >> a[i];
	sort(a, a + N);
	int n = a[N - 1];
	int max_r = -1;
	int r = a[0];
	rep(i, 0, N - 1) {
		int tmp = a[i];
		if(a[i] != 0 and n / a[i] <= 1) {
			tmp = n - a[i];
		}
		if(max_r < tmp) {
			max_r = tmp;
			r = a[i];
		}
	}

	cout << n << " " << r << endl;


}


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

template<typename T, int lower, int upper>
struct offset_array {
    T data[upper-lower+1];
    T& operator[](const int i) {
        return data[i-lower];
    }
};

const int MAX_RANGE = 1e5;
offset_array<int, -MAX_RANGE, MAX_RANGE> lcounts;
offset_array<int, -MAX_RANGE, MAX_RANGE> rcounts;

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

    for (int i = 0; i < N; i++) {
        int l, r;
        cin >> l >> r;
        lcounts[l]++;
        rcounts[r]++;
    }

    lcounts[0]++;
    rcounts[0]++;
    N++;

    long long result = 0;
    int left = 0, right = N;
    for (int x = -MAX_RANGE; x < MAX_RANGE; x++) {
        right -= lcounts[x];
        left += rcounts[x];
        result += 2 * min(left, right);
    }
    cout << result << endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	vi v(4);
	rep(i,0,4)cin>>v[i];
	sort(all(v));
	if(v[0]==1 && v[2]==7 && v[3]==9 && v[1]==4)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 3580
use std::io;

fn read_line() -> String {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line).unwrap();
    return String::from(line.trim());
}

fn main() {
    let n: i64 = read_line().parse().unwrap();
    let ans: u32 = read_line().split_whitespace().map(|s| s.parse::<u32>().unwrap().trailing_zeros()).min().unwrap();
    println!("{}", ans);

}

Measured memory_bytes: 4352
#include <iostream>
#include <atcoder/all>
using namespace std;using z=long;int main(){z N,Q;cin>>N>>Q;atcoder::fenwick_tree<z> b(N);for(z i=0;i<N;i++){z a;cin>>a;b.add(i,a);}while(Q--){z w,e,r;cin>>w>>e>>r;if(w)cout<<b.sum(e,r)<<endl;else b.add(e,r);}}

Measured memory_bytes: 8232
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x,long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var k = Read();
            long g = 1;
            long ans = 0;
            for (int i = 1; i <= k; i++)
            {
                for (int j = 1; j <=k; j++)
                {
                    for (int l= 1; l <=k; l++)
                    {
                        g = gcd(i, j);
                        g = gcd(g, l);
                    
                        ans += g;
                    }
                }
            }
            Console.WriteLine(ans);





            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 17684
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define setp(x) setprecision(x)
#define nep(x) next_permutation(x);
using namespace std;
using ull = unsigned long long;
using ll = long long;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;

int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> Gate(M);
    for(int i = 0; i < M; i++) cin >> Gate[i].fi >> Gate[i].se;

    int max_l = 0, min_r = 1000000;
    for(int i = 0; i < M; i++){
        max_l = max(max_l, Gate[i].fi);
        min_r = min(min_r, Gate[i].se);
    }
    int sum = 0;
    for(int i = 1; i <= N; i++){
        if(max_l <= i and i <= min_r) sum++;
    }
    cout << sum << endl;
}


Measured memory_bytes: 1024
fun main(args: Array<String>){
    val n = readLine()!!.toInt()
    val a = Array<MutableList<Pair<Int, Int>>>(n+1){ mutableListOf()}
    for(i in 1..n){
        repeat(readLine()!!.toInt()){
            val (x, y) = readLine()!!.split(" ").map { it.toInt() }
            a[i].add(Pair(x, y))
        }
    }

    fun search(s: String): Int{
        if(s.length == n+1){
            var f = true
            for(i in 1..n){
                if(s[i] == '1'){
                    f = f && a[i].map { s[it.first].toString() == it.second.toString() }.all { it }
                }
            }
            return if(f) s.filter { it == '1' }.length else 0
        }else{
            return Math.max(search(s+"0"), search(s+"1"))
        }
    }

    println(search("0"))
}

Measured memory_bytes: 51020
//
//  main.m
//  macOS_Demo
//
//  Created by iOS on 2017/5/10.
//  Copyright © 2017年 iOS. All rights reserved.
//


#include <stdio.h>
int book[22][22]={0}, maze[22][22]={0}, num[10], min=999999999, m, n;
int next[4][2]={{-1, 0},{0, 1},{1, 0},{0, -1}};
int hx=4, hy=3 , tx=0, ty=0;
void dfs(int x,int y, int step)
{
    if (x==hx && y==hy) {
        // 到达终点
        if (step<min) {
            min=step;
        }
        return ;
    }
    for (int k=0; k<4; k++) {
        tx=x+next[k][0];
        ty=y+next[k][1];
    
        // 判断是否越界
        if (tx<1 || ty<1 || tx>5 || ty>4) {
            continue;
        }
        // 判断是否有障碍
        if (maze[tx][ty]==0 && book[tx][ty]==0) {
            book[tx][ty]=1;
            dfs(tx, ty, step+1);
            book[tx][ty]=0;
        }
    }
    return;
}
bool isGroupA(int n)
{
    if (n == 1 || n == 3 || n == 5 || n == 7 || n == 8 || n == 10 || n == 12) {
        return true;
    }
    return false;
}
bool isGroupB(int n)
{
    if (n == 4 || n == 6 || n == 9 || n == 11) {
        return true;
    }
    return false;
}
bool isGroupC(int n)
{
    if (n == 2) {
        return true;
    }
    return false;
}
int main()
{
    /*
     0010
     0000
     0010
     0100
     0001
     
     1143
     */
    int a, b;
    scanf("%d%d", &a, &b);
    
    if (isGroupA(a) && isGroupA(b)) {
        printf("Yes");
        return 0;

    }
    
    if (isGroupB(a) && isGroupB(b)) {
        printf("Yes");
        return 0;

    }
    
    if (isGroupC(a) && isGroupC(b)) {
        printf("Yes");
        return 0;

    }
    
    printf("No");
    getchar();getchar();
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define FF 99999
int main(){
        int h,w;
        cin>>h>>w;
        vector<string> m(h);
        int sum=0;
        for(int i=0; i<h; i++){
                cin>>m[i];
                for(int j=0; j<w; j++){
                        if(m[i][j]=='.')
                                sum++;
                }
        }
        sum-=1;
        vector<vector<int>> route(h,vector<int>(w,FF));
        route[0][0]=0;
        queue<pair<int,int>> now;
        now.push(pair<int,int>(0,0));

        while(!now.empty()){
          		pair<int,int> ax;
                ax=now.front(),now.pop();
                int tx=ax.first,ty=ax.second;
                if(tx==w-1&&ty==h-1){
                        cout<<sum-route[h-1][w-1];
                        return 0;
                }
                int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
                for(int i=0; i<4; i++){
                        int ttx=tx+dx[i],tty=ty+dy[i];
                        if(ttx<0||ttx>=w||tty<0||tty>=h)
                                continue;
                        if(m[tty][ttx]=='.'&&route[tty][ttx]==FF){
                                route[tty][ttx]=route[ty][tx]+1;
                                now.push(pair<int,int>(ttx,tty));
                        }
                }
        }
        cout<<-1;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin>>n;
    const int MX=2*1000 + 1;
    vl l;
    l.resize(n);
    ll ans=0;
    REP(i,n){
        cin>>l[i];
    }
    sort(ALL(l));

    REP(i,n-2){//a
        FOR(j,i+1,n-1){//b
            auto it = lower_bound(l.begin()+j+1, l.end(),(l[i]+l[j]));
            ans += it - (l.begin()+j+1);
            //DEBUG2(i,j);
        }
    }

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

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void calc(string[] g) {
    auto rows = g.length;
    auto cols = g[0].length;

    bool[int] rowSkip, colSkip;

    for (int r = 0; r < rows; r++) {
        bool isSkip = true;
        for (int c = 0; c < cols; c++) {
            if (g[r][c] == '#') {
                isSkip = false;
                break;
            }
        }
        if (isSkip) rowSkip[r] = true;
    }

    for (int c = 0; c < cols; c++) {
        bool isSkip = true;
        for (int r = 0; r < rows; r++) {
            if (g[r][c] == '#') {
                isSkip = false;
                break;
            }
        }
        if (isSkip) colSkip[c] = true;
    }

    for (int r = 0; r < rows; r++) {
        if (r in rowSkip) continue;
        for (int c = 0; c < cols; c++) {
            if (c in colSkip) continue;
            write(g[r][c]);
        }
        writeln();
    }
}

void main() {
    auto hw = readints;
    int h = hw[0];

    string[] g;
    for (int i = 0; i < h; i++) {
        g ~= read!string;
    }
    calc(g);
}


Measured memory_bytes: 256