akhauriyash/Code-Regression huggingface dataset:
// ===== 2018/06/02 20:34:38 =====

// ../../../lib/template/includes.hpp

#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <vector>

// ../../../lib/template/const_value.hpp

template <typename T> constexpr T inf();
template <> constexpr int inf<int>() { return 1e9; }
template <> constexpr long long inf<long long>() { return 1e18; }
template <> constexpr long double inf<long double>() { return 1e30; }

template <typename T>
constexpr typename std::enable_if<std::is_arithmetic<T>::value, T>::type
zero() {
  return T(0);
}

const long double pi = acos(-1.0);

// ../../../lib/template/initialize.cpp

struct yes_no : std::numpunct<char> {
  string_type do_truename() const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

struct Initialize {
  Initialize() {
    std::locale loc(std::locale(), new yes_no);
    std::cout << std::boolalpha << std::setprecision(11) << std::fixed;
    std::cout.imbue(loc);
  }
};

const Initialize init;

// ../../../lib/template/macros.hpp

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()

// ../../../lib/template/misc.hpp

template <typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }

// ../../../lib/template/range.hpp

class range {
  class index_type {
    int x;

  public:
    index_type(int x_) : x(x_) {}
    int operator*() const { return x; }
    bool operator!=(index_type &r) { return x < r.x; }
    void operator++() { ++x; }
  };
  index_type i, n;

public:
  range(int n_) : i(0), n(n_) {}
  range(int i_, int n_) : i(i_), n(n_) {}
  index_type &begin() { return i; }
  index_type &end() { return n; }
};

// ../../../lib/template/typedef.hpp

using ll = long long;
using ld = long double;
using Point = std::complex<ld>;

// ../../../lib/template/template.cpp

using namespace std;

// C.cpp

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

void solve(ll N, string S) {
  vector<int> sum(N + 1);
  REP(i,N) sum[i + 1] = sum[i] + (S[i] == 'W');
  int res = inf<int>();
  REP(i,N) {
    int num = sum[i] + ((N - i - 1) - (sum[N] - sum[i + 1]));
    chmin(res, num);
  }
  cout << res << endl;
}

int main() {
	string S;
	ll N;
	scanf("%lld", &N);
	cin >> S;
	solve(N, S);
	return 0;
}
// ===== 2018/06/02 20:34:38 =====



Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
#define MOD 998244353

vector<ll> G[101];
ll CS[101];

void chmax(ll& x, ll y) {
	x = max(x, y);
}

ll dfs(ll c, ll p, ll d) {
	ll D = 0;
	if (p < 0)chmax(CS[d], G[c].size());
	else chmax(CS[d], G[c].size() - 1);
	for (ll i : G[c]) {
		if (i == p)continue;
		D = max(D, dfs(i, c, d + 1));
	}
	return D + 1;
}

int main() {
	ll N, a, b;
	cin >> N;
	vector<pair<ll, ll>> E(N);
	for (ll i = 1;i < N;i++) {
		cin >> a >> b;
		a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
		E[i] = { a,b };
	}
	ll dep, lea;
	vector<pair<ll, ll>> res;
	for (ll i = 0;i < N;i++) {
		for (ll j = 0;j < 101;j++)CS[j] = 0;
		dep = dfs(i, -1, 0);
		lea = 1;
		for (ll j = 0;j < 101;j++) {
			if (CS[j] == 0)break;
			lea *= CS[j];
		}
		res.push_back({ dep,lea });
	}
	for (ll i = 1;i < N;i++) {
		for (ll j = 0;j < 101;j++)CS[j] = 0;
		tie(a, b) = E[i];
		dep = max(dfs(a, b, 0), dfs(b, a, 0));
		lea = 1;
		for (ll j = 0;j < 101;j++) {
			if (CS[j] == 0)break;
			lea *= CS[j];
		}
		res.push_back({ dep,lea * 2 });
	}
	sort(all(res));
	cout << res[0].first << " " << res[0].second << endl;
}

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


int main()
{
    int a , b, k;

    cin>>a>>b>>k;
    for(int i=a;i<= min(a+k-1 , b) ;i++)
    {
        cout<<i<<"\n";
    }
    for(int i= max(a+k,b-k+1 );i<=b;i++)
        cout<<i<<"\n";
}

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

int compare(const void *a,const void *b){
	return *(int *)a-*(int *)b;
	
}


int main(void){
	int a[10];
	int b[10];
	int i;
	int x=0;
	int y=0;
	for (i=0;i<10;i++){
		scanf("%d",&a[i]);
	}
	for (i=0;i<10;i++){
		scanf("%d",&b[i]);
	}
	
	qsort(a,10,sizeof(int),compare);
	x=a[7]+a[8]+a[9];
	
	qsort(b,10,sizeof(int),compare);
	y=b[7]+b[8]+b[9];
	
	printf("%d %d\n",x,y);
	return 0;
}

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

long long n, l = 0, r = 0, m = 1;
string s;
bool f = 0;

const long long T = 1000000007;

