akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
  
using namespace std;

#define pi 3.141592653589793

int main()
{
	double a, b, c;
	cin >> a >> b >> c;
	c = c * pi / 180;
	double s, l, h;
	s = (a * b * sin(c)) / 2;
	l = sqrt((a * a) + (b * b) - 2 * a * b * cos(c)) + a + b;
	h = 2 * s / a;
	printf("%f\n%f\n%f\n", s, l, h);
	return 0;
}

Measured memory_bytes: 1232
#include <stdio.h>

int main(void){
  char a[3];
  
  scanf("%s", &a);
  
  if( a[0] == 'S' && a[1] == 'U') printf("%d", 7);
  else if( a[0] == 'M' && a[1] == 'O') printf("%d", 6);
  else if( a[0] == 'T' && a[1] == 'U') printf("%d", 5);
  else if( a[0] == 'W' && a[1] == 'E') printf("%d", 4);
  else if( a[0] == 'T' && a[1] == 'H') printf("%d", 3);
  else if( a[0] == 'F' && a[1] == 'R') printf("%d", 2);
  else if( a[0] == 'S' && a[1] == 'A') printf("%d", 1);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <queue>

using namespace std;


int main() {

    long r, D, x;

    cin >> r >> D >> x;

    int ux = x;

    for (int i = 0; i < 10; i++) {

        ux = r * ux - D;
        cout << ux << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import heapq

def main():
    n = int(input())
    values=[]
    heap_values=[]
    values=list(map(int,input().split()))
    [heapq.heappush(heap_values, value) for value in values]

    while len(heap_values)!=1:
        tmp1=heapq.heappop(heap_values)
        tmp2=heapq.heappop(heap_values)
        tmp_value=(tmp1+tmp2)/2
        heapq.heappush(heap_values,tmp_value)

    print(heap_values[0])

if __name__=="__main__":
    main()

Measured memory_bytes: 9208
#include<cstdio>
using namespace std;
int sosu[55555];
main(){
  int N;

  sosu[0]=1;
  sosu[1]=1;
  for(int j=2;j<224;j++){
    if(sosu[j]==1) continue;
    for(int i=j+j;i<50001;i+=j){
      sosu[i]=1;
    }
  }
  
  while(1){
    scanf("%d",&N);
    if(N==0) break;
    int res=0;
    for(int i=2;i<=N/2;i++){
      int a = N-i;
      if(sosu[a]==0 && sosu[i]==0){
	res++;
      }
    }
    printf("%d\n",res);
  }
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	int n;cin>>n;
	int ans=n/2;
	if(n%2==0)ans--;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
a = list(map(int,input().split()))
#b = list(map(int,input().split()))

h = 0
p = 1
li = []

for i in range(999):
    h +=p
    p +=1
    li.append(h)

for i in range(len(li)):
    for k in range(len(li)):
        if (a[0]-li[i])==(a[1]-li[k]) and k == i+1:
            print(abs(a[0]-li[i]))
            



Measured memory_bytes: 9184
// B.

#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(int argc, char *argv[]) {
	int n, m;
	cin >> n >> m;
	int cnt[32] = {};
	for (int i = 0; i < n; ++i) {
		int k;
		cin >> k;
		for (int j = 0; j < k; ++j) {
			int a;
			cin >> a;
			cnt[a] += 1;
		}
	}
	int ans = 0;
	for (int i = 1; i <= m; ++i) {
		ans += cnt[i] >= n;
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
	int n,a,b;
	cin >>n>>a>>b;
	vector<int> p(n);
	rep(i,n)
		cin>>p[i];
	int ag=0,bg=0,cg=0;
	rep(i,n){
		if (p[i]<=a)
			ag++;
		else if (a<p[i]&&p[i]<=b)
			bg++;
		else
			cg++;
	}
	int ans=(int)min(ag,min(bg,cg));
	cout <<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define  endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define pb push_back
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const int N=4e3+10;
int r[N],g[N],b[N];
int main()
{
	int n,m,q;
	cin>>n;
	string s;
	cin>>s;
	s='.'+s;
	for(int i=n;i>=1;i--){
		r[i]=r[i+1];
		g[i]=g[i+1];
		b[i]=b[i+1];
		if(s[i]=='R') r[i]++;
		if(s[i]=='G') g[i]++;
		if(s[i]=='B') b[i]++;
	}
	ll ans=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(s[i]==s[j]) continue;
			if(s[i]!='R'&&s[j]!='R'){
				ans+=r[j+1];
				if(j+j-i<=n&&s[j+j-i]=='R') ans--;
			}
			if(s[i]!='G'&&s[j]!='G'){
				ans+=g[j+1];
				if(j+j-i<=n&&s[j+j-i]=='G') ans--;
			}
			if(s[i]!='B'&&s[j]!='B'){
				ans+=b[j+1];
				if(j+j-i<=n&&s[j+j-i]=='B') ans--;
			}
		}
	}
	cout<<ans;
}


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

int main(){
	int c1,c2,c3;
	while(cin >> c1 >> c2 >> c3){
		int p=20-c1-c2;
		int over=0, lower=0;
		for(int i=1; i<=10; i++){
			if(i==c1 || i==c2 || i==c3) continue;
			if(i > p) over++;
			else lower++;
		}
		if(over <= lower) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
   char c;
   cin >> c;

   if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
       cout << "vowel" << endl;
   }else{
       cout << "consonant" << endl;
   }
}

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

int n, m;
int a[1000];

int main() {
	
	while (cin >> n >> m) {
		if (!n) break;
		for (int i = 0; i < n; i++) cin >> a[i];
		int ans = -1;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				if (a[i] + a[j] <= m) {
					ans = max(ans, a[i] + a[j]);
				}
			}
		}
		
		if (ans == -1) { cout << "NONE" << endl; }
		else { cout << ans << endl; }
	}
	return 0;
}

Measured memory_bytes: 3096
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

double g(double x) {
  return double((int) (x * 1000)) / 1000;
}

void solve() {
  int a, b, c, d, e, f;
  while (cin >> a >> b >> c >> d >> e >> f) {
    int nx = c * e - b * f, ny = a * f - c * d;
    int de = a * e - b * d;
    cout << prec(3) << g(1.0 * nx / de) << ' ' << g(1.0 * ny / de) << endl;
  }
}

Measured memory_bytes: 3224
import itertools
import sys
N, = [int(i) for i in input().split(' ')]

yn = "No"

if N in []:
    pass
else:
    for i in range(pow(10, 4)):
        c = i * (i-1) // 2
        if c > N:
            break
        elif c == N:
            yn = "Yes"
            k = i
            break

if yn == "No":
    print(yn)
else:
    print(yn)
    print(k)
    co = 1
    d = [[] for i in range(k)]
    for x in itertools.combinations(range(k), 2):
        d[x[0]].append(str(co))
        d[x[1]].append(str(co))
        co += 1
    #print(d)
    for i in range(k):
        print(N*2//k, " ".join(d[i]))


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

void Main() {
  string s;
  cin >> s;
  if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) cout << "Bad" << endl;
  else cout << "Good" << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
long long K,tmp,cal;
cin>>K;
vector<long long> v;
for(int i=1;i<10;++i){
    v.push_back(i);
}
long long cnt=9;
for(int j=0;j<K;++j){
    tmp=v[j];
    if(tmp%10==0){
        v.push_back(tmp*10);
        v.push_back(tmp*10+1);
        cnt+=2;
    }
    else if(tmp%10==9){
        v.push_back(tmp*10+8);
        v.push_back(tmp*10+9);
        cnt+=2;
    }
    else{
        cal=tmp%10;
        v.push_back(tmp*10+cal-1);
        v.push_back(tmp*10+cal);
        v.push_back(tmp*10+cal+1);
        cnt+=3;
    }   
    if(cnt>K+100){
        break;
    }
}
cout<<v[K-1]<<"\n";
return 0;
}


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

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

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> l(n);
    vector<ll> r(n);
    rep(i, n-1) l[i+1] = gcd(l[i], a[i]);
    for ( int i = n-1; i >= 1; --i ) {
        r[i-1] = gcd(r[i], a[i]);
    }
    ll ans = 1;
    rep(i, n) {
        ans = max(ans, gcd(l[i], r[i]));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using ll = long long int;
using namespace std;
ll mod=1e9+7;
       

int main(){
  int a[32];
    a[0]=1;
    a[1]=1;
    a[2]=1;
    a[3]=2;
    a[4]=1;
    a[5]=2;
    a[6]=1;
    a[7]=5;
    a[8]=2;
    a[9]=2;
    a[10]=1;
    a[11]=5;
    a[12]=1;
    a[13]=2;
    a[14]=1;
    a[15]=14;
    a[16]=1;
    a[17]=5;
    a[18]=1;
    a[19]=5;
    a[20]=2;
    a[21]=2;
    a[22]=1;
    a[23]=15;
    a[24]=2;
    a[25]=2;
    a[26]=5;
    a[27]=4;
    a[28]=1;
    a[29]=4;
    a[30]=1;
    a[31]=51;
  int k;
  cin >> k;
  cout << a[k-1] << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
using namespace std;
using i8t = std::int64_t;
using u8t = std::uint64_t;
using vi8t = std::vector<i8t>;
using vvi8t = std::vector<std::vector<i8t>>;
using vu8t = std::vector<u8t>;
#include <limits>
static const i8t i8t_max=numeric_limits<i8t>::max();
static const i8t i8t_min=numeric_limits<i8t>::min();
#include <unordered_map>
#include <unordered_set>
template<typename Key,typename Value> using map_t=std::unordered_map<Key, Value>;
template<typename Key> using set_t=std::unordered_set<Key>;
#define F3(i,i0,iN,step) for(i8t i=i0,i##_N=iN;i<i##_N;i+=step)
#define F2(i,i0,iN) F3(i,i0,iN,1)
#define F(i,N) F3(i,0,N,1)
#define FR(i,N) for(i8t i=N;i--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
template<typename T> T umax(T& ans,T const& value) {if(value>ans)ans=value;return ans;}
template<typename T> T umin(T& ans,T const& value) {if(value<ans)ans=value;return ans;}
template<typename T> struct identity { using type = T; };

int main() {
  RL(S);
  P(S[2]==S[3]&&S[4]==S[5]?"Yes":"No");
  return 0;
}


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

int n, a[100004], b[100004];

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

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<string>
#define rint register int
using namespace std;
const int maxn=1003;
string s,tp;int n,ext[100005];
int main() {
	scanf("%d",&n);
	for(rint i=1;i<=n;++i) {
		cin>>tp;
		s+=tp;
	}
	int len=s.size();
	for(rint i=0;i<len;++i) {
		int x=0;
		for(rint j=i;j<i+5&&j<len;++j) {
			x=x*10+s[j]-'0';
			ext[x]=1;
		}
	}
	for(rint i=0;i<=99999;++i) if(!ext[i]) {
		cout<<i<<endl;return 0;
	}
	return 0;
}
 


Measured memory_bytes: 3636
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

A, B =  map(int, sys.stdin.readline().split())

print(max(A + B, max(A - B, A * B)))

Measured memory_bytes: 66412
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
 
vector<pair<int, int>> to[100010];
bool visited[100010];
ll dist[100010];


int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    to[u].push_back({v, w});
    to[v].push_back({u, w});
  }
   //bfs
    queue<int> que;
    que.push(0);
    visited[0] = true;
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        ll d = dist[v];
        for (auto p : to[v]) {
            if (visited[p.first]){ continue;}
            dist[p.first] =  d+p.second;
            que.push(p.first);
            visited[p.first] = true;
        }
    }
  for (int i = 0; i < N; i++) cout << dist[i] % 2 << endl;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

vector<int> dp(100500, 0);
vector<int> v;

int n, k;

void dfs(){
  for (int i = 2; i < n; i++) {
    int minv = INT_MAX;
    for (int j = 1; j <= k && i - j >= 0; j++) {
      minv = min(dp[i-j] + abs(v[i-j] - v[i]), minv);
    }
    dp[i] = minv;
  }

  cout << dp[n-1] << endl;
}

int main(){
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    v.push_back(tmp);
  }

  dp[0] = 0;
  dp[1] = abs(v[0] - v[1]);

  dfs();


}


