akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(){
    int h1, m1, s1; //出社時刻
    int h2, m2, s2; //退社時刻
    int h, m, s; // 在社時間

    for(int i = 1; i <= 3; i++){
        cin >> h1 >> m1 >> s1;
        cin >> h2 >> m2 >> s2;

        int T1 = h1 * 3600 + m1 * 60 + s1;
        int T2 = h2 * 3600 + m2 * 60 + s2;
        int T = T2 - T1;

        h = T / 3600;
        m = (T % 3600) / 60;
        s = (T % 3600) % 60;

        cout << h << " " << m << " " << s << endl;
    }
}



Measured memory_bytes: 3084
# Code for B - Battle
# Use input() to fetch data from STDIN
[a, b, c, d] = map(int, input().split())

while a > 0 and c > 0:
    c = c - b

    if c <= 0:
        print("Yes")
        break

    a = a - d

    if a <= 0:
        print("No")
        break



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

#define ALL(c) std::begin(c), std::end(c)

using namespace std;
using ll = long long;
using pr = std::pair<ll, ll>;

ll dist(pr person, pr ck) {
    return abs(person.first - ck.first) + abs(person.second - ck.second);
}

void solve() {
    int n, m;
    cin >> n >> m;
    vector<pr> per(n);
    vector<pr> ck(m);
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        per[i] = make_pair(a, b);
    }
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        ck[i] = make_pair(a, b);
    }

    for (int j = 0; j < n; ++j) {
        pr p = per[j];
        pr min = make_pair(0, dist(p, ck[0]));
        for (int i = 1; i < m; ++i) {
            pr d = make_pair(i, dist(p, ck[i]));
            min = std::min(min, d, [](auto &a, auto &b) { return a.second < b.second; });
        }
        cout << min.first +1 << endl;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);

    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##_len=(int)(n);i<i##_len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

map<int,int> mx,my;
void solve(int N,int M) {
    mx.clear();
    my.clear();
    vi h(N),w(M);
    cin>>h>>w;
    vi sum_y(N),sum_x(M);
    sum_y[0]=h[0];
    sum_x[0]=w[0];
    REP(i,N-1) sum_y[i+1]+=sum_y[i]+h[i+1];
    REP(i,M-1) sum_x[i+1]+=sum_x[i]+w[i+1];

    REP(i,N) {
        REPF(j,i,N) {
            int H=sum_y[j];
            if(i>0) H-=sum_y[i-1];
            mx[H]++;
        }
    }
    REP(i,M) {
        REPF(j,i,M) {
            int W=sum_x[j];
            if(i>0) W-=sum_x[i-1];
            my[W]++;
        }
    }

    int ans=0;
    ITR(itr,mx) {
        if(EXIST(my,itr->first)) {
            ans+=itr->second * my[itr->first];
        }
    }
    cout<<ans<<endl;
}
signed main() {
    while(1) {
        int N,M;
        cin>>N>>M;
        if(N==0 && M==0) break;
        solve(N,M);
    }
    return 0;
}

Measured memory_bytes: 38876
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iostream>
#include <utility>
 
using namespace std;
using ll = long long;
using ld = long double;
using Vl = vector<ll>;
using pll = pair<ll, ll>;
using vb = vector<bool>;
using vs = vector<string>;

#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)

ll N, W;
Vl w(N), v(N);
ll dp[102][100002]; //0

int main() {
    cin >> N >> W;
    w.resize(N);
    v.resize(N);
    REP(i,N) cin >> w[i] >> v[i];
    
    REP(i,N) REP(wi,W+1){
        if(wi >= w[i]){
            dp[i+1][wi] = max(dp[i][wi-w[i]] + v[i], dp[i][wi]);
        }else
        {
            dp[i+1][wi]= dp[i][wi];
        }
    }

    cout << dp[N][W];
    
    return 0;
}



Measured memory_bytes: 78336
import sys
import math
import numpy as np

def main():
    dish = np.array(sys.stdin.read().split())

    minute = [int(dish[i][-1]) for i in range(5)]
    m = min(x for x in minute if x > 0) if minute.count(0) != 5 else 10

    res = (np.ceil(dish.astype(np.int64) / 10) * 10).sum() - 10 + m

    print(int(res))

if __name__ == "__main__":
    main()


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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    long double Y=0, a;
    string s;
    for (int i = 0; i < N; i++)
    {
        cin >> a >> s;
        if (s == "JPY")
        {
            Y += a;
        }
        else
        {
            Y += 380000 * a;
        }
    }
    cout << fixed << setprecision(8) << Y;
    return 0;
}