int main()
{	
	cin >> n >> s;

	for (long long i = 0; i < n * 2; i++) {
		if (((l - r) % 2 == 0 && s[i] == 'B') || ((l - r) % 2 == 1 && s[i] == 'W')) {
			l++;
			m = m * (l - r) % T;
		}
		else
			r++;

		if (r > l || l > n) {
			f = 1;
			break;
		}
	}

	if(f)
		cout << 0 << endl;
	else {
		for (long long i = 2; i <= n; i++)
			m = m * i % T;

		cout << m << endl;
	}

	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
const int INF=1000000000;
const int MOD=1000000007;

int main()
{
 ll h, w, ans;
 cin >> h >> w;
 if((h==1)||(w==1)) ans=1;
 else if(h%2==0) ans=h/2*w;
 else if(w%2==0) ans=h*w/2;
 else ans=h*(w-1)/2+(h+1)/2;
 cout<< ans;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin >> n;
	double p[n];
	for (int i = 0; i < n; i++)cin >> p[i];

	double dp[n + 1][n + 1];
	memset(dp, 0, sizeof(dp));
	dp[0][0] = 1;
	// dp[i][j] is probability of j heads with i coin tosses
	for (int i = 1; i <= n; i++)
	{
		for (int j = 0; j <= n; j++)
		{
			if (j == 0)
			{
				dp[i][j] = dp[i - 1][j] * (1-p[i - 1]);
			}
			else if (j > i)continue;
			else
			{
				dp[i][j] = dp[i - 1][j] * (1 - p[i - 1]) + dp[i - 1][j - 1] * p[i - 1];
			}
		}
	}
	double ans = 0;
	int req = n / 2 + 1;
	for (int j = req; j <= n; j++)
	{
		ans += dp[n][j];
	}
	cout <<fixed << setprecision(9) <<  ans << "\n";
	return 0;
}

Measured memory_bytes: 70656
# AOJ 1501: Grid
# Python3 2018.7.13 bal4u

MOD = 100000007
def dp(n, k):
	if tbl[n][k]: return tbl[n][k]
	if (k << 1) > n: k = n-k
	if k == 0: ans = 1
	elif k == 1: ans = n
	else: ans = dp(n-1, k) + dp(n-1, k-1)
	tbl[n][k] = ans % MOD
	return tbl[n][k]

tbl = [[0 for j in range(1001)] for i in range(1001)]
k = 0
r, c, a1, a2, b1, b2 = map(int, input().split())

dr = abs(a1-b1)
if dr > r-dr: dr = r-dr
if (dr << 1) == r: k += 1

dc = abs(a2-b2)
if dc > c-dc: dc = c-dc
if (dc << 1) == c: k += 1

print((dp(dr+dc, min(dr, dc)) << k) % MOD)



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

#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector
#define beg begin
#define dbg(x) cerr << #x << " = " << x << endl;

template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}

template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i;
    }
    return str;
}

template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.first << " " << a.second;
    return str;
}

template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.first >> a.second;
    return str;
}

void solve(); signed main() {
#ifdef LOCAL
    freopen("C:\\Users\\artma\\CLionProjects\\problems\\input.txt", "r", stdin);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();
    return 0;
}

const int MOD = 1e9 + 7, MAXN = 1e6 + 10, INF = 1e18 + 10, BASE = 37;

void solve() {
    int h, w, n;
    cin >> h >> w >> n;
    vec<pii> p(n);
    cin >> p;

    if (n == 0) {
        cout << (h - 2) * (w - 2) << endl;
        for (int i = 1; i <= 9; ++i) {
            cout << 0 << endl;
        }
        return;
    }

    set<pii> se;
    for (auto it : p) {
        se.insert(it);
    }

    set<pii> S;
    for (auto it : p) {
        for (int i = it.x - 2; i <= it.x; ++i) {
            for (int j = it.y - 2; j <= it.y; ++j) {
                if (1 <= i && i <= h - 2 && 1 <= j && j <= w - 2) {
                    S.insert({i, j});
                }
            }
        }
    }

    cout << (h - 2) * (w - 2) - sz(S) << endl;
    vec<int> cnt(10);
    sort(all(p));

    for (auto it : p) {
        vec<pii> pos;
        for (int i = 0; i < 3; ++i) {
            for (int j = 0; j < 3; ++j) {
                int x1 = it.x - i, x2 = it.x + (3 - i - 1);
                int y1 = it.y - j, y2 = it.y + (3 - j - 1);
                if (1 <= x1 && x2 <= h && 1 <= y1 && y2 <= w) {
                    int count = 0;
                    for (int i1 = x1; i1 <= x2; ++i1) {
                        for (int j1 = y1; j1 <= y2; ++j1) {
                            if (se.count({i1, j1})) {
                                count++;
                            }
                        }
                    }
                    cnt[count]++;
                }
            }
        }
    }

    for (int i = 1; i <= 9; ++i) {
        cout << cnt[i] / i << endl;
    }
}

Measured memory_bytes: 67324
// F - LCS
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
// void vprn(vector<int> &v){ for(int i=0;i<v.size();i++) cout<<v[i]<<(i<v.size()-1?",\t":"\n"); }
// void vvprn(vector<vector<int>> &vv){
// 	for(auto v:vv) vprn(v);
// }