Measured memory_bytes: 1276
#include <stdio.h>
#include <bitset>
#include <string.h>
#include <stack>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <complex>
#include <functional>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
typedef unsigned long long ull ;
#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define pi (acos(-1.0))
#define fi first
#define se second
#define lson (o<<1),l,mid
#define rson (o<<1|1),mid+1,r
#define MP make_pair
#define sqr(x) ((x)*(x))
#define ALL(v) (v).begin(),(v).end()
#define showtime fprintf(stderr,"time = %.15f\n",clock() / (double)CLOCKS_PER_SEC)
const double eps = 1e-9 ;
const int inf = 0x3f3f3f3f ;
const ll INF = (ll)4e18 ;
const int MOD=(int)1e9+7,BAS=257,invBAS=70038911;
inline int sign(double x){return x<-eps?-1:x>eps;}
inline int clz(int x){return __builtin_clz(x);}
inline int clz(ll x){return __builtin_clzll(x);}
inline int lg2(int x){return !x ? -1 : 31-clz(x);}
inline int lg2(ll x){return !x ? -1 : 63-clz(x);}

char s[100000+10];

int main () {
	scanf ("%s", s+1);
	int n = strlen (s+1)+1;
	if (n == 3) {
		if (s[1] == s[2]) {printf ("1 2\n");exit(0);}
	} else {
		for (int i=1; i+1<n; i++)
			if (s[i]==s[i+1]||s[i]==s[i+2]||s[i+1]==s[i+2]) {
				printf("%d %d\n", i, i==n-2?i+1:i+2); exit(0);
			}
	}
	puts ("-1 -1");
	return 0;
}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for(ll i = a; i < n; i++)