Measured memory_bytes: 256
import itertools
N, M, Q = map(int, input().split(" "))
abcd = []
for i in range(Q):
    abcd.append(list(map(int, input().split(" "))))
A = list(itertools.combinations_with_replacement(range(1, M + 1), N))
ans = 0            
for a in A:
    score = 0
    for i in abcd:
        if a[i[1] - 1] == a[i[0] - 1] + i[2]:
            score += i[3]
    ans = max(ans, score)
print(ans)

Measured memory_bytes: 21652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		boolean[] hako = new boolean[10];
		for (int i=0; i<k; i++) {
			int d = sc.nextInt();
			hako[d] = true;
		}
		
		int curr = n;
		int tmp;
		boolean valid;
		
		while(true) {
			tmp=curr;
			valid=true;
			while (tmp!=0) {
				if (hako[tmp %10]) {
					valid=false;
					break;
				}
				tmp = tmp /10;
			}
			if (valid) {
				break;
			}
			curr += 1;
		}

		
		System.out.println(curr);
		sc.close();
	}

}


Measured memory_bytes: 23636
n = int(input())
query = []
ans = 'Yes'
for i in range(n):
  w = input()
  if w in query:
    ans = 'No'
  query.append(w)
  if i == 0:
    judge  = w[-1]
  else:
    if judge != w[0]: 
      ans = 'No'
      break
    else: judge = w[-1]

  
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	char a[1001][1001];
	int i,j;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++)
		cin>>a[i][j];
	}
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			cout<<a[i][j];
			//cout<<a[i][j]<<endl;
		}
		cout<<endl;
		for(j=0;j<m;j++)
		cout<<a[i][j];
		cout<<endl;
	}
	
	return 0;
} 

Measured memory_bytes: 384
R,G,B,N = map(int,input().split())

ans = 0