int main(){
	string S,T; cin>>S>>T;
	int Ns = S.size(), Nt = T.size();
	S = "*" + S; T = "*" + T;

	vvi dp(Nt+1, vi(Ns+1));
	for(int t=1; t<=Nt; t++)
		for(int s=1; s<=Ns; s++)
			if(T[t]==S[s]) dp[t][s] = dp[t-1][s-1] + 1;
			else dp[t][s] = max(dp[t][s-1], dp[t-1][s]);

	// vvprn(dp);//
	// cout<< dp[Nt][Ns] <<endl;

	string ans = "";
	int t = Nt, s = Ns;
	while(t>=1 && s>=1){
		if(T[t]==S[s]){
			ans = S[s] + ans;
			t--; s--;
		}
		else{
			if(dp[t][s]==dp[t][s-1]) s--;
			else if(dp[t][s]==dp[t-1][s]) t--;
			else{ t--; s--; }
		}
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 35584
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] p = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = std.nextInt();
        }
        int max = p[0];
        int count = 0;
        for (int i = 0; i < n; i++) {
            int value = p[i];
            if (value <= max) {
                count++;
            }

            max = Math.min(max, value);
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 83612
import sys

M = []
N = []
for i in range(5):
    l = int(raw_input().split()[0])
    if l % 10 == 0:
        M.append(l)
    else:
        N.append(l)
N = sorted(N,  key=lambda x: 10 - (x % 10))
# print(M, N)

ret = 0
for m in M:
    ret += m
for n in N:
    ret += n
    ret += (10 - (n % 10))
if len(N) != 0:
    ret -= (10 - (N[-1] % 10))
print(ret)


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

int main (void)
{
  int n,i,c=0;
  cin>>n;
  string sp,sq,s1;
  int spn,sqn;
  vector<int>p(n),q(n);
  rep(i,n)cin>>p[i];
  rep(i,n)cin>>q[i];
  rep(i,n)sp+=to_string(p[i]);
  rep(i,n)sq+=to_string(q[i]);
  s1 = sp;
  sort(s1.begin(),s1.end());
  i=0;
  do {
    if(s1==sp)spn=i+1;
    if(s1==sq)sqn=i+1;
    i++;
  } while(next_permutation(s1.begin(), s1.end()));
  cout<<abs(spn-sqn)<<endl;
    
  return 0;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;

int main(){
  string s,t;
  cin >> s >> t;
  vector<int> v1(26,0),v2(26,0);
  r(i,s.size()){
    v1.at(s.at(i)-'a')++;
    v2.at(t.at(i)-'a')++;
  }
  bool flag = true;
  sort(v1.begin(),v1.end());
  sort(v2.begin(),v2.end());
  r(i,26){
    if(v1.at(i)!=v2.at(i))flag=false;
  }
  if(flag)cout << "Yes"<<endl;
  else cout << "No"<<endl;
}

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

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, m, ans;
    cin >> n >> m;
    vector<ll> div;
    frep(i, 1, ll(sqrt(m+0.1))) {
        if((m%i) == 0) {
            div.push_back(i);
            if(i*i != m) div.push_back(m/i);
        }
    }
    sort(ALL(div), greater<ll>());
    rep(i, div.size()) {
        if(div[i] <= m/n) {
            cout << div[i] << endl;
            return 0;
        }
    }

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
l=list(map(int,input().split()))
final=[0]*n
if k>=n:
  print(abs(l[n-1]-l[0]))
else:   
   for i in range(1,k+1):
      final[i]=abs(l[i]-l[0])
  
   for i in range(k+1,n):

      li=[abs(l[i]-l[ik])+final[ik] for ik in range(i-1,i-k-1,-1) ]
      final[i]=min(li)
   print(final[-1])


Measured memory_bytes: 20432
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt");
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var s = input.ReadLine();

        if (s == "Sunny") return "Cloudy";
        if (s == "Cloudy") return "Rainy";
        if (s == "Rainy") return "Sunny";

        return "";
    }
}


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

int main(){
  int n, x;
  cin >> n >> x;
  vector<int> A(n + 1);
  A[0] = 0;
  for (int i = 0; i < n ; i++){
    int x;
    cin >> x;
    A[i+1] = A[i] + x;
  }
  
  int cnt = 0;
  
  for ( int i = 0; i <= n ; i++){
    if( x >= A[i]){
      cnt++;
    }
  }
  
  cout << cnt << endl;

}


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