#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

ll n, x, res;
ll a[107];
int main()
{
	/*
	freopen("input.txt", "r", stdin);
	freopen ("output.txt", "w", stdout);
	*/
	cin >> n >> x;

	forn(i, 0, n)
	{
		cin >> a[i];
	}
	sort(a, a + n);
	ll co = 0;
	forn(i, 0, n)
	{
		co += a[i];
		if (co <= x)
			res++;
	}
	if (co < x && res==n)
	{
		res--;
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 256
W, H, N = map(int, input().split())

white = [0, W, 0, H]

points = [[int(i) for i in input().split()] for j in range(N)]

for point in points:
    if point[2] == 1:
        if point[0] > white[0]:
            white[0] = point[0]
    if point[2] == 2:
        if point[0] < white[1]:
            white[1] = point[0]
    if point[2] == 3:
        if point[1] > white[2]:
            white[2] = point[1]
    if point[2] == 4:
        if point[1] < white[3]:
            white[3] = point[1]

w = white[1] - white[0]
h = white[3] - white[2]

if w > 0 and h > 0:
    print(w * h)
else:
    print(0)

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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n;
	cin >> n;

	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	for (int i = n - 2; i >= 0; i--) {
		if (h[i] <= h[i + 1]) {
			continue;
		}

		h[i]--;
	}

	for (int i = 1; i < n; i++) {
		if (h[i - 1] <= h[i]) {
			continue;
		}

		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 640
n,a,b=gets.split(' ').map(&:to_i)
#h=gets.split(' ').map(&:to_i)
#tajigen = Array.new(4) { Array.new(2,0) }
waru=n/(a+b)
amari = n % (a+b)

if amari<a
  amari2=amari
else
  amari2=a
end

puts  a * waru + amari2

Measured memory_bytes: 1788
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import *
from bisect import *

def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]

N = read()
d = Counter(reads())

dup = sum(v-1 for k, v in d.items() if v >= 2)
print(N - (dup + 1) // 2 * 2)


Measured memory_bytes: 61676
#include <cstdio>
#include <queue>
#include <algorithm>
#define ll long long
#define ps push
#define rep(i,j,k) for (i=j;i<=k;i++)
#define down(i,j,k) for (i=j;i>=k;i--)
using namespace std;
const int N=1e5+5;
int n,i,x,y,z;
ll sum,Max,ans,pre[N],suf[N];
priority_queue<int> heap;
struct arr{
	int x,y,z,key;
}a[N];
bool cmp(const arr &A,const arr &B) {
	return A.key<B.key;
}
int main()
{
//	freopen("coins.in","r",stdin);
//	freopen("coins.out","w",stdout);
	scanf("%d%d%d",&x,&y,&z); n=x+y+z;
	rep(i,1,n) scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].z),a[i].key=a[i].y-a[i].x;
	sort(a+1,a+1+n,cmp);
//	rep(i,1,n) printf("%d %d %d\n",a[i].x,a[i].y,a[i].z);

	rep(i,1,x) heap.ps(a[i].z-a[i].x),sum+=a[i].x;
	rep(i,x,n-y)
	{
		pre[i]=sum+Max;
		heap.ps(a[i+1].z-a[i+1].x);
		Max+=heap.top();
		sum+=a[i+1].x;
		heap.pop();
	}
	while (!heap.empty()) heap.pop(); Max=sum=0;
	rep(i,n-y+1,n) heap.ps(a[i].z-a[i].y),sum+=a[i].y;
	down(i,n-y+1,x+1)
	{
		suf[i]=sum+Max;
		heap.ps(a[i-1].z-a[i-1].y);
		Max+=heap.top();
		sum+=a[i-1].y;
		heap.pop();
	}
	rep(i,x,n-y)
		ans=max(ans,pre[i]+suf[i+1]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3072
//AtCoder ABC079 B - Lucas Number
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    ll N;
    cin>>N;
    ll dp[86+10]; 
    dp[0]=2;
    dp[1]=1;
    for(ll i=2;i<=N;++i){
        dp[i]=dp[i-1]+dp[i-2];
    }   
    cout<<dp[N]<<endl;
    return 0;
}

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

int main(){
    int n, m, x;    cin >> n >> m >> x;
    int fc=0, bc=0;
    for(int i=0; i<m; i++){
        int p;  cin >> p;
        if(p<x) fc += 1;
        else bc += 1;
    }
    cout << min(fc, bc) << endl;
}
    

Measured memory_bytes: 256
#include<iostream>
#include <cstring>
 
using namespace std;
 
int main()
{   
    int i,j;
    char str[100001];
    cin >> str;
    j = strlen(str);
    for(i=0;i<j;i+=2){
    cout << str[i];
  }
       return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn=109;
char s[maxn];
int a[maxn];
int main()
{
    while(scanf("%s",s)!=EOF)
    {
        int len=strlen(s);
        memset(a,0,sizeof(a));
        for(int i=0;i<len;i++)
        {

            a[s[i]-'a']++;
        }
        int flag=1;
        for(int i=0;i<len;i++)
            if(a[s[i]-'a']%2!=0)
            {
                flag=0;
                break;
            }
            if(flag)
                printf("Yes\n");
            else
                printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
#define v vector
#define ll long long 
#define vpll vector<pair<long long,long long> > 
#define F first
#define S second
#define mp make_pair
#define lf long float
#define pb push_back
 
using namespace std; 
 
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<max(a+b,max(a-b,a*b));
	return 0;
}

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

using namespace std;

long long lcm(long long a, long long b) {
	return a / __gcd(a, b) * b;
}

int main() {

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

	vector<int> a(n);
	for(int &x : a) scanf("%d", &x), x /= 2;

	long long l = 1;

	for(int x : a) {
		l = lcm(l, 1LL * x);
		if(l > m) return printf("0\n"), 0;
	}
	int cnt[2] = {0, 0};
	for(int x : a) {
		cnt[l / x % 2]++;
	}
	if(cnt[0]) return printf("0\n"), 0;

	m /= l;

	printf("%d\n", (m + 1) / 2);
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int64_t x[100'000];

int main()
{
    int n;
    int64_t a, b;

    cin >> n >> a >> b;
    for (int i = 0; i < n; i++)
    {
        cin >> x[i];
    }

    int64_t s = 0;
    for (int i = 0; i < n - 1; i++)
    {
        s += min(b, a * (x[i + 1] - x[i]));
    }

    cout << s << endl;
    return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

const long long MAX = 510000;  // 最大を決めておく
// fac…階乗、inv…逆数、finv…逆数の累積積
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理、先にやっておく
void nCr_init() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// nCrを計算する (前処理は忘れないように)
long long nCr(int n, int r) {
  if (n < r) return 0;
  if (n < 0 || r < 0) return 0;
  return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

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

int main() {
  nCr_init();
  int n;
  cin >> n;
  vector<int> v(n + 1);
  for (int i = 0; i < n + 1; i++) { cin >> v[i]; }

  // ダブリを検出
  vector<int> count(n + 1);
  int dabu = -1;
  for (int i = 0; i < n + 1; i++) {
    if (count[v[i]])
      dabu = v[i];
    else
      count[v[i]]++;
  }

  int a = 0;  // ダブリの前、後ろに何個あるか
  bool kaz = true;
  for (int i = 0; i < n + 1; i++) {
    if (v[i] == dabu)
      if (kaz) {
        kaz = false;
      } else {
        kaz = true;
        continue;
      }

    a += kaz;
  }

  // cout << dabu << " " << a << endl;

  for (int i = 1; i <= n + 1; i++) {
    cout << (nCr(n + 1, i) - nCr(a, i - 1) + MOD) % MOD << endl;
  }
}


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

using ll=long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define ALL(v) v.begin(),v.end()

bool f(char c){
	return c=='a'||c=='i'||c=='u'||c=='e'||c=='o';
}

int main() {
	int n;
	while(cin>>n,n){
		vector<string> v(n);
		REP(i,n)cin>>v[i];
		for(int k=1;k<=50;++k){
			vector<string> code(n);
			REP(i,n){
				code[i]+=v[i][0];
				for(int j=1;j<v[i].size();++j){
					if(f(v[i][j-1]))code[i]+=v[i][j];
				}
				if(code[i].size()>=k)code[i]=code[i].substr(0,k);
			}
			
			set<string> s;
			REP(i,n)s.insert(code[i]);
			if(s.size()==n){
				cout<<k<<endl;
				goto next;
			}
		}	
		cout<<-1<<endl;
		next:;
	}
	
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, j, k, count;
  count =0;
  cin >> N;
  for (int i=0;i<N;i++){
    cin >>j >>k;
    count += k-j+1;
  }
  cout << count << endl;
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m, i, a, b, f[200005], c[200005], ans;

int fa(int x) {
    if (f[x] != f[f[x]])
        f[x] = fa(f[x]);
    return f[x];
}

int main() {
    scanf("%d%d", &n, &m);
    for (i = 1; i <= n; ++i)
        f[i] = i;
    for (i = 1; i <= m; ++i) {
        scanf("%d%d", &a, &b);
        if (fa(a) != fa(b))
            f[fa(a)] = fa(b);
    }
    for (i = 1; i <= n; ++i)
        ans = max(ans, ++c[fa(i)]);
    printf("%d", ans);
}

Measured memory_bytes: 10740
#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef string str;
typedef vector<str> vst;
typedef vector<ll> vll;
// for (ll i=0;i<n;i++) {
// sort(.begin(),.end());
int main(){
  str s,ans="No";
  cin>>s;
  ll n=s.size(),existC=0;
  for (ll i=0;i<n;i++) {
    if (s[i]=='C') {
      existC=1;
    }
    if (existC==1 && s[i]=='F') {
      ans="Yes";
    }
  }
  cout<<ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define ll  long long
#define endl '\n'
#define pi 3.14159265
int main()
{           
    IOS;
    ll n,k;
    cin>>n>>k;
    ll mx=n/2+(n%2!=0);
    if(k<=mx)
    	cout<<"YES";
    else
    	cout<<"NO";
}   	

Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    y = 0

    if n == 0 and x == 0:
        break

    for i in range(n):
        for j in range(n):
            for k in range(n):
               if i < j < k:
                   if i + j + k + 3 == x:
                       y += 1

    print(y)




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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	if (s == "SUN") {
		cout << "7\n";
	} else if (s == "MON") {
		cout << "6\n";
	} else if (s == "TUE") {
		cout << "5\n";
	} else if (s == "WED") {
		cout << "4\n";
	} else if (s == "THU") {
		cout << "3\n";
	} else if (s == "FRI") {
		cout << "2\n";
	} else {
		cout << "1\n";
	}
	return 0;
}


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

#define mp make_pair
typedef long long ll;
typedef pair<int,int>pii;
const int N = 1e5;
int arr[N+100];
multiset<int>st;

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&arr[i]);
	}
	for(int i=1;i<=n;i++){
		auto it = st.lower_bound(arr[i]);
		if(it==st.begin())st.insert(arr[i]);
		else{
			it--;
			st.erase(it);
			st.insert(arr[i]);
		}
	}
	printf("%d\n",(int)st.size());
}


Measured memory_bytes: 5376
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int a[105],cnt;
string str;
int main(){
	cin>>str;
	for(int i=0;i<str.length();i++){
		if(str[i]=='0') a[++cnt]=0;
		else if(str[i]=='1') a[++cnt]=1;
		else if(cnt!=0) cnt--;
	}
	for(int i=1;i<=cnt;i++){
		cout<<a[i];
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#define pii pair<int,int>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define cl(a) memset((a),0,sizeof(a))
#define all(n) n.begin(),n.end()
#define lson(x) ((x<<1))
#define rson(x) ((x<<1)|1)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod=1000000007;
const int inf=0x3f3f3f3f;
const double eps=1e-8;
const double pi=acos(-1.0);

int p[100005];
int r[100005];
int find(int x)
{
    if(p[x]==x) return x;
    int pre=find(p[x]);
    r[x]+=r[p[x]];
    return p[x]=pre;
}
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    int x,y,w;
    bool flag=false;
    rep(i,0,n)
    {
        p[i]=i;
        r[i]=0;
    }
    while(m--)
    {
        scanf("%d%d%d",&x,&y,&w);
        int a=find(x),b=find(y);
        if(a==b)
        {
            if(r[x]-r[y]!=w)
            {
                flag=true;
                break;
            }
        }
        else
        {
            p[a]=b;
            r[a]=w+r[y]-r[x];
        }
    }
    if(!flag)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 1024
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1]*n
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
        
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return None
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        
    def size(self, x):
        return - self.parents[self.find(x)]
    
    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    
    def group_count(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


from collections import defaultdict
 
n, m, k = map(int, input().split())
uf = UnionFind(n+1)
friends = defaultdict(int)
block = defaultdict(int)

# Union-Find木を構築する+各人の直接の友達の数を数える
for _ in range(m):
    a, b = map(int, input().split())
    uf.union(a, b)
    friends[a] += 1
    friends[b] += 1

# Union-Find構造で同じグループに属している(友達の友達or友達の友達の友達or...)場合は、
# ブロック候補として数える(同じグループでない場合は、そもそも友達候補ではない)
for _ in range(k):
    c, d = map(int, input().split())
    if uf.find(c) == uf.find(d):
        block[c] += 1
        block[d] += 1

# 同じグループの人数から、直接の友達の数、ブロック候補の数(別グループの人は含まない)、
# そして、自分の分を差し引けば、友達候補の数を求められる
ans = []
for i in range(1, n+1):
    group_sise = uf.size(i)
    friend_size = friends[i]
    block_size = block[i]
    ans.append(group_sise - friend_size - block_size - 1)
print(*ans)

Measured memory_bytes: 32384
import Data.Array (Array, listArray, accumArray, (!))
import Data.List (sort)

type T a = (a,a)
f [x,y] = (x,y)

main = do
  [n,t] <- map read . words <$> getLine :: IO [Int]
  ys <-  sort . filter ((<=t).snd). map (f.map read.words).lines <$> getContents
  if null ys then putStrLn "TLE"
  else print . fst . head $ ys


Measured memory_bytes: 1020
#include<iostream>
#include<vector>
#include<string>
#include<cstdio>
using namespace std;

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)

int main(void){
  loop(i,1,10)
    loop(j,1,10)
    cout<<i<<"x"<<j<<"="<<i*j<<endl;
    //printf("%dx%d=%d\n",i,j,i*j);
    //*/
}

Measured memory_bytes: 1116
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        // code goes here
        int[] in = nextIntArray(br, 3);
        int[] rows = new int[in[0]];
        int[] cols = new int[in[1]];
        Map<String, Integer> map = new HashMap<>();
        for(int i = 0; i < in[2]; i++){
            int[] arr = nextIntArray(br, 2);
            map.put(arr[0]+"-"+arr[1], 0);
            rows[arr[0] - 1]++;
            cols[arr[1] - 1]++;
        }
        int maxrow = 0;
        for(int i = 0; i < in[0]; i++){
            maxrow = Math.max(maxrow, rows[i]);
        }
        List<Integer> maxRowId = new ArrayList<>();
        for(int i = 0; i < in[0]; i++){
            if(maxrow == rows[i]){
                maxRowId.add(i);
            }
        }
        int maxcol = 0;
        for(int i = 0; i < in[1]; i++){
            maxcol = Math.max(maxcol, cols[i]);
        }
        List<Integer> maxColId = new ArrayList<>();
        for(int i = 0; i < in[1]; i++){
            if(maxcol == cols[i]){
                maxColId.add(i);
            }
        }
        boolean has = true;
        for(int i = 0; i < maxRowId.size(); i++){
            for(int j = 0; j < maxColId.size(); j++){
                int x = maxRowId.get(i);
                int y = maxColId.get(j);
                if(!map.containsKey((x + 1)+"-"+(y + 1))){
                    has = false;
                    break;
                }
            }
        }
        if(!has)
        sb.append(maxcol + maxrow);
        else sb.append(maxcol + maxrow - 1);
        System.out.print(sb.toString());
    }

    private static int nextInt(BufferedReader br) throws IOException{
        return Integer.parseInt(br.readLine());
    }

    private static int[] nextIntArray(BufferedReader br, int n) throws IOException{
        StringTokenizer st = new StringTokenizer(br.readLine());
        int[] arr = new int[n];
        for(int i = 0; i < n; i++){
            arr[i] = Integer.parseInt(st.nextToken());
        }
        return arr;
    }

    static class Pair<A, B>{
        A first;
        B second;
        public Pair(A first, B second){
            this.first = first;
            this.second = second;
        }
    }
}


Measured memory_bytes: 101660
N, K = map(int,input().split())
R, S, P = map(int,input().split())
T = input()
l = [False]*N
ans = 0
for i in range(N):
  if T[i] == "r":
    l[i] = "p"
    ans += P
    if i-K >= 0:
      if l[i-K] == "p":
        ans -= P
        l[i] = "r"
        if i+K < N and T[i+K]=="s":
          l[i] = "s"
        elif i+K < N and T[i+K] == "p":
          l[i] = "p"
  elif T[i] == "s":
    l[i] = "r"
    ans += R
    if i-K >= 0:
      if l[i-K] == "r":
        ans -= R
        l[i] = "s"
        if i+K < N and T[i+K]=="r":
          l[i] = "r"
        elif i+K < N and T[i+K]=="p":
          l[i] = "p"
  else:
    l[i] = "s"
    ans += S
    if i-K>=0:
      if l[i-K] == "s":
        ans -= S
        l[i] = "p"
        if i+K < N and T[i+K]=="s":
          l[i] = "s"
        elif i+K < N and T[i+K]=="r":
          l[i] = "r"
print(ans)

Measured memory_bytes: 4212
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int A,B;
	cin >> A >> B;
	vector< vector<int> > d(A,vector<int>(B));
	for(int i =0; i < A*B; i++) cin >> d[i/B][i%B];

	vector< vector<int> > mincost(101,vector<int>(101,0));
	for(int i =1; i <= A; i++) for(int j =1; j <= B; j++)
		for(int k =0; k <= 100; k++) for(int l =0; l <= 100; l++)
			 mincost[k][l] =max(d[i-1][j-1]-k*i-l*j,mincost[k][l]);

	for(int i =1; i <= A; i++) for(int j =1; j <= B; j++) {
		int m =101;
		for(int k =0; k <= 100; k++) for(int l =0; l <= 100; l++)
			m =min(m,mincost[k][l]+k*i+l*j);
		if(m != d[i-1][j-1]) {
			cout << "Impossible\n";
			return 0;
		}
	}

	cout << "Possible\n";
	int N =2*(100+1), M =(N/2)*(N/2)+2*(N/2-1);
	cout << N << " " << M << "\n";
	for(int i =0; i < N/2-1; i++) cout << i+1 << " " << i+2 << " X\n";
	for(int i =0; i <= N/2-1; i++) for(int j =0; j <= N/2-1; j++)
		cout << i+1 << " " << N-j << " " << mincost[i][j] << "\n";
	for(int i =0; i < N/2-1; i++) cout << i+N/2+1 << " " << i+N/2+2 << " Y\n";
	cout << "1 " << N << "\n";
	return 0;}

// look at my code
// my code is amazing


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

using namespace std;
typedef long long ll;

int g[15][15];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            g[i][j] = -1;
        }
    }
    for (int i = 0; i < n; ++i)
    {
        int m;
        cin >> m;
        for (int j = 0; j < m; ++j)
        {
            int a, x;
            cin >> a;
            cin >> x;
            --a;
            g[i][a] = x;
        }
    }
    int ans = 0;
    for (int i = 0; i < (1 << n); ++i)
    {
        vector<int> d(n);
        for (int j = 0; j < n; ++j)
        {
            if (i >> j & 1)
            
            {
                d[j] = 1; // 正直者の組み合わせを仮定する
            }
        }
        bool ok = true;
        for (int j = 0; j < n; ++j)
        {
            if (d[j])
            {
                for (int k = 0; k < n; ++k)
                {
                    if (g[j][k] == -1)
                        continue; // 証言がない
                    if (g[j][k] != d[k])
                        ok = false; // 証言と異なる
                }
            }
        }
        if (ok)
            ans = max(ans, __builtin_popcount(i));
    }

    cout << ans << endl;

    return 0;
}

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

typedef pair<int,int> P;

int main(){
    int H,W,D; cin >> H >> W >> D;
    int a[H][W];
    vector<P> res(H*W);
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> a[i][j];
            a[i][j]--;
            res[a[i][j]]={i,j};
        }
    }
    vector<int> cost(H*W,0);
    for(int i=0;i<H*W-D;i++){
        cost[i+D]=cost[i]+abs(res[i+D].first-res[i].first)+abs(res[i+D].second-res[i].second);
    }
    //for(int i=0;i<H*W;i++){
        //cout << cost[i] << endl;
    //}
    int Q; cin >> Q;
    while(Q--){
        int l,r; cin >> l >> r;
        l--;r--;
        cout << cost[r]-cost[l] << endl;
    }

}

