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

int main() {
  int A,B;
  cin >> A >> B;
  
  if(A >= 6 && A <= 12){
    B /= 2;
  }
  else if(A <= 5){
    B = 0;
  }
  cout << B << endl;
}


Measured memory_bytes: 256
// Winners don't quit and Quitters don't win
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mod 998244353
#define MAX 100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t,a,b;
    cin>>a>>b;
    cout<<(a*b);
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5;

int main(){
	lli N,x;
	cin>>N>>x;
	lli a[MAX];
	rep(i,N)cin>>a[i];
	lli ans=0;
	if(a[0]>x){
		ans=a[0]-x;
        a[0]=x;
	}
	rep1(i,N-1){
		if(a[i-1]+a[i]>x){
			ans=ans+a[i-1]+a[i]-x;
          	a[i]=x-a[i-1];
		}
	}
	cout<<ans;
}

Measured memory_bytes: 1024
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
using namespace std;
#pragma warning(disable : 4996)
vector<vector<int>> g;
vector<int> used, colors, ans;
map<pair<int, int>, int> ma;
int res = 0;

void dfs(int v, int p = -1) {
	int ind = 0;
	int curnum = 0;
	if (p != -1) {
		curnum = ma[{min(p, v), max(p, v)}];
	}
	for (auto i : g[v]) {
		if (i != p) {
			while (p != -1 && colors[ind] == ans[curnum]) {
				ind++;
			}
			ans[ma[{min(i, v), max(i, v)}]] = colors[ind];
			dfs(i, v);
			res = max(res, colors[ind]);
			ind++;
		}
	}
}


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	g.resize(n);
	colors.resize(n);
	ans.resize(n - 1);
	for (int i = 0; i < n; i++) {
		colors[i] = i + 1;
	}
	for (int i = 0; i < n - 1; i++) {
		int from, to;
		cin >> from >> to;
		from--; to--;
		g[from].push_back(to);
		g[to].push_back(from);
		ma[{min(from, to), max(from, to)}] = i;
	}
	dfs(0);
	cout << res << "\n";
	for (auto i : ans)cout << i << "\n";
}

Measured memory_bytes: 15872
int main(){
int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x >= r && x+r <= W && y >= r && y+r <= H){
    printf("Yes\n");
    }
    else{
    printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  if (a.size() != b.size()) {
    cout << (a.size() > b.size() ? "GREATER" : "LESS") << endl;
    return 0;
  }
  for (int i = 0; i < a.size(); i++) {
    if (a[i] != b[i]) {
      cout << (a[i] > b[i] ? "GREATER" : "LESS") << endl;
      return 0; 
    }
  }
  cout << "EQUAL" << endl;
}


Measured memory_bytes: 256
x,k,d=gets.split.map &:to_i
x=x.abs
t=x/d  # 最小の絶対値が変化しなくなるまでに必要な移動回数
m=x%d  # ↑の余りを考慮

res = if t>=k  # tがkに満たない(足りない)場合
        (x-k*d).abs
      elsif (k-t).even?  # 偶数の場合は変化しない
         m
      elsif (k-t).odd?  # 奇数の場合は左右どちらかの小さい方
        [(m-d).abs, (m+d).abs].min
      end
puts res