int main(){
  int N, K, c=0,res=0;
  string S;
  vector<int> vc;
  cin >> N >> K;
  cin >> S;

  vc.push_back(0);
  if(S[0]=='1'){
    vc.push_back(0);
    vc[1]=1;
  }else vc[0]=1;

  for(int i=1;i<N;i++){
    if(S[i]=='0' && S[i-1]=='1' || S[i]=='1' && S[i-1]=='0') vc.push_back(0);
    vc.back()++;
  }

  for(int i=0;i<vc.size();i+=2){
    int sum=0;
    if(i!=0) sum+=vc[i-1];
    for(int j=i;j<=i+(K-1)*2+1 && j<vc.size();j++){
      sum+=vc[j];
    }
    res=max(sum,res);
  }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1020
n = int(input())
a = list(map(int,input().split()))

count2 = 0
count4 = 0

for i in range(len(a)):
    if((a[i] % 4) == 0):
        count4 = count4 + 1;
    elif((a[i] % 2) == 0 and (a[i] % 4) != 0):
        count2 = count2 + 1;

#print("---")
#print(count4)
#print(count2)
#print("---")

if(count2 == 0 and n <= (1+ count4*2)):
    print("Yes")
elif(count2 != 0 and n <= (count2+ count4*2)):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14252
#入力
N = input()
N = int(N)

#素因数分解
L = []
M = []
Nu = N
for i in range(2, int(-(-N**0.5//1))+1):
    if Nu % i == 0:
        j = 0
        while Nu % i == 0:
            j += 1
            Nu //= i
        #L.append(i)
        M.append(j)

if Nu != 1:
    #L.appnend(Nu)
    M.append(1)

if M == []:
    if N != 1:
        #L.append(N)
        M.append(1)
    else:
        M.append(0)

#階差数列
l = max(M)
p = 0
P = []
for i in range(1,l+1):
    p += i
    P.append(p)

#計算
Answer = 0
l = len(M)
for i in range(l):
    m = M[i]
    if m != 0:
        while not(m in P):
            m -= 1
        Index = P.index(m)
        Index += 1
        Answer += Index

print(Answer)

Measured memory_bytes: 9384
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7
N, K = map(int, input().split())
g = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)
def dfs(K, g, now, from_):
    if from_ == -1:
        can_num = K - 1
    else:
        can_num = K - 2
    if K < len(g[now]):
        return 0
    case_num = 1
    for i in g[now]:
        if i != from_:
            case_num *= can_num
            can_num -= 1
            case_num %= mod
    for i in g[now]:
        if i != from_:
            case_num *= dfs(K, g, i, now)
            case_num %= mod
    return case_num
print(K * dfs(K, g, 0, -1) % mod)

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

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

	int cnt = 0;
	for(int i = 1; i < n-1; ++i){
		if(p[i-1] < p[i] && p[i] < p[i+1]) cnt++;
		else if(p[i-1] > p[i] && p[i] > p[i+1]) cnt++;
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, t, e;
	int in;
	int i;
	int ans;
	
	ans = -1;
	scanf("%d %d %d", &n, &t, &e);
	for (i = 0; i < n; i++){
		scanf("%d", &in);
		if (t % in >= in - e || t % in <= e){
			ans = i + 1;
		}
	}
	
	printf("%d\n", ans);
	
	return (0);
}

Measured memory_bytes: 596
#include<iostream>
using namespace std;
int a[102],n;
int gcd(int a, int b)
{
 if(!a || !b)
  return max(a,b);
 else
 {
  int t;
  for(;t=a%b;a=b,b=t);
  return b;
 }
}
int main()
{
	int a,b;
	cin>>a>>b;
	cout<<gcd(a,b)<<endl;
		
	return 0;
 } 


Measured memory_bytes: 3104
#include <iostream>

using namespace std;

int main(){
    string S;
    cin >> S;
    if(S[0] == 'S'){
        cout << "Cloudy" << endl;
    }else if(S[0] == 'C'){
        cout << "Rainy" << endl;
    }else{
        cout << "Sunny" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    static int[] parent;
    static int[] sizes;
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String[] str = stdR.readLine().split(" ");
        int N = Integer.parseInt(str[0]);
        int M = Integer.parseInt(str[1]);
        int[] A = new int[M];
        int[] B = new int[M];
        for(int i = 0 ; i < M ; i++) {
            str = stdR.readLine().split(" ");
            A[i] = Integer.parseInt(str[0]) - 1;
            B[i] = Integer.parseInt(str[1]) - 1;
        }
        
        parent = new int[N];
        sizes = new int[N];
        for(int i = 0 ; i < N ; i++) {
            parent[i] = i;
            sizes[i] = 1;
        }
        
        long[] res = new long[M];
        res[res.length - 1] = (long)N * (N - 1) / 2;
        for(int i = res.length - 2 ; i >= 0 ; i--) {
            if(same(A[i + 1],B[i + 1])) {
               res[i] = res[i + 1];
               unit(A[i + 1],B[i + 1]);
            }else {
               res[i] = res[i + 1] - size(A[i + 1]) * size(B[i + 1]);
               unit(A[i + 1],B[i + 1]);
            }
        }
        
        for(int i = 0 ; i < res.length ; i++) {
            System.out.println(res[i]);
        }
    }
    
    public static int root(int x) {
        if(parent[x] == x)return x;
        return parent[x] = root(parent[x]);
    }
    
    public static void unit(int x,int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)return;
        if(sizes[rx] < sizes[ry]) {
            int tmp = sizes[rx];
            sizes[rx] = sizes[ry];
            sizes[ry] = tmp;
        }
        
        parent[ry] = rx;
        sizes[rx] += sizes[ry];
        sizes[ry] = 0;
    }
    
    public static boolean same(int x,int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    
    // データxが含まれる木の大きさを返す
    public static int size(int x) {
      return sizes[root(x)];
    }
}


Measured memory_bytes: 56156
nums = int(input())
dice = []
for _ in range(nums):
    dice.append(list(map(int, input().split())))


class die:
    face = [0, 0, 0, 0, 0, 0]

    def __init__(self, nums):
        self.face = [nums[f] for f in [0, 3, 1, 2, 4, 5]]

    def roll(self, dirs):

        for di in dirs:
            c_face = list(self.face)
            if di == 'S':
                self.face = [c_face[f] for f in [4, 1, 0, 3, 5, 2]]
            elif di == 'N':
                self.face = [c_face[f] for f in [2, 1, 5, 3, 0, 4]]
            elif di == 'W':
                self.face = [c_face[f] for f in [3, 0, 2, 5, 4, 1]]
            elif di == 'E':
                self.face = [c_face[f] for f in [1, 5, 2, 0, 4, 3]]
            # print(di, self.face)

        return list(self.face)


def search():
    for i, d1 in enumerate(dice):
        dice_set_01 = set()
        for md in (' ', 'W', 'E', 'NW', 'NE', 'WW'):
            d_1 = die(d1)
            d_1.roll(md)
            for r in 'SSSS':
                dice_set_01.add(tuple(d_1.roll(r)))

        for j, d2 in enumerate(dice[i+1:], start=i+1):
            dice_set_02 = set()
            for md in (' ', 'W', 'E', 'NW', 'NE', 'WW'):
                d_2 = die(d2)
                d_2.roll(md)
                for r in 'SSSS':
                    dice_set_02.add(tuple(d_2.roll(r)))
            if dice_set_01 - dice_set_02 == set():
                return False
    return True


print(['No', 'Yes'][search()])


Measured memory_bytes: 5644
import sys

input = sys.stdin.readline
n, m, c = map(int, input().split())
b_list = list(map(int, input().split()))
ans = 0
for _ in range(n):
    a_list = list(map(int, input().split()))
    check = 0
    for i in range(m):
        check += a_list[i] * b_list[i]
    if check + c > 0:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin>>n;
  int c1=0,c2=0,c3=0,c4=0;
  while(n--)
  {
      string temp;
      cin>>temp;
      if(temp=="AC")
        c1++;
      if(temp=="WA")
         c2++;
      if(temp=="TLE")
         c3++;
     if(temp=="RE")
        c4++;
  }
   cout<<"AC x "<<c1<<"\n";
  cout<<"WA x "<<c2<<"\n";
  cout<<"TLE x "<<c3<<"\n";
  cout<<"RE x "<<c4<<"\n";
  return 0;
}

Measured memory_bytes: 3648
n = int(input())


# def main():
#     lft = 0
#     rgt = n
#     while rgt - lft > 1:
#         mid = (rgt + lft) // 2
#         if (n % mid) == 0 and ((n+1) % mid) == 0:
#             lft = mid
#         else:
#             rgt = mid
#     print(lft)

def main():
    p = prime_factor(n)
    ans = f([(i,j) for i, j in p.items()], 0, 1)
    print(ans)

def f(p, i, x):
    if i == len(p):
        tmp = n // x - 1
        if (tmp + 1) * x != n:
            return 0
        return tmp
    ans = 0
    tmp = 1
    for j in range(p[i][1]+1):
        ans += f(p, i+1, x*tmp)
        tmp *= p[i][0]
    return ans

def main():
    import math
    ans = 0
    for i in range(1, int(math.pow(n, 0.5)) + 2):
        if (n - i) % i == 0 and (n - i) // i > i:
            if n <= i:
                break
            ans += (n - i) // i

    print(ans)

def prime_factor(n):
    ret = {}
    i = 2
    while i * i <= n:
        while n % i == 0:
            ret[i] = ret.get(i, 0) + 1
            n /= i
        i += 1
    if n != 1:
        ret[n] = 1
    return ret


if __name__ == '__main__':
    main()
    2499694822001

Measured memory_bytes: 3188
#NとXの読み込み
n, x = input().split()
n = int(n)
x = int (x)
m = []
i_min = 0 
result = 0

#m1からmnまでの読み込み
for i in range(n):
 m.append(int(input()))
#全種類ひとつずつ作る
for i in range(len(m)):
 x = x - m[i]
 result = result + 1
#リストの中の最小値を突き止める
for i in range(len(m)):
 if m[i_min] > m[i]:
   i_min = i
#i_minを作れるだけ作る
for i in range(x):
 if x >= m[i_min]:
  result = result + 1
  x = x - m[i_min]
 else:
  break
#印刷
print(result)


Measured memory_bytes: 3064
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sn = new Scanner(System.in);
		int N = sn.nextInt();
		int a[] = new int[102];
		double sum = 0;
		double min = 0;
		int cost = 0;
		for(int i = 0;i < N; ++i){			
			a[i] = sn.nextInt();
			sum += a[i];
		}
		min = Math.round(sum/N);
		for(int i = 0;i < N; ++i) cost += (a[i] - min)*(a[i] - min);
		System.out.println(cost);
	}
}