Measured memory_bytes: 2560
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    int A, B, C, D;
    cin>>A>>B>>C>>D;
    
    while(A>0 && C>0){
        C-=B;
        A -=D;
        if(C<=0){
            cout<<"Yes";
        }
        else if (A<=0){
            cout<<"No";
        }
    }
    
}


Measured memory_bytes: 3632
#
# abc095 b
#
import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    N, X = map(int, input().split())
    m = [0] * N
    for i in range(N):
        m[i] = int(input())

    R = X - sum(m)
    ans = N + R // min(m)
    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 1000
120
100
140"""
        output = """9"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4 360
90
90
90
90"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """5 3000
150
130
150
130
110"""
        output = """26"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
	resolve()

Measured memory_bytes: 5604
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
 
#define coutv(v) for (int i = 0; i < (v).size(); ++i) cout << v[i] << ' '; cout << endl;
#define coutvv(v) for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cout << v[i][j] << ' '; cout << endl;}
#define debugv(v) {for (int i = 0; i < (v).size(); ++i) cerr << v[i] << ' '; cerr << endl;}
#define debugvv(v) {for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cerr << v[i][j] << ' '; cerr << endl;}}
#define TC int TESTCASE; cin >> TESTCASE; while (TESTCASE--)
typedef long long ll;