for r in range(1+N//R):
    for g in range(1+N//G):
        #print(N-(r*R+g*G),r*R, g*G)
        if N-(r*R+g*G) < 0:
            break
        if (N-(r*R+g*G))%B==0:
            ans += 1
print(ans)

Measured memory_bytes: 67400
n,p = gets.chomp.split(" ").map(&:to_i)
i = gets.chomp.split(" ").map(&:to_i)

odd = i.select(&:odd?)
even = [1] * (n - odd.size)
odd_comb_num = 0
even_comb_num = 0

# pが奇数の場合
if(p == 1)
  if(odd.size >= 1)
    1.step(odd.size, 2) do |i|
      odd_comb_num += odd.combination(i).size
    end
  end
  if(even.size >= 1)
    1.upto(even.size) do |i|
      even_comb_num += even.combination(i).size
    end
  end
  if(odd_comb_num == 0)
    puts 0
  elsif(even_comb_num == 0)
    puts odd_comb_num
  else
    puts odd_comb_num * (even_comb_num+1)
  end
# pが偶数の場合
else
  if(odd.size >= 2)
    2.step(odd.size, 2) do |i|
      odd_comb_num += odd.combination(i).size
    end
  end
  if(even.size >= 1)
    1.upto(even.size) do |i|
      even_comb_num += even.combination(i).size
    end
  end
  if(odd_comb_num == 0)
    puts even_comb_num + 1
  elsif(even_comb_num == 0)
    puts odd_comb_num + 1
  else
    puts (odd_comb_num+1) * (even_comb_num+1)
  end
end

Measured memory_bytes: 3836
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>

#define mk make_pair
using namespace std;

inline int read()
{
  int x=0,f=1;char ch=getchar();
  while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
  while (isdigit(ch)) {x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
  return x*f;
}

const int maxn = 1e6+1e2;

char s[maxn];
int n;
int a[maxn];
int vis[maxn];
int sum[maxn];

vector<pair<int,int>> v;


int main()
{
  scanf("%s",s+1);
  n=strlen(s+1);
  for (int i=1;i<=n;i++) if (s[i]=='1') a[i]=1;
  if (a[1]==0 || a[n]==1) 
  {
  	cout<<-1;
  	return 0;
  }
  v.push_back(mk(1,2));
  int now=2;
  int num=2;
  for (int i=2;i<n;i++)
  {
  	 ++num;
  	 while (vis[now]!=0) now++;
  	 if (a[i]==1)
  	 {
  	 	vis[now]=1;
  	 	if (a[n-num+1]==0)
  	    {
  	 		cout<<-1;
  	 		return 0;
		}
  	 	v.push_back(mk(now,num));
	 }
	 else
	 {
	 	v.push_back(mk(num,now));
	 	sum[now]++;
	 	if (a[sum[now]+1+(n-num)]==0)
	 	{
	 		cout<<-1;
	 		return 0;
		}
	 	vis[num]=1;
	 }
  }
  for (int i=0;i<v.size();i++) printf("%d %d\n",v[i].first,v[i].second); 
  return 0;
}


Measured memory_bytes: 12532
import sys
import itertools
input = sys.stdin.readline

n = int(input())
l_list = list(map(int, input().split()))
p_list = list(itertools.permutations(l_list, 3))
p_list = list(filter(lambda e: len(set(e)) == len(e), p_list))

if len(p_list) < 3:
    print(0)
else:
    count = 0
    for p in p_list:
        if p[0] < p[1] < p[2] and p[2] < p[0] + p[1]:
            count += 1
    print(count)


Measured memory_bytes: 85660
// Problem : B - Distance 
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	ll N,X;
	cin>>N>>X;
	int ans=0;
	F0R(x,N)
	{
		ll a,b;
		cin>>a>>b;
		if(a*a+b*b<=X*X)
			ans++;
	}
	cout<<ans<<nl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3656
n = int(input())
a = [0] + list(map(int, input().split())) + [0]
A = [abs(a[i] - a[i + 1]) for i in range(n + 1)]
total = sum(A)

for i in range(n):
    print(total + abs(a[i + 2] - a[i]) - A[i] - A[i + 1])
    

Measured memory_bytes: 14048
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>

using namespace std;
const long long P = 1000000007;

int main() {
  long long a,b;
  cin >> a >> b;
  string ans;
  if(b >= 0 && a <= 0) {
    ans = "Zero";
  }else if(a > 0 || (b < 0 && (b-a+1)%2 == 0)) {
    ans = "Positive";
  }else {
    ans = "Negative";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define Pint pair<int, int>
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */
const int mod = 998244353;
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main() {
    int N; cin >> N;
    map<int, ll> m;
    int D[N]; rep(i, N) cin >> D[i], m[D[i]]++;
    bool ok = true;
    if(D[0] != 0) ok = false;
    if(m[0] != 1) ok = false;
    ll ans = 1;
    ll prev = m[0], prev_num = -1;
    for(auto itr = m.begin(); itr != m.end(); ++itr) {
        if(prev_num != itr -> first - 1) ok = false;
        ans = (ans * modpow(prev, itr -> second)) % mod;
        prev = itr -> second;
        prev_num = itr -> first;
    }
    cout << ((ok) ? ans : 0) << endl;
}


Measured memory_bytes: 6912
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;


long long int N;
string str[25];
int main() {
	cout << fixed << setprecision(18);
	cin>>N;
	while(N!=0){
		long long int n[205],d[205];
		for(int i=1;i<N;i++){
			cin>>n[i]>>d[i];
		}
		pair<long long int,long long int>pa[205];
		pa[0]={0,0};
		long long int maxh=0,maxw=0,minh=0,minw=0;
		for(int i=1;i<N;i++){
			pa[i]=pa[n[i]];
			if(d[i]==0){pa[i].first--;}
			else if(d[i]==1){pa[i].second--;}
			else if(d[i]==2){pa[i].first++;}
			else{pa[i].second++;}
			maxh=max(maxh,pa[i].first);
			maxw=max(maxw,pa[i].second);
			minh=min(minh,pa[i].first);
			minw=min(minw,pa[i].second);
			
		}
		cout<<(maxh-minh+1)<<" "<<(maxw-minw+1)<<endl;
		cin>>N;
	}
} 


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

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

void solve() {
  auto f = [](int h, int m) {
    return h * 60 + m;
  };
  auto g = [](int x) {
    int h = x / 60;
    int m = x - h * 60;
    return make_pair(h, m);
  };
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int ans = f(h2, m2) - f(h1, m1) - k;
  cout << ans << endl;
}


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}

int main() {
    ll n,b,t;
    cin>>n>>b>>t;
    pr(b * (t/n));

    return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(strs: Array<String>) {
    var scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    scanner.useDelimiter("\\s|\\n")
    val array = Array(100001, { k -> 0})
    for (i in 0 until n) {
        val a = scanner.nextInt()
        array[a]++
    }
    var maxVal = 0
    for(i in 1 until 100000) {
        val value = array[i-1] + array[i] + array[i+1]
        if(value > maxVal) {
            maxVal = value
        }
    }
    println(maxVal)
}

Measured memory_bytes: 53044
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <map>
using namespace std;
using Int = long long;
int main()
{
    int N;
    cin >> N;
    struct point { int x, y; bool b; };
    vector<point> a, b;
    for (int i = 0; i < N; i++) { int x, y; cin >> x >> y; a.push_back({x, y, false}); }
    for (int i = 0; i < N; i++) { int x, y; cin >> x >> y; b.push_back({x, y, false}); }
    sort(b.begin(), b.end(), [](point& a, point& b){ return a.x < b.x; });
    int count = 0;
    for (int i = 0; i < N; i++) {
        int maxj = -1;
        for (int j = 0; j < N; j++) {
            if (!a[j].b && a[j].x < b[i].x && a[j].y < b[i].y) {
                if (maxj == -1 || a[j].y > a[maxj].y) maxj = j;
            }
        }
        if (maxj != -1) {
            a[maxj].b = true;
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
int main(void){
	int H,W,res=0;
	cin>>H>>W;
	int cost[H+1][H+1]={},dp[H+1][H+1]={};
	string s[H+1];
	rep(y,H)cin>>s[y+1];
	rep(x,W-1){
		rep(i,H+1)rep(j,H+1)if(i&&j){
			cost[i][j] = cost[i-1][j-1] + (s[i][x]==s[j][x+1]);
			dp[i][j] = min(dp[i-1][j],dp[i][j-1]) + cost[i][j];
		}
		res+=dp[H][H];
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1152
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

ans = 0

for i in range(len(s)):
    point = 0
    kw = s[i]
    for j in range(len(s)):
        if s[j] == kw:
            point += 1
    for j in range(len(t)):
        if t[j] == kw:
            point -= 1
    ans = max(ans, point)
print(ans)





Measured memory_bytes: 3064
L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(L[K-1])

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

using namespace std;

int main()
{
    string s,t;  cin >> s >> t;
    int Ans = 0;
    for(int i=0;i<s.size();i++){
        if(s[i] == t[i])  Ans++;
    }
    cout << Ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
priority_queue<int>q;
int n,m,ans;
pair<int,int>a[maxn];
int main()
{
	scanf("%d%d",&n,&m);
	for(register int i=1;i<=n;i++)
		scanf("%d%d",&a[i].first,&a[i].second);
	sort(a+1,a+n+1);
	int l=1;
	for(register int i=m;i>=1;i--)
	{
		while(l<=n && a[l].first+i-1<=m)
			q.push(a[l++].second);
		if(!q.empty())
		{
			ans+=q.top();
			q.pop();
		}
	}
	printf("%d",ans);
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  if(N >= 64) {
    cout << "64";
  }
  else if(N >= 32) {
    cout << "32";
  }
  else if(N >= 16) {
    cout << "16";
  }
  else if(N >= 8) {
    cout << "8";
  }
  else if(N >= 4) {
    cout << "4";
  }
  else if(N >= 2) {
    cout << "2";
  }
  else if(N >= 1) {
    cout << "1";
  }
}



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

int is_edge(char *expression)
{ 
  return strlen(expression)==0 ? 1 : 0;
}

int intersection_condition(char *a, char *b)
{
  return (!is_edge(a) && !is_edge(b)) ? 1 : 0;
}

int union_condition(char *a, char *b)
{
  return (!is_edge(a) || !is_edge(b)) ? 1 : 0;
}

void childrens_expression(char *expression, char *left, char *right)
{
  if (is_edge(expression)) {
    left[0] = '\0';
    right[0] = '\0';
  } else {
    int i;
    int l_bracket_num = 0, r_bracket_num = 0;
  
    for (i=0; i<strlen(expression); ++i) {
      int flag = 0;
      switch (expression[i]) {
      case '(':
        ++l_bracket_num;
        break;
      case ')':
        ++r_bracket_num;
        break;
      case ',':
        if (l_bracket_num == r_bracket_num + 1) {
          flag = 1;
        }
        break;
      }
      if (flag) {
        break;
      }
    }
  
    expression = &expression[1];
    strncpy(left, expression, i-1);
    left[i-1] = '\0';
    expression = &expression[i];
    strncpy(right, expression, strlen(expression)-1);
    right[strlen(expression)-1] = '\0';
  }
}

void output(char *a, char *b, int (*condition)(char*, char*))
{
  char a_left[512], a_right[512], b_left[512], b_right[512];
  childrens_expression(a, a_left, a_right);
  childrens_expression(b, b_left, b_right);

  printf("(");

  if (condition(a_left, b_left)) {
    output(a_left, b_left, condition);
  }

  printf(",");

  if (condition(a_right, b_right)) {
    output(a_right, b_right, condition);
  }

  printf(")");
}

int main(void)
{
  char op[4];
  char a[512], b[512];
  
  while (scanf("%s %s %s", op, a, b) != EOF) {
    switch (op[0]) {
    case 'i':
      output(a, b, intersection_condition);
      break;
    case 'u':
      output(a, b, union_condition);
      break;
    }
    printf("\n");
  }

  return 0;
}

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

// isDebug?
#ifndef ONLINE_JUDGE
#define _DEBUG
#endif

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// -* https://xn--kst.jp/blog/2019/08/29/cpp-comp/ *- Thx :)
// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    cout << __FILE__ << ": " << __LINE__ << ": " << __func__ << " -> ";   \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

// namespace / type / class / struct - alias, def:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;
const int FACN = 510000;

// Global Variables:
// ll fac[FACN], finv[FACN], inv[FACN];

// Prototype Declarations:
int gcd(int, int);
int lcm(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    string s;
    cin >> s;
    if(s[s.size() - 1] == 's') {
        cout << s << "es" << endl;
    } else {
        cout << s << "s" << endl;
    }
    return 0;
}
// ===========================================

// Functions:
// 最大公約数 O(log(min(a, b)))
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
// 最小公倍数 O(log(min(a, b)))
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

template <class T>
inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}


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

using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class T> // {{{
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
} // }}}

size_t N, W;
vector<int64_t> w(110), v(110);

auto dp = make_v(-1LL, 110, int(1e5) + 10);

int64_t rec(int64_t idx, int64_t weight) {
    if (idx >= N) return 0;
    if (weight + w[idx] > W) return dp[idx][weight] = rec(idx + 1, weight);
    if (dp[idx][weight] != -1) return dp[idx][weight];
    return dp[idx][weight] = max(rec(idx + 1, weight + w[idx]) + v[idx], rec(idx + 1, weight));
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> N >> W;
    for (size_t i = 0; i < N; ++i) {
        cin >> w[i] >> v[i];
    }

    cout << rec(0, 0) << "\n";

    return 0;
}


Measured memory_bytes: 87296
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> mp(n+1, 0);
    rep(i, 1, n)
    {
        int a;
        cin >> a;
        mp[a]++;
    }
    rep(x, 1, n+1)
        cout << mp[x] << endl;
    return 0;
}

Measured memory_bytes: 4056
#include<stdio.h>
#include<math.h>
int primality(int x);
int main(void){
    int n,i,x,cnt=0;
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d", &x);
        if(primality(x)){
            cnt++;
        }
    }
    printf("%d\n",cnt);

    return 0;
}

int primality(int x){
    int i;
    if(x == 2){
        return 1;
    }
    if(x < 2 || x % 2 == 0){
        return 0;
    }
    i = 3;
    while(i <= sqrt(x)){
        if(x % i == 0){
            return 0;
        }
        i = i + 2;
    }

    return 1;
}


Measured memory_bytes: 2100
#include <iostream>

int main(){
  char a = 'a';//aで初期化
  std::cin >> a;
  if(a=='A'){
    std::cout << 'T' << std::endl;
  }else if(a=='T'){
    std::cout << 'A' << std::endl;
  }else if(a =='C'){
    std::cout << 'G' << std::endl;
  }else{
    std::cout << 'C' << std::endl;
  }
}


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

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

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

using namespace std;

int main() {
    int N;
    string S;
    int A[300010] = {0};
    cin >> N;
    cin >> S;

    if(S[0] == 'E') A[0] = 1;
    else A[0] = 0;

    for(int i = 1; i< N; i++){
        if(S[i] == 'E') A[i]+=A[i-1]+1;
        else A[i] = A[i-1];
    }

    int change = 0;
    int min = N;
    for(int i = 0; i < N; i++) {
        if(i == 0) {
            change = A[N-1] - A[0];
        } else if(i >= N-1) {
            change = N-1 - (A[N-2]);
        } else {
            change = i - (A[i-1]) +  (A[N-1] - A[i]);
        }

        if(change <= min) {
            min = change;
        } 

       // cout << change << ", ";
    }

    //cout << "->" ;
    cout << min << endl;
    return 0;
}

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

int main(){
  int maxnumber=0,part1=0,part2=0,maxnumber2=0,ans=0,ans2=0,number2[100001]={},number[100001]={},n,array[100000];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>array[i];
  }
  for(int i=0;i<n;i+=2){
    number[array[i]]++;
  }
  for(int i=0;i<=100000;i++){
    if(part1<number[i]){
      maxnumber=i;
      part1=number[i];
    }
  }
  for(int i=1;i<n;i+=2){
    number2[array[i]]++;
  }
  for(int i=0;i<=100000;i++){
    if(part2<number2[i]){
      maxnumber2=i;
      part2=number2[i];
    }
  }
  sort(number,number+100001);
  for(int i=0;i<100000;i++){
    ans+=number[i];
    if(maxnumber==maxnumber2&&i==99999){
      ans2+=number[i+1];
      break;
    }
    ans2+=number[i];
  }
  sort(number2,number2+100001);
  for(int i=0;i<100000;i++){
    ans2+=number2[i];
    if(maxnumber==maxnumber2&&i==99999){
      ans+=number2[i+1];
      break;
    }
    ans+=number2[i];
  }
  cout<<min(ans,ans2)<<endl;
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int h = in.nextInt();
		int w = in.nextInt();
		boolean[][] a = new boolean[h][w];
		for(int i=0;i<h;i++) {
			for(int j=0;j<w;j++) {
				a[i][j] = in.nextInt()%2==0;
			}
		}
		int n = 0;
		StringBuilder sb = new StringBuilder();
		String ls = System.lineSeparator();
		for(int i=0;i<h;i++) {
			for(int j=1;j<w;j++) {
				if(a[i][j-1]) continue;
				sb.append((i+1)+" "+j+" "+(i+1)+" "+(j+1)+ls);
				n++;
				if(a[i][j]) a[i][j] = false;
				else a[i][j] = true;
			}
		}
		for(int i=1;i<h;i++) {
			if(a[i-1][w-1]) continue;
			sb.append(i+" "+w+" "+(i+1)+" "+w+ls);
			n++;
			if(a[i][w-1]) a[i][w-1] = false;
			else a[i][w-1] = true;
		}
		
		System.out.println(n);
		System.out.println(sb.toString());
		

	}

}

Measured memory_bytes: 95676
import numpy as np
a, b, c = map(int, input().split()) 
nums = [a,b,c]
list5 = [num for num in nums if num == 5]
list7 = [num for num in nums if num == 7]
if (len(list5)==2 and len(list7)==1):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 12432
// ABC074 D - Restoring Road Network.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <stack>


using lolo=long long;
using namespace std;
using vec=vector<lolo>;
using pari=pair<lolo, lolo>;
using vvec=vector<vec>;
using vecb=vector<bool>;
using Rpriority_queue=priority_queue<lolo, vector<lolo>, greater<lolo>>;
using priority_Q = priority_queue<lolo>;

#define FOR(i,n) for (lolo i=0; i<n; ++i)
#define FORIT(it,V) for (auto it=V.begin(); it!=V.end(); ++it)
#define FORANGE(v, V) for (auto v : v)
#define FORN(i,a,b) for (lolo i=a; i<b; ++i)
#define REV(i,a,b) for (lolo i=a; i>b; --i)
#define REVCNT(i, const_cnt, N) for (lolo i=N-1, cnt=const_cnt; cnt > 0; --cnt, --i)
#define ALL(x) x.begin(), x.end()
template <class T>
void chmin(T& ans, const T& b)
{
	if (ans > b) {
		ans = b;
	}
}


int main()
{
	lolo N;
	cin >> N;
	vvec A(N, vec(N,0));
	FOR(i,N) 
		FOR(j, N) {
		cin >> A[i][j];
	}
	
	vector<vector<bool> > CHECKER(N, vector<bool>(N, false));
	FOR(k, N) {
		FOR(i, N) {
			if (i == k) continue;
			for(int j=i+1; j<N; ++j) {
				if (j == k) continue;
				// ik + kj >= ij になっていること
				if ((A[i][k] + A[k][j] >= A[i][j])); else {
					// 他の地点を経由したほうが近くなってしまう場合は矛盾するので作れない
					cout << -1 << endl;
					exit(0);
				}
				if (A[i][k] + A[k][j] == A[i][j]) {
					CHECKER[i][j] = true;
				} 
			}			
		}
	}

	// trueがついているところは合成できる。
	lolo ans = 0;
	FOR(i, N) {
		for (int j = i + 1; j < N; ++j) {
			if (CHECKER[i][j] == false) {
				ans += A[i][j];
			}
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 1024
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

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

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        n: usize,
        v: [i32; n],
    }
    let mut v = v;
    v.sort_by_key(|x| -x);
    let mut v: Vec<f64> = v.into_iter().map(|x| x as f64).collect();
    for _ in 0..n - 1 {
        let l = v.len();
        v[l - 2] = (v[l - 1] + v[l - 2]) / 2.0;
        v.remove(l - 1);
    }
    println!("{}", v[0]);
}


Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
using namespace std;

int main(){
	
	int n,aaa;
	cin>>n;
	vector<vector<int>> v(n),c(n);
	vector<int> k(n),ans(n);
	rep(i,n){
		cin>>aaa>>k[i];
		v[i].resize(k[i]);
		c[i].resize(k[i]);
		rep(j,k[i]){
			cin>>v[i][j]>>c[i][j];
		}
		ans[i]=-1;
	}
	ans[0]=0;
	int m=INF,mi,mj;
	rep(aaaa,n-1){
		m=INF;
		rep(i,n){
			if(ans[i]!=-1){
				rep(j,k[i]){
					if(ans[v[i][j]]==-1 && m>ans[i]+c[i][j]){
						m=ans[i]+c[i][j];
						mi=i;
						mj=j;
					}
				}
			}
		}
		ans[v[mi][mj]]=m;
	}
	rep(i,n){
		cout<<i<<" "<<ans[i]<<endl;
	}
	
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n);++i)
using namespace std;
using ll = long long; 
using P = pair<int,int>;
using vv = vector<vector<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;}

const int INF = 2147483647;
const int max_N = 1000000000;
const long long inf = 1ll << 60;
const long long mod = 1000000007;

int dx[4] = {1,0,-1,0};
int dy[4] = {0,-1,0,1};
int main(){
    int n;cin >> n;
    string s;cin >> s;
    int l=0,r=n-1;
    int ans=0;
    while(l<r){
        if(s[l]=='W' && s[r]=='W'){
            r--;
        }
        if(s[l]=='R'){
            l++;
        }
        if(s[l]=='W' && s[r]=='R'){
            l++;
            r--;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3732
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

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

int main(void){
    ll n;
    cin >> n;
    VL a(n + 1);
    FOR(x,1,n){
        for (int y = x; y <= n; y += x) a[y]++;
    }
    ll ans = 0;
    FOR(x,1,n) ans += x * a[x];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 81396
# -*- coding: utf-8 -*-
import heapq
import math
import sys

tmp = input()
H, W, d = [int(a) for a in tmp.split()]

def decide_color(i, j, d2):
    x = i + j
    y = i - j
    if y < 0:
        y += (d2 * 2) * max(H, W)
    kinds = [a % (d2*2) < d2 for a in [x, y]]
    ids = [0 if k else 1 for k in kinds]
    #return '/'+str(x)+str(y)+'/'
    return [['R', 'Y'], ['G', 'B']][ids[0]][ids[1]]
def decide_color2(i, j):
    return ['R', 'Y'][(i+j) % 2]

if d % 2 == 1:
    for i in range(H):
        print(''.join([decide_color2(i, j) for j in range(W)]))
else:
    for i in range(H):
        print(''.join([decide_color(i, j, d) for j in range(W)]))


Measured memory_bytes: 3316
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: i32 = read();

    let mut base_array: Vec<i32> = (0..n).map(|_| read::<i32>()).collect();

    for i in 0..n {
        let v = base_array[i as usize];
        let mut j = i - 1;

        while j >= 0 && base_array[j as usize] > v {
            base_array[(j + 1) as usize] = base_array[j as usize];
            j = j - 1;
        }

        base_array[(j + 1) as usize] = v;

        for index in 0..n {
            if index != n - 1 {
                print!("{} ", base_array[index as usize]);
            } else {
                print!("{}", base_array[index as usize]);
            }
        }
        println!("");
    }
}



Measured memory_bytes: 5032
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#define pb push_back
#define mp make_pair
#define PF first
#define PS second
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
#define OUT(x) cout << x << endl
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 100000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main() {
  IN(ll,N);
  AIN(ll,A,N);
  ld sum = 0.0;
  REP(i,N){
    sum += 1.0/A.at(i);
  }
  OUT(1/sum);
}



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

#include <bits/stdc++.h>


using namespace std;

#define INPUT_INT(valName) int valName; cin >> valName
#define INPUT_LLINT(valName) long long int valName; cin >> valName;
#define INPUT_STR(valName) string valName; cin >> valName;
#define INPUT_LINE(valName) string valName; getline(cin,s);
#define INPUT_VECTOR_INT(valName, N) vector<int> valName(N); for(int i=0; i < N; ++i) { cin >> valName[i]; }
#define INPUT_VECTOR_DOUBLE(valName, N) vector<double> valName(N); for(int i=0; i < N; ++i) { cin >> valName[i]; }

#define OUTPUT(A) cout << (A) << endl;
#define OUTPUT2(A, B) cout << (A) << " " << (B) << endl;
#define OUTPUT3(A, B, C) cout << (A) << " " << (B) << " " << (C) << endl;

#define REP(valName, N) for(int valName = 0; valName < N; ++valName)

vector<string> split(const string& str, char delimiter) {
	vector<string> ret;
	string tmp = "";
	for (auto c : str) {
		if (c != delimiter) {
			tmp.push_back(c);
		} else {
			ret.push_back(tmp);
			tmp = "";
		}
	}
	ret.push_back(tmp);
	return ret;
}

template <typename T> void sortAsc(vector<T>& v) { sort(v.begin(), v.end(), less<T>()); }
template <typename T> void sortDesc(vector<T>& v) { sort(v.begin(), v.end(), greater<T>()); }

template <typename T> void insert(vector<T>& dest, const vector<T>& src) { copy(src.begin(), src.end(), back_inserter(dest)); }

template <long long int MOD> long long int mod_inv(long long int a) {
	long long b = MOD, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= MOD;
	if (u < 0) u += MOD;
	return u;
}

template <long long int MOD> long long int mod_add(long long int a, long long int b) {
	return (a + b) % MOD;
}

template <long long int MOD> long long int mod_sum(long long int a, long long int b) {
	return (a - b) % MOD;
}

template <long long int MOD> long long int mod_mul(long long int a, long long int b) {
	return (a % MOD) * (b % MOD) % MOD;
}

template <long long int MOD> long long int mod_mul(long long int a, long long int b, long long int c) {
	return mod_mul<MOD>(a, mod_mul<MOD>(b, c));
}

template <long long int MOD> long long int mod_div(long long int a, long long int b) {
	return (a % MOD) * mod_inv<MOD>(b) % MOD;
}


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

map< int64_t, int > prime_factor(int64_t n) {
	map< int64_t, int > ret;
	for (int64_t i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

int main() {

	// TODO: streamやめる

	cin.tie(0); ios::sync_with_stdio(false);

	INPUT_INT(M1);
	INPUT_INT(D1);
	INPUT_INT(M2);
	INPUT_INT(D2);

	if (M1 != M2 && D2 == 1){
		OUTPUT("1");
	} else {
		OUTPUT("0");
	}


	return 0;
}

Measured memory_bytes: 256
R, G, B, N = map(int, input().split())
ans = 0
for r in range(3001):
    n = N - (r * R)
    if n < 0:
        break
    for g in range(3001):
        nn = n - (g * G)
        if nn < 0:
            break
        elif nn % B == 0:
            ans += 1

print(ans)


Measured memory_bytes: 9020
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#include <set>
#include <map>
#include <iomanip>

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()

using ll = long long;

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

	vector<int> H(N);
	rep(i, N)
	{
		cin >> H[i];
	}

	reverse(all(H));

	rep(i, N - 1)
	{
		if (H[i] + 1 == H[i + 1])
		{
			H[i + 1]--;
		}
		else if (H[i] + 1 < H[i + 1])
		{
			cout << "No" << endl;
			return 0;
		}
	}

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

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
class Max {
public:
	ll operator()(ll a, ll b) const {
		return max(a, b);
	}
};
template<typename T, typename BiOp>
struct SegmentTree {
	vector<T> data;
	T e;
	BiOp op;
	int size;
	SegmentTree(int n, T e, BiOp op) :e(e), op(op) {
		size = 1;
		while (size < n) size *= 2;
		data.resize(size * 2 - 1);
		for (int i = 0; i < size * 2 - 1; i++) data[i] = e;
	}
	void update(int k, T v) {
		k += size - 1;
		data[k] = v;
		while (k > 0) {
			k = (k - 1) / 2;
			data[k] = op(data[k * 2 + 1], data[k * 2 + 2]);
		}
	}
	T query(int a, int b, int k, int l, int r) const {
		if (b <= l || r <= a) return e;
		if (a <= l && r <= b) {
			return data[k];
		}
		return op(query(a, b, k * 2 + 1, l, (l + r) / 2), query(a, b, k * 2 + 2, (l + r) / 2, r));
	}
	T query(int a, int b) const {
		return query(a, b, 0, 0, size);
	}
	T get(int i) {
		return data[i + size - 1];
	}
};
ll h[200000];
ll a[200000];
int main() {
	int N;
	cin >> N;
	SegmentTree<ll, Max> S(200001, 0, Max());
	for (int i = 0; i < N; i++) {
		cin >> h[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < N; i++) {
		ll x = max(S.query(0, h[i]) + a[i], S.get(h[i]));
		S.update(h[i], x);
	}
	cout << S.query(0, N + 1) << endl;
}

Measured memory_bytes: 7424