Measured memory_bytes: 9812
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<climits>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
#include<iomanip>
using namespace std;

int n;
double dp[3000][3000];
double a[3000];

double rec(int i,int l){
	if(i==n){
		if(l>=n/2+1)return 1;
		else return 0;
	}
	if(dp[i][l]!=-1.0)return dp[i][l];
	dp[i][l]=a[i]*rec(i+1,l+1)+(1-a[i])*rec(i+1,l);
	return dp[i][l];
}

int solve(){
    cin>>n;
    rep(i,0,n+1){
    	rep(j,0,n+1)dp[i][j]=-1.0;
	}
    rep(i,0,n)cin>>a[i];
	cout<<setprecision(9)<<rec(0,0)<<endl;
	return 0;
}
int main(){
    waste;
    int t;
    //cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	string s;cin>>s;
	cout<<s.substr(0,s.size()-8)<<endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int>a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());
  int ans = 0;
  rep(i,k) ans += a[i];
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
// #define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    ll now = 100, x;
    cin >> x;
    ll ans = 0;
    while (now < x) {
        now *= 1.01;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define PB push_back
#define MP make_pair
#define FST first
#define SND second
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n;
    cin >> n;

    int ans = 1,count = 0;
    for (int i = 1; i <= n; ++i) {
        if(count++ == ans){
            ans++;
            count = 1;
        }
    }

    for (int i = ans; i >0; --i) {
        if(n>=i){
            cout << i << endl;
            n-=i;
        }
    }
    
    return 0;
}

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