int main() {
	int n;
	cin >> n;
	vector<int> a(1e5);
	for (int x = 1; x < 101; ++x)
	{
		for (int y = 1; y < 101; ++y)
		{
			for (int z = 1; z < 101; ++z)
			{
				if (x*x + y*y + z*z + x*y+y*z+z*x < 10e5) {
					a[x*x + y*y + z*z + x*y+y*z+z*x] += 1;
				}
			}
		}
	}
	for (int i = 1; i <= n; ++i)
	{
		cout << a[i] << endl;
	}
}
 


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  ll x;
  cin>>x;
  ll a = x/11;
  if(x-a*11==0) {
    cout << 2*a<<endl;
  } else if(x-11*a<=6) {
    cout << 2*a+1 << endl;
  } else {
    cout << 2*a+2 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<utility>
#include<climits>
#include<set>
using namespace std;
#define ll long long


int main(){ 
	ios_base::sync_with_stdio(false);
	    cin.tie(0);
	    cout.tie(0);
	    
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);
	    freopen("output.txt","w",stdout);
	#endif


	ll a,b,c,d;cin>>a>>b>>c>>d;

	cout<<max(max(a*c,a*d),max(b*c,b*d));
	/*
	if(b>0 and d>0)
		cout<<b*d;
	else if(b<=0 and d<=0)
		cout<<a*c;
	else if(b<=0 and c>0)
	{
		cout<<b*c;
	}
	else if(d<=0 and a>0)
		cout<<d*a;
	*/
    
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    ll n; cin>>n;
    ll k; cin>>k;
    vector<pair<ll,ll>> box;
    rep(i,0,n){
        ll a,b; 
        cin>>a>>b; 
        box.push_back({a,b});
    }

    sort(all(box));
    ll cnt=0;
    rep(i,0,n){
        cnt+=box[i].second;
        if(cnt>=k){
            cout<<box[i].first<<endl;
            return 0;
        }
    }


}

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