Measured memory_bytes: 14228
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define vec vector<int> 
#define int long long 
#define pii pair<int,int>
//int dp[100001][2];
map<int,int> m[51][51]; 
int arr[51][51];
int n;
int dfs(int i,int j,int len){
	if(len==0){
		m[i][j][len]=0;
		return 0;
	}
	if(len==1){
		return arr[i][j];
	}
	if(m[i][j].find(len)!=m[i][j].end()) return m[i][j][len];
	int ans=0;
	rep(k,n){
		ans+=(dfs(i,k,len/2)%mod*dfs(k,j,(len+1)/2)%mod)%mod;
		ans%=mod;
	}
	m[i][j][len]=ans;
	return ans;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ios_base& scientific (ios_base& str);
	
	int t=1;
	//cin>>t;
	while(t--){
		int k;
		cin>>n>>k;
		rep(i,n){
			rep(j,n){
				cin>>arr[i][j];
			}
		}
		int ans=0;
		rep(i,n){
			rep(j,n){
				ans+=dfs(i,j,k)%mod;
				ans%=mod;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 18944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

bool binarySearch(vector<int> s, int key){
    int left = 0, right = s.size()-1;
    int mid;

    while(right - left > 1){
        mid = (left+right)/2;
        if(s[mid] >= key) right = mid;
        else left = mid;
    }

    return s[right] == key;
}

int main(){
    int n; cin >> n;
    vector<int> s(n+2);
    for(int i=1; i<=n; i++) cin >> s[i];
    s[0] = -1;
    s[n+1] = pow(10, 9)+1;

    int q; cin >> q;
    vector<int> t(q);
    for(int i=0; i<q; i++) cin >> t[i];

    int ans = 0;
    for(int i=0; i<q; i++) if(binarySearch(s, t[i])) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 1e5+10;
int cnt=0,n,k;
LL a[maxn],b[maxn];
int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin >> n >>k;
    for(int i=1;i<=n;i++){
        cin >> a[i];
        if(a[i]==0)
            cnt++;
    }
    if(cnt==0)
        a[++n] = 0;
    sort(a+1,a+1+n);
    int idx = 1;
    for (int i = 1;i <= n;i++) if (a[i]==0) idx = i;
    LL ans = 1e18;
    for(int i=1;i<=n;i++){
        if(i==idx){
            if(k==1 && cnt)
                ans = min(ans,1LL*0);
            continue;
        }
        LL temp = 0;
        int cnt2 = 0;
        temp = temp + abs(a[idx]-a[i]);
        cnt2 += abs(idx-i);
        if(cnt) cnt++;
        if(cnt2>k) continue;
        if(cnt2==k){
            ans = min(ans,temp);
            continue;
        }
        if(i<idx){
            if(idx+k-cnt2<=n){
                temp = temp + 2*abs(a[idx+k-cnt2]-a[idx]);
                ans = min(ans,temp);
            }else continue;
        }
        else{
            if(idx-(k-cnt2)>=1){
                temp = temp + 2*abs(a[idx]-a[idx-(k-cnt2)]);
                ans = min(ans,temp);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	int A,B;
	scanf("%d %d",&A,&B);
	if(B%A==0)printf("%d\n",B+A);
	else printf("%d\n",B-A);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<cstring>
#include<sstream>
using namespace std;

typedef long long ll;

int main() {
  int N,K; cin >> N >> K;
  vector<vector<int>>ds(N);
  for ( int i = 0; i < N; i++ ) {
    int t,d; cin >> t >> d;
    t--;
    ds[t].push_back(d);
  }
  vector<int>y0,y1;
  for ( int i = 0; i < N; i++ ) {
    if ( ds[i].size() == 0 ) continue;
    sort(ds[i].begin(),ds[i].end());
    y1.push_back(ds[i].back());
    ds[i].pop_back();
    y0.insert(y0.end(),ds[i].begin(),ds[i].end());
  }
  sort(y0.rbegin(),y0.rend());
  sort(y1.rbegin(),y1.rend());    
  ll Y = max(1,K-int(y0.size()));
  ll X = 0;
  for ( int i = 0; i < Y; i++ ) X += y1[i];
  for ( int i = 0; i < K-Y; i++ ) X += y0[i];
  ll ans = 0;
  while(1){
    ans = max(ans,X+Y*Y);
    if ( Y >= K || Y >= y1.size() ) break;
    X += y1[Y];
    X -= y0[K-Y-1];
    Y++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6396
#include <stdio.h>
#include <string.h>
#include <vector>
#include <numeric>
#include <algorithm>
#include <functional>
#include <math.h>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;

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

  vi h(n);
  for (int i=0;i<n;++i)
    scanf("%d", &h[i]);

  int x, y;
  vector<vector<int> > neigh(n);
  while (m--) {
    scanf("%d %d", &x, &y);
    x--;
    y--;

    neigh[x].push_back(y);
    neigh[y].push_back(x);
  }

  int ans = 0;

  for (int i=0;i<n;++i) {
    bool is_good = true;
    for (auto& it : neigh[i]) 
      is_good = is_good && (h[i] > h[it]);
    
    if (is_good)
      ++ans; 
  }

  printf("%d", ans);

  return 0;
}


Measured memory_bytes: 8308
A, B, C, D = map(int, list(input()))
for i in range(1<<3):
  r = A
  if i&(1<<2) == 0:
    r += B
  else:
    r -= B
  if i&(1<<1) == 0:
    r += C
  else:
    r -= C
  if i&(1<<0) == 0:
    r += D
  else:
    r -= D
  if r == 7:
    s = str(A)+("+" if i&(1<<2) == 0 else "-")+str(B)+("+" if i&(1<<1) == 0 else "-")+str(C)+("+" if i&(1<<0) == 0 else "-")+str(D)+"=7"
    print(s)
    exit()
print()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){
 
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    ll h1,h2,m1,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;

    ll tm=(h2-(h1+1))*60+(60-m1)+m2;
    ll an=(tm-k);
    cout<<max(0ll,an)<<endl;
    return 0;   
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int a, b, k, c;

	cin>> a >> b >> k;

	for(int i=100;0<i;i--){
		if((a/i)*i==a && (b/i)*i==b){
			k--;
			if(k==0){
				cout<< i << endl;
				i=0;
			}
		}
	}


}

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

int main() {
  int N;
  cin >>N;
  int a,b;
  a=N/100;
  b=N/10;
  
  if((N-7)%10!=0 && a!=7 && (b-7)%10!=0){
    cout <<"No" <<endl;
  }
  else {
    cout <<"Yes" <<endl;
  }
}




Measured memory_bytes: 3632
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int min = 1_000_000_000;
		int max = 1;
		for (int i = 0; i < N; i++) {
			int a = sc.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		}
		
		System.out.println(max - min);

	}
}

Measured memory_bytes: 23892
#include<iostream>
#include<iomanip>
int main()
{
	double a = 0;
	double p = 3.141592653589;
	std::cin >> a;
	std::cout << std::setiosflags(std::ios::fixed) << std::setprecision(6) << (double)p*a*a <<  " " << std::setiosflags(std::ios::fixed) << std::setprecision(6) << (double)a*2*p << std::endl;
	return 0;
}


Measured memory_bytes: 3288
a = [[]]*9
a[0], a[1] ,a[2] = map(int, input().split())
a[3], a[4] ,a[5] = map(int, input().split())
a[6], a[7] ,a[8] = map(int, input().split())
N = int(input())
for n in range(N):
  b = int(input())
  for i in range(9):
    if a[i] == b:
      a[i] = 0
if a[0]+a[1]+a[2] == 0 or a[3]+a[4]+a[5] == 0 or a[6]+a[7]+a[8] == 0 or a[0]+a[3]+a[6] == 0 or a[1]+a[4]+a[7] == 0 or a[2]+a[5]+a[8] == 0 or a[0]+a[4]+a[8] == 0 or a[2]+a[4]+a[6] == 0:
  print('Yes')
else:
  print('No')

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

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int light[10][10];
bool solve(int n){
  int ans[10][10];
  int rslt[10];
  REP(i,10){
    if(i==0) REP(j,10)ans[i][j] = (n>>j&1);
    else REP(j,10) ans[i][j] = rslt[j];
    REP(j,10) rslt[j] = light[i][j];
    REP(j,10){
      if(j-1>=0)rslt[j] ^= ans[i][j-1];
      rslt[j] ^= ans[i][j];
      if(j+1<10)rslt[j] ^= ans[i][j+1];
      if(i-1>=0)rslt[j] ^= ans[i-1][j];
    }
  }
  bool right = true;
  REP(j,10) if(rslt[j]) right = false;
  if(right){
    REP(y,10){
      REP(x,10){
        if(x) cout<<" ";
        cout<<ans[y][x];
      }
      cout<<endl;
    }
  }
  return right;
}


int main(void){
  int N;
  cin>>N;
  while(N--){
    REP(y,10)REP(x,10) cin>>light[y][x];
    REP(i,1<<10) if(solve(i)) break;
  }
  return 0;
}

Measured memory_bytes: 0
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=0
i=0
while x>0 and i<n:
    if i==n-1:
        if x==a[i]:
            ans+=1
        break
    if x>=a[i]:
        x-=a[i]
        ans+=1
    i+=1
print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

class Main {
  static public void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    long A = sc.nextLong();
    long B = sc.nextLong();
    long gcd = gcd(A, B);
    int counter = 1;
    for(int i = 2; i <= Math.sqrt(gcd); i++) {
      if(gcd % i == 0) {
        counter++;
      }
      while(gcd % i == 0) {
        gcd /= i;
      }
    }
    if (gcd > 1) {
      counter++;
    }
    System.out.println(counter);
    return;
  }

  private static long gcd(long m, long n) {

    if(n == 0) {
      return m;
    }
    return gcd(n, m % n);
  }
}


Measured memory_bytes: 22996
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  vl x(n);
  ll m = INT_MAX, M = INT_MIN;
  rep(i, n) {
    cin >> x[i];
    m = min(m, x[i]);
    M = max(M, x[i]);
  }
  ll ans = INT_MAX;
  REP(t, m, M + 1) {
    ll tmp = 0;
    rep(i, n) tmp += (x[i] - t) * (x[i] - t);
    ans = min(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(n)-1,i##_len=(int)(s);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};
//今回の変数

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
ll Minl(ll a, ll b) {
	return (a)<(b) ? (a) : (b);
}
ll Maxl(ll a, ll b) {
	return (a)>(b) ? (a) : (b);
}

int main() {
	char s[5];
	scanf("%s", &s);

	REP(i, 3) {
		if (s[i] == s[i + 1]) {
			puts("Bad");
			return 0;
		}
	}
	puts("Good");
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define BUF 1e5
#define INF 1 << 30
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
constexpr ll mod = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

int dfs(int now, vvi &g, vi &tree) {
    if (g[now].size() == 0) {
        tree[now] = 0;
        return 0;
    }
    int res = 0;
    for (auto adj : g[now]) {
        res += dfs(adj, g, tree);
    }
    tree[now] = res;
    return res;
}

signed main() {
    cin >> N >> Q;
    vvi g(N);
    vi t(N, 0);
    vi res(N, 0);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int q = 0; q < Q; q++) {
        int p, x;
        cin >> p >> x;
        p--;
        t[p] += x;
    }
    vi used(N, 0);
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
        int now = q.front();
        used[now] = 1;
        q.pop();
        res[now] = t[now];
        for (auto adj : g[now]) {
            if (used[adj])
                continue;
            t[adj] += t[now];
            q.push(adj);
        }
    }
    for (int i = 0; i < N; i++) {
        cout << res[i];
        if (i == N - 1) {
            cout << endl;
        } else {
            cout << " ";
        }
    }
}

Measured memory_bytes: 17140
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int y, m, d;
  char tmp;
  scan(y, tmp, m, tmp, d);
  if (y < 2019) {
    print("Heisei");
    return 0;
  }
  if (y == 2019 && m <= 4) {
    print("Heisei");
    return 0;
  }
  print("TBD");

  return 0;
}


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

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

  if (a == 'H') {
    cout << b << endl;
  } else {
    if (b == 'H') cout << 'D' << endl;
    else cout << 'H' << endl;
  }
}


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

int main() {
  string S;
  cin >> S;
  if(S.at(0) == S.at(1) && S.at(1) == S.at(2)){
    cout << "Yes" << endl;
  }
  else if(S.at(3) == S.at(1) && S.at(1) == S.at(2)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}



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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a%b);
}

int vis[999];
bool naive(ll A, ll B, ll C, ll D) {
  if (max({A,B,C,D}) > 30) return false;
  CLR(vis, 0);
  ll x = A;
  for (;;) {
    if (x < B) return false;
    if (vis[x]) return true;
    vis[x] = true;
    x -= B;
    if (x <= C) x += D;
  }
}

bool solve(ll A, ll B, ll C, ll D) {
  if (A < B) return false;
  if (D < B) return false;
  if (C+1 >= B) return true;
  // A >= B
  // D >= B
  // C+1 < B

  ll g = gcd(B, D);
  ll ma = B - g + A % g;
  return !(C < ma);
}

int main2() {
  int T = nextInt();
  for (;T--;) {
    ll a = nextLong();
    ll b = nextLong();
    ll c = nextLong();
    ll d = nextLong();
    bool res = solve(a, b, c, d);
    // if (max({a, b, c, d}) <= 30) {
    //   bool res2 = naive(a, b, c, d);
    //   if (res != res2) {
    //     cout << "WA: " << res << " vs " << res2 << "     " << a << " " << b << " " << c << " " << d << endl;      }
    // }
    cout << (res ? "Yes":"No") << endl;
  }
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

int main(){
long N;
  cin>>N;
 vector<long>count(1005);
  long mod=1e9+7;
  
  for(long i=1; i<=N; i++){
    long T=i;
   for(long j=2; j<=i; j++){
      while(T%j==0){ // Tがjで何回割り切れるかカウント
       count[j]++; 
       T/=j;
      }
   } // N!がどの素因数で何回割り切れるかは、
  } // 1~Nまでの数がそれぞれどの素因数で何回割り切れるかを求めて足し合わせると求まる
   // そのため、iを1~Nまで取り、j<=iまでで割り切れたjを全てcount[j]に入れている
  long ans=1;
  for(long j=2; j<=N; j++){ // N=a^x+b^yなら、Nの約数の個数は(x+1)*(y+1)個
   ans=(ans*(count[j]+1))%mod; // 数値が巨大になるため、各計算ごとに%modをしている
  }
  
  cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
 
using namespace std;
int N;
int P[200001];

int main()
{
  int i,j;
  int count;
  int min;

  cin >> N;
  for (i=1; i<=N; i++) {
    cin >> P[i];
  }

  count=1;
  min = P[1];
  for (i=2; i<=N; i++) {
    if (P[i]<min) {
      count++;
      min=P[i];
    }
  }

  printf("%d\n", count);

  return 0;
}


Measured memory_bytes: 1024
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<string>
#include<cstring>
using namespace std;
typedef vector<int>VI;
typedef vector<VI>VVI;
typedef vector<string>VS;
typedef pair<int,int>PII;
typedef long long LL;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define PB push_back
#define EACH(i,c) for(typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

const int MOD=10000;
int M;
int memo[501][10][3][2][500];
//up->1,down->0;
string s;
int solve(int n,int prev,int ud,int fr,int md){
    if(n==s.size())return md?0:1;
    if(memo[n][prev][ud][fr][md]!=-1)
        return memo[n][prev][ud][fr][md];
    int ret=0;
    for(int i=0;i<=(fr?9:s[n]-'0');i++){
        if(ud==1&&prev>=i)continue;
        if(ud==0&&prev<=i)continue;
        if(ud==2&&prev!=0&&prev==i)continue;

        int u;
        if(ud==2){
            if(prev==0)u=2;
            else if(prev<i)u=0;
            else u=1;
        }
        else u=1-ud;
        int f;
        if(fr)f=1;
        else{
            if(i!=s[n]-'0')f=1;
            else f=0;
        }
        ret+=solve(n+1,i,u,f,(md*10+i)%M);
        ret%=MOD;
    }
    return memo[n][prev][ud][fr][md]=ret;
}

int main(){
    string A,B;
    cin>>A>>B>>M;
    for(int i=A.size()-1;i>=0;i--){
        if(A[i]=='0'){
            A[i]='9';
        }
        else{
            A[i]--;
            break;
        }
    }
    s=A;
    memset(memo,-1,sizeof(memo));
    int a=solve(0,0,2,0,0);
    s=B;
    memset(memo,-1,sizeof(memo));
    int b=solve(0,0,2,0,0);
    cout<<(b-a+MOD)%MOD<<endl;

    return 0;
}

Measured memory_bytes: 59996
#include <stdio.h>
    int main ()
    {long long int a=1,b=1,c=0,d=1,n,i,e,o,j;
    scanf("%lld%lld",&e,&o);

for(i=1;i<e;i++)
{
    for(j=i;j<e;j++)
    {
        c++;
    }
}
for(i=1;i<o;i++)
{
    for(j=i;j<o;j++)
    {
        c++;
    }
}printf("%d\n",c);
        return 0;
    }


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n,m,a[101010],b[101010],k,ans=1e9+100;
int main()
{
	cin>>n>>m>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int j=0;j<m;j++)
	{
		cin>>b[j];
	}
	for(int i=0;i<k;i++)
	{
		int x,y,z;
		cin>>x>>y>>z;
		x--;
		y--;
		ans=min(ans,a[x]+b[y]-z);
	}
	sort(a,a+n);
	sort(b,b+m);
	ans=min(ans,a[0]+b[0]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
# https://atcoder.jp/contests/abc171/tasks/abc171_c

import sys
input = sys.stdin.readline
import string

numbers = string.digits                             # [0-9] をロード
abc = string.ascii_lowercase                        # [a-z] をロード
ABC = string.ascii_uppercase                        # [A-Z] をロード
characters = numbers + abc + ABC                    # [0-9] + [a-z] + [A-Z] の 62進数まで対応


def base_cvt(value, n=2, output=characters):        # n=26, output=abc で、[a-z]表示の26進数を生成可能
    try:
        tmp = int(value)
    except:
        raise ValueError('Invalid value:', value)   # 整数以外はアウト

    if n < 2 or n > len(characters):                # 62進数まで対応
        raise ValueError('Invalid n:', value)

    coef = []
    while tmp >= n:
        idx = tmp % n                               #  tmp = a_k n^k + ... a_1 n^1 + a_0 n^0 の a_0 の値を取り出す
        coef.append(idx)
        tmp = tmp // n                              # a_k n^k + ... a_1 n^1 + a_0 n^0 ⇒　a_k n^k + ... a_1 n^1　:最小桁を消去してループ
    idx = tmp % n
    coef.append(idx)                                # coef = [a_0, a_1, ... , a_k]
    res = "".join(map(lambda x: output[x], reversed(coef)))
    return res

#####################################################################################################
  
  
N = int(input())

k = 0
while N - 26 ** k >= 0:
    N -= 26 ** k
    k += 1

res = base_cvt(N, 26, abc)
l = len(res)
print("".join(["a"] * (k - l)) + res)

Measured memory_bytes: 71856
#include<iostream>
#include<cmath>
using namespace std;
int main() {
	int t, x, y, N;
	int tt=0, xx=0, yy=0,xy,ttt;
	int temp = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> t >> x >> y;
		if (t - tt < abs(x - xx) + abs(y - yy)) {
			cout << "No" << endl;
			return 0;
		}
		if (abs(x - xx) + abs(y - yy)-1 == 0) {
			xy = 0;
		}
		else {
			xy = (abs(x - xx) + abs(y - yy)-1) % 2;
		}
		if (t - tt == 0) {
			ttt = 0;
		}
		else {
			ttt = (t - tt) % 2;
		}
		if (xy==ttt) {
			cout << "No" << endl;
			return 0;
		}
		tt = t; xx = x; yy = y;
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,sum1=0,sum2=0;
cin>>N;
vector<int>a(N);
for(int &x:a)cin>>x;
sort(a.begin(),a.end());
reverse(a.begin(),a.end());
for(int i=0;i<N;i++){
    if(i%2==0)sum1+=a[i];
    else sum2+=a[i];
}
cout<<abs(sum1-sum2);

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int a[100];

int selectionSort(int a[], int n) {
  int count = 0, tmp;
  for (int i = 0; i < n; ++i) {
    int minj = i;
    for (int j = i; j < n; ++j) {
      if (a[j] < a[minj]) {
        minj = j;
      }
    }
    if (i != minj) {
      tmp = a[i];
      a[i] = a[minj];
      a[minj] = tmp;
      count++;
    }
  }
  return count;
}
int main(int argc, char *argv[]) {
  int n, num = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  num = selectionSort(a, n);
  for (int i = 0; i < n; ++i) {
    cout << a[i];
    if (i != n - 1)
      cout << " ";
    else
      cout << "\n";
  }
  cout << num << endl;
  return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<math.h>
using namespace std;

int main() 
{
    int n;
    cin>>n;
    int c[n], v[n];
    for(int i=0; i<n; i++)
    {
    	cin>>v[i];
	}
	for(int i=0; i<n; i++)
    {
    	cin>>c[i];
	}
	int t=0;
	for(int i=0; i<n; i++)
    {
		(v[i]>c[i])?t+=v[i]-c[i]:t+=0;
	}
    
    cout<<t<<endl;
    
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define has(c,i) ((c).find(i) != end(c))
#define DBGDO(X) ({ if(1) cerr << "DBGDO: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n, m; cin >> n >> m;

	vvl adj(n);
	
	FOR(i,0,m) {
		ll a, b; cin >> a >> b;
		a--, b--;
		adj[a].pb(b);
		adj[b].pb(a);
	}

	ll c1 = 0, cb = 0, cn = 0;
	vl col(n,-1);
	FOR(i,0,n) if (col[i] == -1) {
		queue<ll> q;
		q.push(i);
		col[i] = 0;
		bool bip = true;
		while (sz(q)) {
			ll j = q.front(); q.pop();
			for (ll k: adj[j]) {
				if (col[k] == col[j]) bip = false;
				if (col[k] != -1) continue;
				col[k] = !col[j];
				q.push(k);
			}
		}
		if (sz(adj[i])) {
			if (bip) cb++; else cn++;
		} else {
			c1++;
		}
	}
	
	ll res = c1*c1 + 2*c1*(n-c1);
	res += (cb+cn)*(cb+cn) + cb*cb;
	cout << res << endl;

}



Measured memory_bytes: 9984
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace __gnu_pbds; 
using namespace std;

#define ld long double
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define int long long
#define ull unsigned long long 
#define pii pair<int,int>
#define vii vector<int>
#define f first
#define s second
#define endl "\n"
#define all(container) container.begin(), container.end()
#define onlyunique(v) v.erase(unique(all(v)), v.end());

#define TRACE
#ifdef AYUSH
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

template <typename T>
using ordered_set =tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }

int const mod = 1e9+7;
int const inf = 1e18;

int power(int x, int y, int mod = 2e18){ int ans = 1;x %= mod;while(y){if(y&1)ans = (x * ans) % mod;x = (x * x) % mod;y >>= 1;}return ans;}
int modinv(int a, int m){return power(a, m-1-2, m-1);}

void solve(){
	int n;cin>>n;
	vector<pair<int, pair<string, int>>> a;
	vector<pair<int, pair<string, int>>> gr, sm;
	string zero;int zero_ind = -1;
	for(int i=0;i<n;++i){
		string x;cin>>x;
		int l = 0, r = 0;
		for(auto c:x){
			if(c == '(')++l;
			else{
				if(l>0)
					--l;
				else
					++r;
			}

		}
		if(l > r){
			gr.pb({r, {x, i}});
		}
		else{
			sm.pb({l, {x, i}});
		}
	}
	sort(all(gr));
	sort(all(sm));
	reverse(all(sm));
	string ans;
	vii an;
	for(int i=0;i<gr.size();++i){
		ans += gr[i].s.f;
		an.pb(gr[i].s.s);
	}
	for(int i=0;i<sm.size();++i){
		ans += sm[i].s.f;
		an.pb(sm[i].s.s);
	}

	trace(ans);
	int l = 0, r = 0;
	for(auto c:ans){
		if(c == '(')++l;
		else ++r;
		if(r > l){
			cout<<"No";return;
		}
	}
	if(l != r){
			cout<<"No";return;
		
	}
	cout<<"Yes\n";
	
}
signed main(){
    IOS
    int t=1, T=1;
    // cin>>t;
    while(t--){
    	// cout<<"Case #"<<T<<": ";
    	solve();
    	// ++T;
    }
    return 0;
}

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

int M,C,N;

map<int,int> desk[111];
int take(int bk,int &res){  
  for(int i=0;i<M;i++){
    if( desk[i].count(bk) ) {
      res += i+1;
      desk[i].erase(bk);
      return i;
    }
  }
  res += M+1;
  return M;
}
int put(int bk,int cnt,int st,int &res){
  for(int i=st;i<M;i++){
    if( (int)desk[i].size() < C ) {
      res += i+1;
      desk[i][bk] = cnt;
      return i;      
    }
  }
  res += M+1;
  return M;
}

pair<int,int> mink(map<int,int> &mp){
  auto p = make_pair(0,(1<<19));
  for( auto it = mp.begin(); it != mp.end(); it++ ){
    if( p.second > it->second ) p = *it;
  }
  return p;
}

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

  while( cin >> M >> C >> N && (M|C|N) ){

    queue<int> q;
    queue<int> hq[111];


    for(int i=0;i<N;i++){
      int k; cin >> k;
      for(int j=0;j<k;j++){
        int b; cin >> b; hq[i].push(b);
      }
      q.push(i);
    }
    int res = 0;
    int cnt = 0;
    while( !q.empty() ) {
      cnt++;
      int p = q.front(); q.pop();
      if( hq[p].empty() ) continue;
      int bk = hq[p].front(); hq[p].pop();


      take(bk,res);
      int pid = put(bk,cnt,0,res);
      if( pid != 0 ){
        auto dt = mink(desk[0]);
        take( dt.first, res );
        put( dt.first, dt.second, 1, res );

        take( bk,res);
        assert( put(bk, cnt, 0, res) == 0 );
      }
      //cout << cnt << ": " << res << endl;
      q.push( p );
    }
    for(int i=0;i<=M;i++) desk[i].clear();
    cout << res << endl;
  }
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N;
    int a[123] = {};
    Scd(N);
    Rep(i,N) Scd(a[i]);
    sort(a,a+N);
    reverse(a,a+N);

    Repe(i,N,1){
        a[N] += a[i];
    }

    YesNo( a[N] > a[0] );

    return 0;
}



Measured memory_bytes: 256
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
k = gets.chomp.to_i

array = [a, b, c, d, e]

array.each do |x|
  array.each do |y|
    next if x >= y
    if y - x > k
      puts ':('
      exit
    end
  end
end
puts 'Yay!'


Measured memory_bytes: 1788
#include <iostream>
int main(){
  using namespace std;
  int L,R,now_min;
  now_min = 2019;
  cin >> L >> R;
  if(R-L+1 >= 2019){
    cout << 0 << endl;
    return 0;
  }
  for(int i=L;i<R;i++){
    for(int j=i+1;j<=R;j++){
      now_min = min(((i%2019)*(j%2019))%2019, now_min);
      if(now_min==0){ break; }
    }
  }
  cout << now_min << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int c = scanner.nextInt();
        scanner.nextLine();
        char[] chars = scanner.nextLine().toCharArray();
        boolean[] canWork = new boolean[n];
        for (int i = 0; i < n; i++) {
            canWork[i] = chars[i]=='o';
        }
        if(c==0){
            int count = 0;
            for (boolean b : canWork) if(b) count++;
            if(k==count){
                for (int i = 0; i < n; i++) {
                    if(canWork[i]){
                        System.out.println(i+1);
                    }
                }
            }
            return;
        }else{
            int[] lg = new int[k];
            int[] rg = new int[k];
            int counter = 0;
            int i=0;
            while (counter<k){
                while (!canWork[i]) i++;
                lg[counter]=i;
                i+=c+1;
                counter++;
            }
            counter=k-1;
            i=n-1;
            while (counter>=0){
                while (!canWork[i]) i--;
                rg[counter]=i;
                i-=c+1;
                counter--;
            }
            for (int j = 0; j < k; j++) {
                if(lg[j]==rg[j]) System.out.println(lg[j]+1);
            }
        }
    }
}


Measured memory_bytes: 50800
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
  long long n;
  cin>>n;
  long long a,b;
  for(a=sqrt(n);a>=1;a--){
    if(n%a==0){
      b=n/a;
      break;
    }
  }
  int dight=0;
  while(b>0){
    dight++;
    b/=10;
  }
  cout<<dight<<endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[501][501];
int main()
{
//	freopen("express.in","r",stdin);
//	freopen("express.out","w",stdout);
	int n,m,p,x,y;
	scanf("%d%d%d",&n,&m,&p);
	for(int i=1;i<=m;i++)//O(nm)	(<=100000000(1s))
	{
		scanf("%d%d",&x,&y);
		if(y<x)	swap(x,y);
		for(int i=y;i<=n;i++)
			a[x][i]++;
	}
	for(int i=n-1;i>=1;i--)//O(n^2)	(<=250000)
		for(int j=1;j<=n;j++)
			a[i][j]+=a[i+1][j];
	for(int i=1;i<=p;i++)//O(p)	(<=100000)
	{
		scanf("%d%d",&x,&y);
		printf("%d",a[x][y]);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1920
import java.util.Arrays;
    import java.util.Scanner;
     
    public class Main {
    	public static void main(String[]args) {
    		try(Scanner scan = new Scanner(System.in)){
    			
    			
    			int N = scan.nextInt();
    			int[]A = new int[N];
    			for(int i = 0;i<N;i++)A[i] = scan.nextInt();
    			
    			
    			Arrays.sort(A);
    			
    			
    			for(int i = 0;i<N-1;i++) {
    				if(A[i]<0&&A[i+1]<0) {
    					A[i]=-1*A[i];
    					A[i+1]=-1*A[i+1];
    				}else if(A[i]<0&&A[i+1]==0) {
    					A[i]=-1*A[i];
    				}else if(A[i]<0&&A[i+1]>0) {
    					if(A[i]+A[i+1]<-A[i]-A[i+1]) {
    						A[i]=-1*A[i];
    						A[i+1]=-1*A[i+1];
    					}
    				}
    	
    			}
    			
    			
    			
    			long g = 0;
    			
    			for(int i = 0;i<N;i++) {
    				g+=A[i];
    			}
    			
    			System.out.println(g);
    			
    			
    			
    			
    			
    			
    		}
    		
    		
    	}
    		
     
    }

Measured memory_bytes: 60744
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2 vector<vec>
#define vecll2 vector<vecll>
#define vec3 vector<vec2d>
#define vecll3 vector<vecll2d>
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(vector<T> v){for(T e:v)cout<<e<<" ";cout<<endl;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}

const int N=1e5+10;
const ll INF=1e9+7;
ll a[N<<4];
int sum[11];
main(){
    ios
    int h,w,n;scanf("%d%d%d",&h,&w,&n);
    ll x,y;
    int cnt=0;
    ll m=(ll)(h-2)*(w-2);
    rep(iii,n){
        scanf("%d%d",&x,&y);
        rep(i,3)if( x-i>=1 && x-i<=h-2){
            rep(j,3)if(y-j>=1 && y-j<=w-2){
            a[cnt++]=((x-i)<<32)+(y-j);
            }
        }
    }
    sort(a,a+cnt);
    ll t=1;
    rep(i,cnt){
        if(a[i]==a[i+1])t++;
        else sum[t]++,t=1,m--;
    }
    cout<<m<<" ";
    rep2(i,1,9)cout<<sum[i]<<" ";
}



Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 922337203685477;
const ll mininf = -922337203685477;
const ll nax = 0;

string s;
map<ll, ll> mp;
ll p10, ans, sum;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
	
	cin >> s;
	mp[0]++;
	p10 = 1;
	for(ll i = s.size() - 1; i >= 0; i--){
		sum += (s[i] - '0') * p10 % 2019;
		sum %= 2019;
		p10 = (p10 * 10) % 2019;
		ans += mp[sum];
		mp[sum]++;
	}
	cout << ans << '\n';
		
}


Measured memory_bytes: 3752
#include <stdio.h>
#include <string.h>
#include <queue>
using namespace std;
char sa[110], sb[110], sc[110];
queue<char> A, B, C;

int main()
{
  scanf("%s", sa);
  scanf("%s", sb);
  scanf("%s", sc);
  
  for(int i=0; i<strlen(sa); i++)
    A.push(sa[i]);
  
  for(int i=0; i<strlen(sb); i++)
    B.push(sb[i]);
  
  for(int i=0; i<strlen(sc); i++)
    C.push(sc[i]);
  
  char t=A.front(); A.pop();
  
  while(1)
  {
    if(t=='a')
    {
      if(A.empty())
      {
        printf("A"); return 0;
      }
      t=A.front();
      A.pop();
    }
    else if(t=='b')
    {
      if(B.empty())
      {
        printf("B"); return 0;
      }
      t=B.front();
      B.pop();
    }
    else if(t=='c')
    {
      if(C.empty())
      {
        printf("C"); return 0;
      }
      t=C.front();
      C.pop();
    }
    
  }
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int,input().split()))
stp=0
for i in range(N-1,0,-1):
    if H[i]+1 == H[i-1]:
        H[i-1]-=1
    elif H[i] >= H[i-1]:
        pass
    elif H[i] < H[i-1]+1:
        print("No")
        stp = 1
        break
if stp != 1:
    print("Yes")

Measured memory_bytes: 63856
import java.util.Scanner;

class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int H = Integer.parseInt(sc.next());
		int A = Integer.parseInt(sc.next());
		int count = 0;

		while(true) {
			if(H <= 0) break;
			count++;
			H -= A;

		}
		System.out.println(count);
	}
}

Measured memory_bytes: 22612
// D - Five, Five Everywhere
#include <bits/stdc++.h>
using namespace std;
using VB = vector<bool>;

VB primes_create(int n){
	VB p(n+1, true);
	p[0] = p[1] = false;
	for(int i=2; i*i<=n; ++i)
		if(p[i]) for(int j=i+i; j<=n; j+=i) p[j] = false;
	return p;
}

int main(){
	int N; cin>>N;
	VB P = primes_create(55555);
	for(int n=0,p=11; p<P.size() && n<N; p+=10)
		if(P[p] && p%5==1){ cout<<p<<" "; n++; }
}

Measured memory_bytes: 256