int main(){

  map<char, int> cup;
  char c1, c2;

  cup['A'] = 1;
  cup['B'] = 0;
  cup['C'] = 0;

  while(scanf("%c, %c", &c1, &c2) != EOF){
    swap(cup[c1], cup[c2]);
  }

  if(cup['A'] == 1) cout << 'A' << endl;
  else if(cup['B'] == 1) cout << 'B' << endl;
  else cout << 'C' << endl;

  return 0;

}

Measured memory_bytes: 1188
TABLE_BITS_COUNT = [
  0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6
]
TABLE_TRAILING_ZERO = [ 0, 1, 6, 2, 7, 5, 4, 3 ]

def fold_bitflag(n, init)
  loop {
    flg = n & ((~n) + 1)
    if flg == 0
      break init
    end
    init = yield(init, flg)
    n ^= flg
  }
end

H, W, K = ARGF.gets.split.map(&:to_i)

ary = H.times.map {
  ARGF.gets.tr(".#", "01").to_i(2)
}

ans = 0
(0..(1 << H) - 1).each {| row |
  (0..(1 << W) - 1).each {| col |
    cnt = fold_bitflag(row, 0) {| acc, x |
      i = TABLE_TRAILING_ZERO[((x * 0x1d) >> 5) & 0x07]
      acc + TABLE_BITS_COUNT[ary[i] & col]
    }
    if cnt == K
      ans += 1
    end
  }
}
puts ans


Measured memory_bytes: 14328
#include <stdio.h>
int main()
{
	int n,x,min,max;
	double sum=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&x);
		if(i==0)
		{
			max=x;
			min=x;
		} 
		if(x>max) max = x;
		if(x<min) min = x;
		sum = sum + x;
	}
	printf("%d %d %.0lf\n",min,max,sum);
	return 0;
}


Measured memory_bytes: 2756
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int A,B;