using std::cin;
using std::cout;
using std::endl;
using std::vector;

constexpr int SENTINEL = 1000000001;

vector<int> array;
int cnt = 0;

void mergeSort(int begin, int end);

int main()
{
    int n;
    cin >> n;
    array.reserve(n);

    for (auto i = 0; i < n; i++) {
        int in;
        cin >> in;
        array.push_back(in);
    }

    mergeSort(0, n);

    for (auto i = 0; i < n; i++) {
        if (i != 0) {
            cout << " ";
        }
        cout << array.at(i);
    }
    cout << endl << cnt << endl;

    return 0;
}

void merge(int begin, int mid, int end);

void mergeSort(int begin, int end)
{
    if (begin + 1 < end) {
        int mid = (begin + end) / 2;
        mergeSort(begin, mid);
        mergeSort(mid, end);
        merge(begin, mid, end);
    }
}

void merge(int begin, int mid, int end)
{
    int left_n = mid - begin;
    int right_n = end - mid;
    vector<int> left(left_n + 1), right(right_n + 1);

    for (auto i = 0; i < left_n; i++) {
        left.at(i) = array.at(begin + i);
    }
    left.at(left_n) = SENTINEL;

    for (auto i = 0; i < right_n; i++) {
        right.at(i) = array.at(mid + i);
    }
    right.at(right_n) = SENTINEL;

    for (auto i = 0, j = 0, k = begin; k < end; k++) {
        if (left.at(i) <= right.at(j)) {
            array.at(k) = left.at(i++);
        } else {
            array.at(k) = right.at(j++);
        }
        cnt++;
    }
}

Measured memory_bytes: 5060