int main(){
    cin>>A>>B;

    int sum=1;
    int ans=0;
    while(sum<B){
        sum+=A-1;
        ans++;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	char str[5];
	for(int i=1;i<=4;i++){
		cin>>str[i];
	}
	if(str[1]==str[2]&&str[3]==str[4]&&str[1]!=str[3]){
		cout<<"Yes"<<endl;
	}
	else if(str[1]==str[3]&&str[2]==str[4]&&str[1]!=str[2]){
		cout<<"Yes"<<endl;
	}
	else if(str[1]==str[4]&&str[2]==str[3]&&str[1]!=str[2]){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int sum = 0;
		for(int i = 0; i < n; i++){
		    int l = sc.nextInt();
		    int r = sc.nextInt();
		    sum += r-l+1;
		}
		// 計算
		int result = sum;
		
		// 出力
		System.out.println(result);
		
	}
}


Measured memory_bytes: 28244
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <map>
#include <cmath>

using namespace std;
#define rep(i, z, n) for(int i = z; i < (int)n; i++)

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

    cout << ceil(n/2.0) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

const int INF = 1e18 + 239;

struct Frac {
	int up;
	int dw;

	Frac() {
		up = INF;
		dw = 1;
	}

	Frac(int a, int b) {
		up = a;
		dw = b;
	}
	
	bool operator<(const Frac &other) {
		return up * other.dw < other.up * dw;
	}

	bool operator<=(const Frac &other) {
		return up * other.dw <= other.up * dw;
	}
};

Frac get(int a) {
	int s = 0;
	int ta = a;
	while (a > 0) {
		s += (a % 10);
		a /= 10;
	}
	return Frac(ta, s);
}

int next(int c) {
	c++;
 	Frac best = get(c);
 	int ans = c;
 	auto relax = [&](int n) {
 		if (get(n) < best) {
 			best = get(n);
 			ans = n;
 		}
 	};
 	relax(c + 1);
 	string kek = to_string(c);
 	for (int i = (int)kek.size() - 1; i >= 0; i--) {
 		kek[i] = '9';
 		relax(stoll(kek));
 	}
 	return ans;
}

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

	// int n;
	// cin >> n;
	// Frac mn;
	// vector<int> ans;
	// for (int i = n; i > 0; i--) {
	// 	if (get(i) <= mn) {
	// 		ans.push_back(i);
	// 		mn = get(i);
	// 	}
	// }
	// reverse(ans.begin(), ans.end());
	// for (auto t : ans) {
	// 	cout << t << '\n';
	// }
	int k;
	cin >> k;
	int c = 1;
	while (k--) {
		cout << c << '\n';
		c = next(c);
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793
int dx[] = {0,1,-1,0,1,-1,1,-1};
int dy[] = {1,0,0,-1,1,-1,-1,1};

int main(){
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vector<int> X(n);
    vector<int> Y(m);
    for(int i = 0; i < n; i++)
        cin >> X[i];
    for(int i = 0; i < m; i++)
        cin >> Y[i];
    int xn = *max_element(X.begin(), X.end());
    int ym = *min_element(Y.begin(), Y.end());
    int z = xn + 1;
    if(z > x && z <= y && z > xn && z <= ym)
        cout << "No War" << endl;
    else
        cout << "War" << endl;
}


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

int main() {
    int a, b;
    int d, r;
    double f;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    f = (double)a / (double)b;
    printf("%d %d %f\n", d, r, f);
	return 0;
}



Measured memory_bytes: 3188
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    a = LI()
    color = 8
    free = 0
    flag = [False]*color
    for ai in a:
        if ai >= 3200:
            free += 1
        else:
            flag[ai//400] = True
    color_min = max(1, sum(flag))
    color_max = sum(flag)+free
    print("{} {}".format(color_min, color_max))

if __name__ == '__main__':
    main()

Measured memory_bytes: 9084
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <algorithm>
#include <cctype>
#include <iostream>
#include <string>

#define rep(i, n) for (int i = 0; i < n; i++)
#define repi(i, n, iv) for (int i = iv; i < n; i++)
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

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

    int N, M, K;
    cin >> N >> M >> K;

    vector<int> A(N);
    vector<int> B(M);
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];

    int AS = A.size();
    int BS = B.size();
    int ai = 0;
    int bi = 0;

    int result = 0;

    while (true)
    {
        if (ai >= AS)
            break;
        int a = A[ai];
        if (a > K)
            break;

        K -= a;
        result++;
        ai++;
    }

    while (true)
    {
        if (bi >= BS)
            break;
        int b = B[bi];
        if (b > K)
            break;

        K -= b;
        result++;
        bi++;
    }

    cerr << result << endl;

    int t = result;
    int prev = result;
    rep(i, t)
    {
        int tmp = prev;

        if (ai > 0)
        {
            ai--;
            tmp--;
            K += A[ai];
        }

        while (true)
        {
            if (bi >= BS)
                break;
            int b = B[bi];
            if (b > K)
                break;

            K -= b;
            tmp++;
            bi++;
        }

        cerr << tmp << endl;
        result = max(result, tmp);
        prev = tmp;
    }

    cout << result << endl;
}


Measured memory_bytes: 4848
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String s = in.readLine();
		int n = Integer.parseInt(s);
//System.out.println(toHash("TTTTTTTTT"));
		int[] dctnr = new int[toHash("TTTTTTTTTTTT")];
		
		String str;
		for (int i = 0; i < n; i++) {
			s = in.readLine();
			str = s.split(" ") [1];
			if(s.charAt(0) == 'i') {
				dctnr[toHash(str)] = 1;
			} else if(s.charAt(0) == 'f') {
				String p = dctnr[toHash(str)] == 1 ? "yes" : "no";
				System.out.println(p);
			}
		}
	}	
	static int toHash(String s) {
		int n = s.length();
		int temp = 0;
		int ten = 1;
		for (int i = 0; i < n; i++) {
			if(s.charAt(i) == 'T') {
				temp += 1*ten;
			} else if (s.charAt(i) == 'A') {
				temp += 2*ten;
			} else if (s.charAt(i) == 'C') {
				temp += 3*ten;
			} else if (s.charAt(i) == 'G') {
				temp += 5*ten;
			}
			ten *=5;
		}
		return temp;
	}
	
}


Measured memory_bytes: 379808
#include<iostream>
#include<string>
using namespace std;
int f1(char c) {
	if (c == '1')return 1;
	else if (c == '2')return 2;
	else if (c == '3')return 3;
	else if (c == '4')return 4;
	else if (c == '5')return 5;
	else if (c == '6')return 6;
	else if (c == '7')return 7;
	else if (c == '8')return 8;
	else if (c == '9')return 9;
	else if (c == '0')return 0;
}
char f2(int f) {
	if (f == 1)return '1';
	else if (f == 2)return '2';
	else if (f == 3)return '3';
	else if (f == 4)return '4';
	else if (f == 5)return '5';
	else if (f == 6)return '6';
	else if (f == 7)return '7';
	else if (f == 8)return '8';
	else if (f == 9)return '9';
	else if (f == 0)return '0';
	else return 'a';
}
void solve() {
	string s, t, ans; cin >> s >> t;
	if (s.size() > t.size()) {
		string tmp = s;
		s = t;
		t = tmp;
	}
	int k = 0;
	for (int i = 1; i <= s.size(); i++){
		int p;
		p = f1(s[s.size() - i]) + f1(t[t.size() - i]) + k;
		if (p > 9) { k = 1; p -= 10; }
		else k = 0;
		ans = f2(p) + ans;
	}
	for (int i = s.size() + 1; i <= t.size(); i++){
		int p = f1(t[t.size() - i]) + k;
		if (p > 9) { k = 1; p -= 10; }
		else k = 0;
		ans = f2(p) + ans;
	}
	if (k == 1)ans = '1' + ans;
	if (ans.size() > 80)cout << "overflow";
	else cout << ans; cout << endl;
	return;
}
int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++){
		solve();
	}
}

Measured memory_bytes: 3068
import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            int x = Integer.parseInt(sc.next());
            int y = Integer.parseInt(sc.next());
            int z = Integer.parseInt(sc.next());
            
            //出力
            if(x+y<z){
            	System.out.println("No");
            }else{
            	System.out.println("Yes");
            }
            sc.close();
        }
    }
	

Measured memory_bytes: 21844
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class AtCoder {
    public static void Main () {
        const int INF = int.MaxValue;
        var a = new int[12, 12];

        var nmx = Console.ReadLine ().Trim ().Split ().Select (e => int.Parse (e)).ToArray ();
        var n = nmx[0];
        var m = nmx[1];
        var x = nmx[2];

        var c = new int[n];
        for (var i = 0; i < n; i++) {
            var splited = Console.ReadLine ().Trim ().Split ().Select (e => int.Parse (e)).ToArray ();
            c[i] = splited[0];
            for (var j = 0; j < m; j++) {
                a[i, j] = splited[j + 1];
            }
        }

        var ans = INF;
        for (var s = 0; s < (1 << n); s++) {
            int cost = 0;
            var d = new int[m];
            for (var i = 0; i < n; i++) {
                if (((s >> i) & 1) > 0) {
                    cost += c[i];
                    for (var j = 0; j < m; j++) {
                        d[j] += a[i, j];
                    }
                }
                bool ok = true;
                for (var j = 0; j < m; j++) {
                    if (d[j] < x) ok = false;
                }
                if (ok) ans = Math.Min(ans, cost);
            }
        }

        if (ans == INF) {
            Console.WriteLine (-1);
        } else {
            Console.WriteLine (ans);
        }
    }
}

Measured memory_bytes: 28604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD=1000000007;
const long long INF = 1LL<<60;

int main() {
  int64_t N,M,Q,ans=0; cin>>N>>M>>Q;
  vector<int64_t> A(Q),B(Q),C(Q),D(Q);
  rep(i,Q){
    cin>>A.at(i)>>B.at(i)>>C.at(i)>>D.at(i);
    A.at(i)--;
    B.at(i)--;
  }
  bool finish=false;
  vector<int64_t> S(N,1);
  while(true){
    int64_t k=N-1,s=0;
    rep(i,Q){
      if(S.at(B.at(i))-S.at(A.at(i))==C.at(i)) s+=D.at(i);
    }
    ans=max(ans,s);
    while(S.at(k)==M){
      k--;
      if(k==-1){
        finish=true;
        break;
      }
    }
    if(finish) break;
    else{
      S.at(k)++;
      for(int64_t p=k+1; p<N; p++) S.at(p)=S.at(k);
    }
    s=0;
    rep(i,Q){
      if(S.at(B.at(i))-S.at(A.at(i))==C.at(i)) s+=D.at(i);
    }
    ans=max(ans,s);
  }
  cout<<ans;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(auto i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct Pony
{
    long a, b;
 
    Pony(long a_, long b_)
    {
        a = a_;
        b = b_;
    }
 
    bool operator<(const Pony &another) const
    {
        return b < another.b;
    };
};

int fac(int k){
    int sum = 0;
    for (int i = 1; i <= k; ++i)
    {
        sum += i;
    }
    return sum;
}

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

  int n;
  cin >> n;

  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n-1);

  fillInt(a, n);
  fillInt(b, n);
  fillInt(c, n-1);

  int before = -1;
  int res = 0;
  rep(i, n) {
    int now = a[i]-1;
    res+=b[now];
    if(before==now-1)res+=c[before];
    before = now;
  }

  cout << res << endl;


}


Measured memory_bytes